/[webpac2]/trunk/t/1-lookup.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/1-lookup.t

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

revision 6 by dpavlin, Sat Jul 16 14:44:38 2005 UTC revision 30 by dpavlin, Sun Jul 24 14:20:59 2005 UTC
# Line 1  Line 1 
1  #!/usr/bin/perl -w  #!/usr/bin/perl -w
2    
3  use strict;  use strict;
4  use Test::More tests => 6;  use Test::More tests => 16;
5  use Test::Exception;  use Test::Exception;
6  use blib;  use blib;
7    
# Line 20  ok(my $lookup = new WebPAC::Lookup( Line 20  ok(my $lookup = new WebPAC::Lookup(
20          },          },
21  ), "new");  ), "new");
22    
23    ok(my $regex = $lookup->regex, "regex");
24    diag "regex: $regex";
25    
26  my $rec = {  my $rec = {
27          '000' => [ '001' ],          '000' => [ '001' ],
28          '800' => [ 'foo' ],          '800' => [ 'foo' ],
29          '900' => [ 'bar' ],          '900' => [ 'bar' ],
30  };  };
31    
32  ok($lookup->add( $rec ), "add");  diag "testing WebPAC::Lookup own methods";
33    
34  print Dumper($lookup);  ok($lookup->add( $rec ), "add");
35    
36  ok($lookup->{'lookup'}, "have lookup hash");  ok($lookup->{'_lookup_data'}, "have lookup hash");
37    
38  my $lookup_res = {  my $lookup_res = {
39          '800:foo' => [ 'bar' ],          '800:foo' => [ 'bar' ],
# Line 38  my $lookup_res = { Line 41  my $lookup_res = {
41          '900:bar' => [ 'FOO', 'foo' ]          '900:bar' => [ 'FOO', 'foo' ]
42  };  };
43    
44  is_deeply($lookup_res, $lookup->{'lookup'}, "lookup data");  is_deeply($lookup_res, $lookup->{'_lookup_data'}, "lookup data");
45    
46    foreach my $k (keys %{ $lookup_res }) {
47            ok(my @l = $lookup->lookup("lookup{$k}"), "lookup{$k}");
48    
49            cmp_ok($#l, '==', $#{$lookup_res->{$k}}, "result size");
50    
51            is_deeply($lookup_res->{$k}, \@l, "result values");
52    }
53    
54    diag "testing WebPAC::Lookup inherited methods";

Legend:
Removed from v.6  
changed lines
  Added in v.30

  ViewVC Help
Powered by ViewVC 1.1.26