Added YAZ_CHECK_TERM which terminates test program. Using yaz/test.h
[yaz-moved-to-github.git] / test / tstsoap1.c
1 /*
2  * Copyright (C) 1995-2005, Index Data ApS
3  * See the file LICENSE for details.
4  *
5  * $Id: tstsoap1.c,v 1.5 2006-01-29 21:59:13 adam Exp $
6  */
7
8 #include <stdlib.h>
9 #if HAVE_XML2
10 #include <libxml/parser.h>
11 #endif
12 #include <yaz/test.h>
13
14 void tst()
15 {
16 #if HAVE_XML2
17     xmlChar *buf_out;
18     int len_out;
19     xmlDocPtr doc = xmlNewDoc(BAD_CAST "1.0");
20     YAZ_CHECK(doc);
21 #if 0
22     const char *val = "jordbær"; /* makes xmlDocDumpMemory hang .. */
23 #else
24     const char *val = "jordbaer"; /* OK */
25 #endif
26     xmlNodePtr top = xmlNewNode(0, BAD_CAST "top");
27     YAZ_CHECK(top);
28     
29     xmlNewTextChild(top, 0, BAD_CAST "sub", BAD_CAST val);
30     xmlDocSetRootElement(doc, top);
31     
32     xmlDocDumpMemory(doc, &buf_out, &len_out);
33 #if 0
34     printf("%*s", len_out, buf_out);
35 #endif
36
37
38 /* HAVE_XML2 */
39 #endif
40 }
41
42 int main(int argc, char **argv)
43 {
44     YAZ_CHECK_INIT(argc, argv);
45 #if HAVE_XML2
46     LIBXML_TEST_VERSION;
47 #endif
48     tst();
49     YAZ_CHECK_TERM;
50 }
51
52
53 /*
54  * Local variables:
55  * c-basic-offset: 4
56  * indent-tabs-mode: nil
57  * End:
58  * vim: shiftwidth=4 tabstop=8 expandtab
59  */
60