From d5987ef3c3a46551c699d405e523a3bc10da10c1 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Tue, 12 Oct 2010 21:19:35 -0700 Subject: [PATCH] float-format: Convert tests to Autotest framework. --- tests/automake.mk | 2 +- .../float-format.at} | 80 +++---------------- 2 files changed, 12 insertions(+), 70 deletions(-) rename tests/{formats/float-format.sh => libpspp/float-format.at} (79%) mode change 100755 => 100644 diff --git a/tests/automake.mk b/tests/automake.mk index e19f26d3..11cd343f 100644 --- a/tests/automake.mk +++ b/tests/automake.mk @@ -11,7 +11,6 @@ TESTS_ENVIRONMENT += EXEEXT=$(EXEEXT) dist_TESTS = \ tests/formats/date-in.sh \ - tests/formats/float-format.sh \ tests/formats/format-guesser.sh \ tests/formats/ib-in.sh \ tests/formats/legacy-in.sh \ @@ -328,6 +327,7 @@ TESTSUITE_AT = \ tests/language/xforms/select-if.at \ tests/libpspp/abt.at \ tests/libpspp/bt.at \ + tests/libpspp/float-format.at \ tests/libpspp/heap.at \ tests/libpspp/hmap.at \ tests/libpspp/hmapx.at \ diff --git a/tests/formats/float-format.sh b/tests/libpspp/float-format.at old mode 100755 new mode 100644 similarity index 79% rename from tests/formats/float-format.sh rename to tests/libpspp/float-format.at index 5fbc28b0..a00a3537 --- a/tests/formats/float-format.sh +++ b/tests/libpspp/float-format.at @@ -1,65 +1,7 @@ -#! /bin/sh +AT_BANNER([floating point formats]) -# Tests floating-point format conversions. - -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$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 -activity="create test program" -sed -e 's/#.*//' \ - -e 's/^[ ]*//' \ - -e 's/[ ]*$//' \ - -e 's/^\(..*\)$/DEBUG FLOAT FORMAT \1./' \ - > $TEMPDIR/float-format.pspp <<'EOF' +AT_SETUP([floating point format conversions]) +AT_DATA([float-format.txt], [dnl # Each of the tests below checks that conversion between # floating-point formats works correctly. Comparisons that use == # require that conversion from any format on the line to any other @@ -145,11 +87,11 @@ x('.fffffffffffff8p1024') => idb(x'7fefffffffffffff') x('.1p-256') == zl(x'0010000000000000') == idb(x'2fb0000000000000') x('.ffffffffffffffp248') == zl(x'7effffffffffffff') x('.ffffffffffffffp248') => idb(x'4f70000000000000') # Loses precision. -EOF -if [ $? -ne 0 ] ; then no_result ; fi - -activity="run program" -$SUPERVISOR $PSPP --testing-mode -o pspp.csv $TEMPDIR/float-format.pspp -if [ $? -ne 0 ] ; then fail ; fi - -pass +]) +AT_CHECK( + [sed 's/#.*// +s/^[ ]*// +s/[ ]*$// +s/^\(..*\)$/DEBUG FLOAT FORMAT \1./' < float-format.txt > float-format.sps]) +AT_CHECK([pspp --testing-mode -O format=csv float-format.sps]) +AT_CLEANUP -- 2.30.2