0d8e61e0743fbbe69004f30fc5b315f8e0d5ee12
[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 TESTFILE=$TEMPDIR/`basename $0`.sps
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 > $TESTFILE <<EOF
52 DATA LIST LIST NOTABLE /X *.
53 begin data.
54 1
55 2
56 3
57 4
58 5
59 6
60 7
61 8
62 9
63 end data.
64
65 temporary.
66 select if x > 5 .
67 list.
68
69 list.
70 EOF
71 if [ $? -ne 0 ] ; then no_result ; fi
72
73 $SUPERVISOR $here/../src/pspp -o raw-ascii $TESTFILE
74 if [ $? -ne 0 ] ; then no_result ; fi
75
76
77 diff -b -B -w $TEMPDIR/pspp.list - << EOF
78        X
79 --------
80     6.00 
81     7.00 
82     8.00 
83     9.00 
84
85        X
86 --------
87     1.00 
88     2.00 
89     3.00 
90     4.00 
91     5.00 
92     6.00 
93     7.00 
94     8.00 
95     9.00 
96 EOF
97 if [ $? -ne 0 ] ; then fail ; fi
98
99 pass;