- Add test for compute heap munching bug (compute a=upcase(a)) where a is a
authorpjk <pjk>
Wed, 28 Apr 2004 16:03:45 +0000 (16:03 +0000)
committerpjk <pjk>
Wed, 28 Apr 2004 16:03:45 +0000 (16:03 +0000)
  large string

tests/Makefile.am
tests/bugs/computebug.out [new file with mode: 0644]
tests/bugs/computebug.sh [new file with mode: 0755]
tests/bugs/computebug.stat [new file with mode: 0644]

index 55c4e4999274cd23339bdcd4cdc261f427be0d09..8020127f0297e81a0941c15439bbf5c3034a3b5e 100644 (file)
@@ -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 (file)
index 0000000..59d93d0
--- /dev/null
@@ -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 (executable)
index 0000000..ecc6cb4
--- /dev/null
@@ -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 (file)
index 0000000..e308301
--- /dev/null
@@ -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.
+
+