LAG: Convert tests to use Autotest.
authorBen Pfaff <blp@cs.stanford.edu>
Thu, 30 Sep 2010 03:30:24 +0000 (20:30 -0700)
committerBen Pfaff <blp@cs.stanford.edu>
Thu, 30 Sep 2010 04:41:52 +0000 (21:41 -0700)
tests/automake.mk
tests/bugs/lag_crash.sh [deleted file]
tests/command/lag.sh [deleted file]
tests/language/expressions/evaluate.at

index 125b0b79ddee89d2ea8147594d78e1630e94aa4d..986e9ec2190cc25a0c1e26ca0182eabbf3e2988e 100644 (file)
@@ -10,7 +10,6 @@ TESTS_ENVIRONMENT += LC_ALL=C
 TESTS_ENVIRONMENT += EXEEXT=$(EXEEXT)
 
 dist_TESTS = \
-       tests/command/lag.sh \
        tests/command/line-ends.sh \
        tests/command/list.sh \
        tests/command/loop.sh \
@@ -85,7 +84,6 @@ dist_TESTS = \
        tests/bugs/get-no-file.sh \
        tests/bugs/if_crash.sh \
        tests/bugs/input-crash.sh \
-       tests/bugs/lag_crash.sh \
        tests/bugs/list-overflow.sh \
        tests/bugs/match-files-scratch.sh \
        tests/bugs/multipass.sh \
diff --git a/tests/bugs/lag_crash.sh b/tests/bugs/lag_crash.sh
deleted file mode 100755 (executable)
index c98864c..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-#!/bin/sh
-
-# This program tests for a bug which crashed pspp when using LAG
-
-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
-
-
-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
-DATA LIST LIST /x.
-BEGIN DATA
-1 
-2 
-END DATA.
-
-DO IF (x <> LAG(x) ).
-       ECHO 'hello'.
-END IF.
-
-EXECUTE.
-EOF
-if [ $? -ne 0 ] ; then no_result ; fi
-
-
-activity="run_program"
-$SUPERVISOR $PSPP -o pspp.csv $TESTFILE 
-if [ $? -ne 0 ] ; then fail ; fi
-
-
-pass;
diff --git a/tests/command/lag.sh b/tests/command/lag.sh
deleted file mode 100755 (executable)
index 06d8588..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-#!/bin/sh
-
-# This program tests the LAG function
-
-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/lag.stat <<EOF
-data list /W 1.
-begin data.
-1
-2
-3
-4
-5
-end data.
-
-compute X=lag(w,1).
-compute Y=lag(x).
-compute Z=lag(w,2).
-list.
-EOF
-if [ $? -ne 0 ] ; then no_result ; fi
-
-activity="run program"
-$SUPERVISOR $PSPP -o pspp.csv $TEMPDIR/lag.stat
-if [ $? -ne 0 ] ; then no_result ; fi
-
-activity="compare result"
-diff -c $TEMPDIR/pspp.csv - <<EOF
-Table: Reading 1 record from INLINE.
-Variable,Record,Columns,Format
-W,1,1-  1,F1.0
-
-Table: Data List
-W,X,Y,Z
-1,.  ,.  ,.  
-2,1.00,.  ,.  
-3,2.00,1.00,1.00
-4,3.00,2.00,2.00
-5,4.00,3.00,3.00
-EOF
-if [ $? -ne 0 ] ; then fail ; fi
-
-
-pass;
index a7144221bd86c717cf594be74d1d451b3ca825e5..01db036efc1cc6599d3f0874c94dec4af9088b14 100644 (file)
@@ -1843,3 +1843,59 @@ dnl Tests correctness of generic optimizations in optimize_tree().
   [[mod(0, x)], [0.00], [], [(X = 5.00)]],
   [[x ** 1], [5.00], [], [(X = 5.00)]],
   [[x ** 2], [25.00], [], [(X = 5.00)]])
+
+AT_SETUP([LAG function])
+AT_DATA([lag.sps], [dnl
+data list /W 1.
+begin data.
+1
+2
+3
+4
+5
+end data.
+
+compute X=lag(w,1).
+compute Y=lag(x).
+compute Z=lag(w,2).
+list.
+])
+AT_CHECK([pspp -o pspp.csv lag.sps])
+AT_CHECK([cat pspp.csv], [0], [dnl
+Table: Reading 1 record from INLINE.
+Variable,Record,Columns,Format
+W,1,1-  1,F1.0
+
+Table: Data List
+W,X,Y,Z
+1,.  ,.  ,.  @&t@
+2,1.00,.  ,.  @&t@
+3,2.00,1.00,1.00
+4,3.00,2.00,2.00
+5,4.00,3.00,3.00
+])
+AT_CLEANUP
+
+AT_SETUP([LAG crash bug])
+AT_DATA([lag.sps], [dnl
+DATA LIST LIST /x.
+BEGIN DATA
+1 
+2 
+END DATA.
+
+DO IF (x <> LAG(x) ).
+       ECHO 'hello'.
+END IF.
+
+EXECUTE.
+])
+AT_CHECK([pspp -o pspp.csv lag.sps])
+AT_CHECK([cat pspp.csv], [0], [dnl
+Table: Reading free-form data from INLINE.
+Variable,Format
+x,F8.0
+
+hello
+])
+AT_CLEANUP