From 8a0397491d3a82ffd5d3bf80bded0f1562c393a3 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Sat, 25 Sep 2010 22:25:16 -0700 Subject: [PATCH] tests: Convert GET DATA /TYPE=GNM tests to use Autotest. --- configure.ac | 2 +- tests/atlocal.in | 3 + tests/automake.mk | 8 +- .../{ => language/data-io}/Book1.gnm.unzipped | 0 tests/language/data-io/get-data.at | 163 ++++++++++++++++++ 5 files changed, 169 insertions(+), 7 deletions(-) rename tests/{ => language/data-io}/Book1.gnm.unzipped (100%) diff --git a/configure.ac b/configure.ac index e30f93c0..6d01dc90 100644 --- a/configure.ac +++ b/configure.ac @@ -201,7 +201,7 @@ if test $HAVE_LIBXML2 = yes && test $HAVE_ZLIB = yes; then else GNM_SUPPORT=no fi -AM_CONDITIONAL([GNM_SUPPORT], [test $GNM_SUPPORT = yes]) +AC_SUBST([GNM_SUPPORT]) dnl ODT support requires libxml2. if test $HAVE_LIBXML2 = yes; then diff --git a/tests/atlocal.in b/tests/atlocal.in index cd61f44b..0a758a20 100644 --- a/tests/atlocal.in +++ b/tests/atlocal.in @@ -4,3 +4,6 @@ CHARSETALIASDIR="$abs_top_builddir/gl" export CHARSETALIASDIR WITH_PERL_MODULE='@WITH_PERL_MODULE@' host='@host@' +GNM_SUPPORT='@GNM_SUPPORT@' +GZIP= +export GZIP diff --git a/tests/automake.mk b/tests/automake.mk index b4f29dd4..82b223dc 100644 --- a/tests/automake.mk +++ b/tests/automake.mk @@ -116,10 +116,6 @@ dist_TESTS = \ tests/expressions/variables.sh \ tests/expressions/vectors.sh -if GNM_SUPPORT -dist_TESTS += tests/command/get-data-gnm.sh -endif - if PSQL_SUPPORT dist_TESTS += tests/command/get-data-psql.sh endif @@ -319,7 +315,6 @@ tests_output_render_test_LDADD = \ EXTRA_DIST += \ $(dist_TESTS) \ - tests/Book1.gnm.unzipped \ tests/weighting.data tests/data-list.data tests/list.data \ tests/no_case_size.sav \ tests/coverage.sh tests/test_template \ @@ -350,7 +345,8 @@ EXTRA_DIST += \ tests/formats/num-out-cmp.pl \ tests/formats/num-out-compare.pl \ tests/formats/num-out-decmp.pl \ - tests/formats/num-out.pl + tests/formats/num-out.pl \ + tests/language/data-io/Book1.gnm.unzipped CLEANFILES += *.save pspp.* foo* diff --git a/tests/Book1.gnm.unzipped b/tests/language/data-io/Book1.gnm.unzipped similarity index 100% rename from tests/Book1.gnm.unzipped rename to tests/language/data-io/Book1.gnm.unzipped diff --git a/tests/language/data-io/get-data.at b/tests/language/data-io/get-data.at index 1ce180a9..3b4d8b73 100644 --- a/tests/language/data-io/get-data.at +++ b/tests/language/data-io/get-data.at @@ -567,3 +567,166 @@ x 100 ]) AT_CLEANUP + +AT_BANNER([GET DATA /TYPE=GNM]) + +AT_SETUP([GET DATA /TYPE=GNM with CELLRANGE]) +AT_SKIP_IF([test "$GNM_SUPPORT" = no]) +AT_CHECK([gzip -c $top_srcdir/tests/language/data-io/Book1.gnm.unzipped > Book1.gnumeric]) +AT_DATA([get-data.sps], [dnl +GET DATA /TYPE=gnm /FILE='Book1.gnumeric' /READNAMES=off /SHEET=name 'This' /CELLRANGE=range 'g9:i13' . +DISPLAY VARIABLES. +LIST. +]) +AT_CHECK([pspp -o pspp.csv get-data.sps]) +AT_CHECK([cat pspp.csv], [0], [dnl +Variable,Description,,Position +VAR001,Format: F8.2,,1 +,Measure: Scale,, +,Display Alignment: Right,, +,Display Width: 8,, +VAR002,Format: A8,,2 +,Measure: Nominal,, +,Display Alignment: Left,, +,Display Width: 8,, +VAR003,Format: F8.2,,3 +,Measure: Scale,, +,Display Alignment: Right,, +,Display Width: 8,, + +Table: Data List +VAR001,VAR002,VAR003 +.00,fred ,20.00 +1.00,11 ,21.00 +2.00,twelve ,22.00 +3.00,13 ,23.00 +4.00,14 ,24.00 +]) +AT_CLEANUP + +AT_SETUP([GET DATA /TYPE=GNM with CELLRANGE and READNAMES]) +AT_SKIP_IF([test "$GNM_SUPPORT" = no]) +AT_CHECK([gzip -c $top_srcdir/tests/language/data-io/Book1.gnm.unzipped > Book1.gnumeric]) +AT_DATA([get-data.sps], [dnl +GET DATA /TYPE=gnm /FILE='Book1.gnumeric' /READNAMES=on /SHEET=name 'This' /CELLRANGE=range 'g8:i13' . +DISPLAY VARIABLES. +LIST. +]) +AT_CHECK([pspp -o pspp.csv get-data.sps]) +AT_CHECK([cat pspp.csv], [0], [dnl +Variable,Description,,Position +V1,Format: F8.2,,1 +,Measure: Scale,, +,Display Alignment: Right,, +,Display Width: 8,, +V2,Format: A8,,2 +,Measure: Nominal,, +,Display Alignment: Left,, +,Display Width: 8,, +VAR001,Format: F8.2,,3 +,Measure: Scale,, +,Display Alignment: Right,, +,Display Width: 8,, + +Table: Data List +V1,V2,VAR001 +.00,fred ,20.00 +1.00,11 ,21.00 +2.00,twelve ,22.00 +3.00,13 ,23.00 +4.00,14 ,24.00 +]) +AT_CLEANUP + +AT_SETUP([GET DATA /TYPE=GNM without CELLRANGE]) +AT_SKIP_IF([test "$GNM_SUPPORT" = no]) +AT_CHECK([gzip -c $top_srcdir/tests/language/data-io/Book1.gnm.unzipped > Book1.gnumeric]) +AT_DATA([get-data.sps], [dnl +GET DATA /TYPE=gnm /FILE='Book1.gnumeric' /SHEET=index 3. +DISPLAY VARIABLES. +LIST. +]) +AT_CHECK([pspp -o pspp.csv get-data.sps]) +AT_CHECK([cat pspp.csv], [0], [dnl +Variable,Description,,Position +name,Format: A8,,1 +,Measure: Nominal,, +,Display Alignment: Left,, +,Display Width: 8,, +id,Format: F8.2,,2 +,Measure: Scale,, +,Display Alignment: Right,, +,Display Width: 8,, +height,Format: F8.2,,3 +,Measure: Scale,, +,Display Alignment: Right,, +,Display Width: 8,, + +Table: Data List +name,id,height +fred ,.00,23.40 +bert ,1.00,.56 +charlie ,2.00,. @&t@ +dick ,3.00,-34.09 +]) +AT_CLEANUP + +AT_SETUP([GET DATA /TYPE=GNM with missing data]) +AT_SKIP_IF([test "$GNM_SUPPORT" = no]) +AT_CHECK([gzip -c $top_srcdir/tests/language/data-io/Book1.gnm.unzipped > Book1.gnumeric]) +AT_DATA([get-data.sps], [dnl +* This sheet has no data in one of its variables +GET DATA /TYPE=gnm /FILE='Book1.gnumeric' /READNAMES=on /SHEET=index 5. +DISPLAY VARIABLES. +LIST. +]) +AT_CHECK([pspp -o pspp.csv get-data.sps]) +AT_CHECK([cat pspp.csv], [0], [dnl +Variable,Description,,Position +vone,Format: F8.2,,1 +,Measure: Scale,, +,Display Alignment: Right,, +,Display Width: 8,, +vtwo,Format: F8.2,,2 +,Measure: Scale,, +,Display Alignment: Right,, +,Display Width: 8,, +vthree,Format: A8,,3 +,Measure: Nominal,, +,Display Alignment: Left,, +,Display Width: 8,, +v4,Format: F8.2,,4 +,Measure: Scale,, +,Display Alignment: Right,, +,Display Width: 8,, + +Table: Data List +vone,vtwo,vthree,v4 +1.00,3.00,,5.00 +2.00,4.00,,6.00 +]) +AT_CLEANUP + +AT_SETUP([GET DATA /TYPE=GNM with empty sheet]) +AT_SKIP_IF([test "$GNM_SUPPORT" = no]) +AT_CHECK([gzip -c $top_srcdir/tests/language/data-io/Book1.gnm.unzipped > Book1.gnumeric]) +AT_DATA([get-data.sps], [dnl +* This sheet is empty +GET DATA /TYPE=gnm /FILE='Book1.gnumeric' /SHEET=name 'Empty'. +]) +AT_CHECK([pspp -o pspp.csv get-data.sps], [0], [dnl +warning: Selected sheet or range of spreadsheet `Book1.gnumeric' is empty. +]) +AT_CLEANUP + +AT_SETUP([GET DATA /TYPE=GNM with nonexistent sheet]) +AT_SKIP_IF([test "$GNM_SUPPORT" = no]) +AT_CHECK([gzip -c $top_srcdir/tests/language/data-io/Book1.gnm.unzipped > Book1.gnumeric]) +AT_DATA([get-data.sps], [dnl +* This sheet doesnt exist. +GET DATA /TYPE=gnm /FILE='Book1.gnumeric' /SHEET=name 'foobarxx'. +]) +AT_CHECK([pspp -o pspp.csv get-data.sps], [0], [dnl +warning: Selected sheet or range of spreadsheet `Book1.gnumeric' is empty. +]) +AT_CLEANUP -- 2.30.2