tests/bugs/comment-at-eof.sh \
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 \
tests/bugs/data-crash.sh \
tests/bugs/double-frequency.sh \
$(TESTSUITE)
TESTSUITE_AT = \
tests/testsuite.at \
+ tests/language/stats/crosstabs.at \
tests/output/render.at
TESTSUITE = $(srcdir)/tests/testsuite
DISTCLEANFILES += tests/atconfig tests/atlocal $(TESTSUITE)
CHECK_LOCAL += tests_check
tests_check: tests/atconfig tests/atlocal $(TESTSUITE)
- $(SHELL) '$(TESTSUITE)' -C tests AUTOTEST_PATH=tests/output $(TESTSUITEFLAGS)
+ $(SHELL) '$(TESTSUITE)' -C tests AUTOTEST_PATH=tests/output:src/ui/terminal $(TESTSUITEFLAGS)
CLEAN_LOCAL += tests_clean
tests_clean:
+++ /dev/null
-#!/bin/sh
-
-# This program tests for a bug which caused CROSSTABS to crash in
-# integer mode.
-
-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 <<EOF
-DATA LIST LIST /A * B * X * Y * .
-BEGIN DATA.
-2 3 4 5
-END DATA.
-
-CROSSTABS VARIABLES X (1,7) Y (1,7) /TABLES X BY Y.
-EOF
-if [ $? -ne 0 ] ; then no_result ; fi
-
-$SUPERVISOR $PSPP -o pspp.csv $TESTFILE
-if [ $? -ne 0 ] ; then no_result ; fi
-
-
-diff -c $TEMPDIR/pspp.csv - << EOF
-Table: Reading free-form data from INLINE.
-Variable,Format
-A,F8.0
-B,F8.0
-X,F8.0
-Y,F8.0
-
-Table: Summary.
-,Cases,,,,,
-,Valid,,Missing,,Total,
-,N,Percent,N,Percent,N,Percent
-X * Y,1,100.0%,0,0.0%,1,100.0%
-
-Table: X * Y [count].
-,Y,,,,,,,
-X,1.00,2.00,3.00,4.00,5.00,6.00,7.00,Total
-1.00,.0,.0,.0,.0,.0,.0,.0,.0
-2.00,.0,.0,.0,.0,.0,.0,.0,.0
-3.00,.0,.0,.0,.0,.0,.0,.0,.0
-4.00,.0,.0,.0,.0,1.0,.0,.0,1.0
-5.00,.0,.0,.0,.0,.0,.0,.0,.0
-6.00,.0,.0,.0,.0,.0,.0,.0,.0
-7.00,.0,.0,.0,.0,.0,.0,.0,.0
-Total,.0,.0,.0,.0,1.0,.0,.0,1.0
-EOF
-if [ $? -ne 0 ] ; then fail ; fi
-
-pass;
+++ /dev/null
-#!/bin/sh
-
-# This program tests for bug #22037, which caused CROSSTABS to crash.
-
-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 <<EOF
-data list list /x * y (a18).
-
-begin data.
-
- 1. 'zero none'
-
-1 'one unity'
-2 'two duality'
-3 'three lots'
-end data.
-
-CROSSTABS /TABLES = x BY y.
-EOF
-if [ $? -ne 0 ] ; then no_result ; fi
-
-$SUPERVISOR $PSPP -o pspp.csv $TESTFILE > /dev/null
-if [ $? -ne 0 ] ; then no_result ; fi
-
-diff -c $TEMPDIR/pspp.csv - << EOF
-Table: Reading free-form data from INLINE.
-Variable,Format
-x,F8.0
-y,A18
-
-"$TEMPDIR/crosstabs-crash2.sh.sps:4: warning: BEGIN DATA: Missing value(s) for all variables from x onward. These will be filled with the system-missing value or blanks, as appropriate."
-
-"$TEMPDIR/crosstabs-crash2.sh.sps:6: warning: BEGIN DATA: Missing value(s) for all variables from x onward. These will be filled with the system-missing value or blanks, as appropriate."
-
-Table: Summary.
-,Cases,,,,,
-,Valid,,Missing,,Total,
-,N,Percent,N,Percent,N,Percent
-x * y,4,66.7%,2,33.3%,6,100.0%
-
-Table: x * y [count].
-,y,,,,
-x,one unity ,three lots ,two duality ,zero none ,Total
-1.00,1.0,.0,.0,1.0,2.0
-2.00,.0,.0,1.0,.0,1.0
-3.00,.0,1.0,.0,.0,1.0
-Total,1.0,1.0,1.0,1.0,4.0
-EOF
-if [ $? -ne 0 ] ; then fail ; fi
-
-pass;
+++ /dev/null
-#!/bin/sh
-
-# This program tests for a bug which crashed pspp when doing a crosstabs
-
-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
-
-
-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 > $TEMPDIR/ct.stat <<EOF
-DATA LIST FIXED
- / x 1-2
- y 3
- z 4.
-
-BEGIN DATA.
-0111
-0222
-0311
-0412
-0521
-0612
-0711
-0811
-0912
-END DATA.
-
-LIST.
-
-
-CROSSTABS TABLES y by z.
-
-EOF
-if [ $? -ne 0 ] ; then no_result ; fi
-
-
-$SUPERVISOR $PSPP -o pspp.csv $TEMPDIR/ct.stat
-if [ $? -ne 0 ] ; then fail ; fi
-
-
-pass;
+++ /dev/null
-#!/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 <<EOF
-DATA LIST LIST /x * y *.
-BEGIN DATA.
-2 2
-3 1
-4 2
-4 1
-END DATA.
-
-CROSSTABS
- /TABLES= x BY y
- /STATISTICS=CHISQ
- .
-EOF
-if [ $? -ne 0 ] ; then no_result ; fi
-
-$SUPERVISOR $PSPP -o pspp.csv $TESTFILE
-if [ $? -ne 0 ] ; then no_result ; fi
-
-
-diff -c $TEMPDIR/pspp.csv - << EOF
-Table: Reading free-form data from INLINE.
-Variable,Format
-x,F8.0
-y,F8.0
-
-Table: Summary.
-,Cases,,,,,
-,Valid,,Missing,,Total,
-,N,Percent,N,Percent,N,Percent
-x * y,4,100.0%,0,0.0%,4,100.0%
-
-Table: x * y [count].
-,y,,
-x,1.00,2.00,Total
-2.00,.0,1.0,1.0
-3.00,1.0,.0,1.0
-4.00,1.0,1.0,2.0
-Total,2.0,2.0,4.0
-
-Table: Chi-square tests.
-Statistic,Value,df,Asymp. Sig. (2-sided)
-Pearson Chi-Square,2.00,2,.37
-Likelihood Ratio,2.77,2,.25
-Linear-by-Linear Association,.27,1,.60
-N of Valid Cases,4,,
-EOF
-if [ $? -ne 0 ] ; then fail ; fi
-
-pass;
--- /dev/null
+AT_BANNER([CROSSTABS procedure])
+
+AT_SETUP([CROSSTABS integer mode crash])
+AT_DATA([crosstabs.sps],
+ [DATA LIST LIST /A * B * X * Y * .
+BEGIN DATA.
+2 3 4 5
+END DATA.
+
+CROSSTABS VARIABLES X (1,7) Y (1,7) /TABLES X BY Y.
+])
+AT_CHECK([pspp -O format=csv crosstabs.sps], [0],
+ [[Table: Reading free-form data from INLINE.
+Variable,Format
+A,F8.0
+B,F8.0
+X,F8.0
+Y,F8.0
+
+Table: Summary.
+,Cases,,,,,
+,Valid,,Missing,,Total,
+,N,Percent,N,Percent,N,Percent
+X * Y,1,100.0%,0,0.0%,1,100.0%
+
+Table: X * Y [count].
+,Y,,,,,,,
+X,1.00,2.00,3.00,4.00,5.00,6.00,7.00,Total
+1.00,.0,.0,.0,.0,.0,.0,.0,.0
+2.00,.0,.0,.0,.0,.0,.0,.0,.0
+3.00,.0,.0,.0,.0,.0,.0,.0,.0
+4.00,.0,.0,.0,.0,1.0,.0,.0,1.0
+5.00,.0,.0,.0,.0,.0,.0,.0,.0
+6.00,.0,.0,.0,.0,.0,.0,.0,.0
+7.00,.0,.0,.0,.0,.0,.0,.0,.0
+Total,.0,.0,.0,.0,1.0,.0,.0,1.0
+]])
+AT_CLEANUP
+
+# Bug #22037.
+AT_SETUP([CROSSTABS long string crash])
+AT_DATA([crosstabs.sps],
+ [data list list /x * y (a18).
+
+begin data.
+
+ 1. 'zero none'
+
+1 'one unity'
+2 'two duality'
+3 'three lots'
+end data.
+
+CROSSTABS /TABLES = x BY y.
+])
+AT_CHECK([pspp -o - -O format=csv crosstabs.sps], [0],
+ [[Table: Reading free-form data from INLINE.
+Variable,Format
+x,F8.0
+y,A18
+
+"crosstabs.sps:4: warning: BEGIN DATA: Missing value(s) for all variables from x onward. These will be filled with the system-missing value or blanks, as appropriate."
+
+"crosstabs.sps:6: warning: BEGIN DATA: Missing value(s) for all variables from x onward. These will be filled with the system-missing value or blanks, as appropriate."
+
+Table: Summary.
+,Cases,,,,,
+,Valid,,Missing,,Total,
+,N,Percent,N,Percent,N,Percent
+x * y,4,66.7%,2,33.3%,6,100.0%
+
+Table: x * y [count].
+,y,,,,
+x,one unity ,three lots ,two duality ,zero none ,Total
+1.00,1.0,.0,.0,1.0,2.0
+2.00,.0,.0,1.0,.0,1.0
+3.00,.0,1.0,.0,.0,1.0
+Total,1.0,1.0,1.0,1.0,4.0
+]])
+AT_CLEANUP
+
+AT_SETUP([CROSSTABS crash])
+AT_DATA([crosstabs.sps],
+ [[DATA LIST FIXED
+ / x 1-2
+ y 3
+ z 4.
+
+BEGIN DATA.
+0111
+0222
+0311
+0412
+0521
+0612
+0711
+0811
+0912
+END DATA.
+
+LIST.
+
+
+CROSSTABS TABLES y by z.
+]])
+AT_CHECK([pspp -O format=csv crosstabs.sps], [0],
+ [[Table: Reading 1 record from INLINE.
+Variable,Record,Columns,Format
+x,1,1- 2,F2.0
+y,1,3- 3,F1.0
+z,1,4- 4,F1.0
+
+Table: Data List
+x,y,z
+1,1,1
+2,2,2
+3,1,1
+4,1,2
+5,2,1
+6,1,2
+7,1,1
+8,1,1
+9,1,2
+
+Table: Summary.
+,Cases,,,,,
+,Valid,,Missing,,Total,
+,N,Percent,N,Percent,N,Percent
+y * z,9,100.0%,0,0.0%,9,100.0%
+
+Table: y * z [count].
+,z,,
+y,1,2,Total
+1,4.0,3.0,7.0
+2,1.0,1.0,2.0
+Total,5.0,4.0,9.0
+]])
+AT_CLEANUP
+
+# Bug #26739, which caused CROSSTABS to crash or to fail to output
+# chi-square results.
+AT_SETUP([CROSSTABS chi-square crash])
+AT_DATA([crosstabs.sps],
+ [[DATA LIST LIST /x * y *.
+BEGIN DATA.
+2 2
+3 1
+4 2
+4 1
+END DATA.
+
+CROSSTABS
+ /TABLES= x BY y
+ /STATISTICS=CHISQ.
+]])
+AT_CHECK([pspp -O format=csv crosstabs.sps], [0],
+ [[Table: Reading free-form data from INLINE.
+Variable,Format
+x,F8.0
+y,F8.0
+
+Table: Summary.
+,Cases,,,,,
+,Valid,,Missing,,Total,
+,N,Percent,N,Percent,N,Percent
+x * y,4,100.0%,0,0.0%,4,100.0%
+
+Table: x * y [count].
+,y,,
+x,1.00,2.00,Total
+2.00,.0,1.0,1.0
+3.00,1.0,.0,1.0
+4.00,1.0,1.0,2.0
+Total,2.0,2.0,4.0
+
+Table: Chi-square tests.
+Statistic,Value,df,Asymp. Sig. (2-sided)
+Pearson Chi-Square,2.00,2,.37
+Likelihood Ratio,2.77,2,.25
+Linear-by-Linear Association,.27,1,.60
+N of Valid Cases,4,,
+]])
+AT_CLEANUP
+
+# Bug #27883.
+AT_SETUP([CROSSTABS crash with SPLIT FILE])
+AT_DATA([crosstabs.sps],
+ [data list notable / v0 to v2 1-6 (A)
+begin data.
+a c e
+a c e
+a c e
+a d e
+a d f
+b d f
+b d f
+b c f
+b d e
+a c f
+end data.
+SORT CASES BY v0.
+SPLIT FILE SEPARATE BY v0.
+
+CROSSTABS
+ /TABLES= v1 BY v2
+ /FORMAT=AVALUE LABELS TABLES PIVOT
+ /STATISTICS=CHISQ
+ /CELLS=COUNT ROW COLUMN TOTAL.
+])
+AT_CHECK([pspp -O format=csv crosstabs.sps], [0],
+ [[Variable,Value,Label
+v0,a ,
+
+Table: Summary.
+,Cases,,,,,
+,Valid,,Missing,,Total,
+,N,Percent,N,Percent,N,Percent
+v1 * v2,6,100.0%,0,0.0%,6,100.0%
+
+"Table: v1 * v2 [count, row %, column %, total %]."
+,v2,,
+v1,e ,f ,Total
+c ,3.0,1.0,4.0
+,75.0%,25.0%,100.0%
+,75.0%,50.0%,66.7%
+,50.0%,16.7%,66.7%
+d ,1.0,1.0,2.0
+,50.0%,50.0%,100.0%
+,25.0%,50.0%,33.3%
+,16.7%,16.7%,33.3%
+Total,4.0,2.0,6.0
+,66.7%,33.3%,100.0%
+,100.0%,100.0%,100.0%
+,66.7%,33.3%,100.0%
+
+Table: Chi-square tests.
+Statistic,Value,df,Asymp. Sig. (2-sided),Exact Sig. (2-sided),Exact Sig. (1-sided)
+Pearson Chi-Square,.38,1,.54,,
+Likelihood Ratio,.37,1,.54,,
+Fisher's Exact Test,,,,1.00,.60
+Continuity Correction,.00,1,1.00,,
+N of Valid Cases,6,,,,
+
+Variable,Value,Label
+v0,b ,
+
+Table: Summary.
+,Cases,,,,,
+,Valid,,Missing,,Total,
+,N,Percent,N,Percent,N,Percent
+v1 * v2,4,100.0%,0,0.0%,4,100.0%
+
+"Table: v1 * v2 [count, row %, column %, total %]."
+,v2,,
+v1,e ,f ,Total
+c ,.0,1.0,1.0
+,.0%,100.0%,100.0%
+,.0%,33.3%,25.0%
+,.0%,25.0%,25.0%
+d ,1.0,2.0,3.0
+,33.3%,66.7%,100.0%
+,100.0%,66.7%,75.0%
+,25.0%,50.0%,75.0%
+Total,1.0,3.0,4.0
+,25.0%,75.0%,100.0%
+,100.0%,100.0%,100.0%
+,25.0%,75.0%,100.0%
+
+Table: Chi-square tests.
+Statistic,Value,df,Asymp. Sig. (2-sided),Exact Sig. (2-sided),Exact Sig. (1-sided)
+Pearson Chi-Square,.44,1,.50,,
+Likelihood Ratio,.68,1,.41,,
+Fisher's Exact Test,,,,1.00,.75
+Continuity Correction,.00,1,1.00,,
+N of Valid Cases,4,,,,
+]])
+AT_CLEANUP
AT_INIT
+m4_include([tests/language/stats/crosstabs.at])
m4_include([tests/output/render.at])