command/compute.sh \
command/descriptives.sh \
command/file-label.sh \
+ command/filter.sh \
command/flip.sh \
command/lag.sh \
command/list.sh \
sort.data: gengarbage$(EXTEXT)
./gengarbage | head -1000 > $@
-EXTRA_DIST = \
-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 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)
+EXTRA_DIST = $(TESTS)
DISTCLEANFILES = *.save sort.data pspp.* foo* msgs *.actual
--- /dev/null
+#!/bin/sh
+
+# This program tests ....
+
+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/filter.stat << EOF
+data list notable /x 1-2.
+begin data.
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+end data.
+compute filter_$ = mod(x,2).
+
+filter by filter_$.
+list.
+filter off.
+list.
+compute filter_$ = 1 - filter_$.
+filter by filter_$.
+list.
+
+EOF
+if [ $? -ne 0 ] ; then no_result ; fi
+
+
+activity="run program"
+$here/../src/pspp --testing-mode -o raw-ascii $TEMPDIR/filter.stat
+if [ $? -ne 0 ] ; then no_result ; fi
+
+
+activity="check results"
+diff -B -b $TEMPDIR/pspp.list - << EOF
+ X FILTER_$
+-- --------
+ 1 1.00
+ 3 1.00
+ 5 1.00
+ 7 1.00
+ 9 1.00
+
+ X FILTER_$
+-- --------
+ 1 1.00
+ 2 .00
+ 3 1.00
+ 4 .00
+ 5 1.00
+ 6 .00
+ 7 1.00
+ 8 .00
+ 9 1.00
+10 .00
+
+ X FILTER_$
+-- --------
+ 2 1.00
+ 4 1.00
+ 6 1.00
+ 8 1.00
+10 1.00
+
+EOF
+if [ $? -ne 0 ] ; then fail ; fi
+
+pass;
--- /dev/null
+#!/bin/sh
+
+# This program tests the SYSFILE INFO 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 1"
+cat > $TEMPDIR/save.stat << EOF
+data list /x 1-2.
+begin data.
+3
+34
+2
+98
+end data.
+save 'foo.save'.
+display $JDATE.
+finish.
+EOF
+if [ $? -ne 0 ] ; then no_result ; fi
+cp $TEMPDIR/pspp.list /tmp/bar
+
+activity="run program 1"
+$here/../src/pspp --testing-mode -o raw-ascii $TEMPDIR/save.stat
+if [ $? -ne 0 ] ; then no_result ; fi
+
+activity="create program 2"
+cat > $TEMPDIR/read.stat << EOF
+sysfile info file='foo.save'.
+
+finish.
+EOF
+if [ $? -ne 0 ] ; then no_result ; fi
+
+activity="run program 2"
+$here/../src/pspp --testing-mode -o raw-ascii $TEMPDIR/read.stat
+if [ $? -ne 0 ] ; then no_result ; fi
+
+
+activity="compare output"
+diff -B -b $TEMPDIR/pspp.list - << EOF
+1.1 SYSFILE INFO.
+File: $TEMPDIR/foo.save
+Label: No label.
+Created: 18 Dec 03 09:05:20 by GNU pspp 0.3.1 - i686-pc-cygwin
+Endian: Little.
+Variables: 1
+Cases: 4
+Type: System File.
+Weight: Not weighted.
+Mode: Compression on.
++--------+-------------+---+
+|Variable|Description |Pos|
+| | |iti|
+| | |on |
+#========#=============#===#
+|X |Format: F2.0 | 1|
++--------+-------------+---+
+EOF
+if [ $? -ne 0 ] ; then fail ; fi
+
+
+pass;
+++ /dev/null
-title 'Test FILTER'.
-
-data list /x 1-2.
-begin data.
-1
-2
-3
-4
-5
-6
-7
-8
-9
-10
-end data.
-compute filter_$ = mod(x,2).
-filter by filter_$.
-list.
-compute filter_$ = 1 - filter_$.
-list.
-