/[webpac2]/trunk/t/2-input-excel.t
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /trunk/t/2-input-excel.t

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1106 - (show annotations)
Mon Aug 4 19:41:26 2008 UTC (15 years, 8 months ago) by dpavlin
File MIME type: application/x-troff
File size: 964 byte(s)
 r1729@llin:  dpavlin | 2008-08-04 21:41:19 +0200
 rewrite test to dump file which require formatted output,
 reduce size of test binary xls

1 #!/usr/bin/perl -w
2
3 use strict;
4 use blib;
5
6 use Test::More tests => 75;
7
8 BEGIN {
9 use_ok( 'WebPAC::Test' );
10 use_ok( 'WebPAC::Input' );
11 }
12
13 my $module = 'WebPAC::Input::Excel';
14 diag "testing with $module";
15
16 ok(my $input = new WebPAC::Input(
17 module => $module,
18 no_progress_bar => 1,
19 %LOG,
20 ), "new");
21
22 our ($db,$size);
23
24 sub open_xls {
25 my $path = shift || die "no path?";
26 $path = "$abs_path/data/$path";
27 ok(my $db = $input->open( path => $path ), "open $path");
28 ok($size = $input->size, "size $size");
29 return $db;
30 }
31
32 open_xls('excel_95.xls');
33
34 foreach my $mfn ( 1 ... $size ) {
35 my $rec = $input->fetch;
36 if ($mfn <= 10 || $mfn == 20) {
37 ok($rec, "fetch $mfn");
38 } else {
39 ok(! $rec, "empty $mfn");
40 }
41
42 cmp_ok($input->pos, '==', $mfn, "pos $mfn");
43
44 diag "rec: ", dump($rec), "\n" if $debug;
45 }
46
47 open_xls('stara-signatura.xls');
48 for ( 1 .. 14 ) {
49 ok( $input->seek( $_ ), "seek $_");
50 ok( my $rec = $input->fetch, "fetch $_" );
51 diag dump( $rec ) if $debug;
52 }
53

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26