tests: Convert bignum.sh test to use Autotest.
authorBen Pfaff <blp@cs.stanford.edu>
Sat, 25 Sep 2010 23:13:04 +0000 (16:13 -0700)
committerBen Pfaff <blp@cs.stanford.edu>
Sat, 25 Sep 2010 23:13:04 +0000 (16:13 -0700)
tests/automake.mk
tests/command/bignum.sh [deleted file]
tests/data/data-in.at [new file with mode: 0644]

index 772491dfb32a4d9939e930342b1065938951fec7..77de4a377be93d761a0da1d5b09d5efb7889cda0 100644 (file)
@@ -10,7 +10,6 @@ TESTS_ENVIRONMENT += LC_ALL=C
 TESTS_ENVIRONMENT += EXEEXT=$(EXEEXT)
 
 dist_TESTS = \
-       tests/command/bignum.sh \
        tests/command/correlation.sh \
        tests/command/do-if.sh \
        tests/command/do-repeat.sh \
@@ -396,6 +395,7 @@ EXTRA_DIST += \
 
 TESTSUITE_AT = \
        tests/data/calendar.at \
+       tests/data/data-in.at \
        tests/language/data-io/add-files.at \
        tests/language/data-io/data-list.at \
        tests/language/data-io/data-reader.at \
diff --git a/tests/command/bignum.sh b/tests/command/bignum.sh
deleted file mode 100755 (executable)
index d124269..0000000
+++ /dev/null
@@ -1,147 +0,0 @@
-#!/bin/sh
-
-# This program tests the use of big numbers
-
-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 data file"
-cat > $TEMPDIR/bignum.data << wizzah
-0
-0.1
-0.5
-0.8
-0.9
-0.999
-1
-2
-3
-4
-5
-12
-123
-1234
-12345
-123456
-1234567
-12345678
-123456789
-1234567890
-19999999999
-199999999999
-1234567890123
-19999999999999
-199999999999999
-1234567890123456
-19999999999999999
-123456789012345678
-1999999999999999999
-12345678901234567890
-199999999999999999999
-1234567890123456789012
-19999999999999999999999
-123456789012345678901234
-1999999999999999999999999
-12345678901234567890123456
-199999999999999999999999999
-1234567890123456789012345678
-19999999999999999999999999999
-123456789012345678901234567890
-1999999999999999999999999999999
-12345678901234567890123456789012
-199999999999999999999999999999999
-1234567890123456789012345678901234
-19999999999999999999999999999999999
-123456789012345678901234567890123456
-1999999999999999999999999999999999999
-12345678901234567890123456789012345678
-199999999999999999999999999999999999999
-1234567890123456789012345678901234567890
-1999999999999999999999999999999999999999
-1e40
-1.1e40
-1.5e40
-1e41
-1e50
-1e100
-1e150
-1e200
-1e250
-1e300
-1.79641e308
-wizzah
-if [ $? -ne 0 ] ; then no_result ; fi
-
-
-activity="create program"
-cat > $TESTFILE <<foobar
-title 'Test use of big numbers'.
-
-*** Do the portable output.
-data list file='$TEMPDIR/bignum.data'/BIGNUM 1-40.
-list.
-
-*** Do the nonportable output for fun. 
-descriptives BIGNUM.
-foobar
-if [ $? -ne 0 ] ; then no_result ; fi
-
-activity="run program"
-$SUPERVISOR $PSPP -o pspp.csv $TESTFILE
-if [ $? -ne 0 ] ; then no_result ; fi
-
-# Like the above comments say ...
-# ... if we get here without crashing, then the test has passed.
-
-pass;
diff --git a/tests/data/data-in.at b/tests/data/data-in.at
new file mode 100644 (file)
index 0000000..010baf1
--- /dev/null
@@ -0,0 +1,83 @@
+AT_BANNER([data input (data-in)])
+
+dnl Some very old version of PSPP crashed reading big numbers,
+dnl so this checks for regressions.
+AT_SETUP([reading big numbers])
+AT_KEYWORDS([data-in])
+AT_DATA([bignum.txt], [dnl
+0
+0.1
+0.5
+0.8
+0.9
+0.999
+1
+2
+3
+4
+5
+12
+123
+1234
+12345
+123456
+1234567
+12345678
+123456789
+1234567890
+19999999999
+199999999999
+1234567890123
+19999999999999
+199999999999999
+1234567890123456
+19999999999999999
+123456789012345678
+1999999999999999999
+12345678901234567890
+199999999999999999999
+1234567890123456789012
+19999999999999999999999
+123456789012345678901234
+1999999999999999999999999
+12345678901234567890123456
+199999999999999999999999999
+1234567890123456789012345678
+19999999999999999999999999999
+123456789012345678901234567890
+1999999999999999999999999999999
+12345678901234567890123456789012
+199999999999999999999999999999999
+1234567890123456789012345678901234
+19999999999999999999999999999999999
+123456789012345678901234567890123456
+1999999999999999999999999999999999999
+12345678901234567890123456789012345678
+199999999999999999999999999999999999999
+1234567890123456789012345678901234567890
+1999999999999999999999999999999999999999
+1e40
+1.1e40
+1.5e40
+1e41
+1e50
+1e100
+1e150
+1e200
+1e250
+1e300
+1.79641e308
+wizzah
+])
+AT_DATA([bignum.sps], [dnl
+title 'Test use of big numbers'.
+
+*** Do the portable output.
+data list file='bignum.txt'/BIGNUM 1-40.
+list.
+
+*** Do the nonportable output for fun. 
+descriptives BIGNUM.
+])
+AT_CHECK([pspp -o pspp.csv bignum.sps], [0], [ignore])
+AT_CLEANUP