Added custom assert(); Fixed bugs in T-TEST and VALUE LABELS
[pspp-builds.git] / tests / bugs / t-test.sh
1 #!/bin/sh
2
3 # This program tests for a bug which caused T-TEST to 
4 # crash when given invalid syntax
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/rnd.sps <<EOF
52 DATA LIST LIST /id * a * .
53 BEGIN DATA.
54 1 3.5
55 2 2.0
56 3 2.0
57 4 3.5
58 5 3.0
59 6 4.0
60 END DATA.
61
62 T-TEST /testval=2.0 .
63 T-TEST /groups=id(3) .
64 EOF
65 if [ $? -ne 0 ] ; then no_result ; fi
66
67 $SUPERVISOR $here/../src/pspp -o raw-ascii $TEMPDIR/rnd.sps > /dev/null
68 if [ $? -ne 1 ] ; then fail ; fi
69
70 pass;