re-organize directories, add CDS/ISIS manual -- part about file structure
[Biblio-Isis] / t / 002_isis.t
index 3b93a0a..e1163e5 100755 (executable)
@@ -7,17 +7,18 @@ use Data::Dumper;
 
 use Test::More tests => 110;
 
-BEGIN { use_ok( 'IsisDB' ); }
+BEGIN { use_ok( 'Biblio::Isis' ); }
 
+my $debug = shift @ARGV;
 my $isis;
 
 sub test_data {
 
        my $args = {@_};
 
-       isa_ok ($isis, 'IsisDB');
+       isa_ok ($isis, 'Biblio::Isis');
 
-       cmp_ok($isis->{maxmfn}, '==', 5, "maxmfn set to 5");
+       cmp_ok($isis->count, '==', 5, "count is 5");
 
        # test .CNT data
 
@@ -92,7 +93,7 @@ sub test_data {
                '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");
 
@@ -113,7 +114,7 @@ sub test_data {
 
                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");
                }
@@ -121,9 +122,10 @@ sub test_data {
 
 }
 
-$isis = IsisDB->new (
+$isis = Biblio::Isis->new (
        isisdb => './data/winisis/BIBL',
        include_deleted => 1,
+       debug => $debug,
 );
 
 print Dumper($isis);
@@ -139,7 +141,7 @@ test_data(
        ) ],
 );
 
-$isis = IsisDB->new (
+$isis = Biblio::Isis->new (
        isisdb => './data/isismarc/BIBL',
        include_deleted => 1,
 );
@@ -156,7 +158,7 @@ test_data(
 
 # check logically deleted
 
-$isis = IsisDB->new (
+$isis = Biblio::Isis->new (
        isisdb => './data/winisis/BIBL',
        include_deleted => 1,
 );
@@ -164,8 +166,9 @@ $isis = IsisDB->new (
 ok($isis->fetch(3), "deleted found");
 cmp_ok($isis->{deleted}, '==', 3, "MFN 3 is deleted");
 
-$isis = IsisDB->new (
+$isis = Biblio::Isis->new (
        isisdb => './data/winisis/BIBL',
+       debug => $debug,
 );
 
 ok(! $isis->fetch(3), "deleted not found");