From c912ba11ed1d84c40085177439ac7086f2a43b20 Mon Sep 17 00:00:00 2001 From: pjk Date: Wed, 28 Apr 2004 16:03:45 +0000 Subject: [PATCH] - Add test for compute heap munching bug (compute a=upcase(a)) where a is a large string --- tests/Makefile.am | 1 + tests/bugs/computebug.out | 13 ++++++++ tests/bugs/computebug.sh | 62 ++++++++++++++++++++++++++++++++++++++ tests/bugs/computebug.stat | 14 +++++++++ 4 files changed, 90 insertions(+) create mode 100644 tests/bugs/computebug.out create mode 100755 tests/bugs/computebug.sh create mode 100644 tests/bugs/computebug.stat diff --git a/tests/Makefile.am b/tests/Makefile.am index 55c4e499..8020127f 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -46,6 +46,7 @@ TESTS = \ bugs/temporary.sh \ bugs/val-labs.sh \ bugs/recode-copy-bug.sh \ + bugs/computebug.sh \ xforms/casefile.sh \ xforms/expressions.sh \ stats/descript-basic.sh \ diff --git a/tests/bugs/computebug.out b/tests/bugs/computebug.out new file mode 100644 index 00000000..59d93d06 --- /dev/null +++ b/tests/bugs/computebug.out @@ -0,0 +1,13 @@ +1.1 DATA LIST. Reading free-form data from the command file. ++--------+------+ +|Variable|Format| +#========#======# +|A |A161 | +|B |A3 | ++--------+------+ + + A B +----------------------------------------------------------------------------------------------------------------------------------------------------------------- --- +ABC def +GHI jkl + diff --git a/tests/bugs/computebug.sh b/tests/bugs/computebug.sh new file mode 100755 index 00000000..ecc6cb4e --- /dev/null +++ b/tests/bugs/computebug.sh @@ -0,0 +1,62 @@ +#!/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 +cp $top_srcdir/tests/bugs/computebug.stat $TEMPDIR +cd $TEMPDIR + + +if [ $? -ne 0 ] ; then no_result ; fi + + +activity="run program" +$SUPERVISOR $top_srcdir/src/pspp -o raw-ascii $TEMPDIR/computebug.stat +if [ $? -ne 0 ] ; then no_result ; fi + + +activity="compare output" +diff -b -B -w $TEMPDIR/pspp.list $top_srcdir/tests/bugs/computebug.out + +if [ $? -ne 0 ] ; then fail ; fi + +pass; diff --git a/tests/bugs/computebug.stat b/tests/bugs/computebug.stat new file mode 100644 index 00000000..e308301c --- /dev/null +++ b/tests/bugs/computebug.stat @@ -0,0 +1,14 @@ +DATA LIST LIST + /A (A161) + B (A3). + +BEGIN DATA +abc def +ghi jkl +END DATA. + +COMPUTE A=upcase(A). +EXECUTE. +LIST. + + -- 2.30.2