[gnumeric] Tests: test xls->gnumeric vs xls->xls->gnumeric



commit 8bd8c483077d18eb0b608529831a60846a951dcd
Author: Morten Welinder <terra gnome org>
Date:   Sun Mar 11 15:27:34 2012 -0400

    Tests: test xls->gnumeric vs xls->xls->gnumeric

 test/GnumericTest.pm   |   44 +++++++++++++++++++++++++++++++++++++++++++-
 test/t6000-statfuns.pl |    9 +++++++++
 test/t6001-mathfuns.pl |    9 +++++++++
 3 files changed, 61 insertions(+), 1 deletions(-)
---
diff --git a/test/GnumericTest.pm b/test/GnumericTest.pm
index 2a3434e..b95c9f1 100644
--- a/test/GnumericTest.pm
+++ b/test/GnumericTest.pm
@@ -6,7 +6,8 @@ use Config;
 use XML::Parser;
 
 @GnumericTest::ISA = qw (Exporter);
- GnumericTest::EXPORT = qw(test_sheet_calc test_importer test_valgrind
+ GnumericTest::EXPORT = qw(test_sheet_calc test_valgrind
+                           test_importer test_exporter
 			   test_ssindex sstest test_command message
 			   $ssconvert $sstest $topsrc $top_builddir
 			   $samples $PERL);
@@ -309,6 +310,47 @@ sub test_importer {
 
 # -----------------------------------------------------------------------------
 
+sub test_exporter {
+    my ($file) = @_;
+
+    my $tmp = fileparse ($file);
+    $tmp =~ s/\.([a-zA-Z0-9]+)$// or die "Must have extension for export test.";
+    my $ext = $1;
+    my $code;
+
+    my $tmp1 = "$tmp.gnumeric";
+    &junkfile ($tmp1);
+    $code = system ("$ssconvert '$file' '$tmp1' 2>&1 | sed -e 's/^/| /'");
+    &system_failure ($ssconvert, $code) if $code;
+
+    my $tmp2 = "$tmp-new.$ext";
+    &junkfile ($tmp2);
+    $code = system ("$ssconvert '$file' '$tmp2' 2>&1 | sed -e 's/^/| /'");
+    &system_failure ($ssconvert, $code) if $code;
+
+    my $tmp3 = "$tmp-new.gnumeric";
+    &junkfile ($tmp3);
+    $code = system ("$ssconvert '$tmp2' '$tmp3' 2>&1 | sed -e 's/^/| /'");
+    &system_failure ($ssconvert, $code) if $code;
+
+    my $tmp4 = "$tmp.xml";
+    &junkfile ($tmp4);
+    $code = system ("zcat -f '$tmp1' >'$tmp4'");
+    &system_failure ('zcat', $code) if $code;
+
+    my $tmp5 = "$tmp-new.xml";
+    &junkfile ($tmp5);
+    $code = system ("zcat -f '$tmp3' >'$tmp5'");
+    &system_failure ('zcat', $code) if $code;
+
+    $code = system ('diff', '-u', $tmp4, $tmp5);
+    &system_failure ('diff', $code) if $code;
+
+    print STDERR "Pass\n";
+}
+
+# -----------------------------------------------------------------------------
+
 sub test_valgrind {
     my ($cmd,$uselibtool) = @_;
 
diff --git a/test/t6000-statfuns.pl b/test/t6000-statfuns.pl
new file mode 100755
index 0000000..e8ae301
--- /dev/null
+++ b/test/t6000-statfuns.pl
@@ -0,0 +1,9 @@
+#!/usr/bin/perl -w
+# -----------------------------------------------------------------------------
+
+use strict;
+use lib ($0 =~ m|^(.*/)| ? $1 : ".");
+use GnumericTest;
+
+&message ("Check the xls exporter.");
+&test_exporter ("$samples/excel/statfuns.xls");
diff --git a/test/t6001-mathfuns.pl b/test/t6001-mathfuns.pl
new file mode 100755
index 0000000..f21bbfb
--- /dev/null
+++ b/test/t6001-mathfuns.pl
@@ -0,0 +1,9 @@
+#!/usr/bin/perl -w
+# -----------------------------------------------------------------------------
+
+use strict;
+use lib ($0 =~ m|^(.*/)| ? $1 : ".");
+use GnumericTest;
+
+&message ("Check the xls exporter.");
+&test_exporter ("$samples/excel/mathfuns.xls");



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