3 # This program tests the LOOP command
5 TEMPDIR=/tmp/pspp-tst-$$
6 TESTFILE=$TEMPDIR/`basename $0`.sps
8 # ensure that top_builddir are absolute
9 if [ -z "$top_builddir" ] ; then top_builddir=. ; fi
10 if [ -z "$top_srcdir" ] ; then top_srcdir=. ; fi
11 top_builddir=`cd $top_builddir; pwd`
12 PSPP=$top_builddir/src/ui/terminal/pspp
14 # ensure that top_srcdir is absolute
15 top_srcdir=`cd $top_srcdir; pwd`
17 STAT_CONFIG_PATH=$top_srcdir/config
18 export STAT_CONFIG_PATH
26 if [ x"$PSPP_TEST_NO_CLEANUP" != x ] ; then
27 echo "NOT cleaning $TEMPDIR"
62 activity="create prog"
63 cat > $TEMPDIR/loop.stat <<EOF
64 data list notable /x 1 y 2 z 3.
72 echo 'Loop with index'.
79 echo 'Loop with IF condition'.
88 echo 'Loop with END IF condition'.
97 echo 'Loop with index and IF condition based on index'.
98 loop #m=x to y by z if #m < 4.
104 echo 'Loop with index and END IF condition based on index'.
111 echo 'Loop with index and IF and END IF condition based on index'.
112 loop #o=x to y by z if mod(#o,2) = 0.
118 echo 'Loop with no conditions'.
131 if [ $? -ne 0 ] ; then no_result ; fi
133 activity="run program"
134 $SUPERVISOR $PSPP --testing-mode -e $TEMPDIR/stdout $TEMPDIR/loop.stat
135 if [ $? -ne 0 ] ; then no_result ; fi
137 activity="compare stdout"
138 perl -pi -e 's/^\s*$//g' $TEMPDIR/stdout
139 diff -b $TEMPDIR/stdout - <<EOF
141 if [ $? -ne 0 ] ; then fail ; fi
143 activity="compare results"
144 diff -c $TEMPDIR/pspp.csv - <<EOF
169 Loop with IF condition
193 Loop with END IF condition
219 Loop with index and IF condition based on index
237 Loop with index and END IF condition based on index
259 Loop with index and IF and END IF condition based on index
273 Loop with no conditions
295 if [ $? -ne 0 ] ; then fail ; fi