From 18a004633326da86550371e44795c4034fce19be Mon Sep 17 00:00:00 2001 From: "Anders S. Mortensen" Date: Wed, 25 Oct 2006 10:08:50 +0000 Subject: [PATCH] Added. --- lib/ZOOM/IRSpy/Test/Search/Boolean.pm | 60 +++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 lib/ZOOM/IRSpy/Test/Search/Boolean.pm diff --git a/lib/ZOOM/IRSpy/Test/Search/Boolean.pm b/lib/ZOOM/IRSpy/Test/Search/Boolean.pm new file mode 100644 index 0000000..6fe68fb --- /dev/null +++ b/lib/ZOOM/IRSpy/Test/Search/Boolean.pm @@ -0,0 +1,60 @@ +# $Id: Boolean.pm,v 1.1 2006-10-25 10:08:50 sondberg Exp $ + +# See the "Main" test package for documentation + +package ZOOM::IRSpy::Test::Search::Boolean; + +use 5.008; +use strict; +use warnings; + +use ZOOM::IRSpy::Test; +our @ISA = qw(ZOOM::IRSpy::Test); + + +sub start { + my $class = shift(); + my($conn) = @_; + my %pqfs = ('and' => '@and @attr 1=4 mineral @attr 1=4 water', + 'or' => '@or @attr 1=4 mineral @attr 1=4 water', + 'not' => '@not @attr 1=4 mineral @attr 1=4 water', + 'and-or'=> '@and @or @attr 1=4 mineral @attr 1=4 water ' . + '@attr 1=4 of' + ); + + foreach my $operator (keys %pqfs) { + $conn->irspy_search_pqf($pqfs{$operator}, + {'operator' => $operator}, + ZOOM::Event::RECV_SEARCH, \&found, + exception => \&error); + } +} + + +sub found { + my($conn, $task, $test_args, $event) = @_; + my $operator = $test_args->{'operator'}; + my $n = $task->{rs}->size(); + + $conn->log("irspy_test", "search using boolean operator ", $operator, + " found $n record", $n==1 ? "" : "s"); + $conn->record()->store_result('boolean', 'operator' => $operator, + 'ok' => 1); + + return ZOOM::IRSpy::Status::TASK_DONE; +} + + +sub error { + my($conn, $task, $test_args, $exception) = @_; + my $operator = $test_args->{'operator'}; + + $conn->log("irspy_test", "search using boolean operator ", $operator, + " had error: ", $exception); + $conn->record()->store_result('boolean', 'operator' => $operator, + 'ok' => 0); + return ZOOM::IRSpy::Status::TASK_DONE; +} + + +1; -- 1.7.10.4