/[Biblio-Isis]/trunk/t/002_isis.t
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/t/002_isis.t

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 19 by dpavlin, Thu Dec 30 23:16:20 2004 UTC revision 21 by dpavlin, Fri Dec 31 00:46:33 2004 UTC
# Line 5  use blib; Line 5  use blib;
5    
6  use Data::Dumper;  use Data::Dumper;
7    
8  use Test::More tests => 28;  use Test::More tests => 94;
9    
10  BEGIN { use_ok( 'IsisDB' ); }  BEGIN { use_ok( 'IsisDB' ); }
11    
# Line 13  my $isis; Line 13  my $isis;
13    
14  sub test_data {  sub test_data {
15    
16            my $args = {@_};
17    
18          isa_ok ($isis, 'IsisDB');          isa_ok ($isis, 'IsisDB');
19    
20          cmp_ok($isis->{maxmfn}, '==', 5, "maxmfn set to 5");          cmp_ok($isis->{maxmfn}, '==', 5, "maxmfn set to 5");
# Line 56  sub test_data { Line 58  sub test_data {
58                  }                  }
59          }          }
60    
61            # test fetch
62    
63            my $data = [ {
64                    '801' => [ '^aFFZG' ],
65                    '702' => [ '^aHolder^bElizabeth' ],
66                    '990' => [ '2140', '88', 'HAY' ],
67                    '675' => [ '^a159.9' ],
68                    '210' => [ '^aNew York^cNew York University press^dcop. 1988' ],
69            }, {
70                    '210' => [ '^aNew York^cUniversity press^d1989' ],
71                    '700' => [ '^aFrosh^bStephen' ],
72                    '990' => [ '2140', '89', 'FRO' ],
73                    '200' => [ '^aPsychoanalysis and psychology^eminding the gap^fStephen Frosh' ],
74                    '215' => [ '^aIX, 275 str.^d23 cm' ],
75            }, {
76                    '210' => [ '^aLondon^cFree Associoation Books^d1992' ],
77                    '700' => [ '^aTurkle^bShirlie' ],
78                    '990' => [ '2140', '92', 'LAC' ],
79                    '200' => [ '^aPsychoanalitic politics^eJacques Lacan and Freud\'s French Revolution^fSherry Turkle' ],
80                    '686' => [ '^a2140', '^a2140' ],
81            
82            }, {
83                    '700' => [ '^aGross^bRichard' ],
84                    '200' => [ '^aKey studies in psychology^fRichard D. Gross' ],
85                    '210' => [ '^aLondon^cHodder & Stoughton^d1994' ],
86                    '10' => [ '^a0-340-59691-0' ],
87            }, {
88                    # identifier test
89                    '225' => [ '1#^aMcGraw-Hill series in Psychology' ],
90                    '200' => [ '1#^aPsychology^fCamille B. Wortman, Elizabeth F. Loftus, Mary E. Marshal' ],
91            } ];
92                    
93            for (my $mfn = 1; $mfn <= $isis->{'maxmfn'}; $mfn++) {
94                    my $rec;
95                    ok($rec = $isis->fetch($mfn), "fetch $mfn");
96    
97                    foreach my $f (keys %{$data->[$mfn-1]}) {
98                            my $i = 0;
99                            foreach my $v (@{$data->[$mfn-1]->{$f}}) {
100                                    $v =~ s/^[01# ][01# ]// if ($args->{no_ident});
101                                    cmp_ok($rec->{$f}->[$i], '==', $v, "MFN $mfn $f:$i $v");
102                                    $i++;
103                            }
104                    }
105    #               print Dumper($rec);
106            }
107    
108  }  }
109    
110  $isis = IsisDB->new (  $isis = IsisDB->new (
# Line 64  $isis = IsisDB->new ( Line 113  $isis = IsisDB->new (
113    
114  print Dumper($isis);  print Dumper($isis);
115    
116  test_data;  test_data( no_ident => 1 );
117    
118  $isis = IsisDB->new (  $isis = IsisDB->new (
119          isisdb => './data/isismarc/BIBL',          isisdb => './data/isismarc/BIBL',
120  );  );
121    
122  test_data;  test_data();

Legend:
Removed from v.19  
changed lines
  Added in v.21

  ViewVC Help
Powered by ViewVC 1.1.26