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