data-in: Convert tests for binary and hexadecimal formats to Autotest.
authorBen Pfaff <blp@cs.stanford.edu>
Thu, 14 Oct 2010 01:39:31 +0000 (18:39 -0700)
committerBen Pfaff <blp@cs.stanford.edu>
Thu, 14 Oct 2010 01:39:31 +0000 (18:39 -0700)
tests/automake.mk
tests/data/binhex-in.expected.cmp.gz [new file with mode: 0644]
tests/data/data-in.at
tests/formats/ib-in.expected.cmp.gz [deleted file]
tests/formats/ib-in.sh [deleted file]

index bb229d3108f9723bc7faf1f6f2a96412029bb06b..d113ba3f96b30acf1d5121230e618893aa188964 100644 (file)
@@ -11,7 +11,6 @@ TESTS_ENVIRONMENT += EXEEXT=$(EXEEXT)
 
 dist_TESTS = \
        tests/formats/date-in.sh \
-       tests/formats/ib-in.sh \
        tests/formats/month-in.sh \
        tests/formats/num-in.sh \
        tests/formats/num-out.sh \
@@ -216,11 +215,11 @@ EXTRA_DIST += \
        $(dist_TESTS) \
        tests/coverage.sh tests/test_template \
        tests/data/bcd-in.expected.cmp.gz \
+       tests/data/binhex-in.expected.cmp.gz \
        tests/data/binhex-out.expected.gz \
        tests/data/legacy-in.expected.cmp.gz \
        tests/data/v13.sav \
        tests/data/v14.sav \
-       tests/formats/ib-in.expected.cmp.gz \
        tests/formats/num-in.expected.gz \
        tests/formats/num-out.expected.cmp.gz \
        tests/formats/num-out-cmp.pl \
diff --git a/tests/data/binhex-in.expected.cmp.gz b/tests/data/binhex-in.expected.cmp.gz
new file mode 100644 (file)
index 0000000..19e1fa4
Binary files /dev/null and b/tests/data/binhex-in.expected.cmp.gz differ
index 77827b0b01aec5d8e2700910d1701d59aabbe1b5..7806e9b9a1f5fcdca260b68dd44e2e4c5fb79f26 100644 (file)
@@ -82,6 +82,27 @@ descriptives BIGNUM.
 AT_CHECK([pspp -o pspp.csv bignum.sps], [0], [ignore])
 AT_CLEANUP
 
+AT_SETUP([binary and hexadecimal input (IB, PIB, and PIBHEX formats)])
+AT_CHECK([$PERL -e 'print pack "n", $_ foreach 0...65535' > binhex-in.data])
+AT_CHECK([wc -c < binhex-in.data], [0], [131072
+])
+AT_DATA([binhex-in.sps], [dnl
+SET RIB=MSBFIRST.
+SET ERRORS=NONE.
+SET MXWARNS=10000000.
+SET MXERRS=10000000.
+FILE HANDLE data/NAME='binhex-in.data'/MODE=IMAGE/LRECL=2.
+DATA LIST FILE=data NOTABLE/ib 1-2 (IB) pib 1-2 (PIB) pibhex 1-2 (PIBHEX).
+COMPUTE x=$CASENUM - 1.
+PRINT OUTFILE='binhex-in.out'/x (PIBHEX4) ' ' ib pib pibhex.
+EXECUTE.
+])
+AT_CHECK([gzip -cd < $top_srcdir/tests/data/binhex-in.expected.cmp.gz | \
+            $PERL -pe "printf ' %04X ', $.-1" > expout])
+AT_CHECK([pspp -O format=csv binhex-in.sps], [0])
+AT_CHECK([cat binhex-in.out], [0], [expout])
+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
diff --git a/tests/formats/ib-in.expected.cmp.gz b/tests/formats/ib-in.expected.cmp.gz
deleted file mode 100644 (file)
index 19e1fa4..0000000
Binary files a/tests/formats/ib-in.expected.cmp.gz and /dev/null differ
diff --git a/tests/formats/ib-in.sh b/tests/formats/ib-in.sh
deleted file mode 100755 (executable)
index f91915b..0000000
+++ /dev/null
@@ -1,90 +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' > ib-in.data
-
-activity="write pspp syntax"
-cat > ib-in.pspp <<'EOF'
-SET RIB=MSBFIRST.
-SET ERRORS=NONE.
-SET MXWARNS=10000000.
-SET MXERRS=10000000.
-FILE HANDLE data/NAME='ib-in.data'/MODE=IMAGE/LRECL=2.
-DATA LIST FILE=data/ib 1-2 (IB) pib 1-2 (PIB) pibhex 1-2 (PIBHEX).
-COMPUTE x=$CASENUM - 1.
-PRINT OUTFILE='ib-in.out'/x (PIBHEX4) ' ' ib pib pibhex.
-EXECUTE.
-EOF
-if [ $? -ne 0 ] ; then no_result ; fi
-
-activity="run program"
-$SUPERVISOR $PSPP -o pspp.csv ib-in.pspp
-if [ $? -ne 0 ] ; then no_result ; fi
-
-activity="gunzip expected results"
-gzip -cd < $top_srcdir/tests/formats/ib-in.expected.cmp.gz > ib-in.expected.cmp
-if [ $? -ne 0 ] ; then no_result ; fi
-
-activity="decompress expected results"
-$PERL -pe "printf ' %04X ', $.-1" < ib-in.expected.cmp > ib-in.expected
-if [ $? -ne 0 ] ; then no_result ; fi
-
-activity="compare output"
-diff -u ib-in.expected ib-in.out
-if [ $? -ne 0 ] ; then fail ; fi
-
-pass