e77ca799ea7ce0d3dca1570b12dd1ae4d0b21b89
[pspp-builds.git] / tests / bugs / t-test-with-temp.sh
1 #!/bin/sh
2
3 # This program tests that the T-TEST 
4 # works ok with a TEMPORARY transformation
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/out.stat <<EOF
51 data list list /ind * x * .
52 begin data.
53 1 3.5
54 1 2.0
55 1 2.0
56 2 3.5
57 2 3.0
58 2 4.0
59 end data.
60
61 t-test /groups=ind(1,2) /var x.
62 EOF
63 if [ $? -ne 0 ] ; then no_result ; fi
64
65
66 activity="run program"
67 $here/../src/pspp -o raw-ascii $TEMPDIR/out.stat
68 if [ $? -ne 0 ] ; then no_result ; fi
69
70 activity="copy output"
71 cp $TEMPDIR/pspp.list $TEMPDIR/first.list
72 if [ $? -ne 0 ] ; then no_result ; fi
73
74 activity="create program 2"
75 cat > $TEMPDIR/out.stat <<EOF
76 data list list /ind * x * .
77 begin data.
78 1 3.5
79 1 2.0
80 1 2.0
81 2 3.5
82 2 3.0
83 2 4.0
84 2 9.0
85 end data.
86
87 TEMPORARY.
88 SELECT IF ind < 7.
89
90 t-test /groups=ind(1,2) /var x.
91 EOF
92 if [ $? -ne 0 ] ; then no_result ; fi
93
94 activity="compare output"
95 diff -B -b $TEMPDIR/pspp.list $TEMPDIR/first.list
96 if [ $? -ne 0 ] ; then fail ; fi
97
98
99 pass