## 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 \
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 \
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
--- /dev/null
+#!/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 <<EOF
+data list /x 1 y 2 z 3.
+begin data.
+125
+256
+397
+401
+end data.
+loop i=y to z by abs(z-y)/(z-y).
+print /x i.
+break. /* Generates warning.
+end loop.
+execute.
+EOF
+if [ $? -ne 0 ] ; then no_result ; fi
+
+activity="run program"
+$here/../src/pspp --testing-mode -o raw-ascii $TEMPDIR/loop.stat > $TEMPDIR/stdout
+if [ $? -ne 0 ] ; then no_result ; fi
+
+activity="compare stdout"
+diff -B -b $TEMPDIR/stdout - <<EOF
+$TEMPDIR/loop.stat:10: warning: BREAK: BREAK not enclosed in DO IF structure.
+EOF
+if [ $? -ne 0 ] ; then fail ; fi
+
+activity="compare results"
+diff -B -b $TEMPDIR/pspp.list - <<EOF
+1.1 DATA LIST. Reading 1 record from the command file.
++--------+------+-------+------+
+|Variable|Record|Columns|Format|
+#========#======#=======#======#
+|X | 1| 1- 1|F1.0 |
+|Y | 1| 2- 2|F1.0 |
+|Z | 1| 3- 3|F1.0 |
++--------+------+-------+------+
+1 2.00
+2 5.00
+3 9.00
+4 .00
+EOF
+if [ $? -ne 0 ] ; then fail ; fi
+
+
+pass;
activity="create program"
-cat > $TEMPDIR/print.stat <<EOF_print
+cat > $TEMPDIR/print.stat << foobar
title 'Test PRINT transformation'.
remark EOF
print table/A B C D.
list.
-EOF_print
+foobar
if [ $? -ne 0 ] ; then no_result ; fi
EOF
if [ $? -ne 0 ] ; then fail ; fi
-cp $TEMPDIR/pspp.list /tmp/out
activity="compare output"
diff -b -B $TEMPDIR/pspp.list - << EOF
----------------------------------------------------------------------
activity="create program"
cat > $TEMPDIR/sample.stat <<EOF
-set seed=2
+set seed=3
data list /a 1-2.
begin data.
10
end data.
sample .5.
-n 5.
list.
EOF
if [ $? -ne 0 ] ; then no_result ; fi
-$here/../src/pspp -o raw-ascii $TEMPDIR/sample.stat
-if [ $? -ne 0 ] ; then fail ; fi
-
-fail
+activity="run program"
+$here/../src/pspp -o raw-ascii --testing-mode $TEMPDIR/sample.stat
+if [ $? -ne 0 ] ; then no_result ; fi
+activity="compare results"
+diff -B -b $TEMPDIR/pspp.list - << EOF
+1.1 DATA LIST. Reading 1 record from the command file.
++--------+------+-------+------+
+|Variable|Record|Columns|Format|
+#========#======#=======#======#
+|A | 1| 1- 2|F2.0 |
++--------+------+-------+------+
+
+ A
+--
+ 2
+ 6
+ 9
+10
+EOF
+if [ $? -ne 0 ] ; then fail ; fi
pass;
+++ /dev/null
-title 'Test LOOP procedure'.
-
-data list /x 1 y 2 z 3.
-begin data.
-125
-256
-397
-401
-end data.
-loop i=y to z by abs(z-y)/(z-y).
-print /x i.
-break. /* Generates warning.
-end loop.
-execute.
+++ /dev/null
-
-set seed=2
-data list /a 1-2.
-begin data.
-1
-2
-3
-4
-5
-6
-7
-8
-9
-10
-end data.
-
-sample .5 .
-list.