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