--- trunk/t/002_isis.t 2004/12/31 05:43:20 25 +++ trunk/t/002_isis.t 2005/01/05 15:46:26 32 @@ -5,7 +5,7 @@ use Data::Dumper; -use Test::More tests => 108; +use Test::More tests => 110; BEGIN { use_ok( 'IsisDB' ); } @@ -17,14 +17,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 +55,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 +92,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 +113,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"); }