/[SWISH-PlusPlus]/trunk/t/01swish.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/01swish.t

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

revision 10 by dpavlin, Sun Dec 5 12:48:00 2004 UTC revision 14 by dpavlin, Sun Dec 5 15:35:53 2004 UTC
# Line 2  Line 2 
2    
3  use strict;  use strict;
4    
5  use Test::More tests => 22;  use Test::More tests => 29;
6  use Test::Exception;  use Test::Exception;
7  use lib '.';  use lib '.';
8  use blib;  use blib;
# Line 27  ok($i, "open index"); Line 27  ok($i, "open index");
27    
28  ok(-e $index, "index exist");  ok(-e $index, "index exist");
29    
30    ok($i->{'cwd'}, "cwd ".$i->{'cwd'});
31    
32  ok($i->check_bin, "swish++ check");  ok($i->check_bin, "swish++ check");
33    
34  diag $i->{'version'} || die;  ok($i->{'version'}, "version ".$i->{'version'});
35    
36  ok($i->index_document( 42 => 'meaning of life' ), "index 42");  ok($i->index_document( 42 => 'meaning of life' ), "index 42");
37    
38  ok($i->add(  ok($i->add(
39          path => 'life',          path => 'life',
40          title => 'Ultimate question answer found here',          title => 'Ultimate question answer found here',
41          body => '42 is answer to all questions'          body => '42 is answer to all questions',
42            meta => {
43                    author => 'Dobrica Pavlinusic',
44                    date => '2004-12-05',
45                    comment => 'woow!',
46            },
47  ), "index life");  ), "index life");
48    
49  # add one dummy document so that swish++ won't reject all words  # add one dummy document so that swish++ won't reject all words
# Line 45  ok($i->index_document( _dummy_ => '' ), Line 52  ok($i->index_document( _dummy_ => '' ),
52    
53  cmp_ok($i->{'index_dir'}, 'eq', $index, "index_dir ok");  cmp_ok($i->{'index_dir'}, 'eq', $index, "index_dir ok");
54    
55    # I would rather test search to close it itself!
56    #$i->finish_update;
57    
58  foreach my $word (qw(meaning of life)) {  foreach my $word (qw(meaning of life)) {
59          my @r = $i->search($word);          my @r = $i->search($word);
60          cmp_ok(scalar @r, '==', 1, "find $word");          cmp_ok(scalar @r, '==', 1, "find $word");
# Line 54  foreach my $word (qw(Ultimate question a Line 64  foreach my $word (qw(Ultimate question a
64          cmp_ok(scalar $i->search("title=($word)"), '==', 1, "find $word in title");          cmp_ok(scalar $i->search("title=($word)"), '==', 1, "find $word in title");
65          cmp_ok(scalar $i->search("$word"), '==', 1, "find $word anywhere");          cmp_ok(scalar $i->search("$word"), '==', 1, "find $word anywhere");
66  }  }
67    
68    foreach my $word (qw(Dobrica Pavlinusic)) {
69            cmp_ok(scalar $i->search("author=($word)"), '==', 1, "find $word in author");
70    }
71    
72    cmp_ok(scalar $i->search("date=2004-12-05"), '==', 1, "found date");
73    
74    cmp_ok(scalar $i->search("woow!"), '==', 1, "found woow");
75    cmp_ok(scalar $i->search("comment=(woow)"), '==', 1, "found woow");

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

  ViewVC Help
Powered by ViewVC 1.1.26