/[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 22 by dpavlin, Fri Dec 31 01:06:21 2004 UTC revision 28 by dpavlin, Sat Jan 1 22:29:49 2005 UTC
# Line 5  use blib; Line 5  use blib;
5    
6  use Data::Dumper;  use Data::Dumper;
7    
8  use Test::More tests => 104;  use Test::More tests => 110;
9    
10  BEGIN { use_ok( 'IsisDB' ); }  BEGIN { use_ok( 'IsisDB' ); }
11    
# Line 24  sub test_data { Line 24  sub test_data {
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 98  sub test_data { Line 100  sub test_data {
100                          my $i = 0;                          my $i = 0;
101                          foreach my $v (@{$data->[$mfn-1]->{$f}}) {                          foreach my $v (@{$data->[$mfn-1]->{$f}}) {
102                                  $v =~ s/^[01# ][01# ]// if ($args->{no_ident});                                  $v =~ s/^[01# ][01# ]// if ($args->{no_ident});
103                                  cmp_ok($rec->{$f}->[$i], '==', $v, "MFN $mfn $f:$i $v");                                  cmp_ok($v, '==', $rec->{$f}->[$i], "MFN $mfn $f:$i $v");
104                                  $i++;                                  $i++;
105                          }                          }
106                  }                  }
# Line 113  sub test_data { Line 115  sub test_data {
115    
116                  foreach my $mfn (1 .. $isis->{'maxmfn'}) {                  foreach my $mfn (1 .. $isis->{'maxmfn'}) {
117                          my $md5 = md5_hex($isis->to_ascii($mfn));                          my $md5 = md5_hex($isis->to_ascii($mfn));
118                          cmp_ok($args->{md5_ascii}[$mfn - 1], 'eq', $md5, "md5 $mfn");                          cmp_ok($md5, 'eq', $args->{md5_ascii}[$mfn - 1], "md5 $mfn");
119                  }                  }
120          }          }
121    
# Line 121  sub test_data { Line 123  sub test_data {
123    
124  $isis = IsisDB->new (  $isis = IsisDB->new (
125          isisdb => './data/winisis/BIBL',          isisdb => './data/winisis/BIBL',
126            include_deleted => 1,
127  );  );
128    
129  print Dumper($isis);  print Dumper($isis);
# Line 130  test_data( Line 133  test_data(
133          md5_ascii => [ qw(          md5_ascii => [ qw(
134                  a369eff702307ba12eb81656ee0587fe                  a369eff702307ba12eb81656ee0587fe
135                  4fb38537a94f3f5954e40d9536b942b0                  4fb38537a94f3f5954e40d9536b942b0
136                  498cc16c9e7ab0fdc29182533cc35d11                  579a7c6901c654bdeac10547a98e5b71
137                  7d2adf1675c83283aa9b82bf343e3d85                  7d2adf1675c83283aa9b82bf343e3d85
138                  daf2cf86ca7e188e8360a185f3b43423                  daf2cf86ca7e188e8360a185f3b43423
139          ) ],          ) ],
# Line 138  test_data( Line 141  test_data(
141    
142  $isis = IsisDB->new (  $isis = IsisDB->new (
143          isisdb => './data/isismarc/BIBL',          isisdb => './data/isismarc/BIBL',
144            include_deleted => 1,
145  );  );
146    
147  test_data(  test_data(
# Line 149  test_data( Line 153  test_data(
153                  843b9ebccf16a498fba623c78f21b6c0                  843b9ebccf16a498fba623c78f21b6c0
154          ) ],          ) ],
155  );  );
156    
157    # check logically deleted
158    
159    $isis = IsisDB->new (
160            isisdb => './data/winisis/BIBL',
161            include_deleted => 1,
162    );
163    
164    ok($isis->fetch(3), "deleted found");
165    cmp_ok($isis->{deleted}, '==', 3, "MFN 3 is deleted");
166    
167    $isis = IsisDB->new (
168            isisdb => './data/winisis/BIBL',
169    );
170    
171    ok(! $isis->fetch(3), "deleted not found");
172    cmp_ok($isis->{deleted}, '==', 3, "MFN 3 is deleted");
173    

Legend:
Removed from v.22  
changed lines
  Added in v.28

  ViewVC Help
Powered by ViewVC 1.1.26