/[webpac2]/trunk/t/6-unit.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/6-unit.t

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

revision 766 by dpavlin, Sat Aug 26 12:00:36 2006 UTC revision 767 by dpavlin, Tue Oct 31 13:44:42 2006 UTC
# Line 2  Line 2 
2    
3  use strict;  use strict;
4    
5  use Test::More tests => 24;  use Test::More tests => 31;
6  use Test::Exception;  use Test::Exception;
7  use Cwd qw/abs_path/;  use Cwd qw/abs_path/;
8  use File::Temp qw/tempdir/;  use File::Temp qw/tempdir/;
# Line 13  use blib; Line 13  use blib;
13    
14  my $debug = shift @ARGV;  my $debug = shift @ARGV;
15    
16    #
17    # FIXME add lookup testing!
18    #
19    
20  BEGIN {  BEGIN {
 use_ok( 'WebPAC::Lookup' );  
21  use_ok( 'WebPAC::Input' );  use_ok( 'WebPAC::Input' );
22  use_ok( 'WebPAC::Store' );  use_ok( 'WebPAC::Store' );
 use_ok( 'WebPAC::Lookup::Normalize' );  
23  use_ok( 'WebPAC::Normalize' );  use_ok( 'WebPAC::Normalize' );
24  use_ok( 'WebPAC::Output::TT' );  use_ok( 'WebPAC::Output::TT' );
25  }  }
# Line 35  diag "isis_file: $isis_file" if ($debug) Line 37  diag "isis_file: $isis_file" if ($debug)
37  my $normalize_set_pl = "$abs_path/data/normalize.pl";  my $normalize_set_pl = "$abs_path/data/normalize.pl";
38  my $lookup_file = "$abs_path../conf/lookup/isis.pm";  my $lookup_file = "$abs_path../conf/lookup/isis.pm";
39    
 ok(my $lookup = new WebPAC::Lookup(  
         lookup_file => $lookup_file,  
 ), "new Lookup");  
   
40  ok(my $isis = new WebPAC::Input(  ok(my $isis = new WebPAC::Input(
41          module => 'WebPAC::Input::ISIS',          module => 'WebPAC::Input::ISIS',
42          code_page => 'ISO-8859-2',      # application encoding          code_page => 'ISO-8859-2',      # application encoding
# Line 51  ok(my $maxmfn = $isis->open( Line 49  ok(my $maxmfn = $isis->open(
49          code_page => 'cp852',           # database encoding          code_page => 'cp852',           # database encoding
50          lookup_coderef => sub {          lookup_coderef => sub {
51                  my $rec = shift || return;                  my $rec = shift || return;
52                  $lookup->add( $rec );                  ok($rec, 'lookup_coderef has rec');
53                    ok(defined($rec->{'000'}->[0]), 'have mfn');
54          },          },
55  ), "Input::ISIS->open");  ), "Input::ISIS->open");
56    
# Line 69  ok(my $out = new WebPAC::Output::TT( Line 68  ok(my $out = new WebPAC::Output::TT(
68          filters => { foo => sub { shift } },          filters => { foo => sub { shift } },
69  ), "new Output::TT");  ), "new Output::TT");
70    
 diag " lookup => ",Dumper($lookup->lookup_hash) if ($debug);  
   
71  my $t_norm = 0;  my $t_norm = 0;
72    
73  foreach my $pos ( 0 ... $isis->size ) {  foreach my $pos ( 0 ... $isis->size ) {
# Line 81  foreach my $pos ( 0 ... $isis->size ) { Line 78  foreach my $pos ( 0 ... $isis->size ) {
78    
79          my $t = time();          my $t = time();
80          ok( my $ds = WebPAC::Normalize::data_structure(          ok( my $ds = WebPAC::Normalize::data_structure(
                 lookup => $lookup->lookup_hash,  
81                  row => $row,                  row => $row,
82                  rules => $norm_pl,                  rules => $norm_pl,
83          ), "Set data_structure");          ), "Set data_structure");

Legend:
Removed from v.766  
changed lines
  Added in v.767

  ViewVC Help
Powered by ViewVC 1.1.26