6 use Test::More tests => 102;
9 use_ok( 'WebPAC::Test' );
10 use_ok( 'WebPAC::Input' );
12 use_ok( 'Devel::Peek' );
15 my $module = 'WebPAC::Input::CSV';
16 diag "testing with $module";
18 ok(my $input = new WebPAC::Input(
24 ok(my $db = $input->open(
25 path => "$abs_path/data/records-utf8.csv"
27 ok(my $size = $input->size, "size");
28 cmp_ok( $size, '==', 11, 'size ok' );
30 foreach my $mfn ( 1 ... $size ) {
31 my $rec = $input->fetch;
32 ok($rec, "fetch $mfn");
33 cmp_ok($rec->{'000'}->[0], '==', $mfn, 'has mfn');
34 cmp_ok($input->pos, '==', $mfn, "pos $mfn");
36 ok( my $txt = $rec->{'E'}, 'E' );
37 diag Dump( $txt ) if $debug;
38 ok( Encode::is_utf8( $txt, 1 ), 'utf8' );
39 diag "rec: ", dump($rec), "\n" if $debug;
42 ok(my $db = $input->open(
43 path => "$abs_path/data/header_first.csv",
46 ok(my $size = $input->size, "size");
47 cmp_ok( $size, '==', 10 - 1, 'size header_first' );
49 foreach my $mfn ( 1 ... $size ) {
50 my $rec = $input->fetch;
51 ok($rec, "fetch $mfn");
52 cmp_ok($rec->{'000'}->[0], '==', $mfn, 'has mfn');
53 cmp_ok($input->pos, '==', $mfn, "pos $mfn");
55 cmp_ok( $rec->{'A'}, 'eq', $rec->{'publication_title'}, 'A eq publication_title' );
56 diag "rec: ", dump($rec), "\n" if $debug;