From: Ben Pfaff Date: Sat, 9 Oct 2010 14:03:57 +0000 (-0700) Subject: tests: Convert variable display tests to Autotest framework. X-Git-Tag: v0.7.6~74 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a1bbd65d1bbdcd3cf042201203980a9ae9b55d5b;p=pspp-builds.git tests: Convert variable display tests to Autotest framework. --- diff --git a/tests/automake.mk b/tests/automake.mk index 62a8937e..e614c1bd 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/variable-display.sh \ tests/command/vector.sh \ tests/command/very-long-strings.sh \ tests/command/weight.sh \ @@ -337,6 +336,7 @@ TESTSUITE_AT = \ tests/language/dictionary/rename-variables.at \ tests/language/dictionary/split-file.at \ tests/language/dictionary/sys-file-info.at \ + tests/language/dictionary/variable-display.at \ tests/language/expressions/evaluate.at \ tests/language/lexer/variable-parser.at \ tests/language/stats/aggregate.at \ diff --git a/tests/command/variable-display.sh b/tests/command/variable-display.sh deleted file mode 100755 index fece96e6..00000000 --- a/tests/command/variable-display.sh +++ /dev/null @@ -1,94 +0,0 @@ -#!/bin/sh - -# This program tests variable display attribute commands: VARIABLE -# ALIGNMENT, VARIABLE WIDTH, VARIABLE LEVEL. - -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 - - -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 - -# Create command file. -activity="create program" -cat > $TESTFILE << EOF -data list free /x y z. -variable alignment x (left)/y (right)/z (center). -variable width x (10)/y (12)/z (14). -variable level x (scale)/y (ordinal)/z (nominal). -display dictionary. -EOF -if [ $? -ne 0 ] ; then no_result ; fi - - -activity="run program" -$SUPERVISOR $PSPP -o pspp.csv $TESTFILE -if [ $? -ne 0 ] ; then fail ; fi - -activity="compare output" -diff -c $TEMPDIR/pspp.csv - << EOF -Variable,Description,,Position -x,Format: F8.2,,1 -,Measure: Scale,, -,Display Alignment: Left,, -,Display Width: 10,, -y,Format: F8.2,,2 -,Measure: Ordinal,, -,Display Alignment: Right,, -,Display Width: 12,, -z,Format: F8.2,,3 -,Measure: Nominal,, -,Display Alignment: Center,, -,Display Width: 14,, -EOF -if [ $? -ne 0 ] ; then fail ; fi - -pass; diff --git a/tests/language/dictionary/variable-display.at b/tests/language/dictionary/variable-display.at new file mode 100644 index 00000000..6f527a72 --- /dev/null +++ b/tests/language/dictionary/variable-display.at @@ -0,0 +1,27 @@ +AT_BANNER([variable display attributes]) + +AT_SETUP([variable display attribute commands]) +AT_DATA([var-display.sps], [dnl +DATA LIST FREE /x y z. +VARIABLE ALIGNMENT x (LEFT)/y (RIGHT)/z (CENTER). +VARIABLE WIDTH x (10)/y (12)/z (14). +VARIABLE LEVEL x (SCALE)/y (ORDINAL)/z (NOMINAL). +DISPLAY DICTIONARY. +]) +AT_CHECK([pspp -o pspp.csv var-display.sps]) +AT_CHECK([cat pspp.csv], [0], [dnl +Variable,Description,,Position +x,Format: F8.2,,1 +,Measure: Scale,, +,Display Alignment: Left,, +,Display Width: 10,, +y,Format: F8.2,,2 +,Measure: Ordinal,, +,Display Alignment: Right,, +,Display Width: 12,, +z,Format: F8.2,,3 +,Measure: Nominal,, +,Display Alignment: Center,, +,Display Width: 14,, +]) +AT_CLEANUP