N OF CASES: Convert test to Autotest framework.
authorBen Pfaff <blp@cs.stanford.edu>
Sat, 2 Oct 2010 21:32:14 +0000 (14:32 -0700)
committerBen Pfaff <blp@cs.stanford.edu>
Sat, 2 Oct 2010 21:32:14 +0000 (14:32 -0700)
tests/automake.mk
tests/command/n_of_cases.sh [deleted file]
tests/language/command.at

index e02e090b8a6cf0aed9671f9f0f447c7c22ae6bcf..90db8c5b312fb7952efc28ea0eafee5bad28ca95 100644 (file)
@@ -10,7 +10,6 @@ TESTS_ENVIRONMENT += LC_ALL=C
 TESTS_ENVIRONMENT += EXEEXT=$(EXEEXT)
 
 dist_TESTS = \
-       tests/command/n_of_cases.sh \
        tests/command/npar-binomial.sh \
        tests/command/npar-chisquare.sh \
        tests/command/npar-wilcoxon.sh \
diff --git a/tests/command/n_of_cases.sh b/tests/command/n_of_cases.sh
deleted file mode 100755 (executable)
index 667162d..0000000
+++ /dev/null
@@ -1,106 +0,0 @@
-#!/bin/sh
-
-# This program tests the N OF CASES command to make sure
-# that it actually works.
-
-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
-
-cat > $TESTFILE <<EOF
-INPUT PROGRAM.
-LOOP #I = 1 TO 100.
-COMPUTE X=#I.
-END CASE.
-END LOOP.
-END FILE.
-END INPUT PROGRAM.
-
-N OF CASES 15.
-
-LIST.
-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 output"
-diff -c $TEMPDIR/pspp.csv - <<EOF
-Table: Data List
-X
-1.00
-2.00
-3.00
-4.00
-5.00
-6.00
-7.00
-8.00
-9.00
-10.00
-11.00
-12.00
-13.00
-14.00
-15.00
-EOF
-if [ $? -ne 0 ] ; then fail ; fi
-
-
-pass;
index 5636caff5fae56e44424cd036aa760ae17010c1c..f05086d1e7068f79697921333a503eaa518141e3 100644 (file)
@@ -25,3 +25,40 @@ erase FILE='foobar'.
 AT_CHECK([pspp -O format=csv erase.sps])
 AT_CHECK([test ! -e foobar])
 AT_CLEANUP
+
+AT_BANNER([N OF CASES])
+
+AT_SETUP([N OF CASES])
+AT_DATA([n-of-cases.sps], [dnl
+INPUT PROGRAM.
+LOOP #i = 1 TO 100.
+COMPUTE x=#i.
+END CASE.
+END LOOP.
+END FILE.
+END INPUT PROGRAM.
+
+N OF CASES 15.
+
+LIST.
+])
+AT_CHECK([pspp -O format=csv n-of-cases.sps], [0], [dnl
+Table: Data List
+x
+1.00
+2.00
+3.00
+4.00
+5.00
+6.00
+7.00
+8.00
+9.00
+10.00
+11.00
+12.00
+13.00
+14.00
+15.00
+])
+AT_CLEANUP