Fix TEMPORARY bug and add regression test.
[pspp-builds.git] / tests / bugs / temporary.sh
1 #!/bin/sh
2
3 # This program tests for a bug which caused UNIFORM(x) to always return zero.
4
5
6 TEMPDIR=/tmp/pspp-tst-$$
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 program"
50 cat > $TEMPDIR/rnd.sps <<EOF
51 DATA LIST LIST NOTABLE /x *.
52 begin data.
53 1
54 2
55 3
56 4
57 5
58 6
59 7
60 8
61 9
62 end data.
63
64 temporary.
65 select if x > 5 .
66 list.
67
68 list.
69 EOF
70 if [ $? -ne 0 ] ; then no_result ; fi
71
72 $SUPERVISOR $here/../src/pspp -o raw-ascii $TEMPDIR/rnd.sps
73 if [ $? -ne 0 ] ; then no_result ; fi
74
75
76 diff -b -B -w $TEMPDIR/pspp.list - << EOF
77        X
78 --------
79     6.00 
80     7.00 
81     8.00 
82     9.00 
83
84        X
85 --------
86     1.00 
87     2.00 
88     3.00 
89     4.00 
90     5.00 
91     6.00 
92     7.00 
93     8.00 
94     9.00 
95 EOF
96 if [ $? -ne 0 ] ; then fail ; fi
97
98 pass;