tests/bugs/big-input-2.sh \
tests/bugs/case-map.sh \
tests/bugs/comment-at-eof.sh \
- tests/bugs/compute-fmt.sh \
tests/bugs/compression.sh \
tests/bugs/curtailed.sh \
tests/bugs/data-crash.sh \
tests/bugs/unwritable-dir.sh \
tests/bugs/val-labs.sh \
tests/bugs/val-labs-trailing-slash.sh \
- tests/bugs/computebug.sh \
- tests/bugs/compute-lv.sh \
- tests/bugs/compute-sum.sh \
tests/bugs/print-crash.sh \
tests/bugs/keep-all.sh \
tests/data/datasheet-test.sh \
tests/language/stats/autorecode.at \
tests/language/stats/crosstabs.at \
tests/language/stats/frequencies.at \
+ tests/language/xforms/compute.at \
tests/language/xforms/recode.at \
tests/output/render.at
TESTSUITE = $(srcdir)/tests/testsuite
+++ /dev/null
-#!/bin/sh
-
-# This program tests for a bug which caused a crash after SAVE FILE
-# was called on a COMPUTEd variable
-
-
-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
-
-# 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
-INPUT PROGRAM.
- COMPUTE num = 3.
-END FILE.
-END INPUT PROGRAM.
-EXECUTE.
-
-SAVE outfile='$TEMPDIR/temp.sav'.
-EOF
-if [ $? -ne 0 ] ; then no_result ; fi
-
-$SUPERVISOR $PSPP -o pspp.csv $TESTFILE
-if [ $? -ne 0 ] ; then fail; fi
-
-
-
-pass;
+++ /dev/null
-#!/bin/sh
-
-# This program tests for a bug involving COMPUTE and long variable names
-
-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
-
-# 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 prog"
-cat > $TESTFILE <<EOF
-DATA LIST LIST /longVariablename * x *.
-BEGIN DATA.
-1 2
-3 4
-END DATA.
-
-
-COMPUTE longvariableName=100-longvariablename.
-
-LIST.
-
-EOF
-if [ $? -ne 0 ] ; then no_result ; fi
-
-
-activity="run prog"
-$SUPERVISOR $PSPP -o pspp.csv $TESTFILE
-if [ $? -ne 0 ] ; then fail ; fi
-
-
-activity="compare output"
-diff pspp.csv - << EOF
-Table: Reading free-form data from INLINE.
-Variable,Format
-longVariablename,F8.0
-x,F8.0
-
-Table: Data List
-longVariablename,x
-99.00,2.00
-97.00,4.00
-EOF
-if [ $? -ne 0 ] ; then fail ; fi
-
-
-pass;
+++ /dev/null
-#!/bin/sh
-
-# This program tests for a bug in the `compute' command, in which it
-# failed to allow a newly created variable to be used as part of the
-# computation, which actually makes sense for "LEAVE" variables.
-
-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
-
-# 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="copy file"
-cat > compute-sum.stat <<EOF
-DATA LIST /ITEM 1-3.
-COMPUTE SUM=SUM+ITEM.
-PRINT OUTFILE='compute-sum.out' /ITEM SUM.
-LEAVE SUM
-BEGIN DATA.
-123
-404
-555
-999
-END DATA.
-EOF
-if [ $? -ne 0 ] ; then no_result ; fi
-
-activity="run program"
-$SUPERVISOR $PSPP -o pspp.csv $TEMPDIR/compute-sum.stat
-if [ $? -ne 0 ] ; then no_result ; fi
-
-activity="compare output"
-diff compute-sum.out - <<EOF
- 123 123.00
- 404 527.00
- 555 1082.00
- 999 2081.00
-EOF
-if [ $? -ne 0 ] ; then fail ; fi
-
-pass;
+++ /dev/null
-#!/bin/sh
-
-# This program tests for a bug in the `compute' 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
-
-# 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
-if [ $? -ne 0 ] ; then no_result ; fi
-
-activity="create input"
-cat > $TESTFILE <<EOF
-DATA LIST LIST
- /A (A161)
- B (A3).
-
-BEGIN DATA
-abc def
-ghi jkl
-END DATA.
-
-COMPUTE A=upcase(A).
-EXECUTE.
-LIST.
-EOF
-
-activity="run program"
-$SUPERVISOR $PSPP -o pspp.csv $TESTFILE
-if [ $? -ne 0 ] ; then no_result ; fi
-
-
-activity="compare output"
-diff -c $TEMPDIR/pspp.csv - <<EOF
-Table: Reading free-form data from INLINE.
-Variable,Format
-A,A161
-B,A3
-
-Table: Data List
-A,B
-ABC ,def
-GHI ,jkl
-EOF
-if [ $? -ne 0 ] ; then fail ; fi
-
-pass;
--- /dev/null
+AT_BANNER([COMPUTE transformation])
+
+AT_SETUP([COMPUTE crash with SAVE])
+AT_DATA([compute.sps],
+ [INPUT PROGRAM.
+COMPUTE num = 3.
+END FILE.
+END INPUT PROGRAM.
+EXECUTE.
+
+SAVE outfile='temp.sav'.
+])
+AT_CHECK([pspp -O format=csv compute.sps])
+AT_DATA([list.sps],
+ [GET FILE='temp.sav'.
+LIST.
+])
+AT_CHECK([pspp -O format=csv list.sps], [0],
+ [])
+AT_CLEANUP
+
+AT_SETUP([COMPUTE bug in long string UPCASE])
+AT_DATA([compute.sps],
+ [DATA LIST LIST
+ /A (A161)
+ B (A3).
+
+BEGIN DATA
+abc def
+ghi jkl
+END DATA.
+
+COMPUTE A=upcase(A).
+EXECUTE.
+LIST.
+])
+AT_CHECK([pspp -O format=csv compute.sps], [0],
+ [Table: Reading free-form data from INLINE.
+Variable,Format
+A,A161
+B,A3
+
+Table: Data List
+A,B
+ABC ,def
+GHI ,jkl
+])
+AT_CLEANUP
+
+AT_SETUP([COMPUTE bug with long variable names])
+AT_DATA([compute.sps],
+ [DATA LIST LIST /longVariablename * x *.
+BEGIN DATA.
+1 2
+3 4
+END DATA.
+
+
+COMPUTE longvariableName=100-longvariablename.
+
+LIST.
+])
+AT_CHECK([pspp -O format=csv compute.sps], [0],
+ [Table: Reading free-form data from INLINE.
+Variable,Format
+longVariablename,F8.0
+x,F8.0
+
+Table: Data List
+longVariablename,x
+99.00,2.00
+97.00,4.00
+])
+AT_CLEANUP
+
+AT_SETUP([COMPUTE self-reference to new variable])
+AT_DATA([compute.sps],
+ [DATA LIST /ITEM 1-3.
+COMPUTE SUM=SUM+ITEM.
+PRINT OUTFILE='compute-sum.out' /ITEM SUM.
+LEAVE SUM
+BEGIN DATA.
+123
+404
+555
+999
+END DATA.
+])
+AT_CHECK([pspp -O format=csv compute.sps], [0],
+ [Table: Reading 1 record from INLINE.
+Variable,Record,Columns,Format
+ITEM,1,1- 3,F3.0
+])
+AT_CHECK([cat compute-sum.out], [0],
+ [ 123 123.00 @&t@
+ 404 527.00 @&t@
+ 555 1082.00 @&t@
+ 999 2081.00 @&t@
+])
+AT_CLEANUP
m4_include([tests/language/stats/autorecode.at])
m4_include([tests/language/stats/crosstabs.at])
m4_include([tests/language/stats/frequencies.at])
+m4_include([tests/language/xforms/compute.at])
m4_include([tests/language/xforms/recode.at])
m4_include([tests/output/render.at])