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
59 activity="create program $i"
60 cat > $TEMPDIR/prog.sps <<EOF
61 DATA LIST LIST notable /X * .
72 /PERCENTILES = 0 25 50 75 100
75 if [ $? -ne 0 ] ; then no_result; fi
77 activity="run program $i"
78 $SUPERVISOR $PSPP -o raw-ascii $TEMPDIR/prog.sps
79 if [ $? -ne 0 ] ; then no_result ; fi
81 activity="compare output $i"
82 perl -pi -e 's/^\s*$//g' $TEMPDIR/pspp.list
83 diff -b $TEMPDIR/pspp.list - <<EOF
85 +-----------+--------+---------+--------+--------+--------+
86 | | | | | Valid | Cum |
87 |Value Label| Value |Frequency| Percent| Percent| Percent|
88 #===========#========#=========#========#========#========#
89 | | 1.00| 1| 20.0| 20.0| 20.0|
90 | | 2.00| 1| 20.0| 20.0| 40.0|
91 | | 3.00| 1| 20.0| 20.0| 60.0|
92 | | 4.00| 1| 20.0| 20.0| 80.0|
93 | | 5.00| 1| 20.0| 20.0| 100.0|
94 #===========#========#=========#========#========#========#
95 | Total| 5| 100.0| 100.0| |
96 +--------------------+---------+--------+--------+--------+
97 +-------------------+-----+
104 |Percentiles 0 |1.000|
109 +-------------------+-----+
111 if [ $? -ne 0 ] ; then fail ; fi
117 activity="create program $i"
118 cat > $TEMPDIR/prog.sps <<EOF
119 DATA LIST LIST notable /X * F *.
134 /PERCENTILES = 0 25 50 75 100
137 if [ $? -ne 0 ] ; then no_result; fi
140 activity="run program $i"
141 $SUPERVISOR $PSPP -o raw-ascii $TEMPDIR/prog.sps
142 if [ $? -ne 0 ] ; then no_result ; fi
144 activity="compare output $i"
145 perl -pi -e 's/^\s*$//g' $TEMPDIR/pspp.list
146 diff -b $TEMPDIR/pspp.list - <<EOF
148 +-----------+--------+---------+--------+--------+--------+
149 | | | | | Valid | Cum |
150 |Value Label| Value |Frequency| Percent| Percent| Percent|
151 #===========#========#=========#========#========#========#
152 | | 1.00| 2| 20.0| 20.0| 20.0|
153 | | 2.00| 2| 20.0| 20.0| 40.0|
154 | | 3.00| 2| 20.0| 20.0| 60.0|
155 | | 4.00| 2| 20.0| 20.0| 80.0|
156 | | 5.00| 2| 20.0| 20.0| 100.0|
157 #===========#========#=========#========#========#========#
158 | Total| 10| 100.0| 100.0| |
159 +--------------------+---------+--------+--------+--------+
160 +-------------------+-----+
167 |Percentiles 0 |1.000|
172 +-------------------+-----+
174 if [ $? -ne 0 ] ; then fail ; fi
180 activity="create program $i"
181 cat > $TEMPDIR/prog.sps <<EOF
182 DATA LIST LIST notable /X * F *.
195 /PERCENTILES = 0 25 50 75 100
198 if [ $? -ne 0 ] ; then no_result; fi
201 activity="run program $i"
202 $SUPERVISOR $PSPP -o raw-ascii $TEMPDIR/prog.sps
203 if [ $? -ne 0 ] ; then no_result ; fi
205 activity="compare output $i"
206 perl -pi -e 's/^\s*$//g' $TEMPDIR/pspp.list
207 diff -b $TEMPDIR/pspp.list - <<EOF
209 +-----------+--------+---------+--------+--------+--------+
210 | | | | | Valid | Cum |
211 |Value Label| Value |Frequency| Percent| Percent| Percent|
212 #===========#========#=========#========#========#========#
213 | | 1.00| 1| 16.7| 16.7| 16.7|
214 | | 3.00| 2| 33.3| 33.3| 50.0|
215 | | 4.00| 1| 16.7| 16.7| 66.7|
216 | | 5.00| 2| 33.3| 33.3| 100.0|
217 #===========#========#=========#========#========#========#
218 | Total| 6| 100.0| 100.0| |
219 +--------------------+---------+--------+--------+--------+
220 +-------------------+-----+
227 |Percentiles 0 |1.000|
232 +-------------------+-----+
234 if [ $? -ne 0 ] ; then fail ; fi
238 activity="create program $i"
239 cat > $TEMPDIR/prog.sps <<EOF
240 DATA LIST LIST notable /X * F *.
250 MISSING VALUE x (99.0) .
255 /PERCENTILES = 0 25 50 75 100
258 if [ $? -ne 0 ] ; then no_result; fi
261 activity="run program $i"
262 $SUPERVISOR $PSPP -o raw-ascii $TEMPDIR/prog.sps
263 if [ $? -ne 0 ] ; then no_result ; fi
265 activity="compare output $i"
266 perl -pi -e 's/^\s*$//g' $TEMPDIR/pspp.list
267 diff -b $TEMPDIR/pspp.list - <<EOF
269 +-----------+--------+---------+--------+--------+--------+
270 | | | | | Valid | Cum |
271 |Value Label| Value |Frequency| Percent| Percent| Percent|
272 #===========#========#=========#========#========#========#
273 | | 1.00| 1| 10.0| 16.7| 16.7|
274 | | 3.00| 2| 20.0| 33.3| 50.0|
275 | | 4.00| 1| 10.0| 16.7| 66.7|
276 | | 5.00| 2| 20.0| 33.3| 100.0|
277 | | 99.00| 4| 40.0| Missing| |
278 #===========#========#=========#========#========#========#
279 | Total| 10| 100.0| 100.0| |
280 +--------------------+---------+--------+--------+--------+
281 +-------------------+-----+
288 |Percentiles 0 |1.000|
293 +-------------------+-----+
295 if [ $? -ne 0 ] ; then fail ; fi