From: Ben Pfaff Date: Sun, 7 Jun 2009 04:04:21 +0000 (-0700) Subject: crosstabs: Fix chi-square display and add regression test. X-Git-Tag: v0.7.3~54 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=75a44b28768f03ff9774fd9252d1e0f5051f13ea;p=pspp-builds.git crosstabs: Fix chi-square display and add regression test. Bug #26739. --- diff --git a/src/language/stats/crosstabs.q b/src/language/stats/crosstabs.q index e732c4a0..70bbe5cc 100644 --- a/src/language/stats/crosstabs.q +++ b/src/language/stats/crosstabs.q @@ -993,22 +993,22 @@ output_pivot_table (struct crosstabs_proc *proc, struct pivot_table *pt) if (chisq) { display_dimensions (proc, &x, chisq, first_difference); - display_chisq (pt, chisq, &showed_fisher); + display_chisq (&x, chisq, &showed_fisher); } if (sym) { display_dimensions (proc, &x, sym, first_difference); - display_symmetric (proc, pt, sym); + display_symmetric (proc, &x, sym); } if (risk) { display_dimensions (proc, &x, risk, first_difference); - display_risk (pt, risk); + display_risk (&x, risk); } if (direct) { display_dimensions (proc, &x, direct, first_difference); - display_directional (proc, pt, direct); + display_directional (proc, &x, direct); } /* Free the parts of x that are not owned by pt. In diff --git a/tests/automake.mk b/tests/automake.mk index 7dda26df..0fa61752 100644 --- a/tests/automake.mk +++ b/tests/automake.mk @@ -107,6 +107,7 @@ dist_TESTS = \ tests/bugs/compute-fmt.sh \ tests/bugs/compression.sh \ tests/bugs/crosstabs.sh \ + tests/bugs/crosstabs2.sh \ tests/bugs/crosstabs-crash.sh \ tests/bugs/crosstabs-crash2.sh \ tests/bugs/curtailed.sh \ diff --git a/tests/bugs/crosstabs2.sh b/tests/bugs/crosstabs2.sh new file mode 100755 index 00000000..3e662998 --- /dev/null +++ b/tests/bugs/crosstabs2.sh @@ -0,0 +1,132 @@ +#!/bin/sh + +# This program tests for bug #26739, which caused CROSSTABS to crash +# or to fail to output chi-square results. + +TEMPDIR=/tmp/pspp-tst-$$ +TESTFILE=$TEMPDIR/`basename $0`.sps + +# 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 +top_srcdir=`cd $top_srcdir; pwd` + +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 +} + + +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 + +cd $TEMPDIR + +activity="create program" +cat > $TESTFILE <