3 # Tests calculation of percentiles with the
4 # ENHANCED algorithm set.
6 TEMPDIR=/tmp/pspp-tst-$$
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 PSPP=$top_builddir/src/ui/terminal/pspp
14 # ensure that top_srcdir is absolute
15 top_srcdir=`cd $top_srcdir; pwd`
17 STAT_CONFIG_PATH=$top_srcdir/config
18 export STAT_CONFIG_PATH
26 if [ x"$PSPP_TEST_NO_CLEANUP" != x ] ; then
27 echo "NOT cleaning $TEMPDIR"
65 activity="create program $i"
66 cat > $TEMPDIR/prog.sps <<EOF
67 DATA LIST LIST notable /X * .
78 /PERCENTILES = 0 25 50 75 100
81 if [ $? -ne 0 ] ; then no_result; fi
83 activity="run program $i"
84 $SUPERVISOR $PSPP --testing-mode $TEMPDIR/prog.sps
85 if [ $? -ne 0 ] ; then no_result ; fi
87 activity="compare output $i"
88 perl -pi -e 's/^\s*$//g' $TEMPDIR/pspp.list
89 diff -b $TEMPDIR/pspp.list - <<EOF
91 +-----------+--------+---------+--------+--------+--------+
92 | | | | | Valid | Cum |
93 |Value Label| Value |Frequency| Percent| Percent| Percent|
94 #===========#========#=========#========#========#========#
95 | | 1.00| 1| 20.0| 20.0| 20.0|
96 | | 2.00| 1| 20.0| 20.0| 40.0|
97 | | 3.00| 1| 20.0| 20.0| 60.0|
98 | | 4.00| 1| 20.0| 20.0| 80.0|
99 | | 5.00| 1| 20.0| 20.0| 100.0|
100 #===========#========#=========#========#========#========#
101 | Total| 5| 100.0| 100.0| |
102 +--------------------+---------+--------+--------+--------+
103 +-----------------------+-----+
110 |Percentiles 0 |1.000|
115 +-----------------------+-----+
117 if [ $? -ne 0 ] ; then fail ; fi
123 activity="create program $i"
124 cat > $TEMPDIR/prog.sps <<EOF
125 DATA LIST LIST notable /X * F *.
140 /PERCENTILES = 0 25 50 75 100
143 if [ $? -ne 0 ] ; then no_result; fi
146 activity="run program $i"
147 $SUPERVISOR $PSPP --testing-mode $TEMPDIR/prog.sps
148 if [ $? -ne 0 ] ; then no_result ; fi
150 activity="compare output $i"
151 perl -pi -e 's/^\s*$//g' $TEMPDIR/pspp.list
152 diff -b $TEMPDIR/pspp.list - <<EOF
154 +-----------+--------+---------+--------+--------+--------+
155 | | | | | Valid | Cum |
156 |Value Label| Value |Frequency| Percent| Percent| Percent|
157 #===========#========#=========#========#========#========#
158 | | 1.00| 2| 20.0| 20.0| 20.0|
159 | | 2.00| 2| 20.0| 20.0| 40.0|
160 | | 3.00| 2| 20.0| 20.0| 60.0|
161 | | 4.00| 2| 20.0| 20.0| 80.0|
162 | | 5.00| 2| 20.0| 20.0| 100.0|
163 #===========#========#=========#========#========#========#
164 | Total| 10| 100.0| 100.0| |
165 +--------------------+---------+--------+--------+--------+
166 +-----------------------+-----+
173 |Percentiles 0 |1.000|
178 +-----------------------+-----+
180 if [ $? -ne 0 ] ; then fail ; fi
186 activity="create program $i"
187 cat > $TEMPDIR/prog.sps <<EOF
188 DATA LIST LIST notable /X * F *.
201 /PERCENTILES = 0 25 50 75 100
204 if [ $? -ne 0 ] ; then no_result; fi
207 activity="run program $i"
208 $SUPERVISOR $PSPP --testing-mode $TEMPDIR/prog.sps
209 if [ $? -ne 0 ] ; then no_result ; fi
211 activity="compare output $i"
212 perl -pi -e 's/^\s*$//g' $TEMPDIR/pspp.list
213 diff -b $TEMPDIR/pspp.list - <<EOF
215 +-----------+--------+---------+--------+--------+--------+
216 | | | | | Valid | Cum |
217 |Value Label| Value |Frequency| Percent| Percent| Percent|
218 #===========#========#=========#========#========#========#
219 | | 1.00| 1| 16.7| 16.7| 16.7|
220 | | 3.00| 2| 33.3| 33.3| 50.0|
221 | | 4.00| 1| 16.7| 16.7| 66.7|
222 | | 5.00| 2| 33.3| 33.3| 100.0|
223 #===========#========#=========#========#========#========#
224 | Total| 6| 100.0| 100.0| |
225 +--------------------+---------+--------+--------+--------+
226 +-----------------------+-----+
233 |Percentiles 0 |1.000|
238 +-----------------------+-----+
240 if [ $? -ne 0 ] ; then fail ; fi
244 activity="create program $i"
245 cat > $TEMPDIR/prog.sps <<EOF
246 DATA LIST LIST notable /X * F *.
256 MISSING VALUE x (99.0) .
261 /PERCENTILES = 0 25 50 75 100
264 if [ $? -ne 0 ] ; then no_result; fi
267 activity="run program $i"
268 $SUPERVISOR $PSPP --testing-mode $TEMPDIR/prog.sps
269 if [ $? -ne 0 ] ; then no_result ; fi
271 activity="compare output $i"
272 perl -pi -e 's/^\s*$//g' $TEMPDIR/pspp.list
273 diff -b $TEMPDIR/pspp.list - <<EOF
275 +-----------+--------+---------+--------+--------+--------+
276 | | | | | Valid | Cum |
277 |Value Label| Value |Frequency| Percent| Percent| Percent|
278 #===========#========#=========#========#========#========#
279 | | 1.00| 1| 10.0| 16.7| 16.7|
280 | | 3.00| 2| 20.0| 33.3| 50.0|
281 | | 4.00| 1| 10.0| 16.7| 66.7|
282 | | 5.00| 2| 20.0| 33.3| 100.0|
283 | | 99.00| 4| 40.0| Missing| |
284 #===========#========#=========#========#========#========#
285 | Total| 10| 100.0| 100.0| |
286 +--------------------+---------+--------+--------+--------+
287 +-----------------------+-----+
294 |Percentiles 0 |1.000|
299 +-----------------------+-----+
301 if [ $? -ne 0 ] ; then fail ; fi