/[MARC-Fast]/trunk/t/001_marc.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

Diff of /trunk/t/001_marc.t

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2 by dpavlin, Tue Jan 4 15:32:54 2005 UTC revision 11 by dpavlin, Fri Nov 3 20:34:31 2006 UTC
# Line 3  Line 3 
3  use strict;  use strict;
4  use blib;  use blib;
5    
6  use Test::More tests => 20;  use Test::More tests => 40;
7  use Test::Exception;  use Test::Exception;
8  use Data::Dumper;  use Data::Dump qw/dump/;
9    
10  BEGIN { use_ok( 'MARC::Fast' ); }  BEGIN { use_ok( 'MARC::Fast' ); }
11    
12    my $debug = shift @ARGV;
13    
14  my $marc;  my $marc;
15  my %param;  my %param;
16    
# Line 21  throws_ok { $marc = MARC::Fast->new(%par Line 23  throws_ok { $marc = MARC::Fast->new(%par
23  $param{marcdb} = 'data/unimarc.iso';  $param{marcdb} = 'data/unimarc.iso';
24    
25  SKIP: {  SKIP: {
26          skip "no ",$param{marcdb}," test file ", 18 unless (-e $param{marcdb});          skip "no $param{marcdb} test file ", 17 unless (-e $param{marcdb});
27    
28          ok($marc = MARC::Fast->new(%param), "new");          ok($marc = MARC::Fast->new(%param), "new");
29    
30          isa_ok ($marc, 'MARC::Fast');          isa_ok ($marc, 'MARC::Fast');
31    
32            #diag Dumper($marc);
33    
34          cmp_ok($marc->count, '==', scalar @{$marc->{leaders}}, "count == leaders");          cmp_ok($marc->count, '==', scalar @{$marc->{leaders}}, "count == leaders");
35          cmp_ok($marc->count, '==', scalar @{$marc->{fh_offset}}, "count == fh_offset");          cmp_ok($marc->count, '==', scalar @{$marc->{fh_offset}}, "count == fh_offset");
36    
# Line 36  SKIP: { Line 40  SKIP: {
40    
41          foreach (1 .. 10) {          foreach (1 .. 10) {
42                  ok($marc->fetch($_), "fetch $_");                  ok($marc->fetch($_), "fetch $_");
43    
44                    ok(my $hash = $marc->to_hash($_), "to_hash $_");
45                    diag "to_hash($_) = ",dump($hash) if ($debug);
46                    ok(my $ascii = $marc->to_ascii($_), "to_ascii $_");
47                    diag "to_ascii($_) ::\n$ascii" if ($debug);
48          }          }
49  }  }

Legend:
Removed from v.2  
changed lines
  Added in v.11

  ViewVC Help
Powered by ViewVC 1.1.26