From 5dd62a501112f73d25a91530e54fc1dc01f828bd Mon Sep 17 00:00:00 2001 From: Dobrica Pavlinusic Date: Fri, 31 Dec 2004 00:46:33 +0000 Subject: [PATCH 1/1] fetch tests git-svn-id: file:///home/dpavlin/svn/Biblio-Isis/trunk@21 4670fa4d-42ec-0310-ab5b-a66af6943492 --- t/002_isis.t | 55 +++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 52 insertions(+), 3 deletions(-) diff --git a/t/002_isis.t b/t/002_isis.t index 4290505..7fc00c7 100755 --- a/t/002_isis.t +++ b/t/002_isis.t @@ -5,7 +5,7 @@ use blib; use Data::Dumper; -use Test::More tests => 28; +use Test::More tests => 94; BEGIN { use_ok( 'IsisDB' ); } @@ -13,6 +13,8 @@ my $isis; sub test_data { + my $args = {@_}; + isa_ok ($isis, 'IsisDB'); cmp_ok($isis->{maxmfn}, '==', 5, "maxmfn set to 5"); @@ -56,6 +58,53 @@ sub test_data { } } + # 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 ( @@ -64,10 +113,10 @@ $isis = IsisDB->new ( print Dumper($isis); -test_data; +test_data( no_ident => 1 ); $isis = IsisDB->new ( isisdb => './data/isismarc/BIBL', ); -test_data; +test_data(); -- 2.20.1