X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=test%2Ftstsoap2.c;h=342c86d0d2ba0678e2980447edf22a2fcd6e2eb4;hp=1b952b78059bf1136c4624df9825129b2ba29f95;hb=ca68610f410cfe2134cf9e6a2437df7b2ea3abdf;hpb=fb6d99a0c7e07d9cc4a315c447deaf6564a85505 diff --git a/test/tstsoap2.c b/test/tstsoap2.c index 1b952b7..342c86d 100644 --- a/test/tstsoap2.c +++ b/test/tstsoap2.c @@ -1,17 +1,16 @@ -/* - * Copyright (C) 1995-2005, Index Data ApS +/* This file is part of the YAZ toolkit. + * Copyright (C) 1995-2008 Index Data * See the file LICENSE for details. - * - * $Id: tstsoap2.c,v 1.2 2005-06-25 15:46:07 adam Exp $ */ #include -#if HAVE_XML2 -#include - +#include #include #include +#if YAZ_HAVE_XML2 +#include + static void tst_srw(void) { const char *charset = 0; @@ -24,16 +23,19 @@ static void tst_srw(void) {0, 0, 0} }; Z_SRW_PDU *sr = yaz_srw_get(o, Z_SRW_searchRetrieve_request); - Z_SOAP *p = odr_malloc(o, sizeof(*p)); + Z_SOAP *p = (Z_SOAP *) odr_malloc(o, sizeof(*p)); + YAZ_CHECK(o); + YAZ_CHECK(sr); + YAZ_CHECK(p); #if 0 - sr->u.request->query.cql = "jordbær"; + sr->u.request->query.cql = "jordb" "\xe6" "r"; #else sr->u.request->query.cql = "jordbaer"; #endif p->which = Z_SOAP_generic; - p->u.generic = odr_malloc(o, sizeof(*p->u.generic)); + p->u.generic = (Z_SOAP_Generic *) odr_malloc(o, sizeof(*p->u.generic)); p->u.generic->no = 0; p->u.generic->ns = 0; p->u.generic->p = sr; @@ -41,24 +43,18 @@ static void tst_srw(void) ret = z_soap_codec_enc(o, &p, &content_buf, &content_len, h, charset); odr_destroy(o); - if (ret) - { - printf("z_soap_codec_enc failed\n"); - exit(1); - } + YAZ_CHECK(ret == 0); /* codec failed ? */ } #endif int main(int argc, char **argv) { -#if HAVE_XML2 - LIBXML_TEST_VERSION - if (argc <= 1) - { - tst_srw(); - } + YAZ_CHECK_INIT(argc, argv); +#if YAZ_HAVE_XML2 + LIBXML_TEST_VERSION; + tst_srw(); #endif - return 0; + YAZ_CHECK_TERM; } /* * Local variables: