3 |
use strict; |
use strict; |
4 |
use blib; |
use blib; |
5 |
|
|
6 |
my $tests = 269; |
my $tests = 270; |
7 |
|
|
8 |
use Test::More; |
use Test::More; |
9 |
use Test::Exception; |
use Test::Exception; |
245 |
my $skip = int($max / 2) || die "skip is zero, can't test"; |
my $skip = int($max / 2) || die "skip is zero, can't test"; |
246 |
ok($cond->set_skip( $skip ), "cond set_skip($skip)"); |
ok($cond->set_skip( $skip ), "cond set_skip($skip)"); |
247 |
|
|
248 |
|
like($node->cond_to_query( $cond ), qr/skip=$skip/, 'cond_to_query have skip'); |
249 |
|
|
250 |
ok( $nres = $node->search( $cond, 0 ), 'search'); |
ok( $nres = $node->search( $cond, 0 ), 'search'); |
251 |
isa_ok( $nres, 'Search::Estraier::NodeResult' ); |
isa_ok( $nres, 'Search::Estraier::NodeResult' ); |
252 |
cmp_ok($nres->doc_num, '==', $max, "nres->doc_num " . ($max - $skip)); |
cmp_ok($nres->doc_num, '==', $max, "nres->doc_num " . ($max - $skip)); |
253 |
cmp_ok($nres->hits, '==', $doc_num2, "nres->hits $doc_num2"); |
cmp_ok($nres->hits, '==', $doc_num2, "nres->hits $doc_num2"); |
254 |
|
|
255 |
for my $i ( 0 .. ($nres->doc_num - 1) ) { |
for my $i ( 0 .. ($nres->doc_num - 1) ) { |
256 |
my $uri = 'test' . ($i + $delete_num + 1); |
my $uri = 'test' . ($i + $delete_num + $skip + 1); |
257 |
ok( my $rdoc = $nres->get_doc( $i ), "nres->get_doc $i"); |
ok( my $rdoc = $nres->get_doc( $i ), "nres->get_doc $i"); |
258 |
if ($rdoc) { |
if ($rdoc) { |
259 |
cmp_ok( $rdoc->attr('@uri'), 'eq', $uri, "\@uri = $uri"); |
cmp_ok( $rdoc->attr('@uri'), 'eq', $uri, "\@uri = $uri"); |
303 |
ok($msg = $node->master( |
ok($msg = $node->master( |
304 |
action => 'nodeclr', |
action => 'nodeclr', |
305 |
name => $node->name, |
name => $node->name, |
306 |
), "nodeclr $node->name: $msg"); |
), "nodeclr " . $node->name . ": $msg"); |
307 |
|
|
308 |
cmp_ok($node->doc_num, '==', 0, 'no documents'); |
cmp_ok($node->doc_num, '==', 0, 'no documents'); |
309 |
|
|