From: Ben Pfaff Date: Tue, 13 Apr 2010 03:55:45 +0000 (-0700) Subject: DESCRIPTIVES: Convert tests to use Autotest. X-Git-Tag: v0.7.5~64 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5f222ad4739550128ce5502b158763bba53bf9bb;p=pspp-builds.git DESCRIPTIVES: Convert tests to use Autotest. --- diff --git a/tests/automake.mk b/tests/automake.mk index 914ff86b..7fb106c6 100644 --- a/tests/automake.mk +++ b/tests/automake.mk @@ -143,9 +143,6 @@ dist_TESTS = \ tests/data/datasheet-test.sh \ tests/libpspp/sparse-xarray-test.sh \ tests/output/paper-size.sh \ - tests/stats/descript-basic.sh \ - tests/stats/descript-missing.sh \ - tests/stats/descript-mean-bug.sh \ tests/stats/moments.sh \ tests/expressions/expressions.sh \ tests/expressions/epoch.sh \ @@ -412,6 +409,7 @@ TESTSUITE_AT = \ tests/testsuite.at \ tests/language/stats/autorecode.at \ tests/language/stats/crosstabs.at \ + tests/language/stats/descriptives.at \ tests/language/stats/frequencies.at \ tests/language/xforms/compute.at \ tests/language/xforms/recode.at \ diff --git a/tests/language/stats/descriptives.at b/tests/language/stats/descriptives.at new file mode 100644 index 00000000..ec05f1b9 --- /dev/null +++ b/tests/language/stats/descriptives.at @@ -0,0 +1,159 @@ +AT_BANNER([DESCRIPTIVES procedure]) + +AT_SETUP([DESCRIPTIVES basics]) +AT_DATA([descriptives.sps], + [title 'Test DESCRIPTIVES procedure'. + +data list / V0 to V16 1-17. +begin data. +12128989012389023 +34128080123890128 +56127781237893217 +78127378123793112 +90913781237892318 +37978547878935789 +52878237892378279 +12377912789378932 +26787654347894348 +29137178947891888 +end data. + +descript all/stat=all/format=serial. +]) +AT_CHECK([pspp -O format=csv descriptives.sps], [0], + [Title: Test DESCRIPTIVES procedure + +Table: Reading 1 record from INLINE. +Variable,Record,Columns,Format +V0,1,1- 1,F1.0 +V1,1,2- 2,F1.0 +V2,1,3- 3,F1.0 +V3,1,4- 4,F1.0 +V4,1,5- 5,F1.0 +V5,1,6- 6,F1.0 +V6,1,7- 7,F1.0 +V7,1,8- 8,F1.0 +V8,1,9- 9,F1.0 +V9,1,10- 10,F1.0 +V10,1,11- 11,F1.0 +V11,1,12- 12,F1.0 +V12,1,13- 13,F1.0 +V13,1,14- 14,F1.0 +V14,1,15- 15,F1.0 +V15,1,16- 16,F1.0 +V16,1,17- 17,F1.0 + +Table: Valid cases = 10; cases with missing value(s) = 0. +Variable,Valid N,Missing N,Mean,S.E. Mean,Std Dev,Variance,Kurtosis,S.E. Kurt,Skewness,S.E. Skew,Range,Minimum,Maximum,Sum +V0,10,0,3.80,.84,2.66,7.07,-.03,1.33,.89,.69,8.00,1.00,9.00,38.00 +V1,10,0,4.60,.96,3.03,9.16,-1.39,1.33,-.03,.69,9.00,.00,9.00,46.00 +V2,10,0,4.10,1.16,3.67,13.43,-2.02,1.33,.48,.69,8.00,1.00,9.00,41.00 +V3,10,0,4.10,.87,2.77,7.66,-2.05,1.33,.42,.69,7.00,1.00,8.00,41.00 +V4,10,0,7.00,.47,1.49,2.22,7.15,1.33,-2.52,.69,5.00,3.00,8.00,70.00 +V5,10,0,4.90,1.03,3.25,10.54,-1.40,1.33,-.20,.69,9.00,.00,9.00,49.00 +V6,10,0,5.90,.80,2.51,6.32,-.29,1.33,-.96,.69,7.00,1.00,8.00,59.00 +V7,10,0,4.70,1.10,3.47,12.01,-1.99,1.33,-.16,.69,9.00,.00,9.00,47.00 +V8,10,0,4.10,1.10,3.48,12.10,-1.93,1.33,.37,.69,9.00,.00,9.00,41.00 +V9,10,0,4.30,.87,2.75,7.57,-.87,1.33,.73,.69,8.00,1.00,9.00,43.00 +V10,10,0,5.50,.85,2.68,7.17,-1.84,1.33,-.33,.69,7.00,2.00,9.00,55.00 +V11,10,0,6.50,.78,2.46,6.06,-1.28,1.33,-.89,.69,6.00,3.00,9.00,65.00 +V12,10,0,7.90,.60,1.91,3.66,5.24,1.33,-2.21,.69,6.00,3.00,9.00,79.00 +V13,10,0,4.30,.99,3.13,9.79,-1.25,1.33,.33,.69,9.00,.00,9.00,43.00 +V14,10,0,3.60,1.01,3.20,10.27,-.96,1.33,.81,.69,9.00,.00,9.00,36.00 +V15,10,0,3.70,.92,2.91,8.46,-1.35,1.33,.71,.69,7.00,1.00,8.00,37.00 +V16,10,0,6.40,.91,2.88,8.27,-1.14,1.33,-.92,.69,7.00,2.00,9.00,64.00 +]) +AT_CLEANUP + +m4_define([DESCRIPTIVES_MISSING_DATA], + [data list notable / V1 TO V3 1-3. +mis val v1 to v3 (1). +begin data. +111 + + 1 +1 1 +112 +123 +234 +end data. +]) + +AT_SETUP([DESCRIPTIVES -- excluding missing data]) +AT_DATA([descriptives.sps], + [DESCRIPTIVES_MISSING_DATA +descript all/stat=all/format=serial. +]) +AT_CHECK([pspp -O format=csv descriptives.sps], [0], + [Table: Valid cases = 7; cases with missing value(s) = 6. +Variable,Valid N,Missing N,Mean,S.E. Mean,Std Dev,Variance,Kurtosis,S.E. Kurt,Skewness,S.E. Skew,Range,Minimum,Maximum,Sum +V1,1,6,2.00,. ,. ,. ,. ,. ,. ,. ,.00,2.00,2.00,2.00 +V2,2,5,2.50,.50,.71,.50,. ,. ,. ,. ,1.00,2.00,3.00,5.00 +V3,3,4,3.00,.58,1.00,1.00,. ,. ,.00,1.22,2.00,2.00,4.00,9.00 +]) +AT_CLEANUP + +AT_SETUP([DESCRIPTIVES -- including missing data]) +AT_DATA([descriptives.sps], + [DESCRIPTIVES_MISSING_DATA +descript all/stat=all/format=serial/missing=include. +]) +AT_CHECK([pspp -O format=csv descriptives.sps], [0], + [Table: Valid cases = 7; cases with missing value(s) = 3. +Variable,Valid N,Missing N,Mean,S.E. Mean,Std Dev,Variance,Kurtosis,S.E. Kurt,Skewness,S.E. Skew,Range,Minimum,Maximum,Sum +V1,5,2,1.20,.20,.45,.20,5.00,2.00,2.24,.91,1.00,1.00,2.00,6.00 +V2,5,2,1.60,.40,.89,.80,.31,2.00,1.26,.91,2.00,1.00,3.00,8.00 +V3,5,2,2.20,.58,1.30,1.70,-1.49,2.00,.54,.91,3.00,1.00,4.00,11.00 +]) +AT_CLEANUP + +AT_SETUP([DESCRIPTIVES -- excluding missing data listwise]) +AT_DATA([descriptives.sps], + [DESCRIPTIVES_MISSING_DATA +descript all/stat=all/format=serial/missing=listwise. +]) +AT_CHECK([pspp -O format=csv descriptives.sps], [0], + [Table: Valid cases = 1; cases with missing value(s) = 6. +Variable,Valid N,Missing N,Mean,S.E. Mean,Std Dev,Variance,Kurtosis,S.E. Kurt,Skewness,S.E. Skew,Range,Minimum,Maximum,Sum +V1,1,0,2.00,. ,. ,. ,. ,. ,. ,. ,.00,2.00,2.00,2.00 +V2,1,0,3.00,. ,. ,. ,. ,. ,. ,. ,.00,3.00,3.00,3.00 +V3,1,0,4.00,. ,. ,. ,. ,. ,. ,. ,.00,4.00,4.00,4.00 +]) +AT_CLEANUP + +AT_SETUP([DESCRIPTIVES -- including missing data listwise]) +AT_DATA([descriptives.sps], + [DESCRIPTIVES_MISSING_DATA +descript all/stat=all/format=serial/missing=listwise include. +]) +AT_CHECK([pspp -O format=csv descriptives.sps], [0], + [Table: Valid cases = 4; cases with missing value(s) = 3. +Variable,Valid N,Missing N,Mean,S.E. Mean,Std Dev,Variance,Kurtosis,S.E. Kurt,Skewness,S.E. Skew,Range,Minimum,Maximum,Sum +V1,4,0,1.25,.25,.50,.25,4.00,2.62,2.00,1.01,1.00,1.00,2.00,5.00 +V2,4,0,1.75,.48,.96,.92,-1.29,2.62,.85,1.01,2.00,1.00,3.00,7.00 +V3,4,0,2.50,.65,1.29,1.67,-1.20,2.62,.00,1.01,3.00,1.00,4.00,10.00 +]) +AT_CLEANUP + +AT_SETUP([DESCRIPTIVES bug calculating mean only]) +AT_DATA([descriptives.sps], + [SET FORMAT F8.3. + +data list notable / X 1. +begin data. +0 +1 +2 +3 +4 +5 +end data. + +descript all/stat=mean. +]) +AT_CHECK([pspp -O format=csv descriptives.sps], [0], + [Table: Valid cases = 6; cases with missing value(s) = 0. +Variable,N,Mean +X,6,2.500 +]) +AT_CLEANUP diff --git a/tests/stats/descript-basic.sh b/tests/stats/descript-basic.sh deleted file mode 100755 index 3577a03b..00000000 --- a/tests/stats/descript-basic.sh +++ /dev/null @@ -1,135 +0,0 @@ -#!/bin/sh - -# This program tests that the descriptives command actually works - -TEMPDIR=/tmp/pspp-tst-$$ - -# 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 > $TEMPDIR/descript.stat < $TEMPDIR/descript.stat < $TEMPDIR/descript.stat <