/[pgestraier]/trunk/t/pgest.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/pgest.t

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

revision 8 by dpavlin, Fri May 20 22:09:16 2005 UTC revision 9 by dpavlin, Sun May 22 21:18:11 2005 UTC
# Line 2  Line 2 
2    
3  use strict;  use strict;
4    
5  use Test::More tests => 25;  use Test::More tests => 33;
6    
7  BEGIN {  BEGIN {
8          use_ok('DBI');          use_ok('DBI');
# Line 46  sub pgest { Line 46  sub pgest {
46    
47  sub estcmd {  sub estcmd {
48          my $q = shift;          my $q = shift;
49            my $attr = shift;
50    
51          my $cmd = "estcmd search $index '$q'";          my $cmd = "estcmd search ";
52            $cmd .= " -attr '$attr' " if ($attr);
53            $q ||= '';
54            $cmd .= "$index '$q'";
55          diag $cmd;          diag $cmd;
56    
57          open(my $fh, "$cmd |") || die "cmd: $!";          open(my $fh, "$cmd |") || die "cmd: $!";
# Line 59  sub estcmd { Line 63  sub estcmd {
63          return undef;          return undef;
64  }  }
65    
66  foreach my $q (qw(blade runner Philip filip dick)) {  # test simple query
67    foreach my $q (qw(blade runner Philip k. dick)) {
68    
69          ok(my $hits = estcmd($q), "estcmd: $q");          ok(my $hits = estcmd($q), "estcmd: $q");
70    
# Line 67  foreach my $q (qw(blade runner Philip fi Line 72  foreach my $q (qw(blade runner Philip fi
72    
73          cmp_ok(scalar pgest($q, '', 0, 0), '==', $hits, 'blade runner');          cmp_ok(scalar pgest($q, '', 0, 0), '==', $hits, 'blade runner');
74  }  }
75    
76    # test attr query
77    foreach my $q (('@title STRINC Blade Runner', '@title ISTRBW blade runner')) {
78    
79            ok(my $hits = estcmd('',$q), "estcmd: $q");
80    
81            diag "$hits hits";
82    
83            cmp_ok(scalar pgest('', $q, 0, 0), '==', $hits, 'blade runner');
84    }
85    

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

  ViewVC Help
Powered by ViewVC 1.1.26