From d781f450096059a2ae52da5749078e68661b9c91 Mon Sep 17 00:00:00 2001 From: pjk Date: Fri, 23 Apr 2004 18:44:42 +0000 Subject: [PATCH] Add test for bug fixed recently in recode --- tests/Makefile.am | 83 +++++++++---------------------- tests/bugs/recode-copy-bug-1.out | 14 ++++++ tests/bugs/recode-copy-bug-1.stat | 17 +++++++ tests/bugs/recode-copy-bug-2.out | 14 ++++++ tests/bugs/recode-copy-bug-2.stat | 16 ++++++ tests/bugs/recode-copy-bug.sh | 75 ++++++++++++++++++++++++++++ 6 files changed, 159 insertions(+), 60 deletions(-) create mode 100644 tests/bugs/recode-copy-bug-1.out create mode 100644 tests/bugs/recode-copy-bug-1.stat create mode 100644 tests/bugs/recode-copy-bug-2.out create mode 100644 tests/bugs/recode-copy-bug-2.stat create mode 100755 tests/bugs/recode-copy-bug.sh diff --git a/tests/Makefile.am b/tests/Makefile.am index 9238ee69..4f2e7560 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -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 index 00000000..961a79bd --- /dev/null +++ b/tests/bugs/recode-copy-bug-1.out @@ -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 index 00000000..c493a151 --- /dev/null +++ b/tests/bugs/recode-copy-bug-1.stat @@ -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 index 00000000..af6810fb --- /dev/null +++ b/tests/bugs/recode-copy-bug-2.out @@ -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 index 00000000..ddb37e02 --- /dev/null +++ b/tests/bugs/recode-copy-bug-2.stat @@ -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 index 00000000..94d92642 --- /dev/null +++ b/tests/bugs/recode-copy-bug.sh @@ -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; -- 2.30.2