From 1f75309bc1b51264e4459d3d1a82cf513f936a22 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Sat, 25 Sep 2010 16:56:06 -0700 Subject: [PATCH] tests: Convert EXAMINE tests to use Autotest. --- tests/automake.mk | 10 +- tests/bugs/examine-1sample.sh | 79 ----- tests/bugs/examine-crash.sh | 80 ----- tests/bugs/examine-crash2.sh | 81 ----- tests/bugs/examine-crash3.sh | 82 ----- tests/bugs/examine-missing.sh | 80 ----- tests/bugs/examine-missing2.sh | 133 -------- tests/command/examine-extremes.sh | 126 -------- tests/command/examine-percentiles.sh | 163 ---------- tests/command/examine.sh | 237 -------------- tests/language/stats/examine.at | 467 +++++++++++++++++++++++++++ 11 files changed, 468 insertions(+), 1070 deletions(-) delete mode 100755 tests/bugs/examine-1sample.sh delete mode 100755 tests/bugs/examine-crash.sh delete mode 100755 tests/bugs/examine-crash2.sh delete mode 100755 tests/bugs/examine-crash3.sh delete mode 100755 tests/bugs/examine-missing.sh delete mode 100755 tests/bugs/examine-missing2.sh delete mode 100755 tests/command/examine-extremes.sh delete mode 100755 tests/command/examine-percentiles.sh delete mode 100755 tests/command/examine.sh create mode 100644 tests/language/stats/examine.at diff --git a/tests/automake.mk b/tests/automake.mk index 2ba62d58..40ed64ac 100644 --- a/tests/automake.mk +++ b/tests/automake.mk @@ -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 index 62f4e2b6..00000000 --- a/tests/bugs/examine-1sample.sh +++ /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 < $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 index b92d45f9..00000000 --- a/tests/bugs/examine-crash2.sh +++ /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 < $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 index 3e4e9f66..00000000 --- a/tests/bugs/examine-crash3.sh +++ /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 < $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 index 16a9414a..00000000 --- a/tests/bugs/examine-missing.sh +++ /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 < /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 index 9d054368..00000000 --- a/tests/bugs/examine-missing2.sh +++ /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 - < $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 index cd0ad7ca..00000000 --- a/tests/command/examine-extremes.sh +++ /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 < $TESTFILE < $TESTFILE <