tests: Convert EXAMINE tests to use Autotest.
authorBen Pfaff <blp@cs.stanford.edu>
Sat, 25 Sep 2010 23:56:06 +0000 (16:56 -0700)
committerBen Pfaff <blp@cs.stanford.edu>
Sat, 25 Sep 2010 23:56:06 +0000 (16:56 -0700)
tests/automake.mk
tests/bugs/examine-1sample.sh [deleted file]
tests/bugs/examine-crash.sh [deleted file]
tests/bugs/examine-crash2.sh [deleted file]
tests/bugs/examine-crash3.sh [deleted file]
tests/bugs/examine-missing.sh [deleted file]
tests/bugs/examine-missing2.sh [deleted file]
tests/command/examine-extremes.sh [deleted file]
tests/command/examine-percentiles.sh [deleted file]
tests/command/examine.sh [deleted file]
tests/language/stats/examine.at [new file with mode: 0644]

index 2ba62d58cdb72e77b516c2a5848b8f9f3f27dafd..40ed64ac5cff7c07ced379288a58e0e8d4eb59ff 100644 (file)
@@ -10,9 +10,6 @@ TESTS_ENVIRONMENT += LC_ALL=C
 TESTS_ENVIRONMENT += EXEEXT=$(EXEEXT)
 
 dist_TESTS = \
-       tests/command/examine.sh \
-       tests/command/examine-extremes.sh \
-       tests/command/examine-percentiles.sh \
        tests/command/file-label.sh \
        tests/command/file-handle.sh \
        tests/command/filter.sh \
@@ -93,12 +90,6 @@ dist_TESTS = \
        tests/bugs/curtailed.sh \
        tests/bugs/data-crash.sh \
        tests/bugs/get.sh \
-       tests/bugs/examine-crash.sh \
-       tests/bugs/examine-crash2.sh \
-       tests/bugs/examine-crash3.sh \
-       tests/bugs/examine-1sample.sh \
-       tests/bugs/examine-missing.sh \
-       tests/bugs/examine-missing2.sh \
        tests/bugs/get-no-file.sh \
        tests/bugs/if_crash.sh \
        tests/bugs/input-crash.sh \
@@ -407,6 +398,7 @@ TESTSUITE_AT = \
        tests/language/stats/correlations.at \
        tests/language/stats/crosstabs.at \
        tests/language/stats/descriptives.at \
+       tests/language/stats/examine.at \
        tests/language/stats/factor.at \
        tests/language/stats/flip.at \
        tests/language/stats/frequencies.at \
diff --git a/tests/bugs/examine-1sample.sh b/tests/bugs/examine-1sample.sh
deleted file mode 100755 (executable)
index 62f4e2b..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-#!/bin/sh
-
-# This program tests  for a bug in the EXAMINE command, where it
-# would crash if a data file with only one case was presented
-
-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$EXEEXT
-
-# 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
-
-activity="create program"
-cat > $TESTFILE <<EOF
-DATA LIST LIST /quality * .
-BEGIN DATA
-3  
-END DATA
-
-
-EXAMINE
-       quality 
-       /STATISTICS descriptives 
-       .
-EOF
-if [ $? -ne 0 ] ; then no_result ; fi
-
-activity="run program"
-$SUPERVISOR $PSPP -o pspp.csv $TESTFILE
-if [ $? -ne 0 ] ; then fail ; fi
-
-pass
diff --git a/tests/bugs/examine-crash.sh b/tests/bugs/examine-crash.sh
deleted file mode 100755 (executable)
index a651b62..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-#!/bin/sh
-
-# This program tests for a bug which crashed EXAMINE
-
-TEMPDIR=/tmp/pspp-tst-$$
-TESTFILE=$TEMPDIR/`basename $0`.sps
-
-# ensure that top_srcdir and top_builddir  are absolute
-if [ -z "$top_srcdir" ] ; then top_srcdir=. ; fi
-if [ -z "$top_builddir" ] ; then top_builddir=. ; fi
-top_srcdir=`cd $top_srcdir; pwd`
-top_builddir=`cd $top_builddir; pwd`
-
-PSPP=$top_builddir/src/ui/terminal/pspp$EXEEXT
-
-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
-     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 <<EOF > $TESTFILE
-data list list /a * x * y *.
-begin data.
-3 1 3
-5 1 4
-7 2 3
-end data.
-
-examine a by x by y
-       /statistics=DESCRIPTIVES
-       . 
-EOF
-if [ $? -ne 0 ] ; then no_result ; fi
-
-
-activity="run program"
-$SUPERVISOR $PSPP -o pspp.csv $TESTFILE
-if [ $? -ne 0 ] ; then fail ; fi
-
-
-pass;
diff --git a/tests/bugs/examine-crash2.sh b/tests/bugs/examine-crash2.sh
deleted file mode 100755 (executable)
index b92d45f..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-#!/bin/sh
-
-# This program tests for a bug which crashed pspp
-# when two consecutive EXAMINE commands are run.
-
-TEMPDIR=/tmp/pspp-tst-$$
-TESTFILE=$TEMPDIR/`basename $0`.sps
-
-# ensure that top_srcdir and top_builddir  are absolute
-if [ -z "$top_srcdir" ] ; then top_srcdir=. ; fi
-if [ -z "$top_builddir" ] ; then top_builddir=. ; fi
-top_srcdir=`cd $top_srcdir; pwd`
-top_builddir=`cd $top_builddir; pwd`
-
-PSPP=$top_builddir/src/ui/terminal/pspp$EXEEXT
-
-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
-     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 <<EOF > $TESTFILE
-data list list /y * z *.
-begin data.
-6 4
-5 3
-7 6
-end data.
-
-EXAMINE /VARIABLES= z BY y.
-
-EXAMINE /VARIABLES= z. 
-EOF
-if [ $? -ne 0 ] ; then no_result ; fi
-
-
-activity="run program"
-$SUPERVISOR $PSPP -o pspp.csv $TESTFILE
-if [ $? -ne 0 ] ; then fail ; fi
-
-
-pass;
diff --git a/tests/bugs/examine-crash3.sh b/tests/bugs/examine-crash3.sh
deleted file mode 100755 (executable)
index 3e4e9f6..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-#!/bin/sh
-
-# This program tests for a bug which crashed pspp
-# when the /DESCRIPTIVES subcommand of EXAMINE
-# encountered missing values.
-
-TEMPDIR=/tmp/pspp-tst-$$
-TESTFILE=$TEMPDIR/`basename $0`.sps
-
-# ensure that top_srcdir and top_builddir  are absolute
-if [ -z "$top_srcdir" ] ; then top_srcdir=. ; fi
-if [ -z "$top_builddir" ] ; then top_builddir=. ; fi
-top_srcdir=`cd $top_srcdir; pwd`
-top_builddir=`cd $top_builddir; pwd`
-
-PSPP=$top_builddir/src/ui/terminal/pspp$EXEEXT
-
-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
-     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 <<EOF > $TESTFILE
-data list list /x * y *.
-begin data.
-1 0
-2 0
-. 0
-3 1
-4 1
-end data.
-examine x by y /statistics=descriptives. 
-EOF
-if [ $? -ne 0 ] ; then no_result ; fi
-
-
-activity="run program"
-$SUPERVISOR $PSPP -o pspp.csv $TESTFILE
-if [ $? -ne 0 ] ; then fail ; fi
-
-
-pass;
diff --git a/tests/bugs/examine-missing.sh b/tests/bugs/examine-missing.sh
deleted file mode 100755 (executable)
index 16a9414..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-#!/bin/sh
-
-# This program tests for a bug which caused EXAMINE to 
-# crash if all its values were SYSMIS
-
-
-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$EXEEXT
-
-# 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
-
-activity="create program"
-cat > $TESTFILE <<EOF
-DATA LIST LIST /x *.
-BEGIN DATA.
-.
-.
-.
-.
-END DATA.
-
-EXAMINE /x PLOT=HISTOGRAM.
-
-EOF
-if [ $? -ne 0 ] ; then no_result ; fi
-
-activity="run program"
-$SUPERVISOR $PSPP -o pspp.csv -e /dev/null $TESTFILE 2> /dev/null
-if [ $? -ne 0 ] ; then fail ; fi
-
-pass;
diff --git a/tests/bugs/examine-missing2.sh b/tests/bugs/examine-missing2.sh
deleted file mode 100755 (executable)
index 9d05436..0000000
+++ /dev/null
@@ -1,133 +0,0 @@
-#!/bin/sh
-
-# This program tests for a bug in which examine didn't
-# count missing values.
-
-TEMPDIR=/tmp/pspp-tst-$$
-TESTFILE=$TEMPDIR/`basename $0`.sps
-
-# ensure that top_srcdir and top_builddir  are absolute
-if [ -z "$top_srcdir" ] ; then top_srcdir=. ; fi
-if [ -z "$top_builddir" ] ; then top_builddir=. ; fi
-top_srcdir=`cd $top_srcdir; pwd`
-top_builddir=`cd $top_builddir; pwd`
-
-PSPP=$top_builddir/src/ui/terminal/pspp$EXEEXT
-
-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 1"
-cat > $TESTFILE << EOF
-DATA LIST LIST /x * y *.
-BEGIN DATA.
-1   1 
-2   1
-3   1
-4   1
-5   2
-6   2
-.   2
-END DATA
-
-EXAMINE /x by y.
-EOF
-if [ $? -ne 0 ] ; then no_result ; fi
-
-
-activity="run program 1"
-$SUPERVISOR $PSPP -o pspp.csv $TESTFILE
-if [ $? -ne 0 ] ; then no_result ; fi
-
-activity="compare results"
-diff -c $TEMPDIR/pspp.csv - <<EOF
-Table: Reading free-form data from INLINE.
-Variable,Format
-x,F8.0
-y,F8.0
-
-Table: Case Processing Summary
-,Cases,,,,,
-,Valid,,Missing,,Total,
-,N,Percent,N,Percent,N,Percent
-x,6,85.7143%,1,14.2857%,7,100%
-
-Table: Case Processing Summary
-,,Cases,,,,,
-,,Valid,,Missing,,Total,
-,y,N,Percent,N,Percent,N,Percent
-x,1.00,4,100%,0,0%,4,100%
-,2.00,2,66.6667%,1,33.3333%,3,100%
-EOF
-if [ $? -ne 0 ] ; then fail ; fi
-
-
-#Make sure this doesn't interfere with percentiles operation.
-
-activity="create program 2"
-cat > $TESTFILE << EOF
-DATA LIST LIST /X *.
-BEGIN DATA.
-99
-99
-5.00
-END DATA.
-
-MISSING VALUE X (99).
-
-EXAMINE /x
-        /PERCENTILES=HAVERAGE.
-
-
-EOF
-if [ $? -ne 0 ] ; then no_result ; fi
-
-
-activity="run program 2"
-$SUPERVISOR $PSPP -o pspp.csv $TESTFILE
-if [ $? -ne 0 ] ; then fail ; fi
-
-
-pass;
diff --git a/tests/command/examine-extremes.sh b/tests/command/examine-extremes.sh
deleted file mode 100755 (executable)
index cd0ad7c..0000000
+++ /dev/null
@@ -1,126 +0,0 @@
-#!/bin/sh
-
-# This program tests  the EXTREME subcommand of the EXAMINE command.
-
-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$EXEEXT
-
-# 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 free /V1 W
-begin data.
-1  1
-2  1
-3  2
-3  1
-4  1
-5  1
-6  1
-7  1
-8  1
-9  1
-10 1
-11 1
-12 1
-13 1
-14 1
-15 1
-16 1
-17 1
-18 2
-19 1
-20 1
-end data.
-
-weight by w.
-
-examine v1 
- /statistics=extreme(6)
- .
-EOF
-if [ $? -ne 0 ] ; then no_result ; fi
-
-
-activity="run program"
-$SUPERVISOR $PSPP -o pspp.csv $TESTFILE
-if [ $? -ne 0 ] ; then no_result ; fi
-
-activity="compare results"
-diff -c $TEMPDIR/pspp.csv - << EOF
-Table: Case Processing Summary
-,Cases,,,,,
-,Valid,,Missing,,Total,
-,N,Percent,N,Percent,N,Percent
-V1,23.00,100%,.00,0%,23.00,100%
-
-Table: Extreme Values
-,,,Case Number,Value
-V1,Highest,1,21,20.00
-,,2,20,19.00
-,,3,19,18.00
-,,4,19,18.00
-,,5,18,17.00
-,,6,17,16.00
-,Lowest,1,1,1.00
-,,2,2,2.00
-,,3,3,3.00
-,,4,3,3.00
-,,5,4,3.00
-,,6,5,4.00
-EOF
-if [ $? -ne 0 ] ; then fail ; fi
-
-pass
diff --git a/tests/command/examine-percentiles.sh b/tests/command/examine-percentiles.sh
deleted file mode 100755 (executable)
index 92e53c8..0000000
+++ /dev/null
@@ -1,163 +0,0 @@
-#!/bin/sh
-
-# This program tests  the PERCENTILES subcommand of the EXAMINE command.
-# In particular it tests that it behaves properly when there are only 
-# a few cases
-
-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$EXEEXT
-
-# 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 /X *.
-BEGIN DATA.
-2.00 
-8.00 
-5.00 
-END DATA.
-
-EXAMINE /x
-       /PERCENTILES=HAVERAGE.
-
-EXAMINE /x
-       /PERCENTILES=WAVERAGE.
-
-EXAMINE /x
-       /PERCENTILES=ROUND.
-
-EXAMINE /x
-       /PERCENTILES=EMPIRICAL.
-
-EXAMINE /x
-       /PERCENTILES=AEMPIRICAL.
-EOF
-if [ $? -ne 0 ] ; then no_result ; fi
-
-activity="run program"
-$SUPERVISOR $PSPP -o pspp.csv $TESTFILE
-if [ $? -ne 0 ] ; then no_result ; fi
-
-
-activity="compare results"
-diff -c $TEMPDIR/pspp.csv - << EOF
-Table: Reading free-form data from INLINE.
-Variable,Format
-X,F8.0
-
-Table: Case Processing Summary
-,Cases,,,,,
-,Valid,,Missing,,Total,
-,N,Percent,N,Percent,N,Percent
-X,3,100%,0,0%,3,100%
-
-Table: Percentiles
-,,Percentiles,,,,,,
-,,5,10,25,50,75,90,95
-X,HAverage,.40,.80,2.00,5.00,8.00,8.00,8.00
-,Tukey's Hinges,,,3.50,5.00,6.50,,
-
-Table: Case Processing Summary
-,Cases,,,,,
-,Valid,,Missing,,Total,
-,N,Percent,N,Percent,N,Percent
-X,3,100%,0,0%,3,100%
-
-Table: Percentiles
-,,Percentiles,,,,,,
-,,5,10,25,50,75,90,95
-X,Weighted Average,.30,.60,1.50,3.50,5.75,7.10,7.55
-,Tukey's Hinges,,,3.50,5.00,6.50,,
-
-Table: Case Processing Summary
-,Cases,,,,,
-,Valid,,Missing,,Total,
-,N,Percent,N,Percent,N,Percent
-X,3,100%,0,0%,3,100%
-
-Table: Percentiles
-,,Percentiles,,,,,,
-,,5,10,25,50,75,90,95
-X,Rounded,.00,.00,2.00,5.00,5.00,8.00,8.00
-,Tukey's Hinges,,,3.50,5.00,6.50,,
-
-Table: Case Processing Summary
-,Cases,,,,,
-,Valid,,Missing,,Total,
-,N,Percent,N,Percent,N,Percent
-X,3,100%,0,0%,3,100%
-
-Table: Percentiles
-,,Percentiles,,,,,,
-,,5,10,25,50,75,90,95
-X,Empirical,2.00,2.00,2.00,5.00,8.00,8.00,8.00
-,Tukey's Hinges,,,3.50,5.00,6.50,,
-
-Table: Case Processing Summary
-,Cases,,,,,
-,Valid,,Missing,,Total,
-,N,Percent,N,Percent,N,Percent
-X,3,100%,0,0%,3,100%
-
-Table: Percentiles
-,,Percentiles,,,,,,
-,,5,10,25,50,75,90,95
-X,Empirical with averaging,2.00,2.00,2.00,5.00,8.00,8.00,8.00
-,Tukey's Hinges,,,3.50,5.00,6.50,,
-EOF
-if [ $? -ne 0 ] ; then fail ; fi
-
-pass
diff --git a/tests/command/examine.sh b/tests/command/examine.sh
deleted file mode 100755 (executable)
index 663455e..0000000
+++ /dev/null
@@ -1,237 +0,0 @@
-#!/bin/sh
-
-# This program tests  the EXAMINE command.
-
-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$EXEEXT
-
-# 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 /QUALITY * W * BRAND * .
-BEGIN DATA
-3  1  1
-2  2  1
-1  2  1
-1  1  1
-4  1  1
-4  1  1
-5  1  2
-2  1  2
-4  4  2
-2  1  2
-3  1  2
-7  1  3
-4  2  3
-5  3  3
-3  1  3
-6  1  3
-END DATA
-
-WEIGHT BY w.
-
-VARIABLE LABELS brand   'Manufacturer'.
-VARIABLE LABELS quality 'Breaking Strain'.
-
-VALUE LABELS /brand 1 'Aspeger' 2 'Bloggs' 3 'Charlies'.
-
-LIST /FORMAT=NUMBERED.
-
-EXAMINE
-       quality BY brand
-       /STATISTICS descriptives extreme(3)
-       .
-EOF
-if [ $? -ne 0 ] ; then no_result ; fi
-
-
-activity="run program"
-$SUPERVISOR $PSPP -o pspp.csv $TESTFILE
-if [ $? -ne 0 ] ; then no_result ; fi
-
-# NOTE:  In the following data: Only the extreme values have been checked
-# The descriptives have been blindly pasted.
-activity="compare results"
-diff -c $TEMPDIR/pspp.csv - << EOF
-Table: Reading free-form data from INLINE.
-Variable,Format
-QUALITY,F8.0
-W,F8.0
-BRAND,F8.0
-
-Table: Data List
-Case Number,QUALITY,W,BRAND
-1,3.00,1.00,1.00
-2,2.00,2.00,1.00
-3,1.00,2.00,1.00
-4,1.00,1.00,1.00
-5,4.00,1.00,1.00
-6,4.00,1.00,1.00
-7,5.00,1.00,2.00
-8,2.00,1.00,2.00
-9,4.00,4.00,2.00
-10,2.00,1.00,2.00
-11,3.00,1.00,2.00
-12,7.00,1.00,3.00
-13,4.00,2.00,3.00
-14,5.00,3.00,3.00
-15,3.00,1.00,3.00
-16,6.00,1.00,3.00
-
-Table: Case Processing Summary
-,Cases,,,,,
-,Valid,,Missing,,Total,
-,N,Percent,N,Percent,N,Percent
-Breaking Strain,24.00,100%,.00,0%,24.00,100%
-
-Table: Extreme Values
-,,,Case Number,Value
-Breaking Strain,Highest,1,12,7.00
-,,2,16,6.00
-,,3,7,5.00
-,Lowest,1,3,1.00
-,,2,3,1.00
-,,3,4,1.00
-
-Table: Descriptives
-,,,Statistic,Std. Error
-Breaking Strain,Mean,,3.54,.32
-,95% Confidence Interval for Mean,Lower Bound,2.87,
-,,Upper Bound,4.21,
-,5% Trimmed Mean,,3.50,
-,Median,,4.00,
-,Variance,,2.52,
-,Std. Deviation,,1.59,
-,Minimum,,1.00,
-,Maximum,,7.00,
-,Range,,6.00,
-,Interquartile Range,,2.75,
-,Skewness,,.06,.47
-,Kurtosis,,-.36,.92
-
-Table: Case Processing Summary
-,,Cases,,,,,
-,,Valid,,Missing,,Total,
-,Manufacturer,N,Percent,N,Percent,N,Percent
-Breaking Strain,Aspeger,8.00,100%,.00,0%,8.00,100%
-,Bloggs,8.00,100%,.00,0%,8.00,100%
-,Charlies,8.00,100%,.00,0%,8.00,100%
-
-Table: Extreme Values
-,Manufacturer,,,Case Number,Value
-Breaking Strain,Aspeger,Highest,1,5,4.00
-,,,2,6,4.00
-,,,3,1,3.00
-,,Lowest,1,3,1.00
-,,,2,3,1.00
-,,,3,4,1.00
-,Bloggs,Highest,1,7,5.00
-,,,2,9,4.00
-,,,3,9,4.00
-,,Lowest,1,8,2.00
-,,,2,10,2.00
-,,,3,11,3.00
-,Charlies,Highest,1,12,7.00
-,,,2,16,6.00
-,,,3,14,5.00
-,,Lowest,1,15,3.00
-,,,2,13,4.00
-,,,3,13,4.00
-
-Table: Descriptives
-,Manufacturer,,,Statistic,Std. Error
-Breaking Strain,Aspeger,Mean,,2.25,.45
-,,95% Confidence Interval for Mean,Lower Bound,1.18,
-,,,Upper Bound,3.32,
-,,5% Trimmed Mean,,2.22,
-,,Median,,2.00,
-,,Variance,,1.64,
-,,Std. Deviation,,1.28,
-,,Minimum,,1.00,
-,,Maximum,,4.00,
-,,Range,,3.00,
-,,Interquartile Range,,2.75,
-,,Skewness,,.47,.75
-,,Kurtosis,,-1.55,1.48
-,Bloggs,Mean,,3.50,.38
-,,95% Confidence Interval for Mean,Lower Bound,2.61,
-,,,Upper Bound,4.39,
-,,5% Trimmed Mean,,3.50,
-,,Median,,4.00,
-,,Variance,,1.14,
-,,Std. Deviation,,1.07,
-,,Minimum,,2.00,
-,,Maximum,,5.00,
-,,Range,,3.00,
-,,Interquartile Range,,1.75,
-,,Skewness,,-.47,.75
-,,Kurtosis,,-.83,1.48
-,Charlies,Mean,,4.88,.44
-,,95% Confidence Interval for Mean,Lower Bound,3.83,
-,,,Upper Bound,5.92,
-,,5% Trimmed Mean,,4.86,
-,,Median,,5.00,
-,,Variance,,1.55,
-,,Std. Deviation,,1.25,
-,,Minimum,,3.00,
-,,Maximum,,7.00,
-,,Range,,4.00,
-,,Interquartile Range,,1.75,
-,,Skewness,,.30,.75
-,,Kurtosis,,.15,1.48
-EOF
-if [ $? -ne 0 ] ; then fail ; fi
-
-pass
diff --git a/tests/language/stats/examine.at b/tests/language/stats/examine.at
new file mode 100644 (file)
index 0000000..e1b7a6e
--- /dev/null
@@ -0,0 +1,467 @@
+AT_BANNER([EXAMINE])
+
+AT_SETUP([EXAMINE])
+AT_DATA([examine.sps], [
+DATA LIST LIST /QUALITY * W * BRAND * .
+BEGIN DATA
+3  1  1
+2  2  1
+1  2  1
+1  1  1
+4  1  1
+4  1  1
+5  1  2
+2  1  2
+4  4  2
+2  1  2
+3  1  2
+7  1  3
+4  2  3
+5  3  3
+3  1  3
+6  1  3
+END DATA
+
+WEIGHT BY w.
+
+VARIABLE LABELS brand   'Manufacturer'.
+VARIABLE LABELS quality 'Breaking Strain'.
+
+VALUE LABELS /brand 1 'Aspeger' 2 'Bloggs' 3 'Charlies'.
+
+LIST /FORMAT=NUMBERED.
+
+EXAMINE
+       quality BY brand
+       /STATISTICS descriptives extreme(3)
+       .
+])
+AT_CHECK([pspp -o pspp.csv examine.sps])
+dnl In the following data, only the extreme values have been checked.
+dnl The descriptives have been blindly pasted.
+AT_CHECK([cat pspp.csv], [0], [dnl
+Table: Reading free-form data from INLINE.
+Variable,Format
+QUALITY,F8.0
+W,F8.0
+BRAND,F8.0
+
+Table: Data List
+Case Number,QUALITY,W,BRAND
+1,3.00,1.00,1.00
+2,2.00,2.00,1.00
+3,1.00,2.00,1.00
+4,1.00,1.00,1.00
+5,4.00,1.00,1.00
+6,4.00,1.00,1.00
+7,5.00,1.00,2.00
+8,2.00,1.00,2.00
+9,4.00,4.00,2.00
+10,2.00,1.00,2.00
+11,3.00,1.00,2.00
+12,7.00,1.00,3.00
+13,4.00,2.00,3.00
+14,5.00,3.00,3.00
+15,3.00,1.00,3.00
+16,6.00,1.00,3.00
+
+Table: Case Processing Summary
+,Cases,,,,,
+,Valid,,Missing,,Total,
+,N,Percent,N,Percent,N,Percent
+Breaking Strain,24.00,100%,.00,0%,24.00,100%
+
+Table: Extreme Values
+,,,Case Number,Value
+Breaking Strain,Highest,1,12,7.00
+,,2,16,6.00
+,,3,7,5.00
+,Lowest,1,3,1.00
+,,2,3,1.00
+,,3,4,1.00
+
+Table: Descriptives
+,,,Statistic,Std. Error
+Breaking Strain,Mean,,3.54,.32
+,95% Confidence Interval for Mean,Lower Bound,2.87,
+,,Upper Bound,4.21,
+,5% Trimmed Mean,,3.50,
+,Median,,4.00,
+,Variance,,2.52,
+,Std. Deviation,,1.59,
+,Minimum,,1.00,
+,Maximum,,7.00,
+,Range,,6.00,
+,Interquartile Range,,2.75,
+,Skewness,,.06,.47
+,Kurtosis,,-.36,.92
+
+Table: Case Processing Summary
+,,Cases,,,,,
+,,Valid,,Missing,,Total,
+,Manufacturer,N,Percent,N,Percent,N,Percent
+Breaking Strain,Aspeger,8.00,100%,.00,0%,8.00,100%
+,Bloggs,8.00,100%,.00,0%,8.00,100%
+,Charlies,8.00,100%,.00,0%,8.00,100%
+
+Table: Extreme Values
+,Manufacturer,,,Case Number,Value
+Breaking Strain,Aspeger,Highest,1,5,4.00
+,,,2,6,4.00
+,,,3,1,3.00
+,,Lowest,1,3,1.00
+,,,2,3,1.00
+,,,3,4,1.00
+,Bloggs,Highest,1,7,5.00
+,,,2,9,4.00
+,,,3,9,4.00
+,,Lowest,1,8,2.00
+,,,2,10,2.00
+,,,3,11,3.00
+,Charlies,Highest,1,12,7.00
+,,,2,16,6.00
+,,,3,14,5.00
+,,Lowest,1,15,3.00
+,,,2,13,4.00
+,,,3,13,4.00
+
+Table: Descriptives
+,Manufacturer,,,Statistic,Std. Error
+Breaking Strain,Aspeger,Mean,,2.25,.45
+,,95% Confidence Interval for Mean,Lower Bound,1.18,
+,,,Upper Bound,3.32,
+,,5% Trimmed Mean,,2.22,
+,,Median,,2.00,
+,,Variance,,1.64,
+,,Std. Deviation,,1.28,
+,,Minimum,,1.00,
+,,Maximum,,4.00,
+,,Range,,3.00,
+,,Interquartile Range,,2.75,
+,,Skewness,,.47,.75
+,,Kurtosis,,-1.55,1.48
+,Bloggs,Mean,,3.50,.38
+,,95% Confidence Interval for Mean,Lower Bound,2.61,
+,,,Upper Bound,4.39,
+,,5% Trimmed Mean,,3.50,
+,,Median,,4.00,
+,,Variance,,1.14,
+,,Std. Deviation,,1.07,
+,,Minimum,,2.00,
+,,Maximum,,5.00,
+,,Range,,3.00,
+,,Interquartile Range,,1.75,
+,,Skewness,,-.47,.75
+,,Kurtosis,,-.83,1.48
+,Charlies,Mean,,4.88,.44
+,,95% Confidence Interval for Mean,Lower Bound,3.83,
+,,,Upper Bound,5.92,
+,,5% Trimmed Mean,,4.86,
+,,Median,,5.00,
+,,Variance,,1.55,
+,,Std. Deviation,,1.25,
+,,Minimum,,3.00,
+,,Maximum,,7.00,
+,,Range,,4.00,
+,,Interquartile Range,,1.75,
+,,Skewness,,.30,.75
+,,Kurtosis,,.15,1.48
+])
+AT_CLEANUP
+
+AT_SETUP([EXAMINE -- extremes])
+AT_DATA([examine.sps], [dnl
+data list free /V1 W
+begin data.
+1  1
+2  1
+3  2
+3  1
+4  1
+5  1
+6  1
+7  1
+8  1
+9  1
+10 1
+11 1
+12 1
+13 1
+14 1
+15 1
+16 1
+17 1
+18 2
+19 1
+20 1
+end data.
+
+weight by w.
+
+examine v1 
+ /statistics=extreme(6)
+ .
+])
+AT_CHECK([pspp -o pspp.csv examine.sps])
+AT_CHECK([cat pspp.csv], [0], [dnl
+Table: Case Processing Summary
+,Cases,,,,,
+,Valid,,Missing,,Total,
+,N,Percent,N,Percent,N,Percent
+V1,23.00,100%,.00,0%,23.00,100%
+
+Table: Extreme Values
+,,,Case Number,Value
+V1,Highest,1,21,20.00
+,,2,20,19.00
+,,3,19,18.00
+,,4,19,18.00
+,,5,18,17.00
+,,6,17,16.00
+,Lowest,1,1,1.00
+,,2,2,2.00
+,,3,3,3.00
+,,4,3,3.00
+,,5,4,3.00
+,,6,5,4.00
+])
+AT_CLEANUP
+
+dnl Test the PERCENTILES subcommand of the EXAMINE command.
+dnl In particular test that it behaves properly when there are only 
+dnl a few cases.
+AT_SETUP([EXAMINE -- percentiles])
+AT_DATA([examine.sps], [dnl
+DATA LIST LIST /X *.
+BEGIN DATA.
+2.00 
+8.00 
+5.00 
+END DATA.
+
+EXAMINE /x
+       /PERCENTILES=HAVERAGE.
+
+EXAMINE /x
+       /PERCENTILES=WAVERAGE.
+
+EXAMINE /x
+       /PERCENTILES=ROUND.
+
+EXAMINE /x
+       /PERCENTILES=EMPIRICAL.
+
+EXAMINE /x
+       /PERCENTILES=AEMPIRICAL.
+])
+AT_CHECK([pspp -o pspp.csv examine.sps])
+AT_CHECK([cat pspp.csv], [0], [dnl
+Table: Reading free-form data from INLINE.
+Variable,Format
+X,F8.0
+
+Table: Case Processing Summary
+,Cases,,,,,
+,Valid,,Missing,,Total,
+,N,Percent,N,Percent,N,Percent
+X,3,100%,0,0%,3,100%
+
+Table: Percentiles
+,,Percentiles,,,,,,
+,,5,10,25,50,75,90,95
+X,HAverage,.40,.80,2.00,5.00,8.00,8.00,8.00
+,Tukey's Hinges,,,3.50,5.00,6.50,,
+
+Table: Case Processing Summary
+,Cases,,,,,
+,Valid,,Missing,,Total,
+,N,Percent,N,Percent,N,Percent
+X,3,100%,0,0%,3,100%
+
+Table: Percentiles
+,,Percentiles,,,,,,
+,,5,10,25,50,75,90,95
+X,Weighted Average,.30,.60,1.50,3.50,5.75,7.10,7.55
+,Tukey's Hinges,,,3.50,5.00,6.50,,
+
+Table: Case Processing Summary
+,Cases,,,,,
+,Valid,,Missing,,Total,
+,N,Percent,N,Percent,N,Percent
+X,3,100%,0,0%,3,100%
+
+Table: Percentiles
+,,Percentiles,,,,,,
+,,5,10,25,50,75,90,95
+X,Rounded,.00,.00,2.00,5.00,5.00,8.00,8.00
+,Tukey's Hinges,,,3.50,5.00,6.50,,
+
+Table: Case Processing Summary
+,Cases,,,,,
+,Valid,,Missing,,Total,
+,N,Percent,N,Percent,N,Percent
+X,3,100%,0,0%,3,100%
+
+Table: Percentiles
+,,Percentiles,,,,,,
+,,5,10,25,50,75,90,95
+X,Empirical,2.00,2.00,2.00,5.00,8.00,8.00,8.00
+,Tukey's Hinges,,,3.50,5.00,6.50,,
+
+Table: Case Processing Summary
+,Cases,,,,,
+,Valid,,Missing,,Total,
+,N,Percent,N,Percent,N,Percent
+X,3,100%,0,0%,3,100%
+
+Table: Percentiles
+,,Percentiles,,,,,,
+,,5,10,25,50,75,90,95
+X,Empirical with averaging,2.00,2.00,2.00,5.00,8.00,8.00,8.00
+,Tukey's Hinges,,,3.50,5.00,6.50,,
+])
+AT_CLEANUP
+
+AT_SETUP([EXAMINE -- missing values])
+AT_DATA([examine.sps], [dnl
+DATA LIST LIST /x * y *.
+BEGIN DATA.
+1   1 
+2   1
+3   1
+4   1
+5   2
+6   2
+.   2
+END DATA
+
+EXAMINE /x by y.
+])
+AT_CHECK([pspp -o pspp.csv examine.sps])
+AT_CHECK([cat pspp.csv], [0], [dnl
+Table: Reading free-form data from INLINE.
+Variable,Format
+x,F8.0
+y,F8.0
+
+Table: Case Processing Summary
+,Cases,,,,,
+,Valid,,Missing,,Total,
+,N,Percent,N,Percent,N,Percent
+x,6,85.7143%,1,14.2857%,7,100%
+
+Table: Case Processing Summary
+,,Cases,,,,,
+,,Valid,,Missing,,Total,
+,y,N,Percent,N,Percent,N,Percent
+x,1.00,4,100%,0,0%,4,100%
+,2.00,2,66.6667%,1,33.3333%,3,100%
+])
+AT_CLEANUP
+
+AT_SETUP([EXAMINE -- missing values and percentiles])
+AT_DATA([examine.sps], [dnl
+DATA LIST LIST /X *.
+BEGIN DATA.
+99
+99
+5.00
+END DATA.
+
+MISSING VALUE X (99).
+
+EXAMINE /x
+        /PERCENTILES=HAVERAGE.
+])
+AT_CHECK([pspp -o pspp.csv examine.sps])
+dnl Ignore output -- this is just a no-crash check.
+AT_CLEANUP
+
+AT_SETUP([EXAMINE -- crash bug])
+AT_DATA([examine.sps], [dnl
+data list list /a * x * y *.
+begin data.
+3 1 3
+5 1 4
+7 2 3
+end data.
+
+examine a by x by y
+       /statistics=DESCRIPTIVES
+       . 
+])
+AT_CHECK([pspp -o pspp.csv examine.sps])
+dnl Ignore output -- this is just a no-crash check.
+AT_CLEANUP
+
+dnl Test that two consecutive EXAMINE commands don't crash PSPP.
+AT_SETUP([EXAMINE -- consecutive runs don't crash])
+AT_DATA([examine.sps], [dnl
+data list list /y * z *.
+begin data.
+6 4
+5 3
+7 6
+end data.
+
+EXAMINE /VARIABLES= z BY y.
+
+EXAMINE /VARIABLES= z. 
+])
+AT_CHECK([pspp -o pspp.csv examine.sps])
+dnl Ignore output -- this is just a no-crash check.
+AT_CLEANUP
+
+dnl Test that /DESCRIPTIVES does not crash in presence of missing values.
+AT_SETUP([EXAMINE -- missing values don't crash])
+AT_DATA([examine.sps], [dnl
+data list list /x * y *.
+begin data.
+1 0
+2 0
+. 0
+3 1
+4 1
+end data.
+examine x by y /statistics=descriptives. 
+])
+AT_CHECK([pspp -o pspp.csv examine.sps])
+dnl Ignore output -- this is just a no-crash check.
+AT_CLEANUP
+
+dnl Test that having only a single case doesn't crash.
+AT_SETUP([EXAMINE -- single case doesn't crash])
+AT_DATA([examine.sps], [dnl
+DATA LIST LIST /quality * .
+BEGIN DATA
+3  
+END DATA
+
+
+EXAMINE
+       quality 
+       /STATISTICS descriptives 
+       .
+])
+AT_CHECK([pspp -o pspp.csv examine.sps])
+dnl Ignore output -- this is just a no-crash check.
+AT_CLEANUP
+
+dnl Test that all-missing data doesn't crash.
+AT_SETUP([EXAMINE -- all-missing data doesn't crash])
+AT_DATA([examine.sps], [dnl
+DATA LIST LIST /x *.
+BEGIN DATA.
+.
+.
+.
+.
+END DATA.
+
+EXAMINE /x PLOT=HISTOGRAM.
+])
+AT_CHECK([pspp -o pspp.csv examine.sps], [0], [dnl
+warning: Not creating plot because data set is empty.
+])
+dnl Ignore output -- this is just a no-crash check.
+AT_CLEANUP