From: John Darrington Date: Wed, 17 Dec 2003 01:28:10 +0000 (+0000) Subject: Added a test for the LIST command X-Git-Tag: sav-api~2669 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f10ed4942f0f2253d236d5e454a8ab702ed7e72b;p=pspp Added a test for the LIST command --- diff --git a/tests/Makefile.am b/tests/Makefile.am index 69e929d357..d064145a12 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -10,6 +10,7 @@ TESTS = command/aggregate.sh \ command/file-label.sh \ command/flip.sh \ command/lag.sh \ + command/list.sh \ command/loop.sh \ command/print.sh \ command/sample.sh \ @@ -30,8 +31,8 @@ EXTRA_DIST = \ compute.stat crosstabs.stat data-fmts.stat \ data-list.data do-if.stat do-repeat.stat \ expr.stat filter.stat gengarbage.c \ -inpt-pgm.stat list.data list.stat mtch-file.stat \ -means.stat mdfy-vars.stat pcs-if.stat recode.stat \ +inpt-pgm.stat list.data mtch-file.stat \ +means.stat mdfy-vars.stat pcs-if.stat recode.stat \ repeating.stat reread.data reread.stat \ sys-info.stat t-test.stat temporary.stat \ time-date.stat vector.stat weighting.data weighting.stat $(TESTS) diff --git a/tests/command/list.sh b/tests/command/list.sh new file mode 100755 index 0000000000..8b96af218e --- /dev/null +++ b/tests/command/list.sh @@ -0,0 +1,358 @@ +#!/bin/sh + +# This program tests the LIST command. + +TEMPDIR=/tmp/pspp-tst-$$ + +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 > $TEMPDIR/list.stat << foobar +*** Single lines. +remark EOF +---------------------------------------------------------------------- +Testing use of LIST in single-line cases. +---------------------------------------------------------------------- +EOF +data list file='$here/weighting.data'/AVAR 1-5 BVAR 6-10. +weight by BVAR. +list. +*list /cases=from 5 to 20 by 2 /format numbered. +list /format numbered weight. + +*** Multiple lines. +remark EOF +---------------------------------------------------------------------- +Testing use of LIST in multi-line cases. +---------------------------------------------------------------------- +EOF +data list file='$here/list.data' notable /X000 to X126 1-127. +*list /cases=from 1 to 25 by 5 /format numbered. +list x000 to x030. +list /cases=from 1 to 25. + +foobar +if [ $? -ne 0 ] ; then no_result ; fi + +activity="run program" +$here/../src/pspp --testing-mode -o raw-ascii $TEMPDIR/list.stat +if [ $? -ne 0 ] ; then no_result ; fi + + +activity="compare results" +diff -b -B $TEMPDIR/pspp.list - <