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 |Value Label| Value |Frequency| Percent|Valid Percent|Cum Percent|
93 #===========#========#=========#========#=============#===========#
94 | | 1.00| 1| 20.00| 20.00| 20.00|
95 | | 2.00| 1| 20.00| 20.00| 40.00|
96 | | 3.00| 1| 20.00| 20.00| 60.00|
97 | | 4.00| 1| 20.00| 20.00| 80.00|
98 | | 5.00| 1| 20.00| 20.00| 100.00|
99 #===========#========#=========#========#=============#===========#
100 | Total| 5| 100.0| 100.0| |
101 +--------------------+---------+--------+-------------+-----------+
102 +-----------------------+----+
109 |Percentiles 0 |1.00|
114 +-----------------------+----+
116 if [ $? -ne 0 ] ; then fail ; fi
122 activity="create program $i"
123 cat > $TEMPDIR/prog.sps <<EOF
124 DATA LIST LIST notable /X * F *.
139 /PERCENTILES = 0 25 50 75 100
142 if [ $? -ne 0 ] ; then no_result; fi
145 activity="run program $i"
146 $SUPERVISOR $PSPP --testing-mode $TEMPDIR/prog.sps
147 if [ $? -ne 0 ] ; then no_result ; fi
149 activity="compare output $i"
150 perl -pi -e 's/^\s*$//g' $TEMPDIR/pspp.list
151 diff -b $TEMPDIR/pspp.list - <<EOF
153 +-----------+--------+---------+--------+-------------+-----------+
154 |Value Label| Value |Frequency| Percent|Valid Percent|Cum Percent|
155 #===========#========#=========#========#=============#===========#
156 | | 1.00| 2.00| 20.00| 20.00| 20.00|
157 | | 2.00| 2.00| 20.00| 20.00| 40.00|
158 | | 3.00| 2.00| 20.00| 20.00| 60.00|
159 | | 4.00| 2.00| 20.00| 20.00| 80.00|
160 | | 5.00| 2.00| 20.00| 20.00| 100.00|
161 #===========#========#=========#========#=============#===========#
162 | Total| 10.00| 100.0| 100.0| |
163 +--------------------+---------+--------+-------------+-----------+
164 +-----------------------+-----+
171 |Percentiles 0 | 1.00|
176 +-----------------------+-----+
178 if [ $? -ne 0 ] ; then fail ; fi
184 activity="create program $i"
185 cat > $TEMPDIR/prog.sps <<EOF
186 DATA LIST LIST notable /X * F *.
199 /PERCENTILES = 0 25 50 75 100
202 if [ $? -ne 0 ] ; then no_result; fi
205 activity="run program $i"
206 $SUPERVISOR $PSPP --testing-mode $TEMPDIR/prog.sps
207 if [ $? -ne 0 ] ; then no_result ; fi
209 activity="compare output $i"
210 perl -pi -e 's/^\s*$//g' $TEMPDIR/pspp.list
211 diff -b $TEMPDIR/pspp.list - <<EOF
213 +-----------+--------+---------+--------+-------------+-----------+
214 |Value Label| Value |Frequency| Percent|Valid Percent|Cum Percent|
215 #===========#========#=========#========#=============#===========#
216 | | 1.00| 1.00| 16.67| 16.67| 16.67|
217 | | 3.00| 2.00| 33.33| 33.33| 50.00|
218 | | 4.00| 1.00| 16.67| 16.67| 66.67|
219 | | 5.00| 2.00| 33.33| 33.33| 100.00|
220 #===========#========#=========#========#=============#===========#
221 | Total| 6.00| 100.0| 100.0| |
222 +--------------------+---------+--------+-------------+-----------+
223 +-----------------------+----+
230 |Percentiles 0 |1.00|
235 +-----------------------+----+
237 if [ $? -ne 0 ] ; then fail ; fi
241 activity="create program $i"
242 cat > $TEMPDIR/prog.sps <<EOF
243 DATA LIST LIST notable /X * F *.
253 MISSING VALUE x (99.0) .
258 /PERCENTILES = 0 25 50 75 100
261 if [ $? -ne 0 ] ; then no_result; fi
264 activity="run program $i"
265 $SUPERVISOR $PSPP --testing-mode $TEMPDIR/prog.sps
266 if [ $? -ne 0 ] ; then no_result ; fi
268 activity="compare output $i"
269 perl -pi -e 's/^\s*$//g' $TEMPDIR/pspp.list
270 diff -b $TEMPDIR/pspp.list - <<EOF
272 +-----------+--------+---------+--------+-------------+-----------+
273 |Value Label| Value |Frequency| Percent|Valid Percent|Cum Percent|
274 #===========#========#=========#========#=============#===========#
275 | | 1.00| 1.00| 10.00| 16.67| 16.67|
276 | | 3.00| 2.00| 20.00| 33.33| 50.00|
277 | | 4.00| 1.00| 10.00| 16.67| 66.67|
278 | | 5.00| 2.00| 20.00| 33.33| 100.00|
279 | | 99.00| 4.00| 40.00| Missing| |
280 #===========#========#=========#========#=============#===========#
281 | Total| 10.00| 100.0| 100.0| |
282 +--------------------+---------+--------+-------------+-----------+
283 +-----------------------+----+
290 |Percentiles 0 |1.00|
295 +-----------------------+----+
297 if [ $? -ne 0 ] ; then fail ; fi