From 69b9816068e07d79b6717754a0edbb757af84a40 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Sat, 9 Oct 2010 17:38:14 -0700 Subject: [PATCH] WEIGHT: Convert test to Autotest framework. --- tests/automake.mk | 3 +- .../dictionary/weight.at} | 146 ++++++++---------- tests/weighting.data | 52 ------- 3 files changed, 66 insertions(+), 135 deletions(-) rename tests/{command/weight.sh => language/dictionary/weight.at} (61%) mode change 100755 => 100644 delete mode 100644 tests/weighting.data diff --git a/tests/automake.mk b/tests/automake.mk index 7ee732cb..f84097e2 100644 --- a/tests/automake.mk +++ b/tests/automake.mk @@ -11,7 +11,6 @@ TESTS_ENVIRONMENT += EXEEXT=$(EXEEXT) dist_TESTS = \ tests/command/very-long-strings.sh \ - tests/command/weight.sh \ tests/formats/bcd-in.sh \ tests/formats/binhex-out.sh \ tests/formats/date-in.sh \ @@ -254,7 +253,6 @@ tests_output_render_test_LDADD = \ EXTRA_DIST += \ $(dist_TESTS) \ - tests/weighting.data \ tests/coverage.sh tests/test_template \ tests/v13.sav tests/v14.sav \ tests/expressions/randist/beta.out \ @@ -337,6 +335,7 @@ TESTSUITE_AT = \ tests/language/dictionary/sys-file-info.at \ tests/language/dictionary/variable-display.at \ tests/language/dictionary/vector.at \ + tests/language/dictionary/weight.at \ tests/language/expressions/evaluate.at \ tests/language/lexer/variable-parser.at \ tests/language/stats/aggregate.at \ diff --git a/tests/command/weight.sh b/tests/language/dictionary/weight.at old mode 100755 new mode 100644 similarity index 61% rename from tests/command/weight.sh rename to tests/language/dictionary/weight.at index d82cef9c..0eb55bc7 --- a/tests/command/weight.sh +++ b/tests/language/dictionary/weight.at @@ -1,84 +1,71 @@ -#!/bin/sh - -# This program tests the WEIGHT command - -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$EXEEXT - -# 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 +AT_BANNER([WEIGHT]) + +AT_SETUP([WEIGHT]) +AT_DATA([weight.txt], [dnl + 18 1 + 19 7 + 20 26 + 21 76 + 22 57 + 23 58 + 24 38 + 25 38 + 26 30 + 27 21 + 28 23 + 29 24 + 30 23 + 31 14 + 32 21 + 33 21 + 34 14 + 35 14 + 36 17 + 37 11 + 38 16 + 39 14 + 40 15 + 41 14 + 42 14 + 43 8 + 44 15 + 45 10 + 46 12 + 47 13 + 48 13 + 49 5 + 50 5 + 51 3 + 52 7 + 53 6 + 54 2 + 55 2 + 56 2 + 57 3 + 58 1 + 59 3 + 61 1 + 62 3 + 63 1 + 64 1 + 65 2 + 70 1 + 78 1 + 79 1 + 80 1 + 94 1 +]) +AT_DATA([weight.sps], [dnl SET FORMAT F8.3. -data list file='$top_srcdir/tests/weighting.data'/AVAR 1-5 BVAR 6-10. +data list file='weight.txt'/AVAR 1-5 BVAR 6-10. weight by BVAR. descriptives AVAR /statistics all /format serial. frequencies AVAR /statistics all. - -EOF -if [ $? -ne 0 ] ; then no_result ; fi - - -activity="run program" -$SUPERVISOR $PSPP -o pspp.csv $TESTFILE -if [ $? -ne 0 ] ; then no_result ; fi - -activity="compare results" -diff -c $TEMPDIR/pspp.csv - <