X-Git-Url: http://git.indexdata.com/?p=idzebra-moved-to-github.git;a=blobdiff_plain;f=test%2Ftestclient.c;h=24509f4ee079aee54768054d8471f3b8a69fe56d;hp=ee9363b74211ae54c05622187f4b8995468cf095;hb=4e68a651c499e3acc77fbf2dbedd294855206f00;hpb=cab06858d0404c4cd9dff44a38db53c81b8bd646 diff --git a/test/testclient.c b/test/testclient.c index ee9363b..24509f4 100644 --- a/test/testclient.c +++ b/test/testclient.c @@ -1,5 +1,5 @@ /* - * $Id: testclient.c,v 1.4 2002-10-23 13:55:37 adam Exp $ + * $Id: testclient.c,v 1.5 2002-11-09 22:26:19 adam Exp $ * * Z39.50 client specifically for Zebra testing. */ @@ -27,8 +27,10 @@ int main(int argc, char **argv) int retrieve_offset = 0; char *format = 0; int pos; + int check_count = -1; + int exit_code = 0; - while ((ret = options("d:n:o:f:", argv, argc, &arg)) != -2) + while ((ret = options("d:n:o:f:c:", argv, argc, &arg)) != -2) { switch (ret) { @@ -50,6 +52,9 @@ int main(int argc, char **argv) case 'f': format = xstrdup(arg); break; + case 'c': + check_count = atoi(arg); + break; default: printf ("%s: unknown option %s\n", prog, arg); printf ("usage:\n%s [options] target query \n", prog); @@ -81,10 +86,17 @@ int main(int argc, char **argv) r = ZOOM_connection_search_pqf (z, query); if ((error = ZOOM_connection_error(z, &errmsg, &addinfo))) - fprintf (stderr, "Error: %s (%d) %s\n", errmsg, error, addinfo); + { + printf ("Error: %s (%d) %s\n", errmsg, error, addinfo); + if (check_count != -1) + exit_code = 10; + } else + { printf ("Result count: %d\n", ZOOM_resultset_size(r)); - + if (check_count != -1 && check_count != ZOOM_resultset_size(r)) + exit_code = 10; + } if (format) ZOOM_resultset_option_set(r, "preferredRecordSyntax", format); for (pos = 0; pos < retrieve_number; pos++)