From: Ben Pfaff Date: Sun, 3 Oct 2010 12:41:05 +0000 (-0700) Subject: NPAR TESTS: Convert WILCOXON tests to Autotest framework. X-Git-Tag: v0.7.6~107 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=896d9c661627c83b99177f9756ef5e168e0fa637;p=pspp-builds.git NPAR TESTS: Convert WILCOXON tests to Autotest framework. --- diff --git a/tests/automake.mk b/tests/automake.mk index b356189c..5f28780b 100644 --- a/tests/automake.mk +++ b/tests/automake.mk @@ -10,7 +10,6 @@ TESTS_ENVIRONMENT += LC_ALL=C TESTS_ENVIRONMENT += EXEEXT=$(EXEEXT) dist_TESTS = \ - tests/command/npar-wilcoxon.sh \ tests/command/npar-sign.sh \ tests/command/permissions.sh \ tests/command/print.sh \ diff --git a/tests/command/npar-wilcoxon.sh b/tests/command/npar-wilcoxon.sh deleted file mode 100755 index 8c349999..00000000 --- a/tests/command/npar-wilcoxon.sh +++ /dev/null @@ -1,166 +0,0 @@ -#!/bin/sh - -# This program tests the wilcoxon subcommand of npar tests - -TEMPDIR=/tmp/pspp-tst-$$ -TESTFILE=$TEMPDIR/`basename $0`.sps - -# ensure that top_srcdir and top_builddir are absolute -if [ -z "$top_srcdir" ] ; then top_srcdir=. ; fi -if [ -z "$top_builddir" ] ; then top_builddir=. ; fi -top_srcdir=`cd $top_srcdir; pwd` -top_builddir=`cd $top_builddir; pwd` - -PSPP=$top_builddir/src/ui/terminal/pspp$EXEEXT - -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 - 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 1" -cat > $TESTFILE << EOF -data list notable list /foo * bar * w (f8.0). -begin data. -1.00 1.00 1 -1.00 2.00 1 -2.00 1.00 1 -1.00 4.00 1 -2.00 5.00 1 -1.00 19.00 1 -2.00 7.00 1 -4.00 5.00 1 -1.00 12.00 1 -2.00 13.00 1 -2.00 2.00 1 -12.00 .00 2 -12.00 1.00 1 -13.00 1.00 1 -end data - -variable labels foo "first" bar "second". - -weight by w. - -npar test - /wilcoxon=foo with bar (paired) - /missing analysis - /method=exact. - -EOF -if [ $? -ne 0 ] ; then no_result ; fi - - -activity="run program 1" -$SUPERVISOR $PSPP -o pspp.csv $TESTFILE -if [ $? -ne 0 ] ; then no_result ; fi - -activity="generate results" -cat > $TEMPDIR/results.csv < $TESTFILE << EOF -data list notable list /foo * bar * dummy *. -begin data. -1.00 1.00 1 -1.00 2.00 1 -2.00 1.00 1 -1.00 4.00 . -2.00 5.00 . -1.00 19.00 . -2.00 7.00 1 -4.00 5.00 1 -1.00 12.00 1 -2.00 13.00 1 -2.00 2.00 1 -12.00 .00 1 -12.00 .00 1 -34.2 . 1 -12.00 1.00 1 -13.00 1.00 1 -end data - -variable labels foo "first" bar "second". - -npar test - /wilcoxon=foo with bar (paired) - /missing analysis - /method=exact. - -EOF -if [ $? -ne 0 ] ; then no_result ; fi - - -activity="run program 2" -$SUPERVISOR $PSPP -o pspp.csv $TESTFILE -if [ $? -ne 0 ] ; then no_result ; fi - -activity="compare output 2" -diff -b pspp.csv $TEMPDIR/results.csv -if [ $? -ne 0 ] ; then fail ; fi - - - -pass; diff --git a/tests/language/stats/npar.at b/tests/language/stats/npar.at index 760613c0..47926a79 100644 --- a/tests/language/stats/npar.at +++ b/tests/language/stats/npar.at @@ -492,3 +492,99 @@ x,14.00,2.69,1.23,1.00,5.00 y,14.00,1.86,1.10,1.00,4.00 ]) AT_CLEANUP + +AT_SETUP([NPAR TESTS WILCOXON]) +AT_DATA([npar.sps], [dnl +data list notable list /foo * bar * w (f8.0). +begin data. +1.00 1.00 1 +1.00 2.00 1 +2.00 1.00 1 +1.00 4.00 1 +2.00 5.00 1 +1.00 19.00 1 +2.00 7.00 1 +4.00 5.00 1 +1.00 12.00 1 +2.00 13.00 1 +2.00 2.00 1 +12.00 .00 2 +12.00 1.00 1 +13.00 1.00 1 +end data + +variable labels foo "first" bar "second". + +weight by w. + +npar test + /wilcoxon=foo with bar (paired) + /missing analysis + /method=exact. +]) +AT_CHECK([pspp -o pspp.csv npar.sps]) +AT_CHECK([cat pspp.csv], [0], [dnl +Table: Ranks +,,N,Mean Rank,Sum of Ranks +second - first,Negative Ranks,5,8.60,43.00 +,Positive Ranks,8,6.00,48.00 +,Ties,2,, +,Total,15,, + +Table: Test Statistics +,second - first +Z,-.18 +Asymp. Sig. (2-tailed),.86 +Exact Sig. (2-tailed),.89 +Exact Sig. (1-tailed),.45 +]) +AT_CLEANUP + +AT_SETUP([NPAR TESTS WILCOXON with missing values]) +AT_DATA([npar.sps], [dnl +data list notable list /foo * bar * dummy *. +begin data. +1.00 1.00 1 +1.00 2.00 1 +2.00 1.00 1 +1.00 4.00 . +2.00 5.00 . +1.00 19.00 . +2.00 7.00 1 +4.00 5.00 1 +1.00 12.00 1 +2.00 13.00 1 +2.00 2.00 1 +12.00 .00 1 +12.00 .00 1 +34.2 . 1 +12.00 1.00 1 +13.00 1.00 1 +end data + +variable labels foo "first" bar "second". + +npar test + /wilcoxon=foo with bar (paired) + /missing analysis + /method=exact. + +]) +AT_CHECK([pspp -o pspp.csv npar.sps]) +dnl This is the same output as the previous test. +AT_CHECK([cat pspp.csv], [0], [dnl +Table: Ranks +,,N,Mean Rank,Sum of Ranks +second - first,Negative Ranks,5,8.60,43.00 +,Positive Ranks,8,6.00,48.00 +,Ties,2,, +,Total,15,, + +Table: Test Statistics +,second - first +Z,-.18 +Asymp. Sig. (2-tailed),.86 +Exact Sig. (2-tailed),.89 +Exact Sig. (1-tailed),.45 +]) +AT_CLEANUP