data-in: Convert BCD input tests to Autotest framework.
authorBen Pfaff <blp@cs.stanford.edu>
Wed, 13 Oct 2010 03:31:48 +0000 (20:31 -0700)
committerBen Pfaff <blp@cs.stanford.edu>
Wed, 13 Oct 2010 03:31:48 +0000 (20:31 -0700)
tests/automake.mk
tests/data/bcd-in.expected.cmp.gz [new file with mode: 0644]
tests/data/data-in.at
tests/formats/bcd-in.expected.cmp.gz [deleted file]
tests/formats/bcd-in.sh [deleted file]

index 9f58af721afaa197b713cdfa7de46c1904e35bfc..70ff67cc1669a929472ca55969595ff3e0a4e773 100644 (file)
@@ -10,7 +10,6 @@ TESTS_ENVIRONMENT += LC_ALL=C
 TESTS_ENVIRONMENT += EXEEXT=$(EXEEXT)
 
 dist_TESTS = \
-       tests/formats/bcd-in.sh \
        tests/formats/binhex-out.sh \
        tests/formats/date-in.sh \
        tests/formats/date-out.sh \
@@ -224,8 +223,9 @@ tests_output_render_test_LDADD = \
 EXTRA_DIST += \
        $(dist_TESTS) \
        tests/coverage.sh tests/test_template \
-       tests/data/v13.sav tests/data/v14.sav \
-       tests/formats/bcd-in.expected.cmp.gz \
+       tests/data/bcd-in.expected.cmp.gz \
+       tests/data/v13.sav \
+       tests/data/v14.sav \
        tests/formats/binhex-out.expected.gz \
        tests/formats/ib-in.expected.cmp.gz \
        tests/formats/legacy-in.expected.cmp.gz \
diff --git a/tests/data/bcd-in.expected.cmp.gz b/tests/data/bcd-in.expected.cmp.gz
new file mode 100644 (file)
index 0000000..ec1b34b
Binary files /dev/null and b/tests/data/bcd-in.expected.cmp.gz differ
index 010baf115cba890e377411b569126804a966d4b4..f3c1fde952b34871ba18b06a1fd6ca55e9c578a8 100644 (file)
@@ -81,3 +81,23 @@ descriptives BIGNUM.
 ])
 AT_CHECK([pspp -o pspp.csv bignum.sps], [0], [ignore])
 AT_CLEANUP
+
+AT_SETUP([BCD input (P and PK formats)])
+AT_CHECK([$PERL -e 'print pack "n", $_ foreach 0...65535' > bcd-in.data])
+AT_CHECK([wc -c < bcd-in.data], [0], [131072
+])
+AT_DATA([bcd-in.sps], [dnl
+SET ERRORS=NONE.
+SET MXWARNS=10000000.
+SET MXERRS=10000000.
+FILE HANDLE data/NAME='bcd-in.data'/MODE=IMAGE/LRECL=2.
+DATA LIST FILE=data NOTABLE/p 1-2 (P) pk 1-2 (PK).
+COMPUTE x=$CASENUM - 1.
+PRINT OUTFILE='bcd-in.out'/x (PIBHEX4) ' ' P PK.
+EXECUTE.
+])
+AT_CHECK([gzip -cd < $top_srcdir/tests/data/bcd-in.expected.cmp.gz | \
+            $PERL -pe "printf ' %04X ', $.-1" > expout])
+AT_CHECK([pspp -O format=csv bcd-in.sps])
+AT_CHECK([cat bcd-in.out], [0], [expout])
+AT_CLEANUP
diff --git a/tests/formats/bcd-in.expected.cmp.gz b/tests/formats/bcd-in.expected.cmp.gz
deleted file mode 100644 (file)
index ec1b34b..0000000
Binary files a/tests/formats/bcd-in.expected.cmp.gz and /dev/null differ
diff --git a/tests/formats/bcd-in.sh b/tests/formats/bcd-in.sh
deleted file mode 100755 (executable)
index b21b209..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-#! /bin/sh
-
-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$EXEEXT
-: ${PERL:=perl}
-
-# 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="generate data input file"
-$PERL -e 'print pack "n", $_ foreach 0...65535' > bcd-in.data
-
-activity="write pspp syntax"
-cat > bcd-in.pspp <<'EOF'
-SET ERRORS=NONE.
-SET MXWARNS=10000000.
-SET MXERRS=10000000.
-FILE HANDLE data/NAME='bcd-in.data'/MODE=IMAGE/LRECL=2.
-DATA LIST FILE=data/p 1-2 (P) pk 1-2 (PK).
-COMPUTE x=$CASENUM - 1.
-PRINT OUTFILE='bcd-in.out'/x (PIBHEX4) ' ' P PK.
-EXECUTE.
-EOF
-if [ $? -ne 0 ] ; then no_result ; fi
-
-activity="run program"
-$SUPERVISOR $PSPP -o pspp.csv bcd-in.pspp
-if [ $? -ne 0 ] ; then no_result ; fi
-
-activity="gunzip expected results"
-gzip -cd < $top_srcdir/tests/formats/bcd-in.expected.cmp.gz > bcd-in.expected.cmp
-if [ $? -ne 0 ] ; then no_result ; fi
-
-activity="decompress expected results"
-$PERL -pe "printf ' %04X ', $.-1" < bcd-in.expected.cmp > bcd-in.expected
-if [ $? -ne 0 ] ; then no_result ; fi
-
-activity="compare output"
-diff -u bcd-in.expected bcd-in.out
-if [ $? -ne 0 ] ; then fail ; fi
-
-pass