use Data::Dumper;
-use Test::More tests => 28;
+use Test::More tests => 94;
BEGIN { use_ok( 'IsisDB' ); }
sub test_data {
+ my $args = {@_};
+
isa_ok ($isis, 'IsisDB');
cmp_ok($isis->{maxmfn}, '==', 5, "maxmfn set to 5");
}
}
+ # test fetch
+
+ my $data = [ {
+ '801' => [ '^aFFZG' ],
+ '702' => [ '^aHolder^bElizabeth' ],
+ '990' => [ '2140', '88', 'HAY' ],
+ '675' => [ '^a159.9' ],
+ '210' => [ '^aNew York^cNew York University press^dcop. 1988' ],
+ }, {
+ '210' => [ '^aNew York^cUniversity press^d1989' ],
+ '700' => [ '^aFrosh^bStephen' ],
+ '990' => [ '2140', '89', 'FRO' ],
+ '200' => [ '^aPsychoanalysis and psychology^eminding the gap^fStephen Frosh' ],
+ '215' => [ '^aIX, 275 str.^d23 cm' ],
+ }, {
+ '210' => [ '^aLondon^cFree Associoation Books^d1992' ],
+ '700' => [ '^aTurkle^bShirlie' ],
+ '990' => [ '2140', '92', 'LAC' ],
+ '200' => [ '^aPsychoanalitic politics^eJacques Lacan and Freud\'s French Revolution^fSherry Turkle' ],
+ '686' => [ '^a2140', '^a2140' ],
+
+ }, {
+ '700' => [ '^aGross^bRichard' ],
+ '200' => [ '^aKey studies in psychology^fRichard D. Gross' ],
+ '210' => [ '^aLondon^cHodder & Stoughton^d1994' ],
+ '10' => [ '^a0-340-59691-0' ],
+ }, {
+ # identifier test
+ '225' => [ '1#^aMcGraw-Hill series in Psychology' ],
+ '200' => [ '1#^aPsychology^fCamille B. Wortman, Elizabeth F. Loftus, Mary E. Marshal' ],
+ } ];
+
+ for (my $mfn = 1; $mfn <= $isis->{'maxmfn'}; $mfn++) {
+ my $rec;
+ ok($rec = $isis->fetch($mfn), "fetch $mfn");
+
+ foreach my $f (keys %{$data->[$mfn-1]}) {
+ my $i = 0;
+ foreach my $v (@{$data->[$mfn-1]->{$f}}) {
+ $v =~ s/^[01# ][01# ]// if ($args->{no_ident});
+ cmp_ok($rec->{$f}->[$i], '==', $v, "MFN $mfn $f:$i $v");
+ $i++;
+ }
+ }
+# print Dumper($rec);
+ }
+
}
$isis = IsisDB->new (
print Dumper($isis);
-test_data;
+test_data( no_ident => 1 );
$isis = IsisDB->new (
isisdb => './data/isismarc/BIBL',
);
-test_data;
+test_data();