Commit c6e18a47 authored by Morten Welinder's avatar Morten Welinder

t2000-names-insdel.pl: new test

parent c5aa7780
......@@ -3,3 +3,4 @@ Makefile
.deps
.libs
import-db
*~
......@@ -7,16 +7,18 @@ use XML::Parser;
@GnumericTest::ISA = qw (Exporter);
@GnumericTest::EXPORT = qw(test_sheet_calc test_importer test_valgrind
test_ssindex test_command message
test_ssindex sstest test_command message
$ssconvert $topsrc $samples $PERL);
@GnumericTest::EXPORT_OK = qw(junkfile);
use vars qw($topsrc $samples $ssconvert $ssindex $PERL $verbose);
use vars qw($topsrc $samples $PERL $verbose);
use vars qw($ssconvert $ssindex $sstest);
$topsrc = "..";
$samples = "$topsrc/samples";
# FIXME. The binaries might not be in the source tree.
$ssconvert = "$topsrc/src/ssconvert";
$ssindex = "$topsrc/src/ssindex";
$sstest = "$topsrc/src/sstest";
$verbose = 0;
$PERL = $Config{'perlpath'};
$PERL .= $Config{'_exe'} if $^O ne 'VMS' && $PERL !~ m/$Config{'_exe'}$/i;
......@@ -132,6 +134,56 @@ sub test_command {
# -----------------------------------------------------------------------------
sub sstest {
my $test = shift @_;
my $expected = shift @_;
my $cmd = "$sstest $test";
my $actual = `$cmd 2>&1`;
my $err = $?;
die "Failed command: $cmd\n" if $err;
my $ok;
if (ref $expected) {
local $_ = $actual;
$ok = &$expected ($_);
} else {
my @actual = split ("\n", $actual);
chomp @actual;
while (@actual > 0 && $actual[-1] eq '') {
my $dummy = pop @actual;
}
my @expected = split ("\n", $expected);
chomp @expected;
while (@expected > 0 && $expected[-1] eq '') {
my $dummy = pop @expected;
}
my $i = 0;
while ($i < @actual && $i < @expected) {
last if $actual[$i] ne $expected[$i];
$i++;
}
if ($i < @actual || $i < @expected) {
$ok = 0;
print STDERR "Differences between actual and expected on line ", ($i + 1), ":\n";
print STDERR "Actual : ", ($i < @actual ? $actual[$i] : "-"), "\n";
print STDERR "Expected: ", ($i < @expected ? $expected[$i] : "-"), "\n";
} else {
$ok = 1;
}
}
if ($ok) {
print STDERR "Pass\n";
} else {
die "Fail.\n\n";
}
}
# -----------------------------------------------------------------------------
sub test_sheet_calc {
my $file = shift @_;
my $pargs = (ref $_[0]) ? shift @_ : [];
......
......@@ -6,6 +6,8 @@
# 18xx: Operators
# 19xx: Evaluation modes, regressions
#
# 2xxx: Internal sstest
#
# 5xxx: Importers
# 59xx: Minor formats
#
......
#!/usr/bin/perl -w
# -----------------------------------------------------------------------------
use strict;
use lib ($0 =~ m|^(.*/)| ? $1 : ".");
use GnumericTest;
my $expected;
{ local $/; $expected = <DATA>; }
&message ("Check insert/delete col/row's effect on names.");
&sstest ("test_insdel_rowcol_names", $expected);
__DATA__
-----------------------------------------------------------------------------
Start: test_insdel_rowcol_names
-----------------------------------------------------------------------------
Dumping names...
Scope=Sheet1 Name="NAMEA1" Expr=A1
Scope=Sheet1 Name="NAMEA1ABS" Expr=$A$1
Scope=Sheet1 Name="NAMEA2" Expr=A2
Scope=Sheet1 Name="NAMEA2ABS" Expr=$A$2
Scope=Sheet1 Name="Print_Area" Expr=Sheet1!$1:$65536
Scope=Sheet1 Name="Sheet_Title" Expr="Sheet1"
Scope=Sheet2 Name="Print_Area" Expr=Sheet2!$1:$65536
Scope=Sheet2 Name="Sheet_Title" Expr="Sheet2"
Scope=Global Name="NAMEG2" Expr=$A$14+Sheet1!$A$14+Sheet2!$A$14
Scope=Global Name="NAMEGA1" Expr=A1
Dumping names... Done
About to insert before column 3 on Sheet1
Dumping names...
Scope=Sheet1 Name="NAMEA1" Expr=A1
Scope=Sheet1 Name="NAMEA1ABS" Expr=$A$1
Scope=Sheet1 Name="NAMEA2" Expr=A2
Scope=Sheet1 Name="NAMEA2ABS" Expr=$A$2
Scope=Sheet1 Name="Print_Area" Expr=Sheet1!$1:$65536
Scope=Sheet1 Name="Sheet_Title" Expr="Sheet1"
Scope=Sheet2 Name="Print_Area" Expr=Sheet2!$1:$65536
Scope=Sheet2 Name="Sheet_Title" Expr="Sheet2"
Scope=Global Name="NAMEG2" Expr=$A$14+Sheet1!$A$14+Sheet2!$A$14
Scope=Global Name="NAMEGA1" Expr=A1
Dumping names... Done
Undoing.
Done.
About to insert before column 2 on Sheet1
Dumping names...
Scope=Sheet1 Name="NAMEA1" Expr=A1
Scope=Sheet1 Name="NAMEA1ABS" Expr=$A$1
Scope=Sheet1 Name="NAMEA2" Expr=A2
Scope=Sheet1 Name="NAMEA2ABS" Expr=$A$2
Scope=Sheet1 Name="Print_Area" Expr=Sheet1!$1:$65536
Scope=Sheet1 Name="Sheet_Title" Expr="Sheet1"
Scope=Sheet2 Name="Print_Area" Expr=Sheet2!$1:$65536
Scope=Sheet2 Name="Sheet_Title" Expr="Sheet2"
Scope=Global Name="NAMEG2" Expr=$A$14+Sheet1!$A$14+Sheet2!$A$14
Scope=Global Name="NAMEGA1" Expr=A1
Dumping names... Done
Undoing.
Done.
About to insert before column 1 on Sheet1
Dumping names...
Scope=Sheet1 Name="NAMEA1" Expr=A1
Scope=Sheet1 Name="NAMEA1ABS" Expr=$A$1
Scope=Sheet1 Name="NAMEA2" Expr=A2
Scope=Sheet1 Name="NAMEA2ABS" Expr=$A$2
Scope=Sheet1 Name="Print_Area" Expr=Sheet1!$1:$65536
Scope=Sheet1 Name="Sheet_Title" Expr="Sheet1"
Scope=Sheet2 Name="Print_Area" Expr=Sheet2!$1:$65536
Scope=Sheet2 Name="Sheet_Title" Expr="Sheet2"
Scope=Global Name="NAMEG2" Expr=$A$14+Sheet1!$A$14+Sheet2!$A$14
Scope=Global Name="NAMEGA1" Expr=A1
Dumping names... Done
Undoing.
Done.
About to insert before column 0 on Sheet1
Dumping names...
Scope=Sheet1 Name="NAMEA1" Expr=A1
Scope=Sheet1 Name="NAMEA1ABS" Expr=$M$1
Scope=Sheet1 Name="NAMEA2" Expr=A2
Scope=Sheet1 Name="NAMEA2ABS" Expr=$M$2
Scope=Sheet1 Name="Print_Area" Expr=Sheet1!$1:$65536
Scope=Sheet1 Name="Sheet_Title" Expr="Sheet1"
Scope=Sheet2 Name="Print_Area" Expr=Sheet2!$1:$65536
Scope=Sheet2 Name="Sheet_Title" Expr="Sheet2"
Scope=Global Name="NAMEG2" Expr=$A$14+Sheet1!$M$14+Sheet2!$A$14
Scope=Global Name="NAMEGA1" Expr=A1
Dumping names... Done
Undoing.
Done.
About to insert before column 3 on Sheet2
Dumping names...
Scope=Sheet1 Name="NAMEA1" Expr=A1
Scope=Sheet1 Name="NAMEA1ABS" Expr=$A$1
Scope=Sheet1 Name="NAMEA2" Expr=A2
Scope=Sheet1 Name="NAMEA2ABS" Expr=$A$2
Scope=Sheet1 Name="Print_Area" Expr=Sheet1!$1:$65536
Scope=Sheet1 Name="Sheet_Title" Expr="Sheet1"
Scope=Sheet2 Name="Print_Area" Expr=Sheet2!$1:$65536
Scope=Sheet2 Name="Sheet_Title" Expr="Sheet2"
Scope=Global Name="NAMEG2" Expr=$A$14+Sheet1!$A$14+Sheet2!$A$14
Scope=Global Name="NAMEGA1" Expr=A1
Dumping names... Done
Undoing.
Done.
About to insert before column 2 on Sheet2
Dumping names...
Scope=Sheet1 Name="NAMEA1" Expr=A1
Scope=Sheet1 Name="NAMEA1ABS" Expr=$A$1
Scope=Sheet1 Name="NAMEA2" Expr=A2
Scope=Sheet1 Name="NAMEA2ABS" Expr=$A$2
Scope=Sheet1 Name="Print_Area" Expr=Sheet1!$1:$65536
Scope=Sheet1 Name="Sheet_Title" Expr="Sheet1"
Scope=Sheet2 Name="Print_Area" Expr=Sheet2!$1:$65536
Scope=Sheet2 Name="Sheet_Title" Expr="Sheet2"
Scope=Global Name="NAMEG2" Expr=$A$14+Sheet1!$A$14+Sheet2!$A$14
Scope=Global Name="NAMEGA1" Expr=A1
Dumping names... Done
Undoing.
Done.
About to insert before column 1 on Sheet2
Dumping names...
Scope=Sheet1 Name="NAMEA1" Expr=A1
Scope=Sheet1 Name="NAMEA1ABS" Expr=$A$1
Scope=Sheet1 Name="NAMEA2" Expr=A2
Scope=Sheet1 Name="NAMEA2ABS" Expr=$A$2
Scope=Sheet1 Name="Print_Area" Expr=Sheet1!$1:$65536
Scope=Sheet1 Name="Sheet_Title" Expr="Sheet1"
Scope=Sheet2 Name="Print_Area" Expr=Sheet2!$1:$65536
Scope=Sheet2 Name="Sheet_Title" Expr="Sheet2"
Scope=Global Name="NAMEG2" Expr=$A$14+Sheet1!$A$14+Sheet2!$A$14
Scope=Global Name="NAMEGA1" Expr=A1
Dumping names... Done
Undoing.
Done.
About to insert before column 0 on Sheet2
Dumping names...
Scope=Sheet1 Name="NAMEA1" Expr=A1
Scope=Sheet1 Name="NAMEA1ABS" Expr=$A$1
Scope=Sheet1 Name="NAMEA2" Expr=A2
Scope=Sheet1 Name="NAMEA2ABS" Expr=$A$2
Scope=Sheet1 Name="Print_Area" Expr=Sheet1!$1:$65536
Scope=Sheet1 Name="Sheet_Title" Expr="Sheet1"
Scope=Sheet2 Name="Print_Area" Expr=Sheet2!$1:$65536
Scope=Sheet2 Name="Sheet_Title" Expr="Sheet2"
Scope=Global Name="NAMEG2" Expr=$A$14+Sheet1!$A$14+Sheet2!$M$14
Scope=Global Name="NAMEGA1" Expr=A1
Dumping names... Done
Undoing.
Done.
About to delete column 3 on Sheet1
Dumping names...
Scope=Sheet1 Name="NAMEA1" Expr=A1
Scope=Sheet1 Name="NAMEA1ABS" Expr=$A$1
Scope=Sheet1 Name="NAMEA2" Expr=A2
Scope=Sheet1 Name="NAMEA2ABS" Expr=$A$2
Scope=Sheet1 Name="Print_Area" Expr=Sheet1!$1:$65536
Scope=Sheet1 Name="Sheet_Title" Expr="Sheet1"
Scope=Sheet2 Name="Print_Area" Expr=Sheet2!$1:$65536
Scope=Sheet2 Name="Sheet_Title" Expr="Sheet2"
Scope=Global Name="NAMEG2" Expr=$A$14+Sheet1!$A$14+Sheet2!$A$14
Scope=Global Name="NAMEGA1" Expr=A1
Dumping names... Done
Undoing.
Done.
About to delete column 2 on Sheet1
Dumping names...
Scope=Sheet1 Name="NAMEA1" Expr=A1
Scope=Sheet1 Name="NAMEA1ABS" Expr=$A$1
Scope=Sheet1 Name="NAMEA2" Expr=A2
Scope=Sheet1 Name="NAMEA2ABS" Expr=$A$2
Scope=Sheet1 Name="Print_Area" Expr=Sheet1!$1:$65536
Scope=Sheet1 Name="Sheet_Title" Expr="Sheet1"
Scope=Sheet2 Name="Print_Area" Expr=Sheet2!$1:$65536
Scope=Sheet2 Name="Sheet_Title" Expr="Sheet2"
Scope=Global Name="NAMEG2" Expr=$A$14+Sheet1!$A$14+Sheet2!$A$14
Scope=Global Name="NAMEGA1" Expr=A1
Dumping names... Done
Undoing.
Done.
About to delete column 1 on Sheet1
Dumping names...
Scope=Sheet1 Name="NAMEA1" Expr=A1
Scope=Sheet1 Name="NAMEA1ABS" Expr=$A$1
Scope=Sheet1 Name="NAMEA2" Expr=A2
Scope=Sheet1 Name="NAMEA2ABS" Expr=$A$2
Scope=Sheet1 Name="Print_Area" Expr=Sheet1!$1:$65536
Scope=Sheet1 Name="Sheet_Title" Expr="Sheet1"
Scope=Sheet2 Name="Print_Area" Expr=Sheet2!$1:$65536
Scope=Sheet2 Name="Sheet_Title" Expr="Sheet2"
Scope=Global Name="NAMEG2" Expr=$A$14+Sheet1!$A$14+Sheet2!$A$14
Scope=Global Name="NAMEGA1" Expr=A1
Dumping names... Done
Undoing.
Done.
About to delete column 0 on Sheet1
Dumping names...
Scope=Sheet1 Name="NAMEA1" Expr=A1
Scope=Sheet1 Name="NAMEA1ABS" Expr=#REF!
Scope=Sheet1 Name="NAMEA2" Expr=A2
Scope=Sheet1 Name="NAMEA2ABS" Expr=#REF!
Scope=Sheet1 Name="Print_Area" Expr=Sheet1!$1:$65536
Scope=Sheet1 Name="Sheet_Title" Expr="Sheet1"
Scope=Sheet2 Name="Print_Area" Expr=Sheet2!$1:$65536
Scope=Sheet2 Name="Sheet_Title" Expr="Sheet2"
Scope=Global Name="NAMEG2" Expr=$A$14+#REF!+Sheet2!$A$14
Scope=Global Name="NAMEGA1" Expr=A1
Dumping names... Done
Undoing.
Done.
End: test_insdel_rowcol_names
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