Commit b278fe7e authored by Morten Welinder's avatar Morten Welinder

Test: string round trip testing.

parent 325669b8
......@@ -7,7 +7,7 @@ use XML::Parser;
@GnumericTest::ISA = qw (Exporter);
@GnumericTest::EXPORT = qw(test_sheet_calc test_valgrind
test_importer test_exporter
test_importer test_exporter test_roundtrip
test_ssindex sstest test_command message
$ssconvert $sstest $topsrc $top_builddir
$samples $PERL);
......@@ -354,6 +354,46 @@ sub test_exporter {
# -----------------------------------------------------------------------------
sub test_roundtrip {
my ($file,$format,$newext) = @_;
&report_skip ("file $file does not exist") unless -r $file;
my $tmp = fileparse ($file);
$tmp =~ s/\.([a-zA-Z0-9]+)$// or die "Must have extension for roundtrip test.";
my $ext = $1;
my $code;
my $keep = 0;
my $tmp1 = "$tmp.$newext";
&junkfile ($tmp1) unless $keep;
$code = system ("$ssconvert -T $format '$file' '$tmp1' 2>&1 | sed -e 's/^/| /'");
&system_failure ($ssconvert, $code) if $code;
my $tmp2 = "$tmp-new.$ext";
&junkfile ($tmp2) unless $keep;
$code = system ("$ssconvert '$tmp1' '$tmp2' 2>&1 | sed -e 's/^/| /'");
&system_failure ($ssconvert, $code) if $code;
my $tmp_xml = "$tmp.xml";
&junkfile ($tmp_xml) unless $keep;
$code = system ("zcat -f '$file' >'$tmp_xml'");
&system_failure ('zcat', $code) if $code;
my $tmp2_xml = "$tmp-new.xml";
&junkfile ($tmp2_xml) unless $keep;
$code = system ("zcat -f '$tmp2' >'$tmp2_xml'");
&system_failure ('zcat', $code) if $code;
$code = system ('diff', '-u', $tmp_xml, $tmp2_xml);
# Ignore failures for now.
# &system_failure ('diff', $code) if $code;
print STDERR "Pass\n";
}
# -----------------------------------------------------------------------------
sub test_valgrind {
my ($cmd,$uselibtool) = @_;
......
......@@ -71,6 +71,7 @@ TESTS = t1000-statfuns.pl \
t6102-objs-ods.pl \
t6103-lookfuns-ods.pl \
t6104-finfuns-ods.pl \
t6500-strings.pl \
t7000-goal-seek.pl \
t7100-solver-blend.pl \
t7101-solver-afiro.pl \
......
#!/usr/bin/perl -w
# -----------------------------------------------------------------------------
use strict;
use lib ($0 =~ m|^(.*/)| ? $1 : ".");
use GnumericTest;
my $file = "$samples/string-tests.gnumeric";
&message ("Check string ods roundtrip.");
&test_roundtrip ($file, 'Gnumeric_OpenCalc:odf', "ods");
&message ("Check string xls/BIFF7 roundtrip.");
&test_roundtrip ($file, 'Gnumeric_Excel:excel_biff7', "xls");
&message ("Check string xls/BIFF8 roundtrip.");
&test_roundtrip ($file, 'Gnumeric_Excel:excel_biff8', "xls");
&message ("Check string xlsx roundtrip.");
&test_roundtrip ($file, 'Gnumeric_Excel:xlsx', "xlsx");
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment