3 # Tests calculation of percentiles with the
4 # COMPATIBLE 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
62 activity="create program $i"
63 cat > $TEMPDIR/prog.sps <<EOF
64 DATA LIST LIST notable /X * .
76 /PERCENTILES = 0 25 50 75 100
79 if [ $? -ne 0 ] ; then no_result; fi
81 activity="run program $i"
82 $SUPERVISOR $PSPP --testing-mode $TEMPDIR/prog.sps
83 if [ $? -ne 0 ] ; then no_result ; fi
85 activity="compare output $i"
86 perl -pi -e 's/^\s*$//g' $TEMPDIR/pspp.list
87 diff -b $TEMPDIR/pspp.list - <<EOF
89 +-----------+--------+---------+--------+--------+--------+
90 | | | | | Valid | Cum |
91 |Value Label| Value |Frequency| Percent| Percent| Percent|
92 #===========#========#=========#========#========#========#
93 | | 1.00| 1| 20.0| 20.0| 20.0|
94 | | 2.00| 1| 20.0| 20.0| 40.0|
95 | | 3.00| 1| 20.0| 20.0| 60.0|
96 | | 4.00| 1| 20.0| 20.0| 80.0|
97 | | 5.00| 1| 20.0| 20.0| 100.0|
98 #===========#========#=========#========#========#========#
99 | Total| 5| 100.0| 100.0| |
100 +--------------------+---------+--------+--------+--------+
101 +-----------------------+-----+
108 |Percentiles 0 |1.000|
113 +-----------------------+-----+
115 if [ $? -ne 0 ] ; then fail ; fi