[gnumeric] Tests: new test for gnumeric schema check.



commit 9e11a3c02d7ad2463ac484aaa4247f6eaa6532e6
Author: Morten Welinder <terra gnome org>
Date:   Mon Mar 10 16:25:38 2014 -0400

    Tests: new test for gnumeric schema check.

 test/Makefile.am              |    1 +
 test/t6151-gnumeric-syntax.pl |  111 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 112 insertions(+), 0 deletions(-)
---
diff --git a/test/Makefile.am b/test/Makefile.am
index e2b4e5d..8a3f2ea 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -72,6 +72,7 @@ TESTS =       t1000-statfuns.pl                       \
        t6103-lookfuns-ods.pl                   \
        t6104-finfuns-ods.pl                    \
        t6150-ods-syntax.pl                     \
+       t6151-gnumeric-syntax.pl                \
        t6500-strings.pl                        \
        t6501-numbers.pl                        \
        t6502-styles.pl                         \
diff --git a/test/t6151-gnumeric-syntax.pl b/test/t6151-gnumeric-syntax.pl
new file mode 100755
index 0000000..e907754
--- /dev/null
+++ b/test/t6151-gnumeric-syntax.pl
@@ -0,0 +1,111 @@
+#!/usr/bin/perl -w
+# -----------------------------------------------------------------------------
+
+use strict;
+use lib ($0 =~ m|^(.*/)| ? $1 : ".");
+use GnumericTest;
+
+&message ("Check that the gnumeric exporter produces valid files.");
+
+my $schema = "$topsrc/gnumeric.xsd";
+&GnumericTest::report_skip ("Cannot find schema") unless -r $schema;
+
+my $xmllint = &GnumericTest::find_program ("xmllint");
+
+my @sources =
+    ("$samples/excel/address.xls",
+     "$samples/excel/bitwise.xls",
+     "$samples/excel/chart-tests-excel.xls",
+     "$samples/excel/datefuns.xls",
+     "$samples/excel/dbfuns.xls",
+     "$samples/excel/engfuns.xls",
+     "$samples/excel/finfuns.xls",
+     "$samples/excel/functions.xls",
+     "$samples/excel/infofuns.xls",
+     "$samples/excel/logfuns.xls",
+     "$samples/excel/lookfuns2.xls",
+     "$samples/excel/lookfuns.xls",
+     "$samples/excel/mathfuns.xls",
+     "$samples/excel/objs.xls",
+     "$samples/excel/operator.xls",
+     "$samples/excel/sort.xls",
+     "$samples/excel/statfuns.xls",
+     "$samples/excel/textfuns.xls",
+     "$samples/excel/yalta2008.xls",
+     "$samples/excel12/cellstyle.xlsx",
+     # xmllint hangs on these files.  (Well, amath finishes but takes too
+     # long.)
+     # "$samples/crlibm.gnumeric",
+     # "$samples/amath.gnumeric",
+     # "$samples/gamma.gnumeric",
+     "$samples/linest.xls",
+     "$samples/vba-725220.xls",
+     "$samples/sumif.xls",
+     "$samples/array-intersection.xls",
+     "$samples/arrays.xls",
+     "$samples/ftest.xls",
+     "$samples/ttest.xls",
+     "$samples/chitest.xls",
+     "$samples/numbermatch.gnumeric",
+     "$samples/solver/afiro.mps",
+     "$samples/solver/blend.mps",
+     "$samples/auto-filter-tests.gnumeric",
+     "$samples/cell-comment-tests.gnumeric",
+     "$samples/colrow-tests.gnumeric",
+     "$samples/formula-tests.gnumeric",
+     "$samples/merge-tests.gnumeric",
+     "$samples/number-tests.gnumeric",
+     "$samples/page-setup-tests.gnumeric",
+     "$samples/sheet-formatting-tests.gnumeric",
+     "$samples/solver-tests.gnumeric",
+     "$samples/split-panes-tests.gnumeric",
+     "$samples/string-tests.gnumeric",
+     "$samples/merge-tests.gnumeric",
+     "$samples/style-tests.gnumeric",
+     "$samples/validation-tests.gnumeric",
+    );
+my $nskipped = 0;
+my $ngood = 0;
+my $nbad = 0;
+
+foreach my $src (@sources) {
+    if (!-r $src) {
+       $nskipped++;
+       next;
+    }
+
+    print STDERR "Checking $src\n";
+
+    my $tmp = $src;
+    $tmp =~ s|^.*/||;
+    $tmp =~ s|\..*|.xml|;
+    &GnumericTest::junkfile ($tmp);
+    system ("$ssconvert $src $tmp");
+    if (!-r $tmp) {
+       print STDERR "ssconvert failed to produce $tmp\n";
+       die "Fail\n";
+    }
+
+    my $out = `$xmllint --noout --schema $schema $tmp 2>&1`;
+    if ($out !~ /validates$/) {
+       print STDERR "While checking $tmp:\n";
+       &GnumericTest::dump_indented ($out);
+       $nbad++;
+    } else {
+       $ngood++;
+    }
+
+    &GnumericTest::removejunk ($tmp);
+}
+
+&GnumericTest::report_skip ("No source files present") if $nbad + $ngood == 0;
+
+if ($nskipped > 0) {
+    print STDERR "$nskipped files skipped.\n";
+}
+
+if ($nbad > 0) {
+    die "Fail\n";
+} else {
+    print STDERR "Pass\n";
+}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]