From 11d9e38c7b9d01a3b228ecef38fe16314ed7a995 Mon Sep 17 00:00:00 2001 From: mike Date: Tue, 8 Nov 2005 11:45:51 +0000 Subject: [PATCH] New --- t/25-scan.t | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 t/25-scan.t diff --git a/t/25-scan.t b/t/25-scan.t new file mode 100644 index 0000000..31a7c07 --- /dev/null +++ b/t/25-scan.t @@ -0,0 +1,45 @@ +# $Id: 25-scan.t,v 1.1 2005-11-08 11:45:51 mike Exp $ + +# Before `make install' is performed this script should be runnable with +# `make test'. After `make install' it should work as `perl 25-scan.t' + +use strict; +use warnings; +use Test::More tests => 47; + +BEGIN { use_ok('ZOOM') }; + +my $host = "indexdata.com/gils"; +my $conn; +eval { $conn = new ZOOM::Connection($host, 0) }; +ok(!$@, "connection to '$host'"); + +my $startterm = "coelophysis"; +my $ss; +{ $ss = $conn->scan($startterm) }; +ok(!$@, "scan for '$startterm'"); + +my $n = $ss->size(); +ok(defined $n, "got size"); +ok($n == 10, "got 10 terms"); + +my $previous = ""; # Sorts before all legitimate terms +foreach my $i (1 .. $n) { + my($term, $occ) = $ss->term($i-1); + ok(defined $term, + "got term $i of $n: '$term' ($occ occurences)"); + ok($term ge $previous, "term '$term' ge previous '$previous'"); + $previous = $term; + (my $disp, $occ) = $ss->display_term($i-1); + ok(defined $disp, + "display term $i of $n: '$disp' ($occ occurences)"); + ok($disp eq $term, "display term $i identical to term"); +} + +$ss->destroy(); +ok(1, "destroyed scanset"); +eval { $ss->destroy() }; +ok(defined $@ && $@ =~ /been destroy\(\)ed/, + "can't re-destroy scanset"); + +# ### Much still to do: see comment in "15-scan.t" -- 1.7.10.4