Fix memory leaks.
[pspp-builds.git] / tests / command / t-test-indep-missing-list.sh
1 #!/bin/sh
2
3 # This program tests that the T-TEST /GROUPS command works OK
4 # when LISTWISE missing values are involved
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 1"
50 cat > $TEMPDIR/out.stat <<EOF
51 data list list /id * indep * dep1 * dep2.
52 begin data.
53 1 1.0 3.5 6
54 2 1.0 2.0 5
55 3 1.0 2.0 4
56 4 2.0 3.5 3
57 5 2.0 3.0 2
58 6 2.0 4.0 1
59 end data.
60
61 t-test /group=indep /var=dep1 dep2.
62 EOF
63 if [ $? -ne 0 ] ; then no_result ; fi
64
65
66 activity="run program 1"
67 $SUPERVISOR $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/ref.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 /id * indep * dep1 * dep2 *.
77 begin data.
78 1 1.0 3.5 6
79 2 1.0 2.0 5
80 3 1.0 2.0 4
81 4 2.0 3.5 3
82 5 2.0 3.0 2
83 6 2.0 4.0 1
84 7 2.0 .   0
85 end data.
86
87 t-test /missing=listwise,exclude /group=indep /var=dep1, dep2.
88 EOF
89 if [ $? -ne 0 ] ; then no_result ; fi
90
91 activity="run program 2"
92 $SUPERVISOR $here/../src/pspp -o raw-ascii $TEMPDIR/out.stat
93 if [ $? -ne 0 ] ; then no_result ; fi
94
95
96 activity="compare outputs"
97 diff $TEMPDIR/ref.list $TEMPDIR/pspp.list 
98 if [ $? -ne 0 ] ; then fail ; fi
99
100
101 pass