Implemented long variable names a la spss V12.
[pspp-builds.git] / tests / bugs / get.sh
1 #!/bin/sh
2
3 # This program tests for a bug which caused
4 # the second procedure after GET FILE to corrupt its output
5
6
7 TEMPDIR=/tmp/pspp-tst-$$
8 TESTFILE=$TEMPDIR/`basename $0`.sps
9
10 here=`pwd`;
11
12 # ensure that top_srcdir is absolute
13 cd $top_srcdir; top_srcdir=`pwd`
14
15 export STAT_CONFIG_PATH=$top_srcdir/config
16
17
18 cleanup()
19 {
20      rm -rf $TEMPDIR
21 }
22
23
24 fail()
25 {
26     echo $activity
27     echo FAILED
28     cleanup;
29     exit 1;
30 }
31
32
33 no_result()
34 {
35     echo $activity
36     echo NO RESULT;
37     cleanup;
38     exit 2;
39 }
40
41 pass()
42 {
43     cleanup;
44     exit 0;
45 }
46
47 mkdir -p $TEMPDIR
48
49 cd $TEMPDIR
50
51 activity="create program"
52 cat > $TESTFILE <<EOF
53 DATA LIST LIST NOTABLE /location * editor * shell * freq * .
54 BEGIN DATA.
55     1.00     1.00    1.0     2.00
56     1.00     1.00    2.0    30.00
57     1.00     2.00    1.0     8.00
58     1.00     2.00    2.0    20.00
59     2.00     1.00    1.0     2.00
60     2.00     1.00    2.0    22.00
61     2.00     2.00    1.0     1.00
62     2.00     2.00    2.0     3.00
63 END DATA.
64
65 SAVE /OUTFILE='$TEMPDIR/foo.sav'.
66
67 GET /FILE='$TEMPDIR/foo.sav'.
68
69 * This one's ok
70 LIST.
71
72 * But this one get rubbish
73 LIST.
74
75 EOF
76 if [ $? -ne 0 ] ; then no_result ; fi
77
78
79 activity="run program"
80 $SUPERVISOR $here/../src/pspp -o raw-ascii $TESTFILE
81 if [ $? -ne 0 ] ; then no_result ; fi
82
83
84
85
86 activity="compare output"
87 diff -b -B -w $TEMPDIR/pspp.list - << EOF
88 LOCATION   EDITOR    SHELL     FREQ
89  -------- -------- -------- --------
90      1.00     1.00     1.00     2.00 
91      1.00     1.00     2.00    30.00 
92      1.00     2.00     1.00     8.00 
93      1.00     2.00     2.00    20.00 
94      2.00     1.00     1.00     2.00 
95      2.00     1.00     2.00    22.00 
96      2.00     2.00     1.00     1.00 
97      2.00     2.00     2.00     3.00 
98  
99
100 LOCATION   EDITOR    SHELL     FREQ
101  -------- -------- -------- --------
102      1.00     1.00     1.00     2.00 
103      1.00     1.00     2.00    30.00 
104      1.00     2.00     1.00     8.00 
105      1.00     2.00     2.00    20.00 
106      2.00     1.00     1.00     2.00 
107      2.00     1.00     2.00    22.00 
108      2.00     2.00     1.00     1.00 
109      2.00     2.00     2.00     3.00 
110  
111 EOF
112 if [ $? -ne 0 ] ; then fail ; fi
113
114 pass;