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