From: Ben Pfaff Date: Tue, 12 Oct 2010 03:25:09 +0000 (-0700) Subject: output: Convert paper size tests to Autotest framework. X-Git-Tag: v0.7.6~37 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2d60e6d56e7e9fba48f97ae6f518d957992f9a07;p=pspp-builds.git output: Convert paper size tests to Autotest framework. --- diff --git a/tests/automake.mk b/tests/automake.mk index 0acfb32b..479f24e5 100644 --- a/tests/automake.mk +++ b/tests/automake.mk @@ -27,7 +27,6 @@ dist_TESTS = \ tests/formats/wkday-in.sh \ tests/formats/wkday-out.sh \ tests/formats/360.sh \ - tests/output/paper-size.sh \ tests/expressions/randist.sh \ tests/expressions/valuelabel.sh \ tests/expressions/variables.sh \ @@ -370,6 +369,7 @@ TESTSUITE_AT = \ tests/math/moments.at \ tests/output/charts.at \ tests/output/output.at \ + tests/output/paper-size.at \ tests/output/render.at \ tests/ui/terminal/main.at \ tests/perl-module.at diff --git a/tests/output/paper-size.at b/tests/output/paper-size.at new file mode 100644 index 00000000..2ae4cdc1 --- /dev/null +++ b/tests/output/paper-size.at @@ -0,0 +1,37 @@ +AT_BANNER([output -- paper sizes]) + +AT_SETUP([letter default paper size]) +AT_DATA([paper-size.sps], [dnl +debug paper size ''. +]) +AT_CHECK([PAPERSIZE=letter pspp --testing-mode -O format=csv paper-size.sps], + [0], ["" => 8.5 x 11.0 in, 216 x 279 mm +]) +AT_CLEANUP + +AT_SETUP([a4 default paper size]) +AT_DATA([paper-size.sps], [dnl +debug paper size ''. +]) +AT_CHECK([PAPERSIZE=a4 pspp --testing-mode -O format=csv paper-size.sps], + [0], ["" => 8.3 x 11.7 in, 210 x 297 mm +]) +AT_CLEANUP + +AT_SETUP([specific paper sizes]) +AT_KEYWORDS([paper size]) +AT_DATA([paper-size.sps], [dnl +debug paper size 'a4'. +debug paper size 'letter'. +debug paper size '10x14in'. +debug paper size '210x297mm'. +]) +AT_CHECK([PAPERSIZE=a4 pspp --testing-mode -O format=csv paper-size.sps], + [0], [dnl +"a4" => 8.3 x 11.7 in, 210 x 297 mm +"letter" => 8.5 x 11.0 in, 216 x 279 mm +"10x14in" => 10.0 x 14.0 in, 254 x 356 mm +"210x297mm" => 8.3 x 11.7 in, 210 x 297 mm +]) +AT_CLEANUP + diff --git a/tests/output/paper-size.sh b/tests/output/paper-size.sh deleted file mode 100755 index e308abc4..00000000 --- a/tests/output/paper-size.sh +++ /dev/null @@ -1,100 +0,0 @@ -#!/bin/sh - -# This program tests paper size support. - -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 - -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 File 1" -cat > paper-size.pspp < paper-size.out -if [ $? -ne 0 ] ; then no_result ; fi - -activity="compare results" -diff -b $TEMPDIR/paper-size.out - < 8.5 x 11.0 in, 216 x 279 mm -"a4" => 8.3 x 11.7 in, 210 x 297 mm -"letter" => 8.5 x 11.0 in, 216 x 279 mm -"10x14in" => 10.0 x 14.0 in, 254 x 356 mm -"210x297mm" => 8.3 x 11.7 in, 210 x 297 mm -EOF -if [ $? -ne 0 ] ; then fail ; fi - -activity="Create File 2" -cat > paper-size-2.pspp < paper-size-2.out -if [ $? -ne 0 ] ; then no_result ; fi - -activity="compare results 2" -diff -b $TEMPDIR/paper-size-2.out - < 8.3 x 11.7 in, 210 x 297 mm -EOF -if [ $? -ne 0 ] ; then fail ; fi - -pass;