--- trunk/t/002_isis.t 2004/12/31 05:43:20 25 +++ trunk/t/002_isis.t 2005/01/05 21:23:04 33 @@ -5,10 +5,11 @@ use Data::Dumper; -use Test::More tests => 108; +use Test::More tests => 110; BEGIN { use_ok( 'IsisDB' ); } +my $debug = shift @ARGV; my $isis; sub test_data { @@ -17,14 +18,16 @@ isa_ok ($isis, 'IsisDB'); - cmp_ok($isis->{maxmfn}, '==', 5, "maxmfn set to 5"); + cmp_ok($isis->count, '==', 5, "count is 5"); # test .CNT data SKIP: { skip "no CNT file for this database", 5 unless $isis->{cnt_file}; - $isis->read_cnt; + ok(my $isis_cnt = $isis->read_cnt, "read_cnt"); + + cmp_ok(scalar keys %{$isis_cnt}, '==', 2, "returns 2 elements"); my $cnt = { '1' => { @@ -53,7 +56,7 @@ foreach my $c (keys %{$cnt}) { foreach my $kn (keys %{$cnt->{$c}}) { - cmp_ok($isis->{cnt}->{$c}->{$kn}, '==', $cnt->{$c}->{$kn}, "cnt $c $kn same"); + cmp_ok($isis_cnt->{$c}->{$kn}, '==', $cnt->{$c}->{$kn}, "cnt $c $kn same"); } } } @@ -90,7 +93,7 @@ '200' => [ '1#^aPsychology^fCamille B. Wortman, Elizabeth F. Loftus, Mary E. Marshal' ], } ]; - foreach my $mfn (1 .. $isis->{'maxmfn'}) { + foreach my $mfn (1 .. $isis->count) { my $rec; ok($rec = $isis->fetch($mfn), "fetch $mfn"); @@ -111,7 +114,7 @@ skip "no Digest::MD5 module", 5 if ($@); - foreach my $mfn (1 .. $isis->{'maxmfn'}) { + foreach my $mfn (1 .. $isis->count) { my $md5 = md5_hex($isis->to_ascii($mfn)); cmp_ok($md5, 'eq', $args->{md5_ascii}[$mfn - 1], "md5 $mfn"); } @@ -122,6 +125,7 @@ $isis = IsisDB->new ( isisdb => './data/winisis/BIBL', include_deleted => 1, + debug => $debug, ); print Dumper($isis); @@ -164,6 +168,7 @@ $isis = IsisDB->new ( isisdb => './data/winisis/BIBL', + debug => $debug, ); ok(! $isis->fetch(3), "deleted not found");