2 # -----------------------------------------------------------------------------
5 use lib
($0 =~ m
|^(.*/)| ?
$1 : ".");
8 my $src1 = "$samples/excel/statfuns.xls";
9 my $src2 = "$samples/excel/mathfuns.xls";
10 my $src3 = "$samples/excel/engfuns.xls";
11 my $src4 = "$samples/auto-filter-tests.gnumeric";
13 &GnumericTest
::report_skip
("Missing source files")
14 unless -r
$src1 && -r
$src2 && -r
$src3 && -r
$src4;
23 &message
("Checking ssgrep with single file.");
24 &check
("$ssgrep SUM $src1", 'TEST1A', 1);
25 &check
("$ssgrep SUM $src2", 'TEST1B', 0);
26 &check
("$ssgrep SUM $src3", 'TEST1C', 0);
28 &message
("Checking ssgrep with multiple files.");
29 &check
("$ssgrep SUM $src1 $src2 $src3", 'TEST1D', 0);
31 &message
("Checking ssgrep -n.");
32 &check
("$ssgrep -n SUM $src2", 'TEST2A', 0);
34 &message
("Checking ssgrep -c.");
35 &check
("$ssgrep -c SUM $src1", 'TEST3A', 1);
36 &check
("$ssgrep -c SUM $src2", 'TEST3B' ,0);
37 &check
("$ssgrep -c SUM $src3", 'TEST3C', 0);
39 &message
("Checking ssgrep -H.");
40 &check
("$ssgrep -H SUM $src2", 'TEST4A', 0);
42 &message
("Checking ssgrep -h.");
43 &check
("$ssgrep -h SUM $src1 $src2 $src3", 'TEST5A', 0);
45 &message
("Checking ssgrep with proper regexp.");
46 &check
("$ssgrep 'SUM[IS]' $src2", 'TEST6A', 0);
48 &message
("Checking ssgrep with hits on multiple sheets.");
49 &check
("$ssgrep -T -H -n wbc-gtk-actions $src4", 'TEST7A', 0);
51 &message
("Checking ssgrep -i.");
52 &check
("$ssgrep -h -i SUMIF $src1 $src2 $src3", 'TEST8A', 0);
54 &message
("Checking ssgrep -w.");
55 &check
("$ssgrep -h -i -w COUNT $src1 $src2 $src3", 'TEST9A', 0);
57 # -----------------------------------------------------------------------------
62 print STDERR
"Pass\n";
67 my ($cmd,$tag,$ec) = @_;
69 my $expected = $expected{$tag};
70 die unless defined $expected;
72 print STDERR
"# $cmd\n" if $GnumericTest::verbose
;
73 my $output = `$cmd 2>&1`;
77 if ($err != ($ec << 8)) {
78 print STDERR
"Wrong exit status $err\n";
80 } elsif ($output ne $expected) {
81 print STDERR
"Wrong output\n";
87 &GnumericTest
::dump_indented
($output || '(no output)');
98 if (/^\*\*\* (\S+) \*\*\*$/) {
99 $expected{$tag} = $data if $tag;
105 s/\$samples\b/$samples/g;
124 $samples/excel/mathfuns
.xls
:SERIESSUM
125 $samples/excel/mathfuns
.xls
:SUM
126 $samples/excel/mathfuns
.xls
:SUMIF
127 $samples/excel/mathfuns
.xls
:SUMPRODUCT
128 $samples/excel/mathfuns
.xls
:SUMSQ
129 $samples/excel/mathfuns
.xls
:SUMX2MY2
130 $samples/excel/mathfuns
.xls
:SUMX2PY2
131 $samples/excel/mathfuns
.xls
:SUMXMY2
132 $samples/excel/engfuns
.xls
:IMSUM
137 Sheet1
!A73
:SUMPRODUCT
149 $samples/excel/mathfuns
.xls
:SERIESSUM
150 $samples/excel/mathfuns
.xls
:SUM
151 $samples/excel/mathfuns
.xls
:SUMIF
152 $samples/excel/mathfuns
.xls
:SUMPRODUCT
153 $samples/excel/mathfuns
.xls
:SUMSQ
154 $samples/excel/mathfuns
.xls
:SUMX2MY2
155 $samples/excel/mathfuns
.xls
:SUMX2PY2
156 $samples/excel/mathfuns
.xls
:SUMXMY2
171 $samples/auto
-filter
-tests
.gnumeric
:cell
:Sheet1
!G4
:wbc
-gtk
-actions
.c
172 $samples/auto
-filter
-tests
.gnumeric
:cell
:Sheet2
!G4
:wbc
-gtk
-actions
.c
173 $samples/auto
-filter
-tests
.gnumeric
:cell
:Sheet3
!G4
:wbc
-gtk
-actions
.c
178 =sumif
(A14
:A17
,H15
,C14
:C17
)