X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=tests%2Fcommand%2Floop.sh;h=813777f4acea547542e62ce827faecb439877bac;hb=375a1fd3adcb23eb83ed6a6317ce0526f43964b3;hp=15f43ec738d7914a71f7a22dfc815b73814ff455;hpb=c48bf64ab648b9b761a8e0774db3672d8009c64c;p=pspp-builds.git diff --git a/tests/command/loop.sh b/tests/command/loop.sh index 15f43ec7..813777f4 100755 --- a/tests/command/loop.sh +++ b/tests/command/loop.sh @@ -3,17 +3,31 @@ # This program tests the LOOP command TEMPDIR=/tmp/pspp-tst-$$ +TESTFILE=$TEMPDIR/`basename $0`.sps -here=`pwd`; +# ensure that top_builddir are absolute +if [ -z "$top_builddir" ] ; then top_builddir=. ; fi +if [ -z "$top_srcdir" ] ; then top_srcdir=. ; fi +top_builddir=`cd $top_builddir; pwd` +PSPP=$top_builddir/src/ui/terminal/pspp # ensure that top_srcdir is absolute -cd $top_srcdir; top_srcdir=`pwd` +top_srcdir=`cd $top_srcdir; pwd` -export STAT_CONFIG_PATH=$top_srcdir/config +STAT_CONFIG_PATH=$top_srcdir/config +export STAT_CONFIG_PATH + +LANG=C +export LANG cleanup() { + if [ x"$PSPP_TEST_NO_CLEANUP" != x ] ; then + echo "NOT cleaning $TEMPDIR" + return ; + fi + cd / rm -rf $TEMPDIR } @@ -47,45 +61,163 @@ cd $TEMPDIR activity="create prog" cat > $TEMPDIR/loop.stat < y. +print/'--------'. +execute. + +echo 'Loop with index and IF condition based on index'. +loop #m=x to y by z if #m < 4. +print /#m. +end loop. +print/'--------'. +execute. + +echo 'Loop with index and END IF condition based on index'. +loop #n=x to y by z. +print /#n. +end loop if #n >= 4. +print/'--------'. +execute. + +echo 'Loop with index and IF and END IF condition based on index'. +loop #o=x to y by z if mod(#o,2) = 0. +print /#o. +end loop if #o >= 4. +print/'--------'. +execute. + +echo 'Loop with no conditions'. +set mxloops = 2. +compute #p = x. +loop. +print /#p. +compute #p = #p + z. +do if #p >= y. +break. +end if. end loop. +print/'--------'. execute. EOF if [ $? -ne 0 ] ; then no_result ; fi activity="run program" -$SUPERVISOR $here/../src/pspp --testing-mode -o raw-ascii $TEMPDIR/loop.stat > $TEMPDIR/stdout +$SUPERVISOR $PSPP --testing-mode -e $TEMPDIR/stdout $TEMPDIR/loop.stat if [ $? -ne 0 ] ; then no_result ; fi activity="compare stdout" -diff -B -b $TEMPDIR/stdout - <