/[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 25 by dpavlin, Fri Dec 31 05:43:20 2004 UTC revision 32 by dpavlin, Wed Jan 5 15:46:26 2005 UTC
# Line 5  use blib; Line 5  use blib;
5    
6  use Data::Dumper;  use Data::Dumper;
7    
8  use Test::More tests => 108;  use Test::More tests => 110;
9    
10  BEGIN { use_ok( 'IsisDB' ); }  BEGIN { use_ok( 'IsisDB' ); }
11    
# Line 17  sub test_data { Line 17  sub test_data {
17    
18          isa_ok ($isis, 'IsisDB');          isa_ok ($isis, 'IsisDB');
19    
20          cmp_ok($isis->{maxmfn}, '==', 5, "maxmfn set to 5");          cmp_ok($isis->count, '==', 5, "count is 5");
21    
22          # test .CNT data          # test .CNT data
23    
24          SKIP: {          SKIP: {
25                  skip "no CNT file for this database", 5 unless $isis->{cnt_file};                  skip "no CNT file for this database", 5 unless $isis->{cnt_file};
26    
27                  $isis->read_cnt;                  ok(my $isis_cnt = $isis->read_cnt, "read_cnt");
28    
29                    cmp_ok(scalar keys %{$isis_cnt}, '==', 2, "returns 2 elements");
30    
31                  my $cnt = {                  my $cnt = {
32                          '1' => {                          '1' => {
# Line 53  sub test_data { Line 55  sub test_data {
55    
56                  foreach my $c (keys %{$cnt}) {                  foreach my $c (keys %{$cnt}) {
57                          foreach my $kn (keys %{$cnt->{$c}}) {                          foreach my $kn (keys %{$cnt->{$c}}) {
58                                  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");
59                          }                          }
60                  }                  }
61          }          }
# Line 90  sub test_data { Line 92  sub test_data {
92                  '200' => [ '1#^aPsychology^fCamille B. Wortman, Elizabeth F. Loftus, Mary E. Marshal' ],                  '200' => [ '1#^aPsychology^fCamille B. Wortman, Elizabeth F. Loftus, Mary E. Marshal' ],
93          } ];          } ];
94                                    
95          foreach my $mfn (1 .. $isis->{'maxmfn'}) {          foreach my $mfn (1 .. $isis->count) {
96                  my $rec;                  my $rec;
97                  ok($rec = $isis->fetch($mfn), "fetch $mfn");                  ok($rec = $isis->fetch($mfn), "fetch $mfn");
98    
# Line 111  sub test_data { Line 113  sub test_data {
113    
114                  skip "no Digest::MD5 module", 5 if ($@);                  skip "no Digest::MD5 module", 5 if ($@);
115    
116                  foreach my $mfn (1 .. $isis->{'maxmfn'}) {                  foreach my $mfn (1 .. $isis->count) {
117                          my $md5 = md5_hex($isis->to_ascii($mfn));                          my $md5 = md5_hex($isis->to_ascii($mfn));
118                          cmp_ok($md5, 'eq', $args->{md5_ascii}[$mfn - 1], "md5 $mfn");                          cmp_ok($md5, 'eq', $args->{md5_ascii}[$mfn - 1], "md5 $mfn");
119                  }                  }

Legend:
Removed from v.25  
changed lines
  Added in v.32

  ViewVC Help
Powered by ViewVC 1.1.26