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
58 activity="create prog"
59 cat > $TEMPDIR/loop.stat <<EOF
60 data list /X 1 Y 2 ZOOLOGICAL 3.
67 loop iterative_Variable=y to zoological by abs(zoological-y)/(zoological-y).
68 print /x iterative_Variable.
69 break. /* Generates warning.
73 if [ $? -ne 0 ] ; then no_result ; fi
75 activity="run program"
76 $SUPERVISOR $PSPP --testing-mode -o raw-ascii -e $TEMPDIR/stdout $TEMPDIR/loop.stat
77 if [ $? -ne 0 ] ; then no_result ; fi
79 activity="compare stdout"
80 perl -pi -e 's/^\s*$//g' $TEMPDIR/stdout
81 diff -b $TEMPDIR/stdout - <<EOF
83 if [ $? -ne 0 ] ; then fail ; fi
85 activity="compare results"
86 perl -pi -e 's/^\s*$//g' $TEMPDIR/pspp.list
87 diff -b $TEMPDIR/pspp.list - <<EOF
88 1.1 DATA LIST. Reading 1 record from INLINE.
89 +----------+------+-------+------+
90 | Variable |Record|Columns|Format|
91 #==========#======#=======#======#
94 |ZOOLOGICAL| 1| 3- 3|F1.0 |
95 +----------+------+-------+------+
101 if [ $? -ne 0 ] ; then fail ; fi