533a90a8c67e2be657a2f2b8cfadad8d741e2429
[pspp-builds.git] / tests / command / oneway-missing.sh
1 #!/bin/sh
2
3 # This program tests that the ONEWAY anova command works OK when there is missing data
4
5 TEMPDIR=/tmp/pspp-tst-$$
6 TESTFILE=$TEMPDIR/`basename $0`.sps
7
8 here=`pwd`;
9
10 # ensure that top_srcdir is absolute
11 cd $top_srcdir; top_srcdir=`pwd`
12
13 STAT_CONFIG_PATH=$top_srcdir/config
14 export STAT_CONFIG_PATH
15
16
17 cleanup()
18 {
19      cd /
20      rm -rf $TEMPDIR
21 }
22
23
24 fail()
25 {
26     echo $activity
27     echo FAILED
28     cleanup;
29     exit 1;
30 }
31
32
33 no_result()
34 {
35     echo $activity
36     echo NO RESULT;
37     cleanup;
38     exit 2;
39 }
40
41 pass()
42 {
43     cleanup;
44     exit 0;
45 }
46
47 mkdir -p $TEMPDIR
48
49 cd $TEMPDIR
50
51 activity="create program"
52 cat > $TESTFILE <<EOF
53 DATA LIST LIST /v1 * v2 * dep * vn *.
54 BEGIN DATA
55 . .  1  4
56 3 3  1  2
57 2 2  1  2
58 1 1  1  2
59 1 1  1  2
60 4 4  1  2
61 5 5  2  2
62 2 2  2  2
63 4 4  2  2
64 2 2  2  2
65 3 3  2  2
66 7 7  3  2
67 4 4  3  2
68 5 5  3  2
69 3 3  3  2
70 6 6  3  2
71 END DATA
72
73 ONEWAY
74         v1 v2 BY dep
75         /STATISTICS descriptives homogeneity
76         /MISSING ANALYSIS 
77         .
78 EOF
79 if [ $? -ne 0 ] ; then no_result ; fi
80
81
82 activity="run program"
83 $SUPERVISOR $here/../src/pspp -o raw-ascii $TESTFILE
84 if [ $? -ne 0 ] ; then no_result ; fi
85
86 activity="copy output"
87 cp $TEMPDIR/pspp.list $TEMPDIR/pspp.list1
88 if [ $? -ne 0 ] ; then no_result ; fi
89
90 activity="create program 2"
91 cat > $TESTFILE <<EOF
92 DATA LIST LIST /v1 * v2 * dep * vn * .
93 BEGIN DATA
94 4 .  1  2 
95 3 3  1  2
96 2 2  1  2
97 1 1  1  2
98 1 1  1  2
99 4 4  1  2
100 5 5  2  2
101 2 2  2  2
102 4 4  2  2
103 2 2  2  2
104 3 3  2  2
105 7 7  3  2
106 4 4  3  2
107 5 5  3  2
108 3 3  3  2
109 6 6  3  2
110 END DATA
111
112 ONEWAY
113         v1 v2 BY dep
114         /STATISTICS descriptives homogeneity
115         /MISSING LISTWISE
116         .
117 EOF
118 if [ $? -ne 0 ] ; then no_result ; fi
119
120 activity="run program 2"
121 $SUPERVISOR $here/../src/pspp -o raw-ascii $TESTFILE
122 if [ $? -ne 0 ] ; then no_result ; fi
123
124 activity="compare outputs"
125 diff $TEMPDIR/pspp.list $TEMPDIR/pspp.list1
126 if [ $? -ne 0 ] ; then fail ; fi
127
128 # Now try a missing dependent variable
129 # Everything depends upon it, so it should behave as if LISTWISE were set
130 activity="create program 3"
131 cat > $TESTFILE <<EOF
132 DATA LIST LIST /v1 * v2 * dep * vn * .
133 BEGIN DATA
134 4 2  .  2 
135 3 3  1  2
136 2 2  1  2
137 1 1  1  2
138 1 1  1  2
139 4 4  1  2
140 5 5  2  2
141 2 2  2  2
142 4 4  2  2
143 2 2  2  2
144 3 3  2  2
145 7 7  3  2
146 4 4  3  2
147 5 5  3  2
148 3 3  3  2
149 6 6  3  2
150 END DATA
151
152 ONEWAY
153         v1 v2 BY dep
154         /STATISTICS descriptives homogeneity
155         /MISSING ANALYSIS
156         .
157 EOF
158 if [ $? -ne 0 ] ; then no_result ; fi
159
160 activity="run program 3"
161 $SUPERVISOR $here/../src/pspp -o raw-ascii $TESTFILE
162 if [ $? -ne 0 ] ; then no_result ; fi
163
164 activity="compare outputs"
165 diff $TEMPDIR/pspp.list $TEMPDIR/pspp.list1
166 if [ $? -ne 0 ] ; then fail ; fi
167
168
169 pass