1 |
#!/usr/bin/perl -w |
2 |
|
3 |
use strict; |
4 |
use blib; |
5 |
|
6 |
use Data::Dumper; |
7 |
|
8 |
use Test::More tests => 28; |
9 |
|
10 |
BEGIN { use_ok( 'IsisDB' ); } |
11 |
|
12 |
my $isis; |
13 |
|
14 |
sub test_data { |
15 |
|
16 |
isa_ok ($isis, 'IsisDB'); |
17 |
|
18 |
cmp_ok($isis->{maxmfn}, '==', 5, "maxmfn set to 5"); |
19 |
|
20 |
# test .CNT data |
21 |
|
22 |
SKIP: { |
23 |
skip "no CNT file for this database", 5 unless $isis->{cnt_file}; |
24 |
|
25 |
$isis->read_cnt; |
26 |
|
27 |
my $cnt = { |
28 |
'1' => { |
29 |
'N' => 15, |
30 |
'K' => 5, |
31 |
'FMAXPOS' => 8, |
32 |
'POSRX' => 1, |
33 |
'ABNORMAL' => 1, |
34 |
'ORDN' => 5, |
35 |
'LIV' => 0, |
36 |
'ORDF' => 5, |
37 |
'NMAXPOS' => 1 |
38 |
}, |
39 |
'2' => { |
40 |
'N' => 15, |
41 |
'K' => 5, |
42 |
'FMAXPOS' => 4, |
43 |
'POSRX' => 1, |
44 |
'ABNORMAL' => 0, |
45 |
'ORDN' => 5, |
46 |
'LIV' => 0, |
47 |
'ORDF' => 5, |
48 |
'NMAXPOS' => 1 |
49 |
} |
50 |
}; |
51 |
|
52 |
foreach my $c (keys %{$cnt}) { |
53 |
foreach my $kn (keys %{$cnt->{$c}}) { |
54 |
cmp_ok($isis->{cnt}->{$c}->{$kn}, '==', $cnt->{$c}->{$kn}, "cnt $c $kn same"); |
55 |
} |
56 |
} |
57 |
} |
58 |
|
59 |
} |
60 |
|
61 |
$isis = IsisDB->new ( |
62 |
isisdb => './data/winisis/BIBL', |
63 |
); |
64 |
|
65 |
print Dumper($isis); |
66 |
|
67 |
test_data; |
68 |
|
69 |
$isis = IsisDB->new ( |
70 |
isisdb => './data/isismarc/BIBL', |
71 |
); |
72 |
|
73 |
test_data; |