/[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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1256 - (hide annotations)
Tue Jul 28 12:40:46 2009 UTC (14 years, 9 months ago) by dpavlin
File MIME type: application/x-troff
File size: 969 byte(s)
use code from lib insted of blib

1 dpavlin 498 #!/usr/bin/perl -w
2    
3 dpavlin 949 use strict;
4 dpavlin 1256 use lib 'lib';
5 dpavlin 498
6 dpavlin 1106 use Test::More tests => 75;
7 dpavlin 498
8     BEGIN {
9 dpavlin 949 use_ok( 'WebPAC::Test' );
10 dpavlin 727 use_ok( 'WebPAC::Input' );
11 dpavlin 498 }
12    
13     my $module = 'WebPAC::Input::Excel';
14     diag "testing with $module";
15    
16 dpavlin 1100 ok(my $input = new WebPAC::Input(
17     module => $module,
18     no_progress_bar => 1,
19     %LOG,
20     ), "new");
21 dpavlin 498
22 dpavlin 1100 our ($db,$size);
23    
24 dpavlin 1095 sub open_xls {
25 dpavlin 1106 my $path = shift || die "no path?";
26     $path = "$abs_path/data/$path";
27     ok(my $db = $input->open( path => $path ), "open $path");
28 dpavlin 1095 ok($size = $input->size, "size $size");
29     return $db;
30     }
31    
32 dpavlin 1106 open_xls('excel_95.xls');
33 dpavlin 1095
34 dpavlin 498 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 dpavlin 949 diag "rec: ", dump($rec), "\n" if $debug;
45 dpavlin 498 }
46    
47 dpavlin 1106 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