Implemented long variable names a la spss V12.
[pspp-builds.git] / tests / bugs / compute-lv.sh
1 #!/bin/sh
2
3 # This program tests for a bug involving COMPUTE and long variable names
4
5 TEMPDIR=/tmp/pspp-tst-$$
6 TESTFILE=$TEMPDIR/`basename $0`.sps
7
8 here=`pwd`;
9
10 # ensure that top_srcdir is absolute
11 cd $top_srcdir; top_srcdir=`pwd`
12
13 export STAT_CONFIG_PATH=$top_srcdir/config
14
15
16 cleanup()
17 {
18      rm -rf $TEMPDIR
19 }
20
21
22 fail()
23 {
24     echo $activity
25     echo FAILED
26     cleanup;
27     exit 1;
28 }
29
30
31 no_result()
32 {
33     echo $activity
34     echo NO RESULT;
35     cleanup;
36     exit 2;
37 }
38
39 pass()
40 {
41     cleanup;
42     exit 0;
43 }
44
45 mkdir -p $TEMPDIR
46
47 cd $TEMPDIR
48
49 activity="Create prog"
50 cat > $TESTFILE <<EOF
51 DATA LIST LIST /longVariablename * x *.
52 BEGIN DATA.
53 1 2
54 3 4
55 END DATA.
56
57
58 COMPUTE longvariableName=100-longvariablename.
59
60 LIST.
61
62 EOF
63 if [ $? -ne 0 ] ; then no_result ; fi
64
65
66 activity="run prog"
67 $SUPERVISOR $here/../src/pspp -o raw-ascii $TESTFILE
68 if [ $? -ne 0 ] ; then fail ; fi
69
70
71 activity="compare output"
72 diff -B -b pspp.list - << EOF
73 1.1 DATA LIST.  Reading free-form data from the command file.
74 +--------+------+
75 |Variable|Format|
76 #========#======#
77 |LONGVARI|F8.0  |
78 |X       |F8.0  |
79 +--------+------+
80
81 LONGVARI        X 
82 -------- -------- 
83    99.00     2.00
84    97.00     4.00
85 EOF
86 if [ $? -ne 0 ] ; then fail ; fi
87
88
89 pass;