output: Convert paper size tests to Autotest framework.
authorBen Pfaff <blp@cs.stanford.edu>
Tue, 12 Oct 2010 03:25:09 +0000 (20:25 -0700)
committerBen Pfaff <blp@cs.stanford.edu>
Tue, 12 Oct 2010 03:25:09 +0000 (20:25 -0700)
tests/automake.mk
tests/output/paper-size.at [new file with mode: 0644]
tests/output/paper-size.sh [deleted file]

index 0acfb32b18bb0433498107de76e9cb29a9bd46a5..479f24e5a9dcd002b04829187a7fb7b4078adeb9 100644 (file)
@@ -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 (file)
index 0000000..2ae4cdc
--- /dev/null
@@ -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 (executable)
index e308abc..0000000
+++ /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 <<EOF
-debug paper size ''.
-debug paper size 'a4'.
-debug paper size 'letter'.
-debug paper size '10x14in'.
-debug paper size '210x297mm'.
-EOF
-if [ $? -ne 0 ] ; then no_result ; fi
-
-activity="Run pspp 1"
-PAPERSIZE=letter $SUPERVISOR $PSPP --testing-mode -o pspp.csv paper-size.pspp > paper-size.out
-if [ $? -ne 0 ] ; then no_result ; fi
-
-activity="compare results"
-diff -b  $TEMPDIR/paper-size.out - <<EOF
-"" => 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 <<EOF
-debug paper size ''.
-EOF
-if [ $? -ne 0 ] ; then no_result ; fi
-
-activity="Run pspp 2"
-PAPERSIZE=a4 $SUPERVISOR $PSPP --testing-mode -o pspp.csv 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 - <<EOF
-"" => 8.3 x 11.7 in, 210 x 297 mm
-EOF
-if [ $? -ne 0 ] ; then fail ; fi
-
-pass;