2f43310874f21e99977c8b1cc38e1b68df4ea975
[pspp-builds.git] / tests / command / t-test-indep-missing-anal.sh
1 #!/bin/sh
2
3 # This program tests that the T-TEST /GROUPS command works OK
4 # when ANALYSIS missing values are involved
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 STAT_CONFIG_PATH=$top_srcdir/config
15 export STAT_CONFIG_PATH
16
17
18 cleanup()
19 {
20      cd /
21      rm -rf $TEMPDIR
22 }
23
24
25 fail()
26 {
27     echo $activity
28     echo FAILED
29     cleanup;
30     exit 1;
31 }
32
33
34 no_result()
35 {
36     echo $activity
37     echo NO RESULT;
38     cleanup;
39     exit 2;
40 }
41
42 pass()
43 {
44     cleanup;
45     exit 0;
46 }
47
48 mkdir -p $TEMPDIR
49
50 cd $TEMPDIR
51
52 activity="create program 1"
53 cat > $TESTFILE <<EOF
54 data list list /id * indep * dep1 * dep2 *.
55 begin data.
56 1  1.0 3.5 6
57 2  1.0 2.0 5
58 3  1.0 2.0 4
59 4  2.0 3.5 3
60 56 2.0 3.0 1
61 end data.
62
63 t-test /group=indep /var=dep1, dep2.
64 EOF
65 if [ $? -ne 0 ] ; then no_result ; fi
66
67
68 activity="run program 1"
69 $SUPERVISOR $here/../src/pspp -o raw-ascii $TESTFILE
70 if [ $? -ne 0 ] ; then no_result ; fi
71
72 activity="copy output"
73 cp $TEMPDIR/pspp.list $TEMPDIR/ref.list
74 if [ $? -ne 0 ] ; then no_result ; fi
75
76 activity="create program 2"
77 cat > $TESTFILE <<EOF
78 data list list /id * indep * dep1 * dep2.
79 begin data.
80 1 1.0 3.5 6
81 2 1.0 2.0 5
82 3 1.0 2.0 4
83 4 2.0 3.5 3
84 5 2.0 3.0 .
85 6 2.0 .   1
86 7  .  3.1 5
87 end data.
88
89 * Note that if the independent variable is missing, then it's implicitly 
90 * listwise missing.
91
92 t-test /missing=analysis /group=indep /var=dep1 dep2.
93 EOF
94 if [ $? -ne 0 ] ; then no_result ; fi
95
96 activity="run program 2"
97 $SUPERVISOR $here/../src/pspp -o raw-ascii $TESTFILE
98 if [ $? -ne 0 ] ; then no_result ; fi
99
100
101 activity="compare outputs"
102 diff $TEMPDIR/ref.list $TEMPDIR/pspp.list 
103 if [ $? -ne 0 ] ; then fail ; fi
104
105
106 pass