1 # $Id: 25-scan.t,v 1.1 2005-11-08 11:45:51 mike Exp $
3 # Before `make install' is performed this script should be runnable with
4 # `make test'. After `make install' it should work as `perl 25-scan.t'
8 use Test::More tests => 47;
10 BEGIN { use_ok('ZOOM') };
12 my $host = "indexdata.com/gils";
14 eval { $conn = new ZOOM::Connection($host, 0) };
15 ok(!$@, "connection to '$host'");
17 my $startterm = "coelophysis";
19 { $ss = $conn->scan($startterm) };
20 ok(!$@, "scan for '$startterm'");
23 ok(defined $n, "got size");
24 ok($n == 10, "got 10 terms");
26 my $previous = ""; # Sorts before all legitimate terms
27 foreach my $i (1 .. $n) {
28 my($term, $occ) = $ss->term($i-1);
30 "got term $i of $n: '$term' ($occ occurences)");
31 ok($term ge $previous, "term '$term' ge previous '$previous'");
33 (my $disp, $occ) = $ss->display_term($i-1);
35 "display term $i of $n: '$disp' ($occ occurences)");
36 ok($disp eq $term, "display term $i identical to term");
40 ok(1, "destroyed scanset");
41 eval { $ss->destroy() };
42 ok(defined $@ && $@ =~ /been destroy\(\)ed/,
43 "can't re-destroy scanset");
45 # ### Much still to do: see comment in "15-scan.t"