/[webpac2]/trunk/t/2-input-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/2-input-isis.t

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

revision 9 by dpavlin, Sat Jul 16 17:14:43 2005 UTC revision 10 by dpavlin, Sat Jul 16 20:35:30 2005 UTC
# Line 1  Line 1 
1  #!/usr/bin/perl -w  #!/usr/bin/perl -w
2    
3  use Test::More tests => 6;  use Test::More tests => 36;
4  use Test::Exception;  use Test::Exception;
5  use Cwd qw/abs_path/;  use Cwd qw/abs_path/;
6  use blib;  use blib;
# Line 14  ok(my $abs_path = abs_path($0), "abs_pat Line 14  ok(my $abs_path = abs_path($0), "abs_pat
14  $abs_path =~ s#/[^/]*$#/#;  $abs_path =~ s#/[^/]*$#/#;
15    
16  ok(my $isis = new WebPAC::Input::ISIS(), "new");  ok(my $isis = new WebPAC::Input::ISIS(), "new");
17    ok(my $isis_lm = new WebPAC::Input::ISIS( low_mem => 1 ), "new");
18    
19  throws_ok { $isis->open() } qr/filename/, "need filename";  throws_ok { $isis->open() } qr/filename/, "need filename";
20    
21  throws_ok { $isis->open( filename => '/dev/null' ) } qr/can't find database/ , "open";  throws_ok { $isis->open( filename => '/dev/null' ) } qr/can't find database/ , "open";
22    
23  ok($isis->open( filename => "$abs_path/winisis/BIBL" ), "open");  ok($isis->open( filename => "$abs_path/winisis/BIBL" ), "open");
24    ok($isis_lm->open( filename => "$abs_path/winisis/BIBL", low_mem => 1 ), "open");
25    
26    cmp_ok($isis->pos, '==', -1, "mfn");
27    
28    ok(my $size = $isis->size, "size");
29    
30    my @db1;
31    
32    foreach my $mfn ( 1 ... $size ) {
33            ok(my $rec = $isis->fetch, "fetch");
34            cmp_ok($isis->pos, '==', $mfn, "rec $mfn");
35            push @db1, $rec;
36    }
37    
38    my @db2;
39    
40    foreach my $mfn ( 1 ... $size ) {
41            ok($isis_lm->seek($mfn), "seek");
42            ok(my $rec = $isis_lm->fetch, "fetch");
43            cmp_ok($isis_lm->pos, '==', $mfn, "rec $mfn");
44            push @db2, $rec;
45    }
46    
47    is_deeply(\@db1, \@db2, "seek working");

Legend:
Removed from v.9  
changed lines
  Added in v.10

  ViewVC Help
Powered by ViewVC 1.1.26