From: Ben Pfaff Date: Mon, 9 Aug 2010 05:34:48 +0000 (-0700) Subject: BEGIN DATA: Convert tests to use Autotest. X-Git-Tag: v0.7.6~288 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=21fb7a8d5db50ca2a902e0f1d1bfd96fdac69031;p=pspp-builds.git BEGIN DATA: Convert tests to use Autotest. --- diff --git a/tests/automake.mk b/tests/automake.mk index fd509864..98fafb73 100644 --- a/tests/automake.mk +++ b/tests/automake.mk @@ -10,7 +10,6 @@ TESTS_ENVIRONMENT += LC_ALL=C TESTS_ENVIRONMENT += EXEEXT=$(EXEEXT) dist_TESTS = \ - tests/command/beg-data.sh \ tests/command/bignum.sh \ tests/command/count.sh \ tests/command/correlation.sh \ @@ -418,6 +417,7 @@ TESTSUITE_AT = \ tests/data/calendar.at \ tests/language/data-io/add-files.at \ tests/language/data-io/data-list.at \ + tests/language/data-io/data-reader.at \ tests/language/data-io/save.at \ tests/language/data-io/save-translate.at \ tests/language/dictionary/attributes.at \ diff --git a/tests/command/beg-data.sh b/tests/command/beg-data.sh deleted file mode 100755 index 972b990b..00000000 --- a/tests/command/beg-data.sh +++ /dev/null @@ -1,125 +0,0 @@ -#!/bin/sh - -# This program tests the BEGIN DATA / END DATA commands - -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 << EOF_foobar -title 'Test BEGIN DATA ... END DATA'. - -data list /A B 1-2. -list. -begin data. -12 -34 -56 -78 -90 -end data. - -data list /A B 1-2. -begin data. -09 -87 -65 -43 -21 -end data. -list. -EOF_foobar -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 data" -diff -c $TEMPDIR/pspp.csv - << foobar -Title: Test BEGIN DATA ... END DATA - -Table: Reading 1 record from INLINE. -Variable,Record,Columns,Format -A,1,1- 1,F1.0 -B,1,2- 2,F1.0 - -Table: Data List -A,B -1,2 -3,4 -5,6 -7,8 -9,0 - -Table: Reading 1 record from INLINE. -Variable,Record,Columns,Format -A,1,1- 1,F1.0 -B,1,2- 2,F1.0 - -Table: Data List -A,B -0,9 -8,7 -6,5 -4,3 -2,1 -foobar -if [ $? -ne 0 ] ; then fail ; fi - - -pass; diff --git a/tests/language/data-io/data-reader.at b/tests/language/data-io/data-reader.at new file mode 100644 index 00000000..281ca2a2 --- /dev/null +++ b/tests/language/data-io/data-reader.at @@ -0,0 +1,64 @@ +AT_BANNER([BEGIN DATA]) + +# BEGIN DATA can run as a command in itself, or it can appear as part +# of the first procedure. First, test it after a procedure. +AT_SETUP([BEGIN DATA as part of a procedure]) +AT_DATA([begin-data.sps], [dnl +TITLE 'Test BEGIN DATA ... END DATA'. + +DATA LIST /a b 1-2. +LIST. +BEGIN DATA. +12 +34 +56 +78 +90 +END DATA. +]) +AT_CHECK([pspp -O format=csv begin-data.sps], [0], [dnl +Title: Test BEGIN DATA ... END DATA + +Table: Reading 1 record from INLINE. +Variable,Record,Columns,Format +a,1,1- 1,F1.0 +b,1,2- 2,F1.0 + +Table: Data List +a,b +1,2 +3,4 +5,6 +7,8 +9,0 +]) +AT_CLEANUP + +# Also test BEGIN DATA as an independent command. +AT_SETUP([BEGIN DATA as an independent command]) +AT_DATA([begin-data.sps], [dnl +data list /A B 1-2. +begin data. +09 +87 +65 +43 +21 +end data. +list. +]) +AT_CHECK([pspp -O format=csv begin-data.sps], [0], [dnl +Table: Reading 1 record from INLINE. +Variable,Record,Columns,Format +A,1,1- 1,F1.0 +B,1,2- 2,F1.0 + +Table: Data List +A,B +0,9 +8,7 +6,5 +4,3 +2,1 +]) +AT_CLEANUP