From: John Darrington Date: Wed, 17 Dec 2003 00:30:15 +0000 (+0000) Subject: Added tests for LOOP and SAMPLE commands X-Git-Tag: v0.4.0~435 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=af3d0cc241b60028b16ea8173d9496649af9e425;p=pspp-builds.git Added tests for LOOP and SAMPLE commands --- diff --git a/tests/Makefile.am b/tests/Makefile.am index 906e26d5..60f81fce 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,8 +1,5 @@ ## Process this file with automake to produce Makefile.in -*- makefile -*- -bench: - make BENCHMARK=1 check - TESTS_ENVIRONMENT=top_srcdir=${top_srcdir} TESTS = command/aggregate.sh \ command/autorecod.sh \ @@ -12,7 +9,9 @@ TESTS = command/aggregate.sh \ command/descriptives.sh \ command/flip.sh \ command/lag.sh \ + command/loop.sh \ command/print.sh \ + command/sample.sh \ command/sort.sh \ command/tabs.sh \ command/split-file.sh \ @@ -26,19 +25,16 @@ noinst_DATA = sort.data sort.data: gengarbage$(EXTEXT) ./gengarbage | head -1000 > $@ -EXTRA_DIST = bignum.data \ -bignum.stat compute.stat count.stat crosstabs.stat data-fmts.stat \ -data-list.data data-list.stat descript.stat do-if.stat do-repeat.stat \ -expr.stat file-lab.stat filter.stat flip.stat gengarbage.c \ -inpt-pgm.stat lag.stat list.data list.stat loop.stat mtch-file.stat \ -means.stat mdfy-vars.stat print.stat pcs-if.stat recode.stat \ -repeating.stat reread.data reread.stat sample.stat sort.stat \ -splt-file.stat sys-info.stat t-test.stat tabs.stat temporary.stat \ +EXTRA_DIST = \ +compute.stat crosstabs.stat data-fmts.stat \ +data-list.data data-list.stat do-if.stat do-repeat.stat \ +expr.stat file-lab.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 \ +repeating.stat reread.data reread.stat \ +sys-info.stat t-test.stat temporary.stat \ time-date.stat vector.stat weighting.data weighting.stat $(TESTS) -dist-hook: - cp -rp $(srcdir)/expect $(distdir) - DISTCLEANFILES = *.save sort.data pspp.* foo* msgs *.actual MAINTAINERCLEANFILES = Makefile.in diff --git a/tests/command/loop.sh b/tests/command/loop.sh new file mode 100755 index 00000000..474c8994 --- /dev/null +++ b/tests/command/loop.sh @@ -0,0 +1,93 @@ +#!/bin/sh + +# This program tests the LOOP 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 prog" +cat > $TEMPDIR/loop.stat < $TEMPDIR/stdout +if [ $? -ne 0 ] ; then no_result ; fi + +activity="compare stdout" +diff -B -b $TEMPDIR/stdout - < $TEMPDIR/print.stat < $TEMPDIR/print.stat << foobar title 'Test PRINT transformation'. remark EOF @@ -81,7 +81,7 @@ data list list table file='$TEMPDIR/data-list.data'/A B C D. print table/A B C D. list. -EOF_print +foobar if [ $? -ne 0 ] ; then no_result ; fi @@ -109,7 +109,6 @@ $TEMPDIR/data-list.data:6: warning: LIST: Missing value(s) for all variables fro EOF if [ $? -ne 0 ] ; then fail ; fi -cp $TEMPDIR/pspp.list /tmp/out activity="compare output" diff -b -B $TEMPDIR/pspp.list - << EOF ---------------------------------------------------------------------- diff --git a/tests/command/sample.sh b/tests/command/sample.sh index 59989271..b5ab80e7 100755 --- a/tests/command/sample.sh +++ b/tests/command/sample.sh @@ -48,7 +48,7 @@ cd $TEMPDIR activity="create program" cat > $TEMPDIR/sample.stat <