tests: Integrate FREQUENCIES tests into Autotest testsuite.
authorBen Pfaff <blp@cs.stanford.edu>
Sun, 14 Mar 2010 05:44:30 +0000 (21:44 -0800)
committerBen Pfaff <blp@cs.stanford.edu>
Sun, 14 Mar 2010 06:10:49 +0000 (22:10 -0800)
tests/automake.mk
tests/bugs/alpha-freq.sh [deleted file]
tests/bugs/double-frequency.sh [deleted file]
tests/bugs/html-frequency.sh [deleted file]
tests/bugs/piechart.sh [deleted file]
tests/bugs/temp-freq.sh [deleted file]
tests/language/stats/frequencies.at [new file with mode: 0644]
tests/stats/ntiles.sh [deleted file]
tests/stats/percentiles-compatible.sh [deleted file]
tests/testsuite.at

index b259197cc253e8cbc8ae0cc6ac3ea2ddb7aef06c..392c4c4f70c3c9ce2a9e6e866eae9e16d2a72727 100644 (file)
@@ -102,7 +102,6 @@ dist_TESTS = \
        tests/formats/360.sh \
        tests/bugs/agg_crash.sh \
        tests/bugs/agg-crash-2.sh \
-       tests/bugs/alpha-freq.sh \
        tests/bugs/big-input.sh \
        tests/bugs/big-input-2.sh \
        tests/bugs/case-map.sh \
@@ -111,7 +110,6 @@ dist_TESTS = \
        tests/bugs/compression.sh \
        tests/bugs/curtailed.sh \
        tests/bugs/data-crash.sh \
-       tests/bugs/double-frequency.sh \
        tests/bugs/empty-do-repeat.sh \
        tests/bugs/get.sh \
        tests/bugs/examine-crash.sh \
@@ -121,7 +119,6 @@ dist_TESTS = \
        tests/bugs/examine-missing.sh \
        tests/bugs/examine-missing2.sh \
        tests/bugs/get-no-file.sh \
-       tests/bugs/html-frequency.sh \
        tests/bugs/if_crash.sh \
        tests/bugs/input-crash.sh \
        tests/bugs/lag_crash.sh \
@@ -130,7 +127,6 @@ dist_TESTS = \
        tests/bugs/multipass.sh \
        tests/bugs/overwrite-input-file.sh \
        tests/bugs/overwrite-special-file.sh \
-       tests/bugs/piechart.sh \
        tests/bugs/random.sh \
        tests/bugs/shbang.sh \
        tests/bugs/signals.sh \
@@ -148,7 +144,6 @@ dist_TESTS = \
        tests/bugs/computebug.sh \
        tests/bugs/compute-lv.sh \
        tests/bugs/compute-sum.sh \
-       tests/bugs/temp-freq.sh \
        tests/bugs/print-crash.sh \
        tests/bugs/keep-all.sh \
        tests/data/datasheet-test.sh \
@@ -159,9 +154,6 @@ dist_TESTS = \
        tests/stats/descript-missing.sh \
        tests/stats/descript-mean-bug.sh \
        tests/stats/moments.sh \
-       tests/stats/percentiles-compatible.sh \
-       tests/stats/ntiles.sh \
-       tests/stats/percentiles-enhanced.sh \
        tests/expressions/expressions.sh \
        tests/expressions/epoch.sh \
        tests/expressions/randist.sh \
@@ -415,6 +407,7 @@ EXTRA_DIST += \
 TESTSUITE_AT = \
        tests/testsuite.at \
        tests/language/stats/crosstabs.at \
+       tests/language/stats/frequencies.at \
        tests/output/render.at
 TESTSUITE = $(srcdir)/tests/testsuite
 DISTCLEANFILES += tests/atconfig tests/atlocal $(TESTSUITE)
diff --git a/tests/bugs/alpha-freq.sh b/tests/bugs/alpha-freq.sh
deleted file mode 100755 (executable)
index e3adb6e..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-#!/bin/sh
-
-# This program tests for a bug where the FREQUENCIES command would 
-# crash if given an alphanumeric variable
-
-TEMPDIR=/tmp/pspp-tst-$$
-TESTFILE=$TEMPDIR/`basename $0`.sps
-
-# ensure that top_builddir  are absolute
-if [ -z "$top_builddir" ] ; then top_builddir=. ; fi
-if [ -z "$top_srcdir" ] ; then top_srcdir=. ; fi
-top_builddir=`cd $top_builddir; pwd`
-PSPP=$top_builddir/src/ui/terminal/pspp
-
-# ensure that top_srcdir is absolute
-top_srcdir=`cd $top_srcdir; pwd`
-
-STAT_CONFIG_PATH=$top_srcdir/config
-export STAT_CONFIG_PATH
-
-LANG=C
-export LANG
-
-cleanup()
-{
-     if [ x"$PSPP_TEST_NO_CLEANUP" != x ] ; then 
-       echo "NOT cleaning $TEMPDIR" 
-       return ; 
-     fi
-     cd /
-     rm -rf $TEMPDIR
-}
-
-
-fail()
-{
-    echo $activity
-    echo FAILED
-    cleanup;
-    exit 1;
-}
-
-
-no_result()
-{
-    echo $activity
-    echo NO RESULT;
-    cleanup;
-    exit 2;
-}
-
-pass()
-{
-    cleanup;
-    exit 0;
-}
-
-mkdir -p $TEMPDIR
-
-cd $TEMPDIR
-
-cat > $TEMPDIR/prog.sps <<EOF
-DATA LIST FREE/
-   name  (A8) value * quantity .
-BEGIN DATA.
-Cables 829 3 
-END DATA.
-EXECUTE.
-
-FREQUENCIES /VAR = name.
-
-EOF
-if [ $? -ne 0 ] ; then no_result ; fi
-
-
-$SUPERVISOR $PSPP -o pspp.csv $TEMPDIR/prog.sps
-if [ $? -ne 0 ] ; then fail ; fi
-
-
-pass;
diff --git a/tests/bugs/double-frequency.sh b/tests/bugs/double-frequency.sh
deleted file mode 100755 (executable)
index c579cf3..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-#!/bin/sh
-
-# This program tests for a bug where pspp would crash if two frequencies
-# Commands existed in a input file
-
-TEMPDIR=/tmp/pspp-tst-$$
-TESTFILE=$TEMPDIR/`basename $0`.sps
-
-# ensure that top_builddir  are absolute
-if [ -z "$top_builddir" ] ; then top_builddir=. ; fi
-if [ -z "$top_srcdir" ] ; then top_srcdir=. ; fi
-top_builddir=`cd $top_builddir; pwd`
-PSPP=$top_builddir/src/ui/terminal/pspp
-
-# ensure that top_srcdir is absolute
-top_srcdir=`cd $top_srcdir; pwd`
-
-
-STAT_CONFIG_PATH=$top_srcdir/config
-export STAT_CONFIG_PATH
-
-
-cleanup()
-{
-     if [ x"$PSPP_TEST_NO_CLEANUP" != x ] ; then 
-       echo "NOT cleaning $TEMPDIR" 
-       return ; 
-     fi
-     cd /
-     rm -rf $TEMPDIR
-}
-
-
-fail()
-{
-    echo $activity
-    echo FAILED
-    cleanup;
-    exit 1;
-}
-
-
-no_result()
-{
-    echo $activity
-    echo NO RESULT;
-    cleanup;
-    exit 2;
-}
-
-pass()
-{
-    cleanup;
-    exit 0;
-}
-
-mkdir -p $TEMPDIR
-
-
-activity="create data"
-cat << EOF > $TEMPDIR/ff.stat 
-
-data list free /v1 v2.
-begin data.
-0 1
-2 3 
-4 5
-3 4
-end data.
-
-frequencies v1 v2.
-frequencies v1 v2.
-EOF
-if [ $? -ne 0 ] ; then no_result ; fi
-
-
-cd $TEMPDIR
-
-activity="run data"
-$SUPERVISOR $PSPP -o pspp.csv $TEMPDIR/ff.stat
-if [ $? -ne 0 ] ; then fail ; fi
-
-
-pass;
diff --git a/tests/bugs/html-frequency.sh b/tests/bugs/html-frequency.sh
deleted file mode 100755 (executable)
index 3417601..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-#!/bin/sh
-
-# This program tests for a bug where pspp would crash 
-# when a FREQUENCIES command was used with the html 
-# driver.
-
-
-TEMPDIR=/tmp/pspp-tst-$$
-TESTFILE=$TEMPDIR/`basename $0`.sps
-
-# ensure that top_builddir  are absolute
-if [ -z "$top_builddir" ] ; then top_builddir=. ; fi
-if [ -z "$top_srcdir" ] ; then top_srcdir=. ; fi
-top_builddir=`cd $top_builddir; pwd`
-PSPP=$top_builddir/src/ui/terminal/pspp
-
-# ensure that top_srcdir is absolute
-cd $top_srcdir ; top_srcdir=`pwd`
-
-STAT_CONFIG_PATH=$top_srcdir/config
-export STAT_CONFIG_PATH
-
-cleanup()
-{
-     if [ x"$PSPP_TEST_NO_CLEANUP" != x ] ; then 
-       echo "NOT cleaning $TEMPDIR" 
-       return ; 
-     fi
-     cd /
-     rm -rf $TEMPDIR
-}
-
-
-fail()
-{
-    echo $activity
-    echo FAILED
-    cleanup;
-    exit 1;
-}
-
-
-no_result()
-{
-    echo $activity
-    echo NO RESULT;
-    cleanup;
-    exit 2;
-}
-
-pass()
-{
-    cleanup;
-    exit 0;
-}
-
-mkdir -p $TEMPDIR
-
-
-activity="create data"
-cat << EOF > $TESTFILE
-
-data list free /v1 v2.
-begin data.
-0 1
-2 3 
-4 5
-3 4
-end data.
-
-list.
-
-frequencies v1 v2.
-EOF
-if [ $? -ne 0 ] ; then no_result ; fi
-
-cd $TEMPDIR
-
-activity="run data"
-$SUPERVISOR $PSPP -o pspp.html $TESTFILE
-if [ $? -ne 0 ] ; then fail ; fi
-
-
-pass;
diff --git a/tests/bugs/piechart.sh b/tests/bugs/piechart.sh
deleted file mode 100755 (executable)
index 0296de0..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-#!/bin/sh
-
-# This program tests for a bug which crashed pspp when a
-# piechart with too many segments was requested.
-
-
-TEMPDIR=/tmp/pspp-tst-$$
-TESTFILE=$TEMPDIR/`basename $0`.sps
-
-# ensure that top_builddir  are absolute
-if [ -z "$top_builddir" ] ; then top_builddir=. ; fi
-if [ -z "$top_srcdir" ] ; then top_srcdir=. ; fi
-top_builddir=`cd $top_builddir; pwd`
-PSPP=$top_builddir/src/ui/terminal/pspp
-
-# ensure that top_srcdir is absolute
-top_srcdir=`cd $top_srcdir; pwd`
-
-STAT_CONFIG_PATH=$top_srcdir/config
-export STAT_CONFIG_PATH
-
-
-cleanup()
-{
-     if [ x"$PSPP_TEST_NO_CLEANUP" != x ] ; then 
-       echo "NOT cleaning $TEMPDIR" 
-       return ; 
-     fi
-     cd /
-     chmod u+w $TEMPDIR
-     rm -rf $TEMPDIR
-}
-
-
-fail()
-{
-    echo $activity
-    echo FAILED
-    cleanup;
-    exit 1;
-}
-
-
-no_result()
-{
-    echo $activity
-    echo NO RESULT;
-    cleanup;
-    exit 2;
-}
-
-pass()
-{
-    cleanup;
-    exit 0;
-}
-
-mkdir -p $TEMPDIR
-
-cd $TEMPDIR
-
-activity="create test syntax"
-cat > $TESTFILE <<EOF
-data list list /x * w *.
-begin data.
-1  4
-34 10
--9 15
-232 6
-11  4
-134 1
-9  5
-32 16
--2 6
-2  16
-20  6
-end data.
-
-weight by w.
-
-frequencies /x
-       /piechart.
-EOF
-if [ $? -ne 0 ] ; then no_result ; fi
-
-
-activity="run program 1"
-$SUPERVISOR $PSPP -o pspp.csv $TESTFILE
-if [ $? -ne 0 ] ; then fail ; fi
-
-
-pass;
diff --git a/tests/bugs/temp-freq.sh b/tests/bugs/temp-freq.sh
deleted file mode 100755 (executable)
index 1d96a17..0000000
+++ /dev/null
@@ -1,113 +0,0 @@
-#!/bin/sh
-
-# This program tests for a bug which caused FREQUENCIES following
-# TEMPORARY to crash (PR 11492).
-
-TEMPDIR=/tmp/pspp-tst-$$
-TESTFILE=$TEMPDIR/`basename $0`.sps
-
-# ensure that top_builddir  are absolute
-if [ -z "$top_builddir" ] ; then top_builddir=. ; fi
-if [ -z "$top_srcdir" ] ; then top_srcdir=. ; fi
-top_builddir=`cd $top_builddir; pwd`
-PSPP=$top_builddir/src/ui/terminal/pspp
-
-# ensure that top_srcdir is absolute
-top_srcdir=`cd $top_srcdir; pwd`
-
-STAT_CONFIG_PATH=$top_srcdir/config
-export STAT_CONFIG_PATH
-
-LANG=C
-export LANG
-
-
-cleanup()
-{
-     if [ x"$PSPP_TEST_NO_CLEANUP" != x ] ; then 
-       echo "NOT cleaning $TEMPDIR" 
-       return ; 
-     fi
-     cd /
-     rm -rf $TEMPDIR
-}
-
-
-fail()
-{
-    echo $activity
-    echo FAILED
-    cleanup;
-    exit 1;
-}
-
-
-no_result()
-{
-    echo $activity
-    echo NO RESULT;
-    cleanup;
-    exit 2;
-}
-
-pass()
-{
-    cleanup;
-    exit 0;
-}
-
-mkdir -p $TEMPDIR
-
-cd $TEMPDIR
-
-activity="create program"
-cat > $TESTFILE <<EOF
-DATA LIST LIST /SEX (A1) X *.
-BEGIN DATA.
-M 31
-F 21
-M 41
-F 31
-M 13
-F 12
-M 14
-F 13
-END DATA.
-
-
-TEMPORARY
-SELECT IF SEX EQ 'F'
-FREQUENCIES /X .
-
-FINISH
-EOF
-if [ $? -ne 0 ] ; then no_result ; fi
-
-$SUPERVISOR $PSPP -o pspp.csv $TESTFILE
-if [ $? -ne 0 ] ; then no_result ; fi
-
-diff -c $TEMPDIR/pspp.csv - << EOF
-Table: Reading free-form data from INLINE.
-Variable,Format
-SEX,A1
-X,F8.0
-
-Table: X
-Value Label,Value,Frequency,Percent,Valid Percent,Cum Percent
-,12.00,1,25.00,25.00,25.00
-,13.00,1,25.00,25.00,50.00
-,21.00,1,25.00,25.00,75.00
-,31.00,1,25.00,25.00,100.00
-Total,,4,100.0,100.0,
-
-Table: X
-N,Valid,4
-,Missing,0
-Mean,,19.25
-Std Dev,,8.81
-Minimum,,12.00
-Maximum,,31.00
-EOF
-if [ $? -ne 0 ] ; then fail ; fi
-
-pass;
diff --git a/tests/language/stats/frequencies.at b/tests/language/stats/frequencies.at
new file mode 100644 (file)
index 0000000..cfd992a
--- /dev/null
@@ -0,0 +1,464 @@
+AT_BANNER([FREQUENCIES procedure])
+
+AT_SETUP([FREQUENCIES string variable crash])
+AT_DATA([frequencies.sps],
+  [DATA LIST FREE/
+   name  (A8) value * quantity .
+BEGIN DATA.
+Cables 829 3 
+END DATA.
+EXECUTE.
+
+FREQUENCIES /VAR = name.
+])
+AT_CHECK([pspp -O format=csv frequencies.sps], [0],
+  [Table: name
+Value Label,Value,Frequency,Percent,Valid Percent,Cum Percent
+,Cables  ,1,100.00,100.00,100.00
+Total,,1,100.0,100.0,
+])
+AT_CLEANUP
+
+# Tests for a bug where pspp would crash if two FREQUENCIES commands
+# existed in a input file.
+AT_SETUP([FREQUENCIES two runs crash])
+AT_DATA([frequencies.sps],
+  [data list free /v1 v2.
+begin data.
+0 1
+2 3 
+4 5
+3 4
+end data.
+
+frequencies v1 v2/statistics=none.
+frequencies v1 v2/statistics=none.
+])
+AT_CHECK([pspp -O format=csv frequencies.sps], [0],
+  [Table: v1
+Value Label,Value,Frequency,Percent,Valid Percent,Cum Percent
+,.00,1,25.00,25.00,25.00
+,2.00,1,25.00,25.00,50.00
+,3.00,1,25.00,25.00,75.00
+,4.00,1,25.00,25.00,100.00
+Total,,4,100.0,100.0,
+
+Table: v2
+Value Label,Value,Frequency,Percent,Valid Percent,Cum Percent
+,1.00,1,25.00,25.00,25.00
+,3.00,1,25.00,25.00,50.00
+,4.00,1,25.00,25.00,75.00
+,5.00,1,25.00,25.00,100.00
+Total,,4,100.0,100.0,
+
+Table: v1
+Value Label,Value,Frequency,Percent,Valid Percent,Cum Percent
+,.00,1,25.00,25.00,25.00
+,2.00,1,25.00,25.00,50.00
+,3.00,1,25.00,25.00,75.00
+,4.00,1,25.00,25.00,100.00
+Total,,4,100.0,100.0,
+
+Table: v2
+Value Label,Value,Frequency,Percent,Valid Percent,Cum Percent
+,1.00,1,25.00,25.00,25.00
+,3.00,1,25.00,25.00,50.00
+,4.00,1,25.00,25.00,75.00
+,5.00,1,25.00,25.00,100.00
+Total,,4,100.0,100.0,
+])
+AT_CLEANUP
+
+# Tests for a bug where PSPP would crash when a FREQUENCIES command
+# was used with the HTML output driver..
+AT_SETUP([FREQUENCIES HTML output crash])
+AT_DATA([frequencies.sps],
+  [data list free /v1 v2.
+begin data.
+0 1
+2 3 
+4 5
+3 4
+end data.
+
+list.
+
+frequencies v1/statistics=none.
+])
+AT_CHECK([pspp -o - -O format=csv -o pspp.html frequencies.sps], [0],
+  [Table: Data List
+v1,v2
+.00,1.00
+2.00,3.00
+4.00,5.00
+3.00,4.00
+
+Table: v1
+Value Label,Value,Frequency,Percent,Valid Percent,Cum Percent
+,.00,1,25.00,25.00,25.00
+,2.00,1,25.00,25.00,50.00
+,3.00,1,25.00,25.00,75.00
+,4.00,1,25.00,25.00,100.00
+Total,,4,100.0,100.0,
+])
+AT_CHECK([test -s pspp.html])
+AT_CLEANUP
+
+# Tests for a bug which crashed PSPP when a piechart with too many
+# segments was requested..
+AT_SETUP([FREQUENCIES pie chart crash])
+AT_DATA([frequencies.sps],
+  [data list list /x * w *.
+begin data.
+1  4
+34 10
+-9 15
+232 6
+11  4
+134 1
+9  5
+32 16
+-2 6
+2  16
+20  6
+end data.
+
+weight by w.
+
+frequencies /x /format=notable /statistics=none
+       /piechart.
+])
+# Cannot use the CSV driver for this because it does not output charts
+# at all.
+AT_CHECK([pspp frequencies.sps], [0],
+  [DATA LIST
+
+Reading free-form data from INLINE.
++--------+------+
+|Variable|Format|
+#========#======#
+|x       |F8.0  |
+|w       |F8.0  |
++--------+------+
+
+BEGIN DATA
+
+WEIGHT
+
+FREQUENCIES
+])
+AT_CLEANUP
+
+# Tests for a bug which caused FREQUENCIES following TEMPORARY to
+# crash (bug #11492)..
+AT_SETUP([FREQUENCIES crash after TEMPORARY])
+AT_DATA([frequencies.sps],
+  [DATA LIST LIST /SEX (A1) X *.
+BEGIN DATA.
+M 31
+F 21
+M 41
+F 31
+M 13
+F 12
+M 14
+F 13
+END DATA.
+
+
+TEMPORARY
+SELECT IF SEX EQ 'F'
+FREQUENCIES /X .
+
+FINISH
+])
+AT_CHECK([pspp -O format=csv frequencies.sps], [0],
+  [Table: Reading free-form data from INLINE.
+Variable,Format
+SEX,A1
+X,F8.0
+
+Table: X
+Value Label,Value,Frequency,Percent,Valid Percent,Cum Percent
+,12.00,1,25.00,25.00,25.00
+,13.00,1,25.00,25.00,50.00
+,21.00,1,25.00,25.00,75.00
+,31.00,1,25.00,25.00,100.00
+Total,,4,100.0,100.0,
+
+Table: X
+N,Valid,4
+,Missing,0
+Mean,,19.25
+Std Dev,,8.81
+Minimum,,12.00
+Maximum,,31.00
+])
+AT_CLEANUP
+
+m4_define([FREQUENCIES_NTILES_OUTPUT],
+  [Table: x
+N,Valid,5
+,Missing,0
+Mean,,3.00
+Std Dev,,1.58
+Minimum,,1.00
+Maximum,,5.00
+Percentiles,0,1.00
+,25,2.00
+,33,2.33
+,50 (Median),3.00
+,67,3.67
+,75,4.00
+,100,5.00
+])
+AT_SETUP([FREQUENCIES basic percentiles])
+AT_DATA([frequencies.sps],
+  [DATA LIST LIST notable /x * .
+BEGIN DATA.
+1 
+2 
+3 
+4 
+5
+END DATA.
+
+FREQUENCIES 
+       VAR=x
+       /FORMAT=NOTABLE
+       /PERCENTILES = 0 25 33.333 50 66.666 75 100.
+])
+AT_CHECK([pspp -O format=csv frequencies.sps], [0],
+  [FREQUENCIES_NTILES_OUTPUT])
+AT_CLEANUP
+
+AT_SETUP([FREQUENCIES basic n-tiles])
+AT_DATA([frequencies.sps],
+  [DATA LIST LIST notable /x * .
+BEGIN DATA.
+1 
+2 
+3 
+4 
+5
+END DATA.
+
+FREQUENCIES 
+       VAR=x
+       /FORMAT=NOTABLE
+       /NTILES = 3
+       /NTILES = 4.
+])
+AT_CHECK([pspp -O format=csv frequencies.sps], [0],
+  [FREQUENCIES_NTILES_OUTPUT])
+AT_CLEANUP
+
+AT_SETUP([FREQUENCIES compatibility percentiles])
+AT_DATA([frequencies.sps],
+  [DATA LIST LIST notable /X * .
+BEGIN DATA.
+1 
+2 
+3 
+4 
+5
+END DATA.
+
+FREQUENCIES 
+       VAR=x
+       /ALGORITHM=COMPATIBLE
+       /PERCENTILES = 0 25 50 75 100.
+])
+AT_CHECK([pspp -O format=csv frequencies.sps], [0],
+  [Table: X
+Value Label,Value,Frequency,Percent,Valid Percent,Cum Percent
+,1.00,1,20.00,20.00,20.00
+,2.00,1,20.00,20.00,40.00
+,3.00,1,20.00,20.00,60.00
+,4.00,1,20.00,20.00,80.00
+,5.00,1,20.00,20.00,100.00
+Total,,5,100.0,100.0,
+
+Table: X
+N,Valid,5
+,Missing,0
+Mean,,3.00
+Std Dev,,1.58
+Minimum,,1.00
+Maximum,,5.00
+Percentiles,0,1.00
+,25,1.50
+,50 (Median),3.00
+,75,4.50
+,100,5.00
+])
+AT_CLEANUP
+
+AT_SETUP([FREQUENCIES enhanced percentiles])
+AT_DATA([frequencies.sps],
+  [DATA LIST LIST notable /X * .
+BEGIN DATA.
+1 
+2 
+3 
+4 
+5
+END DATA.
+
+FREQUENCIES 
+       VAR=x
+       /PERCENTILES = 0 25 50 75 100.
+])
+AT_CHECK([pspp -O format=csv frequencies.sps], [0],
+  [Table: X
+Value Label,Value,Frequency,Percent,Valid Percent,Cum Percent
+,1.00,1,20.00,20.00,20.00
+,2.00,1,20.00,20.00,40.00
+,3.00,1,20.00,20.00,60.00
+,4.00,1,20.00,20.00,80.00
+,5.00,1,20.00,20.00,100.00
+Total,,5,100.0,100.0,
+
+Table: X
+N,Valid,5
+,Missing,0
+Mean,,3.00
+Std Dev,,1.58
+Minimum,,1.00
+Maximum,,5.00
+Percentiles,0,1.00
+,25,2.00
+,50 (Median),3.00
+,75,4.00
+,100,5.00
+])
+AT_CLEANUP
+
+AT_SETUP([FREQUENCIES enhanced percentiles, weighted])
+AT_DATA([frequencies.sps],
+  [DATA LIST LIST notable /X * F *.
+BEGIN DATA.
+1 2
+2 2
+3 2
+4 1
+4 1
+5 1
+5 1
+END DATA.
+
+WEIGHT BY f.
+
+FREQUENCIES 
+       VAR=x
+       /PERCENTILES = 0 25 50 75 100.
+])
+AT_CHECK([pspp -O format=csv frequencies.sps], [0],
+  [Table: X
+Value Label,Value,Frequency,Percent,Valid Percent,Cum Percent
+,1.00,2.00,20.00,20.00,20.00
+,2.00,2.00,20.00,20.00,40.00
+,3.00,2.00,20.00,20.00,60.00
+,4.00,2.00,20.00,20.00,80.00
+,5.00,2.00,20.00,20.00,100.00
+Total,,10.00,100.0,100.0,
+
+Table: X
+N,Valid,10.00
+,Missing,.00
+Mean,,3.00
+Std Dev,,1.49
+Minimum,,1.00
+Maximum,,5.00
+Percentiles,0,1.00
+,25,2.00
+,50 (Median),3.00
+,75,4.00
+,100,5.00
+])
+AT_CLEANUP
+
+AT_SETUP([FREQUENCIES enhanced percentiles, weighted (2)])
+AT_DATA([frequencies.sps],
+  [DATA LIST LIST notable /X * F *.
+BEGIN DATA.
+1 1
+3 2
+4 1
+5 1
+5 1
+END DATA.
+
+WEIGHT BY f.
+
+FREQUENCIES 
+       VAR=x
+       /PERCENTILES = 0 25 50 75 100.
+])
+AT_CHECK([pspp -O format=csv frequencies.sps], [0],
+  [Table: X
+Value Label,Value,Frequency,Percent,Valid Percent,Cum Percent
+,1.00,1.00,16.67,16.67,16.67
+,3.00,2.00,33.33,33.33,50.00
+,4.00,1.00,16.67,16.67,66.67
+,5.00,2.00,33.33,33.33,100.00
+Total,,6.00,100.0,100.0,
+
+Table: X
+N,Valid,6.00
+,Missing,.00
+Mean,,3.50
+Std Dev,,1.52
+Minimum,,1.00
+Maximum,,5.00
+Percentiles,0,1.00
+,25,3.00
+,50 (Median),3.50
+,75,4.75
+,100,5.00
+])
+AT_CLEANUP
+
+AT_SETUP([FREQUENCIES enhanced percentiles, weighted, missing values])
+AT_DATA([frequencies.sps],
+  [DATA LIST LIST notable /X * F *.
+BEGIN DATA.
+1 1
+3 2
+4 1
+5 1
+5 1
+99 4
+END DATA.
+
+MISSING VALUE x (99.0) .
+WEIGHT BY f.
+
+FREQUENCIES 
+       VAR=x
+       /PERCENTILES = 0 25 50 75 100.
+])
+AT_CHECK([pspp -O format=csv frequencies.sps], [0],
+  [Table: X
+Value Label,Value,Frequency,Percent,Valid Percent,Cum Percent
+,1.00,1.00,10.00,16.67,16.67
+,3.00,2.00,20.00,33.33,50.00
+,4.00,1.00,10.00,16.67,66.67
+,5.00,2.00,20.00,33.33,100.00
+,99.00,4.00,40.00,Missing,
+Total,,10.00,100.0,100.0,
+
+Table: X
+N,Valid,6.00
+,Missing,4.00
+Mean,,3.50
+Std Dev,,1.52
+Minimum,,1.00
+Maximum,,5.00
+Percentiles,0,1.00
+,25,3.00
+,50 (Median),3.50
+,75,4.75
+,100,5.00
+])
+AT_CLEANUP
diff --git a/tests/stats/ntiles.sh b/tests/stats/ntiles.sh
deleted file mode 100755 (executable)
index 697cc42..0000000
+++ /dev/null
@@ -1,117 +0,0 @@
-#! /bin/sh
-
-# Tests the NTILE subcommand of the frequencies command
-
-TEMPDIR=/tmp/pspp-tst-$$
-
-# ensure that top_builddir  are absolute
-if [ -z "$top_builddir" ] ; then top_builddir=. ; fi
-if [ -z "$top_srcdir" ] ; then top_srcdir=. ; fi
-top_builddir=`cd $top_builddir; pwd`
-PSPP=$top_builddir/src/ui/terminal/pspp
-
-# ensure that top_srcdir is absolute
-top_srcdir=`cd $top_srcdir; pwd`
-
-STAT_CONFIG_PATH=$top_srcdir/config
-export STAT_CONFIG_PATH
-
-
-cleanup()
-{
-     if [ x"$PSPP_TEST_NO_CLEANUP" != x ] ; then 
-       echo "NOT cleaning $TEMPDIR" 
-       return ; 
-     fi
-     cd /
-     rm -rf $TEMPDIR
-}
-
-
-fail()
-{
-    echo $activity
-    echo FAILED
-    cleanup;
-    exit 1;
-}
-
-
-no_result()
-{
-    echo $activity
-    echo NO RESULT;
-    cleanup;
-    exit 2;
-}
-
-pass()
-{
-    cleanup;
-    exit 0;
-}
-
-mkdir -p $TEMPDIR
-
-cd $TEMPDIR
-
-
-i=1;
-
-activity="create program $i"
-cat > $TEMPDIR/prog.sps <<EOF
-DATA LIST LIST notable /x * .
-BEGIN DATA.
-1 
-2 
-3 
-4 
-5
-END DATA.
-
-FREQUENCIES 
-       VAR=x
-       /PERCENTILES = 0 25 33.333 50 66.666 75 100
-
-EOF
-if [ $? -ne 0 ] ; then no_result; fi
-
-activity="run program $i"
-$SUPERVISOR $PSPP -o pspp.csv $TEMPDIR/prog.sps
-if [ $? -ne 0 ] ; then no_result ; fi
-
-activity="move output"
-cp $TEMPDIR/pspp.csv $TEMPDIR/list.ref
-if [ $? -ne 0 ] ; then no_result ; fi
-
-i=$[$i+1];
-
-activity="create program $i"
-cat > $TEMPDIR/prog.sps <<EOF
-DATA LIST LIST notable /x * .
-BEGIN DATA.
-1 
-2 
-3 
-4 
-5
-END DATA.
-
-FREQUENCIES 
-       VAR=x
-       /NTILES = 3
-       /NTILES = 4
-       .
-EOF
-if [ $? -ne 0 ] ; then no_result; fi
-
-activity="run program $i"
-$SUPERVISOR $PSPP -o pspp.csv $TEMPDIR/prog.sps
-if [ $? -ne 0 ] ; then no_result ; fi
-
-activity="compare output"
-diff $TEMPDIR/pspp.csv $TEMPDIR/list.ref
-if [ $? -ne 0 ] ; then fail; fi
-
-
-pass;
diff --git a/tests/stats/percentiles-compatible.sh b/tests/stats/percentiles-compatible.sh
deleted file mode 100755 (executable)
index 934fb6c..0000000
+++ /dev/null
@@ -1,114 +0,0 @@
-#! /bin/sh
-
-# Tests calculation of percentiles with the 
-# COMPATIBLE algorithm set.
-
-TEMPDIR=/tmp/pspp-tst-$$
-
-# ensure that top_builddir  are absolute
-if [ -z "$top_builddir" ] ; then top_builddir=. ; fi
-if [ -z "$top_srcdir" ] ; then top_srcdir=. ; fi
-top_builddir=`cd $top_builddir; pwd`
-PSPP=$top_builddir/src/ui/terminal/pspp
-
-# ensure that top_srcdir is absolute
-top_srcdir=`cd $top_srcdir; pwd`
-
-STAT_CONFIG_PATH=$top_srcdir/config
-export STAT_CONFIG_PATH
-
-LANG=C
-export LANG
-
-
-cleanup()
-{
-     if [ x"$PSPP_TEST_NO_CLEANUP" != x ] ; then 
-       echo "NOT cleaning $TEMPDIR" 
-       return ; 
-     fi
-     cd /
-     rm -rf $TEMPDIR
-}
-
-
-fail()
-{
-    echo $activity
-    echo FAILED
-    cleanup;
-    exit 1;
-}
-
-
-no_result()
-{
-    echo $activity
-    echo NO RESULT;
-    cleanup;
-    exit 2;
-}
-
-pass()
-{
-    cleanup;
-    exit 0;
-}
-
-mkdir -p $TEMPDIR
-
-cd $TEMPDIR
-
-
-i=1;
-
-activity="create program $i"
-cat > $TEMPDIR/prog.sps <<EOF
-DATA LIST LIST notable /X * .
-BEGIN DATA.
-1 
-2 
-3 
-4 
-5
-END DATA.
-
-FREQUENCIES 
-       VAR=x
-       /ALGORITHM=COMPATIBLE
-       /PERCENTILES = 0 25 50 75 100
-
-EOF
-if [ $? -ne 0 ] ; then no_result; fi
-
-activity="run program $i"
-$SUPERVISOR $PSPP -o pspp.csv $TEMPDIR/prog.sps
-if [ $? -ne 0 ] ; then no_result ; fi
-
-activity="compare output $i"
-diff -c $TEMPDIR/pspp.csv - <<EOF
-Table: X
-Value Label,Value,Frequency,Percent,Valid Percent,Cum Percent
-,1.00,1,20.00,20.00,20.00
-,2.00,1,20.00,20.00,40.00
-,3.00,1,20.00,20.00,60.00
-,4.00,1,20.00,20.00,80.00
-,5.00,1,20.00,20.00,100.00
-Total,,5,100.0,100.0,
-
-Table: X
-N,Valid,5
-,Missing,0
-Mean,,3.00
-Std Dev,,1.58
-Minimum,,1.00
-Maximum,,5.00
-Percentiles,0,1.00
-,25,1.50
-,50 (Median),3.00
-,75,4.50
-,100,5.00
-EOF
-if [ $? -ne 0 ] ; then fail ; fi
-
-pass;
index f2a6e309d47163ffec1dc00faffa046075e867aa..5595de73e946cdf3de90bc4bee8e83efb4a002a3 100644 (file)
@@ -1,4 +1,5 @@
 AT_INIT
 
 m4_include([tests/language/stats/crosstabs.at])
+m4_include([tests/language/stats/frequencies.at])
 m4_include([tests/output/render.at])