/[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 36 by dpavlin, Thu Jan 6 20:48:07 2005 UTC revision 45 by dpavlin, Thu Jul 6 20:31:46 2006 UTC
# Line 3  Line 3 
3  use strict;  use strict;
4  use blib;  use blib;
5    
 use Data::Dumper;  
   
6  use Test::More tests => 110;  use Test::More tests => 110;
7    use File::Spec;
8    
9    my $emulate_dump = 0;
10    
11    BEGIN {
12            use_ok( 'Biblio::Isis' );
13            eval "use Data::Dump";
14    
15            if (! $@) {
16                    *Dumper = *Data::Dump::dump;
17            } else {
18                    use Data::Dumper;
19            }
20    }
21    
 BEGIN { use_ok( 'Biblio::Isis' ); }  
22    
23  my $debug = shift @ARGV;  my $debug = shift @ARGV;
24  my $isis;  my $isis;
25    
26    my $path_winisis = File::Spec->catfile('data', 'winisis', 'BIBL');
27    my $path_isismarc = File::Spec->catfile('data', 'isismarc', 'BIBL');
28    
29  sub test_data {  sub test_data {
30    
31          my $args = {@_};          my $args = {@_};
# Line 94  sub test_data { Line 108  sub test_data {
108          } ];          } ];
109                                    
110          foreach my $mfn (1 .. $isis->count) {          foreach my $mfn (1 .. $isis->count) {
111    
112                    diag "row: ",Dumper( $data->[$mfn-1] );
113    
114                  my $rec;                  my $rec;
115                  ok($rec = $isis->fetch($mfn), "fetch $mfn");                  ok($rec = $isis->fetch($mfn), "fetch $mfn");
116    
# Line 101  sub test_data { Line 118  sub test_data {
118                          my $i = 0;                          my $i = 0;
119                          foreach my $v (@{$data->[$mfn-1]->{$f}}) {                          foreach my $v (@{$data->[$mfn-1]->{$f}}) {
120                                  $v =~ s/^[01# ][01# ]// if ($args->{no_ident});                                  $v =~ s/^[01# ][01# ]// if ($args->{no_ident});
121                                  cmp_ok($v, '==', $rec->{$f}->[$i], "MFN $mfn $f:$i $v");                                  cmp_ok($v, 'eq', $rec->{$f}->[$i], "MFN $mfn $f:$i $v");
122                                  $i++;                                  $i++;
123                          }                          }
124                  }                  }
# Line 123  sub test_data { Line 140  sub test_data {
140  }  }
141    
142  $isis = Biblio::Isis->new (  $isis = Biblio::Isis->new (
143          isisdb => './data/winisis/BIBL',          isisdb => $path_winisis,
144          include_deleted => 1,          include_deleted => 1,
145          debug => $debug,          debug => $debug,
146  );  );
147    
148  print Dumper($isis);  diag "isis-new result: ", Dumper($isis);
149    
150  test_data(  test_data(
151          no_ident => 1,          no_ident => 1,
# Line 142  test_data( Line 159  test_data(
159  );  );
160    
161  $isis = Biblio::Isis->new (  $isis = Biblio::Isis->new (
162          isisdb => './data/isismarc/BIBL',          isisdb => $path_isismarc,
163          include_deleted => 1,          include_deleted => 1,
164  );  );
165    
# Line 159  test_data( Line 176  test_data(
176  # check logically deleted  # check logically deleted
177    
178  $isis = Biblio::Isis->new (  $isis = Biblio::Isis->new (
179          isisdb => './data/winisis/BIBL',          isisdb => $path_winisis,
180          include_deleted => 1,          include_deleted => 1,
181  );  );
182    
# Line 167  ok($isis->fetch(3), "deleted found"); Line 184  ok($isis->fetch(3), "deleted found");
184  cmp_ok($isis->{deleted}, '==', 3, "MFN 3 is deleted");  cmp_ok($isis->{deleted}, '==', 3, "MFN 3 is deleted");
185    
186  $isis = Biblio::Isis->new (  $isis = Biblio::Isis->new (
187          isisdb => './data/winisis/BIBL',          isisdb => $path_winisis,
188          debug => $debug,          debug => $debug,
189  );  );
190    

Legend:
Removed from v.36  
changed lines
  Added in v.45

  ViewVC Help
Powered by ViewVC 1.1.26