X-Git-Url: http://jsfdemo.indexdata.com/?a=blobdiff_plain;ds=sidebyside;f=t%2F14-sorting.t;h=ea74c6c80415fe8cd41fa562490bcae6c2402dd9;hb=bc1064f676d60c92f03cb0cf5d05fbca4f2fd7a6;hp=96beee1d7e7394302804d03e301f39a0fddd873d;hpb=0177bc22561c63fc9ff231a6a7556a163bacc84a;p=ZOOM-Perl-moved-to-github.git diff --git a/t/14-sorting.t b/t/14-sorting.t index 96beee1..ea74c6c 100644 --- a/t/14-sorting.t +++ b/t/14-sorting.t @@ -1,30 +1,18 @@ -# $Id: 14-sorting.t,v 1.2 2005-11-04 16:34:16 mike Exp $ +# $Id: 14-sorting.t,v 1.8 2006-11-02 17:48:26 mike Exp $ # Before `make install' is performed this script should be runnable with # `make test'. After `make install' it should work as `perl 14-sorting.t' -# ### At present, this test fails -- so far as I can see, because -# the underlying ZOOM-C sorting functionality is broken, as -# verified using "zoomsh" with the commands: -# -# ZOOM>open indexdata.dk/gils -# ZOOM>find @attr 1=4 map -# ZOOM>sort 1=4 -# ZOOM>show 0 5 -# -# Hopefully Adam will fix the underlying code, and then this -# will Just Work. - use strict; use warnings; -use Test::More tests => 26; +use Test::More tests => 29; use MARC::Record; BEGIN { use_ok('Net::Z3950::ZOOM') }; my($errcode, $errmsg, $addinfo) = (undef, "dummy", "dummy"); -my $host = "indexdata.com/gils"; +my $host = "z3950.indexdata.com/gils"; my $conn = Net::Z3950::ZOOM::connection_new($host, 0); $errcode = Net::Z3950::ZOOM::connection_error($conn, $errmsg, $addinfo); ok($errcode == 0, "connection to '$host'"); @@ -32,7 +20,8 @@ ok($errcode == 0, "connection to '$host'"); my $qstr = '@attr 1=4 map'; my $query = Net::Z3950::ZOOM::query_create(); Net::Z3950::ZOOM::query_prefix($query, $qstr); -Net::Z3950::ZOOM::query_sortby($query, "1=4i"); -### There's no way to check for success, as this is a void function +# Now reverse the order of sorting. We never use resultset_sort(), +# which is identical to sort1() except that it returns nothing. +my $status = Net::Z3950::ZOOM::resultset_sort1($rs, "yaz", "1=4>i"); +ok($status < 0, "malformed sort criterion rejected"); +$status = Net::Z3950::ZOOM::resultset_sort1($rs, "yaz", "1=4 >i"); +ok($status == 0, "sort criterion accepted"); $previous = "z"; # Sorts after all legitimate titles foreach my $i (1 .. $n) {