bd6a2249068ccf26062190041c1a1226c3dba1c6
[pspp-builds.git] / tests / command / t-test-1-sample-missing-anal.sh
1 #!/bin/sh
2
3 # This program tests that the T-TEST /TESTVAL command works OK
4 # when there are per analysis missing values 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 * x1 * x2.
52 begin data.
53 1 3.5 34
54 2 2.0 10
55 3 2.0 23
56 4 3.5 98
57 5 3.0 23
58 67 4.0 8
59 end data.
60
61 t-test /testval=3.0 /var=x1 x2.
62 EOF
63 if [ $? -ne 0 ] ; then no_result ; fi
64
65
66 activity="run program 1"
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/ref.list
72 if [ $? -ne 0 ] ; then no_result ; fi
73
74
75 activity="create program 2"
76 cat > $TEMPDIR/out.stat <<EOF
77 data list list /id * x1 * x2.
78 begin data.
79 1 3.5 34
80 2 2.0 10
81 3 2.0 23
82 4 3.5 98
83 5 3.0 23
84 6 4.0 .
85 7  .  8
86 end data.
87
88 t-test /missing=analysis /testval=3.0 /var=x1 x2.
89 EOF
90 if [ $? -ne 0 ] ; then no_result ; fi
91
92 activity="run program 2"
93 $here/../src/pspp -o raw-ascii $TEMPDIR/out.stat
94 if [ $? -ne 0 ] ; then no_result ; fi
95
96 activity="compare outputs"
97 diff $TEMPDIR/ref.list $TEMPDIR/pspp.list
98 if [ $? -ne 0 ] ; then fail ; fi
99
100
101 pass