Add test for bug fixed recently in recode
authorpjk <pjk>
Fri, 23 Apr 2004 18:44:42 +0000 (18:44 +0000)
committerpjk <pjk>
Fri, 23 Apr 2004 18:44:42 +0000 (18:44 +0000)
tests/Makefile.am
tests/bugs/recode-copy-bug-1.out [new file with mode: 0644]
tests/bugs/recode-copy-bug-1.stat [new file with mode: 0644]
tests/bugs/recode-copy-bug-2.out [new file with mode: 0644]
tests/bugs/recode-copy-bug-2.stat [new file with mode: 0644]
tests/bugs/recode-copy-bug.sh [new file with mode: 0755]

index 9238ee691c1f06c60855c2a2d4a568f32fc1cbbc..4f2e7560cb0d3cc07889ae1eee982e014b29fb0f 100644 (file)
@@ -1,67 +1,30 @@
 ## Process this file with automake to produce Makefile.in  -*- makefile -*-
 
-TESTS_ENVIRONMENT=top_srcdir=${top_srcdir}
-TESTS = \
-       command/aggregate.sh \
-       command/autorecod.sh \
-       command/beg-data.sh \
-       command/bignum.sh \
-       command/count.sh \
-       command/erase.sh \
-       command/file-label.sh \
-       command/filter.sh \
-       command/flip.sh \
-       command/lag.sh \
-       command/list.sh \
-       command/loop.sh \
-       command/print.sh \
-       command/sample.sh \
-       command/sort.sh \
-       command/split-file.sh \
-       command/t-test-1-indep-val.sh \
-       command/t-test-1-sample-missing-anal.sh \
-       command/t-test-1-sample-missing-list.sh \
-       command/t-test-1s.sh \
-       command/t-test-groups.sh \
-       command/t-test-indep-missing-anal.sh \
-       command/t-test-indep-missing-list.sh \
-       command/t-test-paired-missing-anal.sh \
-       command/t-test-paired-missing-list.sh \
-       command/t-test-pairs.sh \
-       command/tabs.sh \
-       command/use.sh \
-       command/weight.sh \
-       bugs/alpha-freq.sh \
-       bugs/comment-at-eof.sh \
-       bugs/compute-fmt.sh \
-       bugs/crosstabs.sh \
-       bugs/data-crash.sh \
-       bugs/double-frequency.sh \
-       bugs/get.sh \
-       bugs/html-frequency.sh \
-       bugs/multipass.sh \
-       bugs/random.sh \
-       bugs/t-test-with-temp.sh \
-       bugs/t-test.sh \
-       bugs/temporary.sh \
-       bugs/val-labs.sh \
-       xforms/casefile.sh \
-       xforms/expressions.sh \
-       stats/descript-basic.sh \
-       stats/descript-missing.sh \
-       stats/descript-mean-bug.sh \
-       stats/moments.sh \
-       stats/percentiles-compatible.sh \
-       stats/percentiles-enhanced.sh
+AUTOMAKE_OPTIONS = gnits 1.7
 
-noinst_PROGRAMS = gengarbage
+SUBDIRS = m4 intl doc lib src po config tests 
 
-noinst_DATA = sort.data
-sort.data: gengarbage$(EXTEXT)
-       ./gengarbage | head -1000 > $@
+pkgdocdir = $(prefix)/doc/@PACKAGE@
+pkgdoc_DATA = NEWS README TODO
+noinst_DATA = AUTHORS THANKS
 
-EXTRA_DIST = $(TESTS) weighting.data data-list.data list.data
+DISTCLEANFILES = pref.h
 
-DISTCLEANFILES = *.save sort.data pspp.* foo* msgs *.actual
+dist-hook:
+       cp -rp $(top_srcdir)/examples $(distdir)
 
-MAINTAINERCLEANFILES = Makefile.in
+# A `private installation' in my terms is just having the appropriate
+# configuration files in ~/.pspp instead of a global configuration
+# location.  So I let those files be installed automatically.
+
+private-install:
+       $(MAKE) private-install -C config
+private-uninstall:
+       $(MAKE) private-uninstall -C config
+
+EXTRA_DIST = mkinstalldirs  config.rpath  NEWS ONEWS TODO pref.h.orig configure
+
+MAINTAINERCLEANFILES = Makefile.in aclocal.m4 
+
+
+ACLOCAL_AMFLAGS = -I m4
diff --git a/tests/bugs/recode-copy-bug-1.out b/tests/bugs/recode-copy-bug-1.out
new file mode 100644 (file)
index 0000000..961a79b
--- /dev/null
@@ -0,0 +1,14 @@
+1.1 DATA LIST.  Reading free-form data from the command file.
++--------+------+
+|Variable|Format|
+#========#======#
+|A       |A1    |
+|B       |A1    |
++--------+------+
+
+A B
+- -
+3 2 
+2 3 
+1 4 
+
diff --git a/tests/bugs/recode-copy-bug-1.stat b/tests/bugs/recode-copy-bug-1.stat
new file mode 100644 (file)
index 0000000..c493a15
--- /dev/null
@@ -0,0 +1,17 @@
+TITLE 'Test for regression of recode COPY bug'
+
+DATA LIST LIST
+ /A (A1)
+ B (A1).
+
+BEGIN DATA
+1     2
+2     3
+3     4
+END DATA.
+
+** Clearly, the else=copy is superfluous here
+RECODE A ("1"="3") ("3"="1") (ELSE=COPY).
+EXECUTE.
+LIST.
+
diff --git a/tests/bugs/recode-copy-bug-2.out b/tests/bugs/recode-copy-bug-2.out
new file mode 100644 (file)
index 0000000..af6810f
--- /dev/null
@@ -0,0 +1,14 @@
+1.1 DATA LIST.  Reading free-form data from the command file.
++--------+------+
+|Variable|Format|
+#========#======#
+|A       |A1    |
+|B       |A1    |
++--------+------+
+
+A B A1
+- - --
+1 2  3 
+2 3  2 
+3 4  1 
+
diff --git a/tests/bugs/recode-copy-bug-2.stat b/tests/bugs/recode-copy-bug-2.stat
new file mode 100644 (file)
index 0000000..ddb37e0
--- /dev/null
@@ -0,0 +1,16 @@
+DATA LIST LIST
+ /A (A1)
+ B (A1).
+
+BEGIN DATA
+1     2
+2     3
+3     4
+END DATA.
+
+STRING a1 (A1).
+RECODE A ("1"="3") ("3"="1") (ELSE=COPY) INTO a1.
+EXECUTE.
+LIST.
+
+
diff --git a/tests/bugs/recode-copy-bug.sh b/tests/bugs/recode-copy-bug.sh
new file mode 100755 (executable)
index 0000000..94d9264
--- /dev/null
@@ -0,0 +1,75 @@
+#!/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/recode-copy-bug-1.stat $TEMPDIR
+cp $top_srcdir/tests/bugs/recode-copy-bug-2.stat $TEMPDIR
+cd $TEMPDIR
+
+
+if [ $? -ne 0 ] ; then no_result ; fi
+
+
+activity="run program"
+$SUPERVISOR $top_srcdir/src/pspp -o raw-ascii $TEMPDIR/recode-copy-bug-1.stat
+if [ $? -ne 0 ] ; then no_result ; fi
+
+
+activity="compare output"
+diff -b -B -w $TEMPDIR/pspp.list $top_srcdir/tests/bugs/recode-copy-bug-1.out
+
+if [ $? -ne 0 ] ; then fail ; fi
+
+
+activity="run program"
+$SUPERVISOR $top_srcdir/src/pspp -o raw-ascii $TEMPDIR/recode-copy-bug-2.stat
+if [ $? -ne 0 ] ; then no_result ; fi
+
+
+activity="compare output"
+diff -b -B -w $TEMPDIR/pspp.list $top_srcdir/tests/bugs/recode-copy-bug-2.out
+
+if [ $? -ne 0 ] ; then fail ; fi
+
+
+pass;