From ed7bce25787929340a3f264f00dde7c979e571a9 Mon Sep 17 00:00:00 2001 From: John Darrington Date: Wed, 13 Apr 2005 14:50:05 +0000 Subject: [PATCH] Added some test files, which I'd forgotten about. --- tests/command/longvars.sh | 118 ++++++++++++++++++++++++++++++++++ tests/command/rename.sh | 105 ++++++++++++++++++++++++++++++ tests/command/sysfiles-old.sh | 105 ++++++++++++++++++++++++++++++ tests/command/sysfiles.sh | 95 +++++++++++++++++++++++++++ 4 files changed, 423 insertions(+) create mode 100755 tests/command/longvars.sh create mode 100755 tests/command/rename.sh create mode 100755 tests/command/sysfiles-old.sh create mode 100755 tests/command/sysfiles.sh diff --git a/tests/command/longvars.sh b/tests/command/longvars.sh new file mode 100755 index 00000000..d0fe2e81 --- /dev/null +++ b/tests/command/longvars.sh @@ -0,0 +1,118 @@ +#!/bin/sh + +# This program tests that both long and short variable names are parsed OK. + +TEMPDIR=/tmp/pspp-tst-$$ +TESTFILE=$TEMPDIR/`basename $0`.sps + +here=`pwd`; + +# ensure that top_srcdir is absolute +cd $top_srcdir; top_srcdir=`pwd` + +export STAT_CONFIG_PATH=$top_srcdir/config + + +cleanup() +{ + 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 + +# Use crosstabs, since its TABLES subcommand exercises the array var set +# feature. +activity="create program" +cat > $TESTFILE < $TESTFILE < $TESTFILE < /dev/null +if [ $? -ne 0 ] ; then no_result ; fi + +# Ensure that the written file has no long name table +activity="check sysfile type" +grep 'X=X' $TEMPDIR/foo.sav +if [ $? -eq 0 ] ; then fail ; fi + +activity="compare output" +diff -b -B -w $TEMPDIR/pspp.list - << EOF + X VARIABLE VARIAB_A VARIAB_B +-------- -------- -------- -------- + 1.00 1.00 1.00 2.00 + 1.00 1.00 2.00 30.00 + 1.00 2.00 1.00 8.00 + 1.00 2.00 2.00 20.00 + 2.00 1.00 1.00 2.00 + 2.00 1.00 2.00 22.00 + 2.00 2.00 1.00 1.00 + 2.00 2.00 2.00 3.00 + +EOF +if [ $? -ne 0 ] ; then fail ; fi + +pass; diff --git a/tests/command/sysfiles.sh b/tests/command/sysfiles.sh new file mode 100755 index 00000000..e16d1612 --- /dev/null +++ b/tests/command/sysfiles.sh @@ -0,0 +1,95 @@ +#!/bin/sh + +# This program tests that system files can be read and written +# including the long variable names. + + +TEMPDIR=/tmp/pspp-tst-$$ +TESTFILE=$TEMPDIR/`basename $0`.sps + +here=`pwd`; + +# ensure that top_srcdir is absolute +cd $top_srcdir; top_srcdir=`pwd` + +export STAT_CONFIG_PATH=$top_srcdir/config + + +cleanup() +{ + 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 <