From 25fae2dc8f76919b486763951c3571b5c8ef33b4 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Sat, 2 Oct 2010 13:51:44 -0700 Subject: [PATCH] MISSING VALUES: Convert test to Autotest framework. --- tests/automake.mk | 4 +- tests/command/missing-values.sh | 137 -------------------- tests/data-list.data | 6 - tests/language/dictionary/missing-values.at | 72 ++++++++++ 4 files changed, 74 insertions(+), 145 deletions(-) delete mode 100755 tests/command/missing-values.sh delete mode 100644 tests/data-list.data create mode 100644 tests/language/dictionary/missing-values.at diff --git a/tests/automake.mk b/tests/automake.mk index 39b16d90..9170f9d3 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/missing-values.sh \ tests/command/no_case_size.sh \ tests/command/n_of_cases.sh \ tests/command/npar-binomial.sh \ @@ -300,7 +299,7 @@ tests_output_render_test_LDADD = \ EXTRA_DIST += \ $(dist_TESTS) \ - tests/weighting.data tests/data-list.data \ + tests/weighting.data \ tests/no_case_size.sav \ tests/coverage.sh tests/test_template \ tests/v13.sav tests/v14.sav \ @@ -374,6 +373,7 @@ TESTSUITE_AT = \ tests/language/data-io/save.at \ tests/language/data-io/save-translate.at \ tests/language/dictionary/attributes.at \ + tests/language/dictionary/missing-values.at \ tests/language/dictionary/mrsets.at \ tests/language/expressions/evaluate.at \ tests/language/lexer/variable-parser.at \ diff --git a/tests/command/missing-values.sh b/tests/command/missing-values.sh deleted file mode 100755 index e5cb0c1d..00000000 --- a/tests/command/missing-values.sh +++ /dev/null @@ -1,137 +0,0 @@ -#!/bin/sh - -# This program tests MISSING VALUES - -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 - -# Copy this file --- it's shared with another test -activity="create data" -cp $top_srcdir/tests/data-list.data $TEMPDIR -if [ $? -ne 0 ] ; then no_result ; fi - - -activity="create program" -cat > $TEMPDIR/missing-values.stat << foobar -DATA LIST NOTABLE/str1 1-5 (A) str2 6-8 (A) date1 9-19 (DATE) num1 20-25 - longstr 26-36 (A). - -/* Valid: numeric missing values. -MISSING VALUES date1 num1 (1). -MISSING VALUES date1 num1 (1, 2). -MISSING VALUES date1 num1 (1, 2, 3). - -/* Valid: numeric missing values using the first variable's format. -MISSING VALUES num1 date1 ('1'). -MISSING VALUES num1 date1 ('1', '2'). -MISSING VALUES num1 date1 ('1', '2', '3'). -MISSING VALUES date1 num1 ('06-AUG-05'). -MISSING VALUES date1 num1 ('06-AUG-05', '01-OCT-78'). -MISSING VALUES date1 num1 ('06-AUG-05', '01-OCT-78', '14-FEB-81'). - -/* Valid: ranges of numeric missing values. -MISSING VALUES num1 (1 THRU 2). -MISSING VALUES num1 (LO THRU 2). -MISSING VALUES num1 (LOWEST THRU 2). -MISSING VALUES num1 (1 THRU HI). -MISSING VALUES num1 (1 THRU HIGHEST). - -/* Valid: a range of numeric missing values, plus an individual value. -MISSING VALUES num1 (1 THRU 2, 3). -MISSING VALUES num1 (LO THRU 2, 3). -MISSING VALUES num1 (LOWEST THRU 2, 3). -MISSING VALUES num1 (1 THRU HI, -1). -MISSING VALUES num1 (1 THRU HIGHEST, -1). - -/* Valid: string missing values. -MISSING VALUES str1 str2 longstr ('abc ','def'). - -/* Invalid: too long for str2. -MISSING VALUES str1 str2 longstr ('abcde'). - -/* Invalid: long string missing value longer than 8 bytes. -MISSING VALUES longstr ('abcdefghijk'). - -/* Invalid: no string ranges. -MISSING VALUES str1 ('a' THRU 'z'). - -/* Invalid: mixing string and numeric variables. -MISSING VALUES str1 num1 ('123'). - -/* Valid: may mix variable types when clearing missing values. -MISSING VALUES ALL (). - -foobar -if [ $? -ne 0 ] ; then no_result ; fi - - -activity="run program" -$SUPERVISOR $PSPP -o pspp.csv --error-file=$TEMPDIR/errs $TEMPDIR/missing-values.stat -# Note vv --- there are errors in input. Therefore, the command must FAIL -if [ $? -eq 0 ] ; then fail ; fi - -activity="compare error messages" -diff -u -w $TEMPDIR/errs - <