SPLIT FILE: Convert test to Autotest framework.
authorBen Pfaff <blp@cs.stanford.edu>
Tue, 5 Oct 2010 04:33:03 +0000 (21:33 -0700)
committerBen Pfaff <blp@cs.stanford.edu>
Tue, 5 Oct 2010 04:33:03 +0000 (21:33 -0700)
tests/automake.mk
tests/command/split-file.sh [deleted file]
tests/language/dictionary/split-file.at [new file with mode: 0644]

index d3054e163883aa03a560f6369248d1162ce75d81..b3ad2b438846c162ca7150a9fded59cd6e220358 100644 (file)
@@ -10,7 +10,6 @@ TESTS_ENVIRONMENT += LC_ALL=C
 TESTS_ENVIRONMENT += EXEEXT=$(EXEEXT)
 
 dist_TESTS = \
-       tests/command/split-file.sh \
        tests/command/t-test-1-indep-val.sh \
        tests/command/t-test-1-sample-missing-anal.sh \
        tests/command/t-test-1-sample-missing-list.sh \
@@ -355,6 +354,7 @@ TESTSUITE_AT = \
        tests/language/dictionary/missing-values.at \
        tests/language/dictionary/mrsets.at \
        tests/language/dictionary/rename-variables.at \
+       tests/language/dictionary/split-file.at \
        tests/language/dictionary/sys-file-info.at \
        tests/language/expressions/evaluate.at \
        tests/language/lexer/variable-parser.at \
diff --git a/tests/command/split-file.sh b/tests/command/split-file.sh
deleted file mode 100755 (executable)
index 9762292..0000000
+++ /dev/null
@@ -1,122 +0,0 @@
-#!/bin/sh
-
-# This program tests the split file command
-
-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 > $TEMPDIR/split.stat <<EOF
-title 'Test SPLIT FILE utility'.
-
-data list notable /X 1 Y 2.
-begin data.
-12
-16
-17
-19
-15
-14
-27
-20
-26
-25
-28
-29
-24
-end data.
-split file by x.
-list.
-EOF
-if [ $? -ne 0 ] ; then no_result ; fi
-
-activity="run program"
-$SUPERVISOR $PSPP -o pspp.csv $TEMPDIR/split.stat
-if [ $? -ne 0 ] ; then no_result ; fi
-
-activity="compare results"
-diff -c $TEMPDIR/pspp.csv - <<EOF
-Title: Test SPLIT FILE utility
-
-Variable,Value,Label
-X,1,
-
-Table: Data List
-X,Y
-1,2
-1,6
-1,7
-1,9
-1,5
-1,4
-
-Variable,Value,Label
-X,2,
-
-Table: Data List
-X,Y
-2,7
-2,0
-2,6
-2,5
-2,8
-2,9
-2,4
-EOF
-if [ $? -ne 0 ] ; then fail ; fi
-
-pass;
diff --git a/tests/language/dictionary/split-file.at b/tests/language/dictionary/split-file.at
new file mode 100644 (file)
index 0000000..39b3412
--- /dev/null
@@ -0,0 +1,55 @@
+AT_BANNER([SPLIT FILE])
+
+AT_SETUP([SPLIT FILE])
+AT_DATA([split-file.sps], [dnl
+title 'Test SPLIT FILE utility'.
+
+data list notable /X 1 Y 2.
+begin data.
+12
+16
+17
+19
+15
+14
+27
+20
+26
+25
+28
+29
+24
+end data.
+split file by x.
+list.
+])
+AT_CHECK([pspp -o pspp.csv split-file.sps])
+AT_CHECK([cat pspp.csv], [0], [dnl
+Title: Test SPLIT FILE utility
+
+Variable,Value,Label
+X,1,
+
+Table: Data List
+X,Y
+1,2
+1,6
+1,7
+1,9
+1,5
+1,4
+
+Variable,Value,Label
+X,2,
+
+Table: Data List
+X,Y
+2,7
+2,0
+2,6
+2,5
+2,8
+2,9
+2,4
+])
+AT_CLEANUP