VECTOR: Convert tests to Autotest framework.
authorBen Pfaff <blp@cs.stanford.edu>
Sun, 10 Oct 2010 00:28:54 +0000 (17:28 -0700)
committerBen Pfaff <blp@cs.stanford.edu>
Sun, 10 Oct 2010 00:28:54 +0000 (17:28 -0700)
tests/automake.mk
tests/command/vector.sh [deleted file]
tests/language/dictionary/vector.at [new file with mode: 0644]

index e614c1bd1161690d21019265fe7b162af1d9710b..7ee732cbf109413385ca7733695a831dbf269b7f 100644 (file)
@@ -10,7 +10,6 @@ TESTS_ENVIRONMENT += LC_ALL=C
 TESTS_ENVIRONMENT += EXEEXT=$(EXEEXT)
 
 dist_TESTS = \
-       tests/command/vector.sh \
        tests/command/very-long-strings.sh \
        tests/command/weight.sh \
        tests/formats/bcd-in.sh \
@@ -337,6 +336,7 @@ TESTSUITE_AT = \
        tests/language/dictionary/split-file.at \
        tests/language/dictionary/sys-file-info.at \
        tests/language/dictionary/variable-display.at \
+       tests/language/dictionary/vector.at \
        tests/language/expressions/evaluate.at \
        tests/language/lexer/variable-parser.at \
        tests/language/stats/aggregate.at \
diff --git a/tests/command/vector.sh b/tests/command/vector.sh
deleted file mode 100755 (executable)
index c5d4184..0000000
+++ /dev/null
@@ -1,142 +0,0 @@
-#!/bin/sh
-
-# This program tests the VECTOR 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 prog"
-cat > $TEMPDIR/vector.stat <<EOF
-data list notable/x 1.
-vector v(4).
-display vector.
-
-data list notable/x 1.
-vector #vec(4, comma10.2).
-display vector.
-
-input program.
-vector x(5).
-data list/x5 x2 x3 x1 x4 1-5.
-end input program.
-display vector.
-
-data list notable/u w x y z 1-5.
-vector a=u to y.
-vector b=x to z.
-vector c=all.
-display vector.
-EOF
-if [ $? -ne 0 ] ; then no_result ; fi
-
-activity="run program"
-$SUPERVISOR $PSPP -o pspp.csv -e $TEMPDIR/stdout $TEMPDIR/vector.stat
-if [ $? -ne 0 ] ; then no_result ; fi
-
-activity="compare stdout"
-perl -pi -e 's/^\s*$//g' $TEMPDIR/stdout
-diff -b $TEMPDIR/stdout  - <<EOF
-EOF
-if [ $? -ne 0 ] ; then fail ; fi
-
-activity="compare results"
-diff -c $TEMPDIR/pspp.csv  - <<EOF
-Vector,Position,Variable,Print Format
-v,1,v1,F8.2
-,2,v2,F8.2
-,3,v3,F8.2
-,4,v4,F8.2
-
-Vector,Position,Variable,Print Format
-#vec,1,#vec1,COMMA10.2
-,2,#vec2,COMMA10.2
-,3,#vec3,COMMA10.2
-,4,#vec4,COMMA10.2
-
-Table: Reading 1 record from INLINE.
-Variable,Record,Columns,Format
-x5,1,1-  1,F1.0
-x2,1,2-  2,F1.0
-x3,1,3-  3,F1.0
-x1,1,4-  4,F1.0
-x4,1,5-  5,F1.0
-
-Vector,Position,Variable,Print Format
-x,1,x1,F8.2
-,2,x2,F8.2
-,3,x3,F8.2
-,4,x4,F8.2
-,5,x5,F8.2
-
-Vector,Position,Variable,Print Format
-a,1,u,F1.0
-,2,w,F1.0
-,3,x,F1.0
-,4,y,F1.0
-b,1,x,F1.0
-,2,y,F1.0
-,3,z,F1.0
-c,1,u,F1.0
-,2,w,F1.0
-,3,x,F1.0
-,4,y,F1.0
-,5,z,F1.0
-EOF
-if [ $? -ne 0 ] ; then fail ; fi
-
-
-pass;
diff --git a/tests/language/dictionary/vector.at b/tests/language/dictionary/vector.at
new file mode 100644 (file)
index 0000000..e7a2cdd
--- /dev/null
@@ -0,0 +1,78 @@
+AT_BANNER([VECTOR])
+
+AT_SETUP([VECTOR short form])
+AT_DATA([vector.sps], [dnl
+data list notable/x 1.
+vector v(4).
+display vector.
+])
+AT_CHECK([pspp -o pspp.csv vector.sps])
+AT_CHECK([cat pspp.csv], [0], [dnl
+Vector,Position,Variable,Print Format
+v,1,v1,F8.2
+,2,v2,F8.2
+,3,v3,F8.2
+,4,v4,F8.2
+])
+AT_CLEANUP
+
+AT_SETUP([VECTOR short form with format specification])
+AT_DATA([vector.sps], [dnl
+data list notable/x 1.
+vector #vec(4, comma10.2).
+display vector.
+])
+AT_CHECK([pspp -o pspp.csv vector.sps])
+AT_CHECK([cat pspp.csv], [0], [dnl
+Vector,Position,Variable,Print Format
+#vec,1,#vec1,COMMA10.2
+,2,#vec2,COMMA10.2
+,3,#vec3,COMMA10.2
+,4,#vec4,COMMA10.2
+])
+AT_CLEANUP
+
+AT_SETUP([VECTOR short form in INPUT PROGRAM])
+AT_DATA([vector.sps], [dnl
+input program.
+vector x(5).
+data list notable/x5 x2 x3 x1 x4 1-5.
+end input program.
+display vector.
+])
+AT_CHECK([pspp -o pspp.csv vector.sps])
+AT_CHECK([cat pspp.csv], [0], [dnl
+Vector,Position,Variable,Print Format
+x,1,x1,F8.2
+,2,x2,F8.2
+,3,x3,F8.2
+,4,x4,F8.2
+,5,x5,F8.2
+])
+AT_CLEANUP
+
+AT_SETUP([VECTOR long form])
+AT_DATA([vector.sps], [dnl
+data list notable/u w x y z 1-5.
+vector a=u to y.
+vector b=x to z.
+vector c=all.
+display vector.
+])
+AT_CHECK([pspp -o pspp.csv vector.sps])
+AT_CHECK([cat pspp.csv], [0], [dnl
+Vector,Position,Variable,Print Format
+a,1,u,F1.0
+,2,w,F1.0
+,3,x,F1.0
+,4,y,F1.0
+b,1,x,F1.0
+,2,y,F1.0
+,3,z,F1.0
+c,1,u,F1.0
+,2,w,F1.0
+,3,x,F1.0
+,4,y,F1.0
+,5,z,F1.0
+])
+AT_CLEANUP