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

Annotation of /trunk/t/001_marc.t

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2 - (hide annotations)
Tue Jan 4 15:32:54 2005 UTC (19 years, 3 months ago) by dpavlin
File MIME type: application/x-troff
File size: 947 byte(s)
check for test data and skip tests if it doesn't exists

1 dpavlin 1 #!/usr/bin/perl -w
2    
3     use strict;
4     use blib;
5    
6     use Test::More tests => 20;
7     use Test::Exception;
8     use Data::Dumper;
9    
10     BEGIN { use_ok( 'MARC::Fast' ); }
11    
12     my $marc;
13     my %param;
14    
15     throws_ok { $marc = MARC::Fast->new(%param); } qr/marcdb/, "marcdb parametar";
16    
17     $param{marcdb} = '/foo/bar/file';
18    
19     throws_ok { $marc = MARC::Fast->new(%param); } qr/foo.bar/, "marcdb exist";
20    
21 dpavlin 2 $param{marcdb} = 'data/unimarc.iso';
22 dpavlin 1
23 dpavlin 2 SKIP: {
24     skip "no ",$param{marcdb}," test file ", 18 unless (-e $param{marcdb});
25 dpavlin 1
26 dpavlin 2 ok($marc = MARC::Fast->new(%param), "new");
27 dpavlin 1
28 dpavlin 2 isa_ok ($marc, 'MARC::Fast');
29 dpavlin 1
30 dpavlin 2 cmp_ok($marc->count, '==', scalar @{$marc->{leaders}}, "count == leaders");
31     cmp_ok($marc->count, '==', scalar @{$marc->{fh_offset}}, "count == fh_offset");
32 dpavlin 1
33 dpavlin 2 ok(! $marc->fetch(0), "fetch 0");
34     ok($marc->fetch($marc->count), "fetch max:".$marc->count);
35     ok(! $marc->fetch($marc->count + 1), "fetch max+1:".($marc->count+1));
36    
37     foreach (1 .. 10) {
38     ok($marc->fetch($_), "fetch $_");
39     }
40 dpavlin 1 }

Properties

Name Value
svn:executable

  ViewVC Help
Powered by ViewVC 1.1.26