blob: 35a16c1ccde8c4f8ff98f61b931f1165e7c92abb [file] [log] [blame]
Daniel Veillardd93f6252004-11-02 15:53:51 +00001/*
2 * testapi.c: libxml2 API tester program.
3 *
4 * Automatically generated by gentest.py from libxml2-api.xml
5 *
6 * See Copyright for the status of this software.
7 *
8 * daniel@veillard.com
9 */
10
11#include <stdio.h>
Daniel Veillardce244ad2004-11-05 10:03:46 +000012#include <string.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +000013#include <libxml/xmlerror.h>
Daniel Veillard3d97e662004-11-04 10:49:00 +000014#include <libxml/relaxng.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +000015
16static int testlibxml2(void);
Daniel Veillardce244ad2004-11-05 10:03:46 +000017static int test_module(const char *module);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018
19static int generic_errors = 0;
20static int call_tests = 0;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021static int function_tests = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022
Daniel Veillard5ea30d72004-11-08 11:54:28 +000023static xmlChar chartab[1024];
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000024static int inttab[1024];
25static unsigned long longtab[1024];
Daniel Veillardce244ad2004-11-05 10:03:46 +000026
27static xmlDocPtr api_doc = NULL;
Daniel Veillard27f20102004-11-05 11:50:11 +000028static xmlDtdPtr api_dtd = NULL;
Daniel Veillardce244ad2004-11-05 10:03:46 +000029static xmlNodePtr api_root = NULL;
30static xmlAttrPtr api_attr = NULL;
Daniel Veillard27f20102004-11-05 11:50:11 +000031static xmlNsPtr api_ns = NULL;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032
Daniel Veillardd93f6252004-11-02 15:53:51 +000033static void
34structured_errors(void *userData ATTRIBUTE_UNUSED,
35 xmlErrorPtr error ATTRIBUTE_UNUSED) {
36 generic_errors++;
37}
38
Daniel Veillardce244ad2004-11-05 10:03:46 +000039static void
40free_api_doc(void) {
41 xmlFreeDoc(api_doc);
42 api_doc = NULL;
Daniel Veillard27f20102004-11-05 11:50:11 +000043 api_dtd = NULL;
Daniel Veillardce244ad2004-11-05 10:03:46 +000044 api_root = NULL;
45 api_attr = NULL;
Daniel Veillard27f20102004-11-05 11:50:11 +000046 api_ns = NULL;
Daniel Veillardce244ad2004-11-05 10:03:46 +000047}
48
49static xmlDocPtr
50get_api_doc(void) {
51 if (api_doc == NULL) {
Daniel Veillard27f20102004-11-05 11:50:11 +000052 api_doc = xmlReadMemory("<!DOCTYPE root [<!ELEMENT root EMPTY>]><root xmlns:h='http://example.com/' h:foo='bar'/>", 88, "root_test", NULL, 0);
Daniel Veillardce244ad2004-11-05 10:03:46 +000053 api_root = NULL;
54 api_attr = NULL;
55 }
56 return(api_doc);
57}
58
Daniel Veillard27f20102004-11-05 11:50:11 +000059static xmlDtdPtr
60get_api_dtd(void) {
61 if ((api_dtd == NULL) || (api_dtd->type != XML_DTD_NODE)) {
62 get_api_doc();
63 if ((api_doc != NULL) && (api_doc->children != NULL) &&
64 (api_doc->children->type == XML_DTD_NODE))
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000065 api_dtd = (xmlDtdPtr) api_doc->children;
Daniel Veillard27f20102004-11-05 11:50:11 +000066 }
67 return(api_dtd);
68}
69
Daniel Veillardce244ad2004-11-05 10:03:46 +000070static xmlNodePtr
71get_api_root(void) {
72 if ((api_root == NULL) || (api_root->type != XML_ELEMENT_NODE)) {
73 get_api_doc();
74 if ((api_doc != NULL) && (api_doc->children != NULL) &&
Daniel Veillard27f20102004-11-05 11:50:11 +000075 (api_doc->children->next != NULL) &&
76 (api_doc->children->next->type == XML_ELEMENT_NODE))
77 api_root = api_doc->children->next;
Daniel Veillardce244ad2004-11-05 10:03:46 +000078 }
79 return(api_root);
80}
81
Daniel Veillard27f20102004-11-05 11:50:11 +000082static xmlNsPtr
83get_api_ns(void) {
84 get_api_root();
85 if (api_root != NULL)
86 api_ns = api_root->nsDef;
87 return(api_ns);
88}
89
Daniel Veillardce244ad2004-11-05 10:03:46 +000090static xmlAttrPtr
91get_api_attr(void) {
Daniel Veillardc8311492004-11-08 16:51:13 +000092#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED)
Daniel Veillardce244ad2004-11-05 10:03:46 +000093 static int nr = 0;
94 xmlChar name[20];
Daniel Veillardc8311492004-11-08 16:51:13 +000095#endif
Daniel Veillardce244ad2004-11-05 10:03:46 +000096
97 if ((api_root == NULL) || (api_root->type != XML_ELEMENT_NODE)) {
98 get_api_root();
99 }
100 if (api_root == NULL)
101 return(NULL);
102 if (api_root->properties != NULL) {
103 api_attr = api_root->properties;
104 return(api_root->properties);
105 }
Daniel Veillardc8311492004-11-08 16:51:13 +0000106 api_attr = NULL;
107#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED)
Daniel Veillardce244ad2004-11-05 10:03:46 +0000108 snprintf((char *) name, 20, "foo%d", nr++);
109 api_attr = xmlSetProp(api_root, name, (const xmlChar *) "bar");
Daniel Veillardc8311492004-11-08 16:51:13 +0000110#endif
Daniel Veillardce244ad2004-11-05 10:03:46 +0000111 return(api_attr);
112}
113
Daniel Veillardd0cf7f62004-11-09 16:17:02 +0000114static int quiet = 0;
115
Daniel Veillardce244ad2004-11-05 10:03:46 +0000116int main(int argc, char **argv) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000117 int ret;
118 int blocks, mem;
119
Daniel Veillard5ea30d72004-11-08 11:54:28 +0000120 memset(chartab, 0, sizeof(chartab));
Daniel Veillardc8311492004-11-08 16:51:13 +0000121 strncpy((char *) chartab, " chartab\n", 20);
Daniel Veillard5ea30d72004-11-08 11:54:28 +0000122 memset(inttab, 0, sizeof(inttab));
123 memset(longtab, 0, sizeof(longtab));
124
Daniel Veillarda03e3652004-11-02 18:45:30 +0000125 xmlInitParser();
Daniel Veillard3d97e662004-11-04 10:49:00 +0000126#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillarddd6d3002004-11-03 14:20:29 +0000127 xmlRelaxNGInitTypes();
Daniel Veillard3d97e662004-11-04 10:49:00 +0000128#endif
Daniel Veillarda03e3652004-11-02 18:45:30 +0000129
Daniel Veillardd93f6252004-11-02 15:53:51 +0000130 LIBXML_TEST_VERSION
131
132 xmlSetStructuredErrorFunc(NULL, structured_errors);
133
Daniel Veillardd0cf7f62004-11-09 16:17:02 +0000134 if (argc >= 2) {
135 if (!strcmp(argv[1], "-q")) {
136 quiet = 1;
137 if (argc >= 3)
138 ret = test_module(argv[2]);
139 else
140 ret = testlibxml2();
141 } else {
142 ret = test_module(argv[1]);
143 }
144 } else
Daniel Veillardce244ad2004-11-05 10:03:46 +0000145 ret = testlibxml2();
Daniel Veillardd93f6252004-11-02 15:53:51 +0000146
147 xmlCleanupParser();
148 blocks = xmlMemBlocks();
149 mem = xmlMemUsed();
150 if ((blocks != 0) || (mem != 0)) {
151 printf("testapi leaked %d bytes in %d blocks\n", mem, blocks);
152 }
153 xmlMemoryDump();
154
155 return (ret != 0);
156}
157
158#include <libxml/HTMLparser.h>
159#include <libxml/HTMLtree.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +0000160#include <libxml/catalog.h>
161#include <libxml/chvalid.h>
162#include <libxml/dict.h>
163#include <libxml/encoding.h>
164#include <libxml/entities.h>
165#include <libxml/hash.h>
166#include <libxml/list.h>
167#include <libxml/nanoftp.h>
168#include <libxml/nanohttp.h>
169#include <libxml/parser.h>
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +0000170#include <libxml/parserInternals.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +0000171#include <libxml/pattern.h>
172#include <libxml/relaxng.h>
173#include <libxml/schemasInternals.h>
174#include <libxml/tree.h>
175#include <libxml/uri.h>
176#include <libxml/valid.h>
177#include <libxml/xinclude.h>
178#include <libxml/xmlIO.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +0000179#include <libxml/xmlerror.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +0000180#include <libxml/xmlreader.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +0000181#include <libxml/xmlsave.h>
182#include <libxml/xmlschemas.h>
183#include <libxml/xmlschemastypes.h>
184#include <libxml/xmlstring.h>
185#include <libxml/xmlwriter.h>
186#include <libxml/xpath.h>
187#include <libxml/xpointer.h>
Daniel Veillarda521d282004-11-09 14:59:59 +0000188#include <libxml/debugXML.h>
Daniel Veillardd93f6252004-11-02 15:53:51 +0000189
William M. Brackf13f77f2004-11-12 16:03:48 +0000190/*
191 We manually define xmlErrMemory because it's normal declaration
192 is "hidden" by #ifdef IN_LIBXML
193*/
194void xmlErrMemory(xmlParserCtxtPtr ctxt, const char *extra);
195
William M. Brack015ccb22005-02-13 08:18:52 +0000196/*
197 We need some "remote" addresses, but want to avoid getting into
198 name resolution delays, so we use these
199*/
200#define REMOTE1GOOD "http://localhost/"
201#define REMOTE1BAD "http://missing. example.org/"
202#define REMOTE2GOOD "ftp://localhost/foo"
203
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000204#define gen_nb_void_ptr 2
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +0000205
Daniel Veillard3d97e662004-11-04 10:49:00 +0000206static void *gen_void_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +0000207 return(NULL);
208}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000209static void des_void_ptr(int no ATTRIBUTE_UNUSED, void *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +0000210}
211
Daniel Veillardce244ad2004-11-05 10:03:46 +0000212#if 0
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000213#define gen_nb_const_void_ptr 2
214
215static const void *gen_const_void_ptr(int no, int nr ATTRIBUTE_UNUSED) {
216 if (no == 0) return((const void *) "immutable string");
217 return(NULL);
218}
219static void des_const_void_ptr(int no ATTRIBUTE_UNUSED, const void *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
220}
Daniel Veillardce244ad2004-11-05 10:03:46 +0000221#endif
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000222
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000223#define gen_nb_userdata 3
224
Daniel Veillard3d97e662004-11-04 10:49:00 +0000225static void *gen_userdata(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000226 if (no == 0) return((void *) &call_tests);
227 if (no == 1) return((void *) -1);
228 return(NULL);
229}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000230static void des_userdata(int no ATTRIBUTE_UNUSED, void *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000231}
232
233
Daniel Veillardd93f6252004-11-02 15:53:51 +0000234#define gen_nb_int 4
235
Daniel Veillard3d97e662004-11-04 10:49:00 +0000236static int gen_int(int no, int nr ATTRIBUTE_UNUSED) {
237 if (no == 0) return(0);
238 if (no == 1) return(1);
Daniel Veillardc2c894f2004-11-07 12:17:35 +0000239 if (no == 2) return(-1);
240 if (no == 3) return(122);
Daniel Veillard3d97e662004-11-04 10:49:00 +0000241 return(-1);
242}
243
244static void des_int(int no ATTRIBUTE_UNUSED, int val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
245}
246
Daniel Veillard6128c012004-11-08 17:16:15 +0000247#define gen_nb_parseroptions 5
248
249static int gen_parseroptions(int no, int nr ATTRIBUTE_UNUSED) {
250 if (no == 0) return(XML_PARSE_NOBLANKS | XML_PARSE_RECOVER);
251 if (no == 1) return(XML_PARSE_NOENT | XML_PARSE_DTDLOAD | XML_PARSE_DTDATTR | XML_PARSE_DTDVALID | XML_PARSE_NOCDATA);
252 if (no == 2) return(XML_PARSE_XINCLUDE | XML_PARSE_NOXINCNODE | XML_PARSE_NSCLEAN);
253 if (no == 3) return(XML_PARSE_XINCLUDE | XML_PARSE_NODICT);
254 return(XML_PARSE_SAX1);
255}
256
257static void des_parseroptions(int no ATTRIBUTE_UNUSED, int val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
258}
259
Daniel Veillardce244ad2004-11-05 10:03:46 +0000260#if 0
Daniel Veillardf2a36f92004-11-08 17:55:01 +0000261#define gen_nb_long 5
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000262
263static long gen_long(int no, int nr ATTRIBUTE_UNUSED) {
264 if (no == 0) return(0);
265 if (no == 1) return(1);
Daniel Veillardc2c894f2004-11-07 12:17:35 +0000266 if (no == 2) return(-1);
267 if (no == 3) return(122);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000268 return(-1);
269}
270
271static void des_long(int no ATTRIBUTE_UNUSED, long val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
272}
Daniel Veillardce244ad2004-11-05 10:03:46 +0000273#endif
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000274
Daniel Veillardf2a36f92004-11-08 17:55:01 +0000275#define gen_nb_xmlChar 4
276
277static xmlChar gen_xmlChar(int no, int nr ATTRIBUTE_UNUSED) {
278 if (no == 0) return('a');
279 if (no == 1) return(' ');
280 if (no == 2) return('ø');
281 return(0);
282}
283
284static void des_xmlChar(int no ATTRIBUTE_UNUSED, xmlChar val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
285}
286
Daniel Veillard3d97e662004-11-04 10:49:00 +0000287#define gen_nb_unsigned_int 3
288
289static unsigned int gen_unsigned_int(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000290 if (no == 0) return(0);
291 if (no == 1) return(1);
292 if (no == 2) return(122);
293 return(-1);
294}
295
Daniel Veillard3d97e662004-11-04 10:49:00 +0000296static void des_unsigned_int(int no ATTRIBUTE_UNUSED, unsigned int val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000297}
298
Daniel Veillard3d95c732004-11-06 22:25:14 +0000299#define gen_nb_unsigned_long 4
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000300
301static unsigned long gen_unsigned_long(int no, int nr ATTRIBUTE_UNUSED) {
302 if (no == 0) return(0);
303 if (no == 1) return(1);
304 if (no == 2) return(122);
305 return(-1);
306}
307
308static void des_unsigned_long(int no ATTRIBUTE_UNUSED, unsigned long val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
309}
310
Daniel Veillard3d95c732004-11-06 22:25:14 +0000311#define gen_nb_double 4
312
313static double gen_double(int no, int nr ATTRIBUTE_UNUSED) {
314 if (no == 0) return(0);
315 if (no == 1) return(-1.1);
Daniel Veillardd0cf7f62004-11-09 16:17:02 +0000316#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +0000317 if (no == 2) return(xmlXPathNAN);
Daniel Veillardc8311492004-11-08 16:51:13 +0000318#endif
Daniel Veillard3d95c732004-11-06 22:25:14 +0000319 return(-1);
320}
321
322static void des_double(int no ATTRIBUTE_UNUSED, double val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
323}
324
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000325#define gen_nb_unsigned_long_ptr 2
326
327static unsigned long *gen_unsigned_long_ptr(int no, int nr) {
328 if (no == 0) return(&longtab[nr]);
329 return(NULL);
330}
331
332static void des_unsigned_long_ptr(int no ATTRIBUTE_UNUSED, unsigned long *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
333}
334
335#define gen_nb_int_ptr 2
336
337static int *gen_int_ptr(int no, int nr) {
338 if (no == 0) return(&inttab[nr]);
339 return(NULL);
340}
341
342static void des_int_ptr(int no ATTRIBUTE_UNUSED, int *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
343}
344
Daniel Veillardd93f6252004-11-02 15:53:51 +0000345#define gen_nb_const_char_ptr 4
346
Daniel Veillardce682bc2004-11-05 17:22:25 +0000347static char *gen_const_char_ptr(int no, int nr ATTRIBUTE_UNUSED) {
348 if (no == 0) return((char *) "foo");
349 if (no == 1) return((char *) "<foo/>");
350 if (no == 2) return((char *) "test/ent2");
Daniel Veillardd93f6252004-11-02 15:53:51 +0000351 return(NULL);
352}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000353static void des_const_char_ptr(int no ATTRIBUTE_UNUSED, const char *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000354}
355
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000356#define gen_nb_xmlChar_ptr 2
357
Daniel Veillard3d97e662004-11-04 10:49:00 +0000358static xmlChar *gen_xmlChar_ptr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000359 if (no == 0) return(&chartab[0]);
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000360 return(NULL);
361}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000362static void des_xmlChar_ptr(int no ATTRIBUTE_UNUSED, xmlChar *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000363}
364
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000365#define gen_nb_FILE_ptr 2
366
367static FILE *gen_FILE_ptr(int no, int nr ATTRIBUTE_UNUSED) {
368 if (no == 0) return(fopen("test.out", "a+"));
369 return(NULL);
370}
371static void des_FILE_ptr(int no ATTRIBUTE_UNUSED, FILE *val, int nr ATTRIBUTE_UNUSED) {
372 if (val != NULL) fclose(val);
373}
374
Daniel Veillarda82b1822004-11-08 16:24:57 +0000375#define gen_nb_debug_FILE_ptr 2
376static FILE *gen_debug_FILE_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
377 return(fopen("test.out", "a+"));
378}
379static void des_debug_FILE_ptr(int no ATTRIBUTE_UNUSED, FILE *val, int nr ATTRIBUTE_UNUSED) {
380 if (val != NULL) fclose(val);
381}
382
Daniel Veillardd93f6252004-11-02 15:53:51 +0000383#define gen_nb_const_xmlChar_ptr 5
384
Daniel Veillardce682bc2004-11-05 17:22:25 +0000385static xmlChar *gen_const_xmlChar_ptr(int no, int nr ATTRIBUTE_UNUSED) {
386 if (no == 0) return((xmlChar *) "foo");
387 if (no == 1) return((xmlChar *) "<foo/>");
388 if (no == 2) return((xmlChar *) "nøne");
389 if (no == 3) return((xmlChar *) " 2ab ");
Daniel Veillardd93f6252004-11-02 15:53:51 +0000390 return(NULL);
391}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000392static void des_const_xmlChar_ptr(int no ATTRIBUTE_UNUSED, const xmlChar *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000393}
394
395#define gen_nb_filepath 8
396
Daniel Veillard3d97e662004-11-04 10:49:00 +0000397static const char *gen_filepath(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000398 if (no == 0) return("missing.xml");
399 if (no == 1) return("<foo/>");
400 if (no == 2) return("test/ent2");
401 if (no == 3) return("test/valid/REC-xml-19980210.xml");
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000402 if (no == 4) return("test/valid/dtds/xhtml1-strict.dtd");
William M. Brack015ccb22005-02-13 08:18:52 +0000403 if (no == 5) return(REMOTE1GOOD);
404 if (no == 6) return(REMOTE1BAD);
Daniel Veillardd93f6252004-11-02 15:53:51 +0000405 return(NULL);
406}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000407static void des_filepath(int no ATTRIBUTE_UNUSED, const char *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000408}
409
Daniel Veillard27f20102004-11-05 11:50:11 +0000410#define gen_nb_eaten_name 2
411
412static xmlChar *gen_eaten_name(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +0000413 if (no == 0) return(xmlStrdup(BAD_CAST "eaten"));
Daniel Veillard27f20102004-11-05 11:50:11 +0000414 return(NULL);
415}
416static void des_eaten_name(int no ATTRIBUTE_UNUSED, xmlChar *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
417}
418
Daniel Veillardd93f6252004-11-02 15:53:51 +0000419#define gen_nb_fileoutput 6
420
Daniel Veillard3d97e662004-11-04 10:49:00 +0000421static const char *gen_fileoutput(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000422 if (no == 0) return("/missing.xml");
423 if (no == 1) return("<foo/>");
William M. Brack015ccb22005-02-13 08:18:52 +0000424 if (no == 2) return(REMOTE2GOOD);
425 if (no == 3) return(REMOTE1GOOD);
426 if (no == 4) return(REMOTE1BAD);
Daniel Veillardd93f6252004-11-02 15:53:51 +0000427 return(NULL);
428}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000429static void des_fileoutput(int no ATTRIBUTE_UNUSED, const char *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000430}
431
Daniel Veillarda521d282004-11-09 14:59:59 +0000432#define gen_nb_xmlParserCtxtPtr 3
Daniel Veillard3d97e662004-11-04 10:49:00 +0000433static xmlParserCtxtPtr gen_xmlParserCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000434 if (no == 0) return(xmlNewParserCtxt());
Daniel Veillarda521d282004-11-09 14:59:59 +0000435 if (no == 1) return(xmlCreateMemoryParserCtxt("<doc/>", 6));
Daniel Veillardd93f6252004-11-02 15:53:51 +0000436 return(NULL);
437}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000438static void des_xmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, xmlParserCtxtPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000439 if (val != NULL)
440 xmlFreeParserCtxt(val);
441}
442
Daniel Veillard34099b42004-11-04 17:34:35 +0000443#define gen_nb_xmlSAXHandlerPtr 2
444static xmlSAXHandlerPtr gen_xmlSAXHandlerPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarda521d282004-11-09 14:59:59 +0000445#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +0000446 if (no == 0) return((xmlSAXHandlerPtr) &xmlDefaultSAXHandler);
Daniel Veillarda521d282004-11-09 14:59:59 +0000447#endif
Daniel Veillard34099b42004-11-04 17:34:35 +0000448 return(NULL);
449}
450static void des_xmlSAXHandlerPtr(int no ATTRIBUTE_UNUSED, xmlSAXHandlerPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
451}
452
Daniel Veillardc0be74b2004-11-03 19:16:55 +0000453#define gen_nb_xmlValidCtxtPtr 2
Daniel Veillard3d97e662004-11-04 10:49:00 +0000454static xmlValidCtxtPtr gen_xmlValidCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarda521d282004-11-09 14:59:59 +0000455#ifdef LIBXML_VALID_ENABLED
Daniel Veillardc0be74b2004-11-03 19:16:55 +0000456 if (no == 0) return(xmlNewValidCtxt());
Daniel Veillarda521d282004-11-09 14:59:59 +0000457#endif
Daniel Veillardc0be74b2004-11-03 19:16:55 +0000458 return(NULL);
459}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000460static void des_xmlValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlValidCtxtPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarda521d282004-11-09 14:59:59 +0000461#ifdef LIBXML_VALID_ENABLED
Daniel Veillardc0be74b2004-11-03 19:16:55 +0000462 if (val != NULL)
463 xmlFreeValidCtxt(val);
Daniel Veillarda521d282004-11-09 14:59:59 +0000464#endif
Daniel Veillardc0be74b2004-11-03 19:16:55 +0000465}
466
Daniel Veillard34099b42004-11-04 17:34:35 +0000467#define gen_nb_xmlParserInputBufferPtr 8
468
469static xmlParserInputBufferPtr gen_xmlParserInputBufferPtr(int no, int nr ATTRIBUTE_UNUSED) {
470 if (no == 0) return(xmlParserInputBufferCreateFilename("missing.xml", XML_CHAR_ENCODING_NONE));
471 if (no == 1) return(xmlParserInputBufferCreateFilename("<foo/>", XML_CHAR_ENCODING_NONE));
472 if (no == 2) return(xmlParserInputBufferCreateFilename("test/ent2", XML_CHAR_ENCODING_NONE));
473 if (no == 3) return(xmlParserInputBufferCreateFilename("test/valid/REC-xml-19980210.xml", XML_CHAR_ENCODING_NONE));
474 if (no == 4) return(xmlParserInputBufferCreateFilename("test/valid/dtds/xhtml1-strict.dtd", XML_CHAR_ENCODING_NONE));
William M. Brack015ccb22005-02-13 08:18:52 +0000475 if (no == 5) return(xmlParserInputBufferCreateFilename(REMOTE1GOOD, XML_CHAR_ENCODING_NONE));
476 if (no == 6) return(xmlParserInputBufferCreateFilename(REMOTE1BAD, XML_CHAR_ENCODING_NONE));
Daniel Veillard34099b42004-11-04 17:34:35 +0000477 return(NULL);
478}
479static void des_xmlParserInputBufferPtr(int no ATTRIBUTE_UNUSED, xmlParserInputBufferPtr val, int nr ATTRIBUTE_UNUSED) {
480 xmlFreeParserInputBuffer(val);
481}
482
Daniel Veillardd93f6252004-11-02 15:53:51 +0000483#define gen_nb_xmlDocPtr 3
Daniel Veillard3d97e662004-11-04 10:49:00 +0000484static xmlDocPtr gen_xmlDocPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000485 if (no == 0) return(xmlNewDoc(BAD_CAST "1.0"));
486 if (no == 1) return(xmlReadMemory("<foo/>", 6, "test", NULL, 0));
487 return(NULL);
488}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000489static void des_xmlDocPtr(int no ATTRIBUTE_UNUSED, xmlDocPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardce244ad2004-11-05 10:03:46 +0000490 if ((val != NULL) && (val != api_doc) && (val->doc != api_doc))
Daniel Veillardd93f6252004-11-02 15:53:51 +0000491 xmlFreeDoc(val);
492}
493
Daniel Veillardce244ad2004-11-05 10:03:46 +0000494#define gen_nb_xmlAttrPtr 2
495static xmlAttrPtr gen_xmlAttrPtr(int no, int nr ATTRIBUTE_UNUSED) {
496 if (no == 0) return(get_api_attr());
497 return(NULL);
498}
499static void des_xmlAttrPtr(int no, xmlAttrPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
500 if (no == 0) free_api_doc();
501}
502
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000503#define gen_nb_xmlDictPtr 2
504static xmlDictPtr gen_xmlDictPtr(int no, int nr ATTRIBUTE_UNUSED) {
505 if (no == 0) return(xmlDictCreate());
506 return(NULL);
507}
508static void des_xmlDictPtr(int no ATTRIBUTE_UNUSED, xmlDictPtr val, int nr ATTRIBUTE_UNUSED) {
509 if (val != NULL)
510 xmlDictFree(val);
511}
512
Daniel Veillardce244ad2004-11-05 10:03:46 +0000513#define gen_nb_xmlNodePtr 3
Daniel Veillard3d97e662004-11-04 10:49:00 +0000514static xmlNodePtr gen_xmlNodePtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000515 if (no == 0) return(xmlNewPI(BAD_CAST "test", NULL));
Daniel Veillardce244ad2004-11-05 10:03:46 +0000516 if (no == 1) return(get_api_root());
Daniel Veillardd93f6252004-11-02 15:53:51 +0000517 return(NULL);
Daniel Veillardce244ad2004-11-05 10:03:46 +0000518/* if (no == 2) return((xmlNodePtr) get_api_doc()); */
Daniel Veillardd93f6252004-11-02 15:53:51 +0000519}
Daniel Veillard27f20102004-11-05 11:50:11 +0000520static void des_xmlNodePtr(int no, xmlNodePtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardce244ad2004-11-05 10:03:46 +0000521 if (no == 1) free_api_doc();
522 else if (val != NULL) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000523 xmlUnlinkNode(val);
524 xmlFreeNode(val);
525 }
526}
527
Daniel Veillard27f20102004-11-05 11:50:11 +0000528#define gen_nb_xmlDtdPtr 3
529static xmlDtdPtr gen_xmlDtdPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +0000530 if (no == 0)
531 return(xmlNewDtd(NULL, BAD_CAST "dtd", BAD_CAST"foo", BAD_CAST"bar"));
Daniel Veillard27f20102004-11-05 11:50:11 +0000532 if (no == 1) return(get_api_dtd());
533 return(NULL);
534}
535static void des_xmlDtdPtr(int no, xmlDtdPtr val, int nr ATTRIBUTE_UNUSED) {
536 if (no == 1) free_api_doc();
537 else if (val != NULL) {
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +0000538 xmlUnlinkNode((xmlNodePtr) val);
539 xmlFreeNode((xmlNodePtr) val);
Daniel Veillard27f20102004-11-05 11:50:11 +0000540 }
541}
542
543#define gen_nb_xmlNsPtr 2
544static xmlNsPtr gen_xmlNsPtr(int no, int nr ATTRIBUTE_UNUSED) {
545 if (no == 0) return(get_api_ns());
546 return(NULL);
547}
548static void des_xmlNsPtr(int no, xmlNsPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
549 if (no == 0) free_api_doc();
550}
551
Daniel Veillardd93f6252004-11-02 15:53:51 +0000552#define gen_nb_xmlNodePtr_in 3
Daniel Veillard3d97e662004-11-04 10:49:00 +0000553static xmlNodePtr gen_xmlNodePtr_in(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000554 if (no == 0) return(xmlNewPI(BAD_CAST "test", NULL));
555 if (no == 0) return(xmlNewText(BAD_CAST "text"));
556 return(NULL);
557}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000558static void des_xmlNodePtr_in(int no ATTRIBUTE_UNUSED, xmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd93f6252004-11-02 15:53:51 +0000559}
560
Daniel Veillardc8311492004-11-08 16:51:13 +0000561#ifdef LIBXML_WRITER_ENABLED
Daniel Veillarde43cc572004-11-03 11:50:29 +0000562#define gen_nb_xmlTextWriterPtr 2
Daniel Veillard3d97e662004-11-04 10:49:00 +0000563static xmlTextWriterPtr gen_xmlTextWriterPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarde43cc572004-11-03 11:50:29 +0000564 if (no == 0) return(xmlNewTextWriterFilename("test.out", 0));
565 return(NULL);
566}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000567static void des_xmlTextWriterPtr(int no ATTRIBUTE_UNUSED, xmlTextWriterPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarde43cc572004-11-03 11:50:29 +0000568 if (val != NULL) xmlFreeTextWriter(val);
569}
Daniel Veillardc8311492004-11-08 16:51:13 +0000570#endif
Daniel Veillarde43cc572004-11-03 11:50:29 +0000571
Daniel Veillardc8311492004-11-08 16:51:13 +0000572#ifdef LIBXML_READER_ENABLED
Daniel Veillarddd6d3002004-11-03 14:20:29 +0000573#define gen_nb_xmlTextReaderPtr 4
Daniel Veillard3d97e662004-11-04 10:49:00 +0000574static xmlTextReaderPtr gen_xmlTextReaderPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarddd6d3002004-11-03 14:20:29 +0000575 if (no == 0) return(xmlNewTextReaderFilename("test/ent2"));
576 if (no == 1) return(xmlNewTextReaderFilename("test/valid/REC-xml-19980210.xml"));
577 if (no == 2) return(xmlNewTextReaderFilename("test/valid/dtds/xhtml1-strict.dtd"));
578 return(NULL);
579}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000580static void des_xmlTextReaderPtr(int no ATTRIBUTE_UNUSED, xmlTextReaderPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillarddd6d3002004-11-03 14:20:29 +0000581 if (val != NULL) xmlFreeTextReader(val);
582}
Daniel Veillardc8311492004-11-08 16:51:13 +0000583#endif
Daniel Veillarddd6d3002004-11-03 14:20:29 +0000584
Daniel Veillard34099b42004-11-04 17:34:35 +0000585#define gen_nb_xmlBufferPtr 3
Daniel Veillard3d97e662004-11-04 10:49:00 +0000586static xmlBufferPtr gen_xmlBufferPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000587 if (no == 0) return(xmlBufferCreate());
Daniel Veillardce244ad2004-11-05 10:03:46 +0000588 if (no == 1) return(xmlBufferCreateStatic((void *)"a static buffer", 13));
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000589 return(NULL);
590}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000591static void des_xmlBufferPtr(int no ATTRIBUTE_UNUSED, xmlBufferPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000592 if (val != NULL) {
593 xmlBufferFree(val);
594 }
595}
596
597#define gen_nb_xmlListPtr 2
Daniel Veillard3d97e662004-11-04 10:49:00 +0000598static xmlListPtr gen_xmlListPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000599 if (no == 0) return(xmlListCreate(NULL, NULL));
600 return(NULL);
601}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000602static void des_xmlListPtr(int no ATTRIBUTE_UNUSED, xmlListPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000603 if (val != NULL) {
604 xmlListDelete(val);
605 }
606}
607
608#define gen_nb_xmlHashTablePtr 2
Daniel Veillard3d97e662004-11-04 10:49:00 +0000609static xmlHashTablePtr gen_xmlHashTablePtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000610 if (no == 0) return(xmlHashCreate(10));
611 return(NULL);
612}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000613static void des_xmlHashTablePtr(int no ATTRIBUTE_UNUSED, xmlHashTablePtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000614 if (val != NULL) {
615 xmlHashFree(val, NULL);
616 }
617}
618
619#include <libxml/xpathInternals.h>
620
Daniel Veillardc8311492004-11-08 16:51:13 +0000621#ifdef LIBXML_XPATH_ENABLED
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000622#define gen_nb_xmlXPathObjectPtr 5
Daniel Veillard3d97e662004-11-04 10:49:00 +0000623static xmlXPathObjectPtr gen_xmlXPathObjectPtr(int no, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000624 if (no == 0) return(xmlXPathNewString(BAD_CAST "string object"));
625 if (no == 1) return(xmlXPathNewFloat(1.1));
626 if (no == 2) return(xmlXPathNewBoolean(1));
627 if (no == 3) return(xmlXPathNewNodeSet(NULL));
628 return(NULL);
629}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000630static void des_xmlXPathObjectPtr(int no ATTRIBUTE_UNUSED, xmlXPathObjectPtr val, int nr ATTRIBUTE_UNUSED) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000631 if (val != NULL) {
632 xmlXPathFreeObject(val);
633 }
634}
Daniel Veillardc8311492004-11-08 16:51:13 +0000635#endif
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000636
Daniel Veillardc8311492004-11-08 16:51:13 +0000637#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillard3d97e662004-11-04 10:49:00 +0000638#define gen_nb_xmlOutputBufferPtr 2
639static xmlOutputBufferPtr gen_xmlOutputBufferPtr(int no, int nr ATTRIBUTE_UNUSED) {
640 if (no == 0) return(xmlOutputBufferCreateFilename("test.out", NULL, 0));
641 return(NULL);
642}
643static void des_xmlOutputBufferPtr(int no ATTRIBUTE_UNUSED, xmlOutputBufferPtr val, int nr ATTRIBUTE_UNUSED) {
644 if (val != NULL) {
645 xmlOutputBufferClose(val);
646 }
647}
Daniel Veillardc8311492004-11-08 16:51:13 +0000648#endif
Daniel Veillard3d97e662004-11-04 10:49:00 +0000649
Daniel Veillardc8311492004-11-08 16:51:13 +0000650#ifdef LIBXML_FTP_ENABLED
Daniel Veillard27f20102004-11-05 11:50:11 +0000651#define gen_nb_xmlNanoFTPCtxtPtr 4
652static void *gen_xmlNanoFTPCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) {
William M. Brack015ccb22005-02-13 08:18:52 +0000653 if (no == 0) return(xmlNanoFTPNewCtxt(REMOTE2GOOD));
654 if (no == 1) return(xmlNanoFTPNewCtxt(REMOTE1GOOD));
Daniel Veillard27f20102004-11-05 11:50:11 +0000655 if (no == 2) return(xmlNanoFTPNewCtxt("foo"));
656 return(NULL);
657}
658static void des_xmlNanoFTPCtxtPtr(int no ATTRIBUTE_UNUSED, void *val, int nr ATTRIBUTE_UNUSED) {
659 if (val != NULL) {
660 xmlNanoFTPFreeCtxt(val);
661 }
662}
Daniel Veillardc8311492004-11-08 16:51:13 +0000663#endif
Daniel Veillard27f20102004-11-05 11:50:11 +0000664
Daniel Veillardc8311492004-11-08 16:51:13 +0000665#ifdef LIBXML_HTTP_ENABLED
Daniel Veillard27f20102004-11-05 11:50:11 +0000666#define gen_nb_xmlNanoHTTPCtxtPtr 1
William M. Brack015ccb22005-02-13 08:18:52 +0000667static void *gen_xmlNanoHTTPCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) {
668 if (no == 0) return(xmlNanoHTTPOpen(REMOTE1GOOD, NULL));
669 if (no == 1) return(xmlNanoHTTPOpen(REMOTE2GOOD, NULL));
670 if (no == 2) return(xmlNanoHTTPOpen(REMOTE1BAD, NULL));
Daniel Veillard27f20102004-11-05 11:50:11 +0000671 return(NULL);
672}
William M. Brack015ccb22005-02-13 08:18:52 +0000673static void des_xmlNanoHTTPCtxtPtr(int no ATTRIBUTE_UNUSED, void *val, int nr ATTRIBUTE_UNUSED) {
674 if (val != NULL) {
675 xmlNanoHTTPClose(val);
676 }
Daniel Veillard27f20102004-11-05 11:50:11 +0000677}
Daniel Veillardc8311492004-11-08 16:51:13 +0000678#endif
Daniel Veillard27f20102004-11-05 11:50:11 +0000679
Daniel Veillard3d97e662004-11-04 10:49:00 +0000680#define gen_nb_xmlCharEncoding 4
681static xmlCharEncoding gen_xmlCharEncoding(int no, int nr ATTRIBUTE_UNUSED) {
682 if (no == 0) return(XML_CHAR_ENCODING_UTF8);
683 if (no == 1) return(XML_CHAR_ENCODING_NONE);
William M. Brack015ccb22005-02-13 08:18:52 +0000684 if (no == 2) return(XML_CHAR_ENCODING_8859_1);
Daniel Veillard3d97e662004-11-04 10:49:00 +0000685 return(XML_CHAR_ENCODING_ERROR);
686}
687static void des_xmlCharEncoding(int no ATTRIBUTE_UNUSED, xmlCharEncoding val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
688}
689
Daniel Veillard42595322004-11-08 10:52:06 +0000690#define gen_nb_xmlHashDeallocator 2
691static void
692test_xmlHashDeallocator(void *payload ATTRIBUTE_UNUSED, xmlChar *name ATTRIBUTE_UNUSED) {
693}
694
695static xmlHashDeallocator gen_xmlHashDeallocator(int no, int nr ATTRIBUTE_UNUSED) {
696 if (no == 0) return(test_xmlHashDeallocator);
697 return(NULL);
698}
699static void des_xmlHashDeallocator(int no ATTRIBUTE_UNUSED, xmlHashDeallocator val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
700}
701
Daniel Veillardd93f6252004-11-02 15:53:51 +0000702
703static void desret_int(int val ATTRIBUTE_UNUSED) {
704}
Daniel Veillardf2a36f92004-11-08 17:55:01 +0000705static void desret_xmlChar(xmlChar val ATTRIBUTE_UNUSED) {
706}
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000707static void desret_long(long val ATTRIBUTE_UNUSED) {
708}
William M. Brack094dd862004-11-14 14:28:34 +0000709static void desret_unsigned_long(unsigned long val ATTRIBUTE_UNUSED) {
710}
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000711static void desret_double(double val ATTRIBUTE_UNUSED) {
712}
Daniel Veillard3d97e662004-11-04 10:49:00 +0000713static void desret_xmlCharEncoding(xmlCharEncoding val ATTRIBUTE_UNUSED) {
714}
Daniel Veillardce244ad2004-11-05 10:03:46 +0000715#if 0
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000716static void desret_const_void_ptr(void *val ATTRIBUTE_UNUSED) {
717}
Daniel Veillardce244ad2004-11-05 10:03:46 +0000718#endif
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +0000719static void desret_void_ptr(void *val ATTRIBUTE_UNUSED) {
720}
Daniel Veillardd93f6252004-11-02 15:53:51 +0000721static void desret_const_char_ptr(const char *val ATTRIBUTE_UNUSED) {
722}
Daniel Veillardd005b9e2004-11-03 17:07:05 +0000723static void desret_const_xmlChar_ptr(const xmlChar *val ATTRIBUTE_UNUSED) {
724}
Daniel Veillard8a32fe42004-11-02 22:10:16 +0000725static void desret_xmlChar_ptr(xmlChar *val) {
726 if (val != NULL)
727 xmlFree(val);
728}
Daniel Veillardd93f6252004-11-02 15:53:51 +0000729static void desret_xmlDocPtr(xmlDocPtr val) {
Daniel Veillardce244ad2004-11-05 10:03:46 +0000730 if (val != api_doc)
731 xmlFreeDoc(val);
Daniel Veillardd93f6252004-11-02 15:53:51 +0000732}
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000733static void desret_xmlDictPtr(xmlDictPtr val) {
734 xmlDictFree(val);
735}
Daniel Veillardc8311492004-11-08 16:51:13 +0000736#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillard3d95c732004-11-06 22:25:14 +0000737static void desret_xmlOutputBufferPtr(xmlOutputBufferPtr val) {
738 xmlOutputBufferClose(val);
739}
Daniel Veillardc8311492004-11-08 16:51:13 +0000740#endif
741#ifdef LIBXML_READER_ENABLED
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000742static void desret_xmlTextReaderPtr(xmlTextReaderPtr val) {
743 xmlFreeTextReader(val);
744}
Daniel Veillardc8311492004-11-08 16:51:13 +0000745#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +0000746static void desret_xmlNodePtr(xmlNodePtr val) {
Daniel Veillardce244ad2004-11-05 10:03:46 +0000747 if ((val != NULL) && (val != api_root) && (val != (xmlNodePtr) api_doc)) {
748 xmlUnlinkNode(val);
749 xmlFreeNode(val);
750 }
Daniel Veillardd93f6252004-11-02 15:53:51 +0000751}
Daniel Veillard57b25162004-11-06 14:50:18 +0000752static void desret_xmlAttrPtr(xmlAttrPtr val) {
753 if (val != NULL) {
754 xmlUnlinkNode((xmlNodePtr) val);
755 xmlFreeNode((xmlNodePtr) val);
756 }
757}
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000758static void desret_xmlEntityPtr(xmlEntityPtr val) {
759 if (val != NULL) {
760 xmlUnlinkNode((xmlNodePtr) val);
761 xmlFreeNode((xmlNodePtr) val);
762 }
763}
Daniel Veillard42595322004-11-08 10:52:06 +0000764static void desret_xmlElementPtr(xmlElementPtr val) {
765 if (val != NULL) {
766 xmlUnlinkNode((xmlNodePtr) val);
767 }
768}
769static void desret_xmlAttributePtr(xmlAttributePtr val) {
770 if (val != NULL) {
771 xmlUnlinkNode((xmlNodePtr) val);
772 }
773}
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000774static void desret_xmlNsPtr(xmlNsPtr val ATTRIBUTE_UNUSED) {
775}
Daniel Veillard34099b42004-11-04 17:34:35 +0000776static void desret_xmlDtdPtr(xmlDtdPtr val) {
777 desret_xmlNodePtr((xmlNodePtr)val);
778}
Daniel Veillardc8311492004-11-08 16:51:13 +0000779#ifdef LIBXML_XPATH_ENABLED
Daniel Veillard3d97e662004-11-04 10:49:00 +0000780static void desret_xmlXPathObjectPtr(xmlXPathObjectPtr val) {
Daniel Veillard1ba06bb2004-11-04 12:32:18 +0000781 xmlXPathFreeObject(val);
Daniel Veillard3d97e662004-11-04 10:49:00 +0000782}
Daniel Veillardf2a36f92004-11-08 17:55:01 +0000783static void desret_xmlNodeSetPtr(xmlNodeSetPtr val) {
784 xmlXPathFreeNodeSet(val);
785}
Daniel Veillardc8311492004-11-08 16:51:13 +0000786#endif
Daniel Veillard34099b42004-11-04 17:34:35 +0000787static void desret_xmlParserCtxtPtr(xmlParserCtxtPtr val) {
788 xmlFreeParserCtxt(val);
789}
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000790static void desret_xmlParserInputBufferPtr(xmlParserInputBufferPtr val) {
791 xmlFreeParserInputBuffer(val);
792}
Daniel Veillard42595322004-11-08 10:52:06 +0000793static void desret_xmlParserInputPtr(xmlParserInputPtr val) {
794 xmlFreeInputStream(val);
795}
Daniel Veillardc8311492004-11-08 16:51:13 +0000796#ifdef LIBXML_WRITER_ENABLED
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000797static void desret_xmlTextWriterPtr(xmlTextWriterPtr val) {
798 xmlFreeTextWriter(val);
799}
Daniel Veillardc8311492004-11-08 16:51:13 +0000800#endif
Daniel Veillard3d95c732004-11-06 22:25:14 +0000801static void desret_xmlBufferPtr(xmlBufferPtr val) {
802 xmlBufferFree(val);
803}
Daniel Veillardc8311492004-11-08 16:51:13 +0000804#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillard42595322004-11-08 10:52:06 +0000805static void desret_xmlSchemaParserCtxtPtr(xmlSchemaParserCtxtPtr val) {
806 xmlSchemaFreeParserCtxt(val);
807}
808static void desret_xmlSchemaTypePtr(xmlSchemaTypePtr val ATTRIBUTE_UNUSED) {
809}
810static void desret_xmlRelaxNGParserCtxtPtr(xmlRelaxNGParserCtxtPtr val) {
811 xmlRelaxNGFreeParserCtxt(val);
812}
Daniel Veillardc8311492004-11-08 16:51:13 +0000813#endif
814#ifdef LIBXML_HTML_ENABLED
William M. Brackf13f77f2004-11-12 16:03:48 +0000815static void desret_const_htmlEntityDesc_ptr(const htmlEntityDesc * val ATTRIBUTE_UNUSED) {
Daniel Veillard42595322004-11-08 10:52:06 +0000816}
William M. Brack015ccb22005-02-13 08:18:52 +0000817static void desret_xmlNanoHTTPCtxtPtr(void *val) {
818 xmlNanoHTTPClose(val);
819}
Daniel Veillardc8311492004-11-08 16:51:13 +0000820#endif
William M. Brack015ccb22005-02-13 08:18:52 +0000821#ifdef LIBXML_FTP_ENABLED
822static void desret_xmlNanoFTPCtxtPtr(void *val) {
823 xmlNanoFTPClose(val);
824}
825#endif
Daniel Veillarda521d282004-11-09 14:59:59 +0000826/* cut and pasted from autogenerated to avoid troubles */
827#define gen_nb_const_xmlChar_ptr_ptr 1
828static xmlChar ** gen_const_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
829 return(NULL);
830}
831static void des_const_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, const xmlChar ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
832}
833
834#define gen_nb_unsigned_char_ptr 1
835static unsigned char * gen_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
836 return(NULL);
837}
838static void des_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, unsigned char * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
839}
840
841#define gen_nb_const_unsigned_char_ptr 1
842static unsigned char * gen_const_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
843 return(NULL);
844}
845static void des_const_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, const unsigned char * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
846}
847
848#ifdef LIBXML_HTML_ENABLED
849#define gen_nb_const_htmlNodePtr 1
850static htmlNodePtr gen_const_htmlNodePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
851 return(NULL);
852}
853static void des_const_htmlNodePtr(int no ATTRIBUTE_UNUSED, const htmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
854}
855#endif
856
857#ifdef LIBXML_HTML_ENABLED
858#define gen_nb_htmlDocPtr 3
859static htmlDocPtr gen_htmlDocPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
860 if (no == 0) return(htmlNewDoc(NULL, NULL));
861 if (no == 1) return(htmlReadMemory("<html/>", 7, "test", NULL, 0));
862 return(NULL);
863}
864static void des_htmlDocPtr(int no ATTRIBUTE_UNUSED, htmlDocPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
865 if ((val != NULL) && (val != api_doc) && (val->doc != api_doc))
866 xmlFreeDoc(val);
867}
868static void desret_htmlDocPtr(htmlDocPtr val) {
869 if ((val != NULL) && (val != api_doc) && (val->doc != api_doc))
870 xmlFreeDoc(val);
871}
872#define gen_nb_htmlParserCtxtPtr 3
873static htmlParserCtxtPtr gen_htmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
874 if (no == 0) return(xmlNewParserCtxt());
875 if (no == 1) return(htmlCreateMemoryParserCtxt("<html/>", 7));
876 return(NULL);
877}
878static void des_htmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, htmlParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
879 if (val != NULL)
880 htmlFreeParserCtxt(val);
881}
882static void desret_htmlParserCtxtPtr(htmlParserCtxtPtr val) {
883 if (val != NULL)
884 htmlFreeParserCtxt(val);
885}
886#endif
887
888#ifdef LIBXML_XPATH_ENABLED
889#define gen_nb_xmlNodeSetPtr 1
890static xmlNodeSetPtr gen_xmlNodeSetPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
891 return(NULL);
892}
893static void des_xmlNodeSetPtr(int no ATTRIBUTE_UNUSED, xmlNodeSetPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
894}
895#endif
896
897#ifdef LIBXML_DEBUG_ENABLED
Daniel Veillardd0cf7f62004-11-09 16:17:02 +0000898#ifdef LIBXML_XPATH_ENABLED
Daniel Veillarda521d282004-11-09 14:59:59 +0000899#define gen_nb_xmlShellCtxtPtr 1
900static xmlShellCtxtPtr gen_xmlShellCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
901 return(NULL);
902}
903static void des_xmlShellCtxtPtr(int no ATTRIBUTE_UNUSED, xmlShellCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
904}
905#endif
Daniel Veillardd0cf7f62004-11-09 16:17:02 +0000906#endif
Daniel Veillarda521d282004-11-09 14:59:59 +0000907
908#ifdef LIBXML_PATTERN_ENABLED
909#define gen_nb_xmlPatternPtr 1
910static xmlPatternPtr gen_xmlPatternPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
911 return(NULL);
912}
913static void des_xmlPatternPtr(int no ATTRIBUTE_UNUSED, xmlPatternPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
914}
915#endif
916
William M. Brack094dd862004-11-14 14:28:34 +0000917#define gen_nb_xmlElementContentPtr 1
918static xmlElementContentPtr gen_xmlElementContentPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
919 return(NULL);
920}
921static void des_xmlElementContentPtr(int no ATTRIBUTE_UNUSED, xmlElementContentPtr val, int nr ATTRIBUTE_UNUSED) {
922 if (val != NULL)
923 xmlFreeElementContent(val);
924}
925static void desret_xmlElementContentPtr(xmlElementContentPtr val) {
926 if (val != NULL)
927 xmlFreeElementContent(val);
928}
929
930#define gen_nb_xmlParserNodeInfoSeqPtr 1
931static xmlParserNodeInfoSeqPtr gen_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
932 return(NULL);
933}
934static void des_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, xmlParserNodeInfoSeqPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
935}
936
937static void desret_const_xmlParserNodeInfo_ptr(const xmlParserNodeInfo *val ATTRIBUTE_UNUSED) {
938}
939
Daniel Veillardd5cc0f72004-11-06 19:24:28 +0000940/************************************************************************
941 * *
942 * WARNING: end of the manually maintained part of the test code *
943 * do not remove or alter the CUT HERE line *
944 * *
945 ************************************************************************/
946
Daniel Veillard34099b42004-11-04 17:34:35 +0000947/* CUT HERE: everything below that line is generated */
Daniel Veillarda521d282004-11-09 14:59:59 +0000948#ifdef LIBXML_HTML_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +0000949static void desret_htmlStatus(htmlStatus val ATTRIBUTE_UNUSED) {
950}
951
Daniel Veillarda521d282004-11-09 14:59:59 +0000952#endif
953
Daniel Veillard57b25162004-11-06 14:50:18 +0000954#define gen_nb_xmlAttributeDefault 4
955static xmlAttributeDefault gen_xmlAttributeDefault(int no, int nr ATTRIBUTE_UNUSED) {
956 if (no == 1) return(XML_ATTRIBUTE_FIXED);
957 if (no == 2) return(XML_ATTRIBUTE_IMPLIED);
958 if (no == 3) return(XML_ATTRIBUTE_NONE);
959 if (no == 4) return(XML_ATTRIBUTE_REQUIRED);
960 return(0);
961}
William M. Brack094dd862004-11-14 14:28:34 +0000962
Daniel Veillard57b25162004-11-06 14:50:18 +0000963static void des_xmlAttributeDefault(int no ATTRIBUTE_UNUSED, xmlAttributeDefault val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
964}
Daniel Veillard57b25162004-11-06 14:50:18 +0000965
966#define gen_nb_xmlAttributeType 4
967static xmlAttributeType gen_xmlAttributeType(int no, int nr ATTRIBUTE_UNUSED) {
968 if (no == 1) return(XML_ATTRIBUTE_CDATA);
969 if (no == 2) return(XML_ATTRIBUTE_ENTITIES);
970 if (no == 3) return(XML_ATTRIBUTE_ENTITY);
971 if (no == 4) return(XML_ATTRIBUTE_ENUMERATION);
972 return(0);
973}
William M. Brack094dd862004-11-14 14:28:34 +0000974
Daniel Veillard57b25162004-11-06 14:50:18 +0000975static void des_xmlAttributeType(int no ATTRIBUTE_UNUSED, xmlAttributeType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
976}
Daniel Veillard57b25162004-11-06 14:50:18 +0000977
978#define gen_nb_xmlBufferAllocationScheme 3
979static xmlBufferAllocationScheme gen_xmlBufferAllocationScheme(int no, int nr ATTRIBUTE_UNUSED) {
980 if (no == 1) return(XML_BUFFER_ALLOC_DOUBLEIT);
981 if (no == 2) return(XML_BUFFER_ALLOC_EXACT);
982 if (no == 3) return(XML_BUFFER_ALLOC_IMMUTABLE);
983 return(0);
984}
William M. Brack094dd862004-11-14 14:28:34 +0000985
Daniel Veillard57b25162004-11-06 14:50:18 +0000986static void des_xmlBufferAllocationScheme(int no ATTRIBUTE_UNUSED, xmlBufferAllocationScheme val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
987}
William M. Brack094dd862004-11-14 14:28:34 +0000988
Daniel Veillard57b25162004-11-06 14:50:18 +0000989static void desret_xmlBufferAllocationScheme(xmlBufferAllocationScheme val ATTRIBUTE_UNUSED) {
990}
991
Daniel Veillarda521d282004-11-09 14:59:59 +0000992#ifdef LIBXML_CATALOG_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +0000993#define gen_nb_xmlCatalogAllow 4
994static xmlCatalogAllow gen_xmlCatalogAllow(int no, int nr ATTRIBUTE_UNUSED) {
995 if (no == 1) return(XML_CATA_ALLOW_ALL);
996 if (no == 2) return(XML_CATA_ALLOW_DOCUMENT);
997 if (no == 3) return(XML_CATA_ALLOW_GLOBAL);
998 if (no == 4) return(XML_CATA_ALLOW_NONE);
999 return(0);
1000}
William M. Brack094dd862004-11-14 14:28:34 +00001001
Daniel Veillard57b25162004-11-06 14:50:18 +00001002static void des_xmlCatalogAllow(int no ATTRIBUTE_UNUSED, xmlCatalogAllow val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1003}
William M. Brack094dd862004-11-14 14:28:34 +00001004
Daniel Veillard57b25162004-11-06 14:50:18 +00001005static void desret_xmlCatalogAllow(xmlCatalogAllow val ATTRIBUTE_UNUSED) {
1006}
1007
Daniel Veillarda521d282004-11-09 14:59:59 +00001008#endif
1009
1010#ifdef LIBXML_CATALOG_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +00001011#define gen_nb_xmlCatalogPrefer 3
1012static xmlCatalogPrefer gen_xmlCatalogPrefer(int no, int nr ATTRIBUTE_UNUSED) {
1013 if (no == 1) return(XML_CATA_PREFER_NONE);
1014 if (no == 2) return(XML_CATA_PREFER_PUBLIC);
1015 if (no == 3) return(XML_CATA_PREFER_SYSTEM);
1016 return(0);
1017}
William M. Brack094dd862004-11-14 14:28:34 +00001018
Daniel Veillard57b25162004-11-06 14:50:18 +00001019static void des_xmlCatalogPrefer(int no ATTRIBUTE_UNUSED, xmlCatalogPrefer val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1020}
William M. Brack094dd862004-11-14 14:28:34 +00001021
Daniel Veillard57b25162004-11-06 14:50:18 +00001022static void desret_xmlCatalogPrefer(xmlCatalogPrefer val ATTRIBUTE_UNUSED) {
1023}
1024
Daniel Veillarda521d282004-11-09 14:59:59 +00001025#endif
1026
Daniel Veillard57b25162004-11-06 14:50:18 +00001027#define gen_nb_xmlElementContentType 4
1028static xmlElementContentType gen_xmlElementContentType(int no, int nr ATTRIBUTE_UNUSED) {
1029 if (no == 1) return(XML_ELEMENT_CONTENT_ELEMENT);
1030 if (no == 2) return(XML_ELEMENT_CONTENT_OR);
1031 if (no == 3) return(XML_ELEMENT_CONTENT_PCDATA);
1032 if (no == 4) return(XML_ELEMENT_CONTENT_SEQ);
1033 return(0);
1034}
Daniel Veillard57b25162004-11-06 14:50:18 +00001035
William M. Brack094dd862004-11-14 14:28:34 +00001036static void des_xmlElementContentType(int no ATTRIBUTE_UNUSED, xmlElementContentType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
Daniel Veillard57b25162004-11-06 14:50:18 +00001037}
1038
1039#define gen_nb_xmlElementTypeVal 4
1040static xmlElementTypeVal gen_xmlElementTypeVal(int no, int nr ATTRIBUTE_UNUSED) {
1041 if (no == 1) return(XML_ELEMENT_TYPE_ANY);
1042 if (no == 2) return(XML_ELEMENT_TYPE_ELEMENT);
1043 if (no == 3) return(XML_ELEMENT_TYPE_EMPTY);
1044 if (no == 4) return(XML_ELEMENT_TYPE_MIXED);
1045 return(0);
1046}
William M. Brack094dd862004-11-14 14:28:34 +00001047
Daniel Veillard57b25162004-11-06 14:50:18 +00001048static void des_xmlElementTypeVal(int no ATTRIBUTE_UNUSED, xmlElementTypeVal val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1049}
Daniel Veillard57b25162004-11-06 14:50:18 +00001050
Daniel Veillard57b25162004-11-06 14:50:18 +00001051static void desret_xmlParserErrors(xmlParserErrors val ATTRIBUTE_UNUSED) {
1052}
1053
Daniel Veillarda521d282004-11-09 14:59:59 +00001054#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +00001055#define gen_nb_xmlSchemaValType 4
1056static xmlSchemaValType gen_xmlSchemaValType(int no, int nr ATTRIBUTE_UNUSED) {
1057 if (no == 1) return(XML_SCHEMAS_ANYSIMPLETYPE);
1058 if (no == 2) return(XML_SCHEMAS_ANYTYPE);
1059 if (no == 3) return(XML_SCHEMAS_ANYURI);
1060 if (no == 4) return(XML_SCHEMAS_BASE64BINARY);
1061 return(0);
1062}
William M. Brack094dd862004-11-14 14:28:34 +00001063
Daniel Veillard57b25162004-11-06 14:50:18 +00001064static void des_xmlSchemaValType(int no ATTRIBUTE_UNUSED, xmlSchemaValType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1065}
Daniel Veillard57b25162004-11-06 14:50:18 +00001066
Daniel Veillarda521d282004-11-09 14:59:59 +00001067#endif
1068
Daniel Veillardb5839c32005-02-19 18:27:14 +00001069#ifdef LIBXML_SCHEMAS_ENABLED
1070#define gen_nb_xmlSchemaWhitespaceValueType 4
1071static xmlSchemaWhitespaceValueType gen_xmlSchemaWhitespaceValueType(int no, int nr ATTRIBUTE_UNUSED) {
1072 if (no == 1) return(XML_SCHEMA_WHITESPACE_COLLAPSE);
1073 if (no == 2) return(XML_SCHEMA_WHITESPACE_PRESERVE);
1074 if (no == 3) return(XML_SCHEMA_WHITESPACE_REPLACE);
1075 if (no == 4) return(XML_SCHEMA_WHITESPACE_UNKNOWN);
1076 return(0);
1077}
1078
1079static void des_xmlSchemaWhitespaceValueType(int no ATTRIBUTE_UNUSED, xmlSchemaWhitespaceValueType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1080}
1081
1082#endif
1083
Daniel Veillard34099b42004-11-04 17:34:35 +00001084#include <libxml/HTMLparser.h>
1085#include <libxml/HTMLtree.h>
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001086#include <libxml/SAX2.h>
Daniel Veillarda82b1822004-11-08 16:24:57 +00001087#include <libxml/c14n.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001088#include <libxml/catalog.h>
1089#include <libxml/chvalid.h>
Daniel Veillarda82b1822004-11-08 16:24:57 +00001090#include <libxml/debugXML.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001091#include <libxml/dict.h>
1092#include <libxml/encoding.h>
1093#include <libxml/entities.h>
1094#include <libxml/hash.h>
1095#include <libxml/list.h>
1096#include <libxml/nanoftp.h>
1097#include <libxml/nanohttp.h>
1098#include <libxml/parser.h>
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001099#include <libxml/parserInternals.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001100#include <libxml/pattern.h>
1101#include <libxml/relaxng.h>
1102#include <libxml/schemasInternals.h>
1103#include <libxml/tree.h>
1104#include <libxml/uri.h>
1105#include <libxml/valid.h>
1106#include <libxml/xinclude.h>
1107#include <libxml/xmlIO.h>
Daniel Veillarda82b1822004-11-08 16:24:57 +00001108#include <libxml/xmlautomata.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001109#include <libxml/xmlerror.h>
Daniel Veillardf6b71bd2005-01-04 17:50:14 +00001110#include <libxml/xmlmodule.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001111#include <libxml/xmlreader.h>
Daniel Veillarda82b1822004-11-08 16:24:57 +00001112#include <libxml/xmlregexp.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001113#include <libxml/xmlsave.h>
1114#include <libxml/xmlschemas.h>
1115#include <libxml/xmlschemastypes.h>
1116#include <libxml/xmlstring.h>
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +00001117#include <libxml/xmlunicode.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001118#include <libxml/xmlwriter.h>
1119#include <libxml/xpath.h>
Daniel Veillarda82b1822004-11-08 16:24:57 +00001120#include <libxml/xpathInternals.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001121#include <libxml/xpointer.h>
1122static int test_HTMLparser(void);
1123static int test_HTMLtree(void);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001124static int test_SAX2(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001125static int test_c14n(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001126static int test_catalog(void);
1127static int test_chvalid(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001128static int test_debugXML(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001129static int test_dict(void);
1130static int test_encoding(void);
1131static int test_entities(void);
1132static int test_hash(void);
1133static int test_list(void);
1134static int test_nanoftp(void);
1135static int test_nanohttp(void);
1136static int test_parser(void);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001137static int test_parserInternals(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001138static int test_pattern(void);
1139static int test_relaxng(void);
1140static int test_schemasInternals(void);
1141static int test_tree(void);
1142static int test_uri(void);
1143static int test_valid(void);
1144static int test_xinclude(void);
1145static int test_xmlIO(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001146static int test_xmlautomata(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001147static int test_xmlerror(void);
Daniel Veillardf6b71bd2005-01-04 17:50:14 +00001148static int test_xmlmodule(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001149static int test_xmlreader(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001150static int test_xmlregexp(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001151static int test_xmlsave(void);
1152static int test_xmlschemas(void);
1153static int test_xmlschemastypes(void);
1154static int test_xmlstring(void);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +00001155static int test_xmlunicode(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001156static int test_xmlwriter(void);
1157static int test_xpath(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001158static int test_xpathInternals(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001159static int test_xpointer(void);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001160
1161/**
1162 * testlibxml2:
1163 *
1164 * Main entry point of the tester for the full libxml2 module,
1165 * it calls all the tester entry point for each module.
1166 *
1167 * Returns the number of error found
1168 */
1169static int
1170testlibxml2(void)
1171{
Daniel Veillard42595322004-11-08 10:52:06 +00001172 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001173
Daniel Veillard42595322004-11-08 10:52:06 +00001174 test_ret += test_HTMLparser();
1175 test_ret += test_HTMLtree();
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001176 test_ret += test_SAX2();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001177 test_ret += test_c14n();
Daniel Veillard42595322004-11-08 10:52:06 +00001178 test_ret += test_catalog();
1179 test_ret += test_chvalid();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001180 test_ret += test_debugXML();
Daniel Veillard42595322004-11-08 10:52:06 +00001181 test_ret += test_dict();
1182 test_ret += test_encoding();
1183 test_ret += test_entities();
1184 test_ret += test_hash();
1185 test_ret += test_list();
1186 test_ret += test_nanoftp();
1187 test_ret += test_nanohttp();
1188 test_ret += test_parser();
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001189 test_ret += test_parserInternals();
Daniel Veillard42595322004-11-08 10:52:06 +00001190 test_ret += test_pattern();
1191 test_ret += test_relaxng();
1192 test_ret += test_schemasInternals();
1193 test_ret += test_tree();
1194 test_ret += test_uri();
1195 test_ret += test_valid();
1196 test_ret += test_xinclude();
1197 test_ret += test_xmlIO();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001198 test_ret += test_xmlautomata();
Daniel Veillard42595322004-11-08 10:52:06 +00001199 test_ret += test_xmlerror();
Daniel Veillardf6b71bd2005-01-04 17:50:14 +00001200 test_ret += test_xmlmodule();
Daniel Veillard42595322004-11-08 10:52:06 +00001201 test_ret += test_xmlreader();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001202 test_ret += test_xmlregexp();
Daniel Veillard42595322004-11-08 10:52:06 +00001203 test_ret += test_xmlsave();
1204 test_ret += test_xmlschemas();
1205 test_ret += test_xmlschemastypes();
1206 test_ret += test_xmlstring();
1207 test_ret += test_xmlunicode();
1208 test_ret += test_xmlwriter();
1209 test_ret += test_xpath();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001210 test_ret += test_xpathInternals();
Daniel Veillard42595322004-11-08 10:52:06 +00001211 test_ret += test_xpointer();
Daniel Veillardd93f6252004-11-02 15:53:51 +00001212
Daniel Veillard3d97e662004-11-04 10:49:00 +00001213 printf("Total: %d functions, %d tests, %d errors\n",
Daniel Veillard42595322004-11-08 10:52:06 +00001214 function_tests, call_tests, test_ret);
1215 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001216}
1217
1218
1219static int
1220test_UTF8ToHtml(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001221 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001222
William M. Brack21e4ef22005-01-02 09:53:13 +00001223#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00001224 int mem_base;
1225 int ret_val;
1226 unsigned char * out; /* a pointer to an array of bytes to store the result */
1227 int n_out;
1228 int * outlen; /* the length of @out */
1229 int n_outlen;
1230 unsigned char * in; /* a pointer to an array of UTF-8 chars */
1231 int n_in;
1232 int * inlen; /* the length of @in */
1233 int n_inlen;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001234
Daniel Veillardce682bc2004-11-05 17:22:25 +00001235 for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
1236 for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
1237 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
1238 for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
1239 mem_base = xmlMemBlocks();
1240 out = gen_unsigned_char_ptr(n_out, 0);
1241 outlen = gen_int_ptr(n_outlen, 1);
1242 in = gen_const_unsigned_char_ptr(n_in, 2);
1243 inlen = gen_int_ptr(n_inlen, 3);
1244
William M. Brackf13f77f2004-11-12 16:03:48 +00001245 ret_val = UTF8ToHtml(out, outlen, (const unsigned char *)in, inlen);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001246 desret_int(ret_val);
1247 call_tests++;
1248 des_unsigned_char_ptr(n_out, out, 0);
1249 des_int_ptr(n_outlen, outlen, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00001250 des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001251 des_int_ptr(n_inlen, inlen, 3);
1252 xmlResetLastError();
1253 if (mem_base != xmlMemBlocks()) {
1254 printf("Leak of %d blocks found in UTF8ToHtml",
1255 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001256 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001257 printf(" %d", n_out);
1258 printf(" %d", n_outlen);
1259 printf(" %d", n_in);
1260 printf(" %d", n_inlen);
1261 printf("\n");
1262 }
1263 }
1264 }
1265 }
1266 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001267 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001268#endif
1269
Daniel Veillard42595322004-11-08 10:52:06 +00001270 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001271}
1272
Daniel Veillarda521d282004-11-09 14:59:59 +00001273#ifdef LIBXML_HTML_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +00001274
Daniel Veillardce682bc2004-11-05 17:22:25 +00001275#define gen_nb_const_htmlElemDesc_ptr 1
1276static htmlElemDesc * gen_const_htmlElemDesc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1277 return(NULL);
1278}
1279static void des_const_htmlElemDesc_ptr(int no ATTRIBUTE_UNUSED, const htmlElemDesc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1280}
Daniel Veillarda521d282004-11-09 14:59:59 +00001281#endif
1282
Daniel Veillardce682bc2004-11-05 17:22:25 +00001283
Daniel Veillardd93f6252004-11-02 15:53:51 +00001284static int
1285test_htmlAttrAllowed(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001286 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001287
William M. Brack21e4ef22005-01-02 09:53:13 +00001288#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +00001289 int mem_base;
1290 htmlStatus ret_val;
1291 htmlElemDesc * elt; /* HTML element */
1292 int n_elt;
1293 xmlChar * attr; /* HTML attribute */
1294 int n_attr;
1295 int legacy; /* whether to allow deprecated attributes */
1296 int n_legacy;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001297
Daniel Veillard57b25162004-11-06 14:50:18 +00001298 for (n_elt = 0;n_elt < gen_nb_const_htmlElemDesc_ptr;n_elt++) {
1299 for (n_attr = 0;n_attr < gen_nb_const_xmlChar_ptr;n_attr++) {
1300 for (n_legacy = 0;n_legacy < gen_nb_int;n_legacy++) {
1301 mem_base = xmlMemBlocks();
1302 elt = gen_const_htmlElemDesc_ptr(n_elt, 0);
1303 attr = gen_const_xmlChar_ptr(n_attr, 1);
1304 legacy = gen_int(n_legacy, 2);
1305
William M. Brackf13f77f2004-11-12 16:03:48 +00001306 ret_val = htmlAttrAllowed((const htmlElemDesc *)elt, (const xmlChar *)attr, legacy);
Daniel Veillard57b25162004-11-06 14:50:18 +00001307 desret_htmlStatus(ret_val);
1308 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00001309 des_const_htmlElemDesc_ptr(n_elt, (const htmlElemDesc *)elt, 0);
1310 des_const_xmlChar_ptr(n_attr, (const xmlChar *)attr, 1);
Daniel Veillard57b25162004-11-06 14:50:18 +00001311 des_int(n_legacy, legacy, 2);
1312 xmlResetLastError();
1313 if (mem_base != xmlMemBlocks()) {
1314 printf("Leak of %d blocks found in htmlAttrAllowed",
1315 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001316 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00001317 printf(" %d", n_elt);
1318 printf(" %d", n_attr);
1319 printf(" %d", n_legacy);
1320 printf("\n");
1321 }
1322 }
1323 }
1324 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001325 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00001326#endif
1327
Daniel Veillard42595322004-11-08 10:52:06 +00001328 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001329}
1330
Daniel Veillarda521d282004-11-09 14:59:59 +00001331#ifdef LIBXML_HTML_ENABLED
1332
1333#define gen_nb_htmlNodePtr 1
1334static htmlNodePtr gen_htmlNodePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1335 return(NULL);
1336}
1337static void des_htmlNodePtr(int no ATTRIBUTE_UNUSED, htmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1338}
1339#endif
1340
Daniel Veillardd93f6252004-11-02 15:53:51 +00001341
1342static int
1343test_htmlAutoCloseTag(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001344 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001345
William M. Brack21e4ef22005-01-02 09:53:13 +00001346#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00001347 int mem_base;
1348 int ret_val;
1349 htmlDocPtr doc; /* the HTML document */
1350 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001351 xmlChar * name; /* The tag name */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001352 int n_name;
1353 htmlNodePtr elem; /* the HTML element */
1354 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001355
Daniel Veillarda521d282004-11-09 14:59:59 +00001356 for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001357 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
Daniel Veillarda521d282004-11-09 14:59:59 +00001358 for (n_elem = 0;n_elem < gen_nb_htmlNodePtr;n_elem++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001359 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00001360 doc = gen_htmlDocPtr(n_doc, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001361 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarda521d282004-11-09 14:59:59 +00001362 elem = gen_htmlNodePtr(n_elem, 2);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001363
William M. Brackf13f77f2004-11-12 16:03:48 +00001364 ret_val = htmlAutoCloseTag(doc, (const xmlChar *)name, elem);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001365 desret_int(ret_val);
1366 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001367 des_htmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00001368 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarda521d282004-11-09 14:59:59 +00001369 des_htmlNodePtr(n_elem, elem, 2);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001370 xmlResetLastError();
1371 if (mem_base != xmlMemBlocks()) {
1372 printf("Leak of %d blocks found in htmlAutoCloseTag",
1373 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001374 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001375 printf(" %d", n_doc);
1376 printf(" %d", n_name);
1377 printf(" %d", n_elem);
1378 printf("\n");
1379 }
1380 }
1381 }
1382 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001383 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001384#endif
1385
Daniel Veillard42595322004-11-08 10:52:06 +00001386 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001387}
1388
1389
1390static int
1391test_htmlCreateMemoryParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001392 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001393
William M. Brack21e4ef22005-01-02 09:53:13 +00001394#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard34099b42004-11-04 17:34:35 +00001395 int mem_base;
1396 htmlParserCtxtPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001397 char * buffer; /* a pointer to a char array */
Daniel Veillard34099b42004-11-04 17:34:35 +00001398 int n_buffer;
1399 int size; /* the size of the array */
1400 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001401
Daniel Veillard34099b42004-11-04 17:34:35 +00001402 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
1403 for (n_size = 0;n_size < gen_nb_int;n_size++) {
1404 mem_base = xmlMemBlocks();
1405 buffer = gen_const_char_ptr(n_buffer, 0);
1406 size = gen_int(n_size, 1);
1407
William M. Brackf13f77f2004-11-12 16:03:48 +00001408 ret_val = htmlCreateMemoryParserCtxt((const char *)buffer, size);
Daniel Veillarda521d282004-11-09 14:59:59 +00001409 desret_htmlParserCtxtPtr(ret_val);
Daniel Veillard34099b42004-11-04 17:34:35 +00001410 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00001411 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard34099b42004-11-04 17:34:35 +00001412 des_int(n_size, size, 1);
1413 xmlResetLastError();
1414 if (mem_base != xmlMemBlocks()) {
1415 printf("Leak of %d blocks found in htmlCreateMemoryParserCtxt",
1416 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001417 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +00001418 printf(" %d", n_buffer);
1419 printf(" %d", n_size);
1420 printf("\n");
1421 }
1422 }
1423 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001424 function_tests++;
Daniel Veillard34099b42004-11-04 17:34:35 +00001425#endif
1426
Daniel Veillard42595322004-11-08 10:52:06 +00001427 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001428}
1429
Daniel Veillarda521d282004-11-09 14:59:59 +00001430#ifdef LIBXML_HTML_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +00001431
Daniel Veillardce682bc2004-11-05 17:22:25 +00001432#define gen_nb_htmlSAXHandlerPtr 1
1433static htmlSAXHandlerPtr gen_htmlSAXHandlerPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1434 return(NULL);
1435}
1436static void des_htmlSAXHandlerPtr(int no ATTRIBUTE_UNUSED, htmlSAXHandlerPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1437}
Daniel Veillarda521d282004-11-09 14:59:59 +00001438#endif
1439
Daniel Veillardce682bc2004-11-05 17:22:25 +00001440
Daniel Veillardd93f6252004-11-02 15:53:51 +00001441static int
1442test_htmlCreatePushParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001443 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001444
William M. Brack21e4ef22005-01-02 09:53:13 +00001445#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_PUSH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00001446 int mem_base;
1447 htmlParserCtxtPtr ret_val;
1448 htmlSAXHandlerPtr sax; /* a SAX handler */
1449 int n_sax;
1450 void * user_data; /* The user data returned on SAX callbacks */
1451 int n_user_data;
1452 char * chunk; /* a pointer to an array of chars */
1453 int n_chunk;
1454 int size; /* number of chars in the array */
1455 int n_size;
1456 const char * filename; /* an optional file name or URI */
1457 int n_filename;
1458 xmlCharEncoding enc; /* an optional encoding */
1459 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001460
Daniel Veillardce682bc2004-11-05 17:22:25 +00001461 for (n_sax = 0;n_sax < gen_nb_htmlSAXHandlerPtr;n_sax++) {
1462 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
1463 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
1464 for (n_size = 0;n_size < gen_nb_int;n_size++) {
Daniel Veillard42595322004-11-08 10:52:06 +00001465 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
Daniel Veillardce682bc2004-11-05 17:22:25 +00001466 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
1467 mem_base = xmlMemBlocks();
1468 sax = gen_htmlSAXHandlerPtr(n_sax, 0);
1469 user_data = gen_userdata(n_user_data, 1);
1470 chunk = gen_const_char_ptr(n_chunk, 2);
1471 size = gen_int(n_size, 3);
Daniel Veillard42595322004-11-08 10:52:06 +00001472 filename = gen_fileoutput(n_filename, 4);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001473 enc = gen_xmlCharEncoding(n_enc, 5);
1474
William M. Brackf13f77f2004-11-12 16:03:48 +00001475 ret_val = htmlCreatePushParserCtxt(sax, user_data, (const char *)chunk, size, filename, enc);
Daniel Veillarda521d282004-11-09 14:59:59 +00001476 desret_htmlParserCtxtPtr(ret_val);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001477 call_tests++;
1478 des_htmlSAXHandlerPtr(n_sax, sax, 0);
1479 des_userdata(n_user_data, user_data, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00001480 des_const_char_ptr(n_chunk, (const char *)chunk, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001481 des_int(n_size, size, 3);
Daniel Veillard42595322004-11-08 10:52:06 +00001482 des_fileoutput(n_filename, filename, 4);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001483 des_xmlCharEncoding(n_enc, enc, 5);
1484 xmlResetLastError();
1485 if (mem_base != xmlMemBlocks()) {
1486 printf("Leak of %d blocks found in htmlCreatePushParserCtxt",
1487 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001488 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001489 printf(" %d", n_sax);
1490 printf(" %d", n_user_data);
1491 printf(" %d", n_chunk);
1492 printf(" %d", n_size);
1493 printf(" %d", n_filename);
1494 printf(" %d", n_enc);
1495 printf("\n");
1496 }
1497 }
1498 }
1499 }
1500 }
1501 }
1502 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001503 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001504#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +00001505
Daniel Veillard42595322004-11-08 10:52:06 +00001506 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001507}
1508
1509
1510static int
1511test_htmlCtxtReadDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001512 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001513
William M. Brack21e4ef22005-01-02 09:53:13 +00001514#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00001515 int mem_base;
1516 htmlDocPtr ret_val;
1517 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1518 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001519 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001520 int n_cur;
1521 const char * URL; /* the base URL to use for the document */
1522 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001523 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001524 int n_encoding;
1525 int options; /* a combination of htmlParserOption(s) */
1526 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001527
Daniel Veillarda521d282004-11-09 14:59:59 +00001528 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001529 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
1530 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
1531 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
1532 for (n_options = 0;n_options < gen_nb_int;n_options++) {
1533 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00001534 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001535 cur = gen_const_xmlChar_ptr(n_cur, 1);
1536 URL = gen_filepath(n_URL, 2);
1537 encoding = gen_const_char_ptr(n_encoding, 3);
1538 options = gen_int(n_options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001539
William M. Brackf13f77f2004-11-12 16:03:48 +00001540 ret_val = htmlCtxtReadDoc(ctxt, (const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00001541 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001542 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001543 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00001544 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001545 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00001546 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001547 des_int(n_options, options, 4);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001548 xmlResetLastError();
1549 if (mem_base != xmlMemBlocks()) {
1550 printf("Leak of %d blocks found in htmlCtxtReadDoc",
1551 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001552 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001553 printf(" %d", n_ctxt);
1554 printf(" %d", n_cur);
1555 printf(" %d", n_URL);
1556 printf(" %d", n_encoding);
1557 printf(" %d", n_options);
1558 printf("\n");
1559 }
1560 }
1561 }
1562 }
1563 }
1564 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001565 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001566#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00001567
Daniel Veillard42595322004-11-08 10:52:06 +00001568 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001569}
1570
1571
1572static int
1573test_htmlCtxtReadFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001574 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001575
William M. Brack21e4ef22005-01-02 09:53:13 +00001576#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00001577 htmlDocPtr ret_val;
1578 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1579 int n_ctxt;
1580 const char * filename; /* a file or URL */
1581 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001582 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001583 int n_encoding;
1584 int options; /* a combination of htmlParserOption(s) */
1585 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001586
Daniel Veillarda521d282004-11-09 14:59:59 +00001587 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001588 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
1589 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
1590 for (n_options = 0;n_options < gen_nb_int;n_options++) {
Daniel Veillarda521d282004-11-09 14:59:59 +00001591 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001592 filename = gen_filepath(n_filename, 1);
1593 encoding = gen_const_char_ptr(n_encoding, 2);
1594 options = gen_int(n_options, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001595
William M. Brackf13f77f2004-11-12 16:03:48 +00001596 ret_val = htmlCtxtReadFile(ctxt, filename, (const char *)encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00001597 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001598 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001599 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001600 des_filepath(n_filename, filename, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00001601 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001602 des_int(n_options, options, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001603 xmlResetLastError();
Daniel Veillarda03e3652004-11-02 18:45:30 +00001604 }
1605 }
1606 }
1607 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001608 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001609#endif
1610
Daniel Veillard42595322004-11-08 10:52:06 +00001611 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001612}
1613
1614
1615static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00001616test_htmlCtxtReadMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001617 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001618
William M. Brack21e4ef22005-01-02 09:53:13 +00001619#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00001620 int mem_base;
1621 htmlDocPtr ret_val;
1622 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1623 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001624 char * buffer; /* a pointer to a char array */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001625 int n_buffer;
1626 int size; /* the size of the array */
1627 int n_size;
1628 const char * URL; /* the base URL to use for the document */
1629 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001630 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001631 int n_encoding;
1632 int options; /* a combination of htmlParserOption(s) */
1633 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001634
Daniel Veillarda521d282004-11-09 14:59:59 +00001635 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001636 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
1637 for (n_size = 0;n_size < gen_nb_int;n_size++) {
1638 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
1639 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
1640 for (n_options = 0;n_options < gen_nb_int;n_options++) {
1641 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00001642 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001643 buffer = gen_const_char_ptr(n_buffer, 1);
1644 size = gen_int(n_size, 2);
1645 URL = gen_filepath(n_URL, 3);
1646 encoding = gen_const_char_ptr(n_encoding, 4);
1647 options = gen_int(n_options, 5);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001648
William M. Brackf13f77f2004-11-12 16:03:48 +00001649 ret_val = htmlCtxtReadMemory(ctxt, (const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00001650 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001651 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001652 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00001653 des_const_char_ptr(n_buffer, (const char *)buffer, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001654 des_int(n_size, size, 2);
1655 des_filepath(n_URL, URL, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +00001656 des_const_char_ptr(n_encoding, (const char *)encoding, 4);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001657 des_int(n_options, options, 5);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001658 xmlResetLastError();
1659 if (mem_base != xmlMemBlocks()) {
1660 printf("Leak of %d blocks found in htmlCtxtReadMemory",
1661 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001662 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001663 printf(" %d", n_ctxt);
1664 printf(" %d", n_buffer);
1665 printf(" %d", n_size);
1666 printf(" %d", n_URL);
1667 printf(" %d", n_encoding);
1668 printf(" %d", n_options);
1669 printf("\n");
1670 }
1671 }
1672 }
1673 }
1674 }
1675 }
1676 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001677 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001678#endif
1679
Daniel Veillard42595322004-11-08 10:52:06 +00001680 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001681}
1682
1683
1684static int
1685test_htmlCtxtReset(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001686 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001687
William M. Brack21e4ef22005-01-02 09:53:13 +00001688#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00001689 int mem_base;
1690 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1691 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001692
Daniel Veillarda521d282004-11-09 14:59:59 +00001693 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001694 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00001695 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001696
1697 htmlCtxtReset(ctxt);
1698 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001699 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001700 xmlResetLastError();
1701 if (mem_base != xmlMemBlocks()) {
1702 printf("Leak of %d blocks found in htmlCtxtReset",
1703 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001704 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001705 printf(" %d", n_ctxt);
1706 printf("\n");
1707 }
1708 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001709 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001710#endif
1711
Daniel Veillard42595322004-11-08 10:52:06 +00001712 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001713}
1714
1715
1716static int
1717test_htmlCtxtUseOptions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001718 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001719
William M. Brack21e4ef22005-01-02 09:53:13 +00001720#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00001721 int mem_base;
1722 int ret_val;
1723 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1724 int n_ctxt;
1725 int options; /* a combination of htmlParserOption(s) */
1726 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001727
Daniel Veillarda521d282004-11-09 14:59:59 +00001728 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001729 for (n_options = 0;n_options < gen_nb_int;n_options++) {
1730 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00001731 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001732 options = gen_int(n_options, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001733
1734 ret_val = htmlCtxtUseOptions(ctxt, options);
1735 desret_int(ret_val);
1736 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001737 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001738 des_int(n_options, options, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001739 xmlResetLastError();
1740 if (mem_base != xmlMemBlocks()) {
1741 printf("Leak of %d blocks found in htmlCtxtUseOptions",
1742 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001743 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001744 printf(" %d", n_ctxt);
1745 printf(" %d", n_options);
1746 printf("\n");
1747 }
1748 }
1749 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001750 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001751#endif
1752
Daniel Veillard42595322004-11-08 10:52:06 +00001753 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001754}
1755
1756
1757static int
1758test_htmlElementAllowedHere(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001759 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001760
William M. Brack21e4ef22005-01-02 09:53:13 +00001761#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00001762 int mem_base;
1763 int ret_val;
1764 htmlElemDesc * parent; /* HTML parent element */
1765 int n_parent;
1766 xmlChar * elt; /* HTML element */
1767 int n_elt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001768
Daniel Veillardce682bc2004-11-05 17:22:25 +00001769 for (n_parent = 0;n_parent < gen_nb_const_htmlElemDesc_ptr;n_parent++) {
1770 for (n_elt = 0;n_elt < gen_nb_const_xmlChar_ptr;n_elt++) {
1771 mem_base = xmlMemBlocks();
1772 parent = gen_const_htmlElemDesc_ptr(n_parent, 0);
1773 elt = gen_const_xmlChar_ptr(n_elt, 1);
1774
William M. Brackf13f77f2004-11-12 16:03:48 +00001775 ret_val = htmlElementAllowedHere((const htmlElemDesc *)parent, (const xmlChar *)elt);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001776 desret_int(ret_val);
1777 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00001778 des_const_htmlElemDesc_ptr(n_parent, (const htmlElemDesc *)parent, 0);
1779 des_const_xmlChar_ptr(n_elt, (const xmlChar *)elt, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001780 xmlResetLastError();
1781 if (mem_base != xmlMemBlocks()) {
1782 printf("Leak of %d blocks found in htmlElementAllowedHere",
1783 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001784 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001785 printf(" %d", n_parent);
1786 printf(" %d", n_elt);
1787 printf("\n");
1788 }
1789 }
1790 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001791 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001792#endif
1793
Daniel Veillard42595322004-11-08 10:52:06 +00001794 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001795}
1796
1797
1798static int
1799test_htmlElementStatusHere(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001800 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001801
William M. Brack21e4ef22005-01-02 09:53:13 +00001802#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +00001803 int mem_base;
1804 htmlStatus ret_val;
1805 htmlElemDesc * parent; /* HTML parent element */
1806 int n_parent;
1807 htmlElemDesc * elt; /* HTML element */
1808 int n_elt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001809
Daniel Veillard57b25162004-11-06 14:50:18 +00001810 for (n_parent = 0;n_parent < gen_nb_const_htmlElemDesc_ptr;n_parent++) {
1811 for (n_elt = 0;n_elt < gen_nb_const_htmlElemDesc_ptr;n_elt++) {
1812 mem_base = xmlMemBlocks();
1813 parent = gen_const_htmlElemDesc_ptr(n_parent, 0);
1814 elt = gen_const_htmlElemDesc_ptr(n_elt, 1);
1815
William M. Brackf13f77f2004-11-12 16:03:48 +00001816 ret_val = htmlElementStatusHere((const htmlElemDesc *)parent, (const htmlElemDesc *)elt);
Daniel Veillard57b25162004-11-06 14:50:18 +00001817 desret_htmlStatus(ret_val);
1818 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00001819 des_const_htmlElemDesc_ptr(n_parent, (const htmlElemDesc *)parent, 0);
1820 des_const_htmlElemDesc_ptr(n_elt, (const htmlElemDesc *)elt, 1);
Daniel Veillard57b25162004-11-06 14:50:18 +00001821 xmlResetLastError();
1822 if (mem_base != xmlMemBlocks()) {
1823 printf("Leak of %d blocks found in htmlElementStatusHere",
1824 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001825 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00001826 printf(" %d", n_parent);
1827 printf(" %d", n_elt);
1828 printf("\n");
1829 }
1830 }
1831 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001832 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00001833#endif
1834
Daniel Veillard42595322004-11-08 10:52:06 +00001835 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001836}
1837
1838
1839static int
1840test_htmlEncodeEntities(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001841 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001842
William M. Brack21e4ef22005-01-02 09:53:13 +00001843#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00001844 int mem_base;
1845 int ret_val;
1846 unsigned char * out; /* a pointer to an array of bytes to store the result */
1847 int n_out;
1848 int * outlen; /* the length of @out */
1849 int n_outlen;
1850 unsigned char * in; /* a pointer to an array of UTF-8 chars */
1851 int n_in;
1852 int * inlen; /* the length of @in */
1853 int n_inlen;
1854 int quoteChar; /* the quote character to escape (' or ") or zero. */
1855 int n_quoteChar;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001856
Daniel Veillardce682bc2004-11-05 17:22:25 +00001857 for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
1858 for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
1859 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
1860 for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
1861 for (n_quoteChar = 0;n_quoteChar < gen_nb_int;n_quoteChar++) {
1862 mem_base = xmlMemBlocks();
1863 out = gen_unsigned_char_ptr(n_out, 0);
1864 outlen = gen_int_ptr(n_outlen, 1);
1865 in = gen_const_unsigned_char_ptr(n_in, 2);
1866 inlen = gen_int_ptr(n_inlen, 3);
1867 quoteChar = gen_int(n_quoteChar, 4);
1868
William M. Brackf13f77f2004-11-12 16:03:48 +00001869 ret_val = htmlEncodeEntities(out, outlen, (const unsigned char *)in, inlen, quoteChar);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001870 desret_int(ret_val);
1871 call_tests++;
1872 des_unsigned_char_ptr(n_out, out, 0);
1873 des_int_ptr(n_outlen, outlen, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00001874 des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001875 des_int_ptr(n_inlen, inlen, 3);
1876 des_int(n_quoteChar, quoteChar, 4);
1877 xmlResetLastError();
1878 if (mem_base != xmlMemBlocks()) {
1879 printf("Leak of %d blocks found in htmlEncodeEntities",
1880 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001881 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001882 printf(" %d", n_out);
1883 printf(" %d", n_outlen);
1884 printf(" %d", n_in);
1885 printf(" %d", n_inlen);
1886 printf(" %d", n_quoteChar);
1887 printf("\n");
1888 }
1889 }
1890 }
1891 }
1892 }
1893 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001894 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001895#endif
1896
Daniel Veillard42595322004-11-08 10:52:06 +00001897 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001898}
1899
1900
1901static int
1902test_htmlEntityLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001903 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001904
William M. Brack21e4ef22005-01-02 09:53:13 +00001905#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +00001906 int mem_base;
1907 const htmlEntityDesc * ret_val;
1908 xmlChar * name; /* the entity name */
1909 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001910
Daniel Veillard42595322004-11-08 10:52:06 +00001911 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
1912 mem_base = xmlMemBlocks();
1913 name = gen_const_xmlChar_ptr(n_name, 0);
1914
William M. Brackf13f77f2004-11-12 16:03:48 +00001915 ret_val = htmlEntityLookup((const xmlChar *)name);
Daniel Veillard42595322004-11-08 10:52:06 +00001916 desret_const_htmlEntityDesc_ptr(ret_val);
1917 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00001918 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillard42595322004-11-08 10:52:06 +00001919 xmlResetLastError();
1920 if (mem_base != xmlMemBlocks()) {
1921 printf("Leak of %d blocks found in htmlEntityLookup",
1922 xmlMemBlocks() - mem_base);
1923 test_ret++;
1924 printf(" %d", n_name);
1925 printf("\n");
1926 }
1927 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001928 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00001929#endif
1930
Daniel Veillard42595322004-11-08 10:52:06 +00001931 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001932}
1933
1934
1935static int
1936test_htmlEntityValueLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001937 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001938
William M. Brack21e4ef22005-01-02 09:53:13 +00001939#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +00001940 int mem_base;
1941 const htmlEntityDesc * ret_val;
1942 unsigned int value; /* the entity's unicode value */
1943 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001944
Daniel Veillard42595322004-11-08 10:52:06 +00001945 for (n_value = 0;n_value < gen_nb_unsigned_int;n_value++) {
1946 mem_base = xmlMemBlocks();
1947 value = gen_unsigned_int(n_value, 0);
1948
1949 ret_val = htmlEntityValueLookup(value);
1950 desret_const_htmlEntityDesc_ptr(ret_val);
1951 call_tests++;
1952 des_unsigned_int(n_value, value, 0);
1953 xmlResetLastError();
1954 if (mem_base != xmlMemBlocks()) {
1955 printf("Leak of %d blocks found in htmlEntityValueLookup",
1956 xmlMemBlocks() - mem_base);
1957 test_ret++;
1958 printf(" %d", n_value);
1959 printf("\n");
1960 }
1961 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001962 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00001963#endif
1964
Daniel Veillard42595322004-11-08 10:52:06 +00001965 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001966}
1967
1968
1969static int
1970test_htmlHandleOmittedElem(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001971 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001972
William M. Brack21e4ef22005-01-02 09:53:13 +00001973#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00001974 int mem_base;
1975 int ret_val;
1976 int val; /* int 0 or 1 */
1977 int n_val;
1978
1979 for (n_val = 0;n_val < gen_nb_int;n_val++) {
1980 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00001981 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001982
1983 ret_val = htmlHandleOmittedElem(val);
1984 desret_int(ret_val);
1985 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00001986 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001987 xmlResetLastError();
1988 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001989 printf("Leak of %d blocks found in htmlHandleOmittedElem",
Daniel Veillardd93f6252004-11-02 15:53:51 +00001990 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001991 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001992 printf(" %d", n_val);
1993 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00001994 }
1995 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001996 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001997#endif
1998
Daniel Veillard42595322004-11-08 10:52:06 +00001999 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002000}
2001
2002
2003static int
2004test_htmlIsAutoClosed(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002005 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002006
William M. Brack21e4ef22005-01-02 09:53:13 +00002007#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002008 int mem_base;
2009 int ret_val;
2010 htmlDocPtr doc; /* the HTML document */
2011 int n_doc;
2012 htmlNodePtr elem; /* the HTML element */
2013 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002014
Daniel Veillarda521d282004-11-09 14:59:59 +00002015 for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) {
2016 for (n_elem = 0;n_elem < gen_nb_htmlNodePtr;n_elem++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002017 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002018 doc = gen_htmlDocPtr(n_doc, 0);
2019 elem = gen_htmlNodePtr(n_elem, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002020
2021 ret_val = htmlIsAutoClosed(doc, elem);
2022 desret_int(ret_val);
2023 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002024 des_htmlDocPtr(n_doc, doc, 0);
2025 des_htmlNodePtr(n_elem, elem, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002026 xmlResetLastError();
2027 if (mem_base != xmlMemBlocks()) {
2028 printf("Leak of %d blocks found in htmlIsAutoClosed",
2029 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002030 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002031 printf(" %d", n_doc);
2032 printf(" %d", n_elem);
2033 printf("\n");
2034 }
2035 }
2036 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002037 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002038#endif
2039
Daniel Veillard42595322004-11-08 10:52:06 +00002040 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002041}
2042
2043
2044static int
2045test_htmlIsScriptAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002046 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002047
William M. Brack21e4ef22005-01-02 09:53:13 +00002048#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00002049 int mem_base;
2050 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002051 xmlChar * name; /* an attribute name */
Daniel Veillardd93f6252004-11-02 15:53:51 +00002052 int n_name;
2053
2054 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
2055 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002056 name = gen_const_xmlChar_ptr(n_name, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002057
William M. Brackf13f77f2004-11-12 16:03:48 +00002058 ret_val = htmlIsScriptAttribute((const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002059 desret_int(ret_val);
2060 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00002061 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002062 xmlResetLastError();
2063 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002064 printf("Leak of %d blocks found in htmlIsScriptAttribute",
Daniel Veillardd93f6252004-11-02 15:53:51 +00002065 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002066 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002067 printf(" %d", n_name);
2068 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00002069 }
2070 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002071 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002072#endif
2073
Daniel Veillard42595322004-11-08 10:52:06 +00002074 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002075}
2076
2077
2078static int
2079test_htmlNodeStatus(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002080 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002081
William M. Brack21e4ef22005-01-02 09:53:13 +00002082#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +00002083 int mem_base;
2084 htmlStatus ret_val;
2085 htmlNodePtr node; /* an htmlNodePtr in a tree */
2086 int n_node;
2087 int legacy; /* whether to allow deprecated elements (YES is faster here for Element nodes) */
2088 int n_legacy;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002089
Daniel Veillarda521d282004-11-09 14:59:59 +00002090 for (n_node = 0;n_node < gen_nb_const_htmlNodePtr;n_node++) {
Daniel Veillard57b25162004-11-06 14:50:18 +00002091 for (n_legacy = 0;n_legacy < gen_nb_int;n_legacy++) {
2092 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002093 node = gen_const_htmlNodePtr(n_node, 0);
Daniel Veillard57b25162004-11-06 14:50:18 +00002094 legacy = gen_int(n_legacy, 1);
2095
William M. Brackf13f77f2004-11-12 16:03:48 +00002096 ret_val = htmlNodeStatus((const htmlNodePtr)node, legacy);
Daniel Veillard57b25162004-11-06 14:50:18 +00002097 desret_htmlStatus(ret_val);
2098 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00002099 des_const_htmlNodePtr(n_node, (const htmlNodePtr)node, 0);
Daniel Veillard57b25162004-11-06 14:50:18 +00002100 des_int(n_legacy, legacy, 1);
2101 xmlResetLastError();
2102 if (mem_base != xmlMemBlocks()) {
2103 printf("Leak of %d blocks found in htmlNodeStatus",
2104 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002105 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00002106 printf(" %d", n_node);
2107 printf(" %d", n_legacy);
2108 printf("\n");
2109 }
2110 }
2111 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002112 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00002113#endif
2114
Daniel Veillard42595322004-11-08 10:52:06 +00002115 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002116}
2117
2118
2119static int
2120test_htmlParseCharRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002121 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002122
William M. Brack21e4ef22005-01-02 09:53:13 +00002123#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002124 int mem_base;
2125 int ret_val;
2126 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2127 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002128
Daniel Veillarda521d282004-11-09 14:59:59 +00002129 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002130 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002131 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002132
2133 ret_val = htmlParseCharRef(ctxt);
2134 desret_int(ret_val);
2135 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002136 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002137 xmlResetLastError();
2138 if (mem_base != xmlMemBlocks()) {
2139 printf("Leak of %d blocks found in htmlParseCharRef",
2140 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002141 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002142 printf(" %d", n_ctxt);
2143 printf("\n");
2144 }
2145 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002146 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002147#endif
2148
Daniel Veillard42595322004-11-08 10:52:06 +00002149 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002150}
2151
2152
2153static int
2154test_htmlParseChunk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002155 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002156
William M. Brack21e4ef22005-01-02 09:53:13 +00002157#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_PUSH_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002158 int mem_base;
2159 int ret_val;
2160 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2161 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002162 char * chunk; /* an char array */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002163 int n_chunk;
2164 int size; /* the size in byte of the chunk */
2165 int n_size;
2166 int terminate; /* last chunk indicator */
2167 int n_terminate;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002168
Daniel Veillarda521d282004-11-09 14:59:59 +00002169 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002170 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
2171 for (n_size = 0;n_size < gen_nb_int;n_size++) {
2172 for (n_terminate = 0;n_terminate < gen_nb_int;n_terminate++) {
2173 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002174 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002175 chunk = gen_const_char_ptr(n_chunk, 1);
2176 size = gen_int(n_size, 2);
2177 terminate = gen_int(n_terminate, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002178
William M. Brackf13f77f2004-11-12 16:03:48 +00002179 ret_val = htmlParseChunk(ctxt, (const char *)chunk, size, terminate);
Daniel Veillarda521d282004-11-09 14:59:59 +00002180 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
Daniel Veillarda03e3652004-11-02 18:45:30 +00002181 desret_int(ret_val);
2182 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002183 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002184 des_const_char_ptr(n_chunk, (const char *)chunk, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002185 des_int(n_size, size, 2);
2186 des_int(n_terminate, terminate, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002187 xmlResetLastError();
2188 if (mem_base != xmlMemBlocks()) {
2189 printf("Leak of %d blocks found in htmlParseChunk",
2190 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002191 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002192 printf(" %d", n_ctxt);
2193 printf(" %d", n_chunk);
2194 printf(" %d", n_size);
2195 printf(" %d", n_terminate);
2196 printf("\n");
2197 }
2198 }
2199 }
2200 }
2201 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002202 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002203#endif
Daniel Veillarda03e3652004-11-02 18:45:30 +00002204
Daniel Veillard42595322004-11-08 10:52:06 +00002205 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002206}
2207
2208
2209static int
2210test_htmlParseDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002211 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002212
William M. Brack21e4ef22005-01-02 09:53:13 +00002213#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002214 int mem_base;
2215 htmlDocPtr ret_val;
2216 xmlChar * cur; /* a pointer to an array of xmlChar */
2217 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002218 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002219 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002220
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002221 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
2222 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2223 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002224 cur = gen_xmlChar_ptr(n_cur, 0);
2225 encoding = gen_const_char_ptr(n_encoding, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002226
William M. Brackf13f77f2004-11-12 16:03:48 +00002227 ret_val = htmlParseDoc(cur, (const char *)encoding);
Daniel Veillarda521d282004-11-09 14:59:59 +00002228 desret_htmlDocPtr(ret_val);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002229 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002230 des_xmlChar_ptr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002231 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002232 xmlResetLastError();
2233 if (mem_base != xmlMemBlocks()) {
2234 printf("Leak of %d blocks found in htmlParseDoc",
2235 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002236 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002237 printf(" %d", n_cur);
2238 printf(" %d", n_encoding);
2239 printf("\n");
2240 }
2241 }
2242 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002243 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002244#endif
2245
Daniel Veillard42595322004-11-08 10:52:06 +00002246 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002247}
2248
2249
2250static int
2251test_htmlParseDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002252 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002253
William M. Brack21e4ef22005-01-02 09:53:13 +00002254#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002255 int mem_base;
2256 int ret_val;
2257 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2258 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002259
Daniel Veillarda521d282004-11-09 14:59:59 +00002260 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002261 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002262 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002263
2264 ret_val = htmlParseDocument(ctxt);
Daniel Veillarda521d282004-11-09 14:59:59 +00002265 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
Daniel Veillarda03e3652004-11-02 18:45:30 +00002266 desret_int(ret_val);
2267 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002268 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002269 xmlResetLastError();
2270 if (mem_base != xmlMemBlocks()) {
2271 printf("Leak of %d blocks found in htmlParseDocument",
2272 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002273 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002274 printf(" %d", n_ctxt);
2275 printf("\n");
2276 }
2277 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002278 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002279#endif
2280
Daniel Veillard42595322004-11-08 10:52:06 +00002281 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002282}
2283
2284
2285static int
2286test_htmlParseElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002287 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002288
William M. Brack21e4ef22005-01-02 09:53:13 +00002289#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002290 int mem_base;
2291 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2292 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002293
Daniel Veillarda521d282004-11-09 14:59:59 +00002294 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002295 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002296 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002297
2298 htmlParseElement(ctxt);
2299 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002300 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002301 xmlResetLastError();
2302 if (mem_base != xmlMemBlocks()) {
2303 printf("Leak of %d blocks found in htmlParseElement",
2304 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002305 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002306 printf(" %d", n_ctxt);
2307 printf("\n");
2308 }
2309 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002310 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002311#endif
2312
Daniel Veillard42595322004-11-08 10:52:06 +00002313 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002314}
2315
2316
2317static int
2318test_htmlParseEntityRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002319 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002320
William M. Brack21e4ef22005-01-02 09:53:13 +00002321#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +00002322 int mem_base;
2323 const htmlEntityDesc * ret_val;
2324 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2325 int n_ctxt;
2326 xmlChar ** str; /* location to store the entity name */
2327 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002328
Daniel Veillarda521d282004-11-09 14:59:59 +00002329 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillard42595322004-11-08 10:52:06 +00002330 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr_ptr;n_str++) {
2331 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002332 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard42595322004-11-08 10:52:06 +00002333 str = gen_const_xmlChar_ptr_ptr(n_str, 1);
2334
William M. Brackf13f77f2004-11-12 16:03:48 +00002335 ret_val = htmlParseEntityRef(ctxt, (const xmlChar **)str);
Daniel Veillard42595322004-11-08 10:52:06 +00002336 desret_const_htmlEntityDesc_ptr(ret_val);
2337 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002338 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002339 des_const_xmlChar_ptr_ptr(n_str, (const xmlChar **)str, 1);
Daniel Veillard42595322004-11-08 10:52:06 +00002340 xmlResetLastError();
2341 if (mem_base != xmlMemBlocks()) {
2342 printf("Leak of %d blocks found in htmlParseEntityRef",
2343 xmlMemBlocks() - mem_base);
2344 test_ret++;
2345 printf(" %d", n_ctxt);
2346 printf(" %d", n_str);
2347 printf("\n");
2348 }
2349 }
2350 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002351 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002352#endif
2353
Daniel Veillard42595322004-11-08 10:52:06 +00002354 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002355}
2356
2357
2358static int
2359test_htmlParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002360 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002361
William M. Brack21e4ef22005-01-02 09:53:13 +00002362#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002363 htmlDocPtr ret_val;
2364 const char * filename; /* the filename */
2365 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002366 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002367 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002368
Daniel Veillarda03e3652004-11-02 18:45:30 +00002369 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
2370 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00002371 filename = gen_filepath(n_filename, 0);
2372 encoding = gen_const_char_ptr(n_encoding, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002373
William M. Brackf13f77f2004-11-12 16:03:48 +00002374 ret_val = htmlParseFile(filename, (const char *)encoding);
Daniel Veillarda521d282004-11-09 14:59:59 +00002375 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002376 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002377 des_filepath(n_filename, filename, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002378 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002379 xmlResetLastError();
2380 }
2381 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002382 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002383#endif
2384
Daniel Veillard42595322004-11-08 10:52:06 +00002385 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002386}
2387
2388
2389static int
2390test_htmlReadDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002391 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002392
William M. Brack21e4ef22005-01-02 09:53:13 +00002393#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002394 int mem_base;
2395 htmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002396 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002397 int n_cur;
2398 const char * URL; /* the base URL to use for the document */
2399 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002400 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002401 int n_encoding;
2402 int options; /* a combination of htmlParserOption(s) */
2403 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002404
Daniel Veillarda03e3652004-11-02 18:45:30 +00002405 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
2406 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
2407 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2408 for (n_options = 0;n_options < gen_nb_int;n_options++) {
2409 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002410 cur = gen_const_xmlChar_ptr(n_cur, 0);
2411 URL = gen_filepath(n_URL, 1);
2412 encoding = gen_const_char_ptr(n_encoding, 2);
2413 options = gen_int(n_options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002414
William M. Brackf13f77f2004-11-12 16:03:48 +00002415 ret_val = htmlReadDoc((const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00002416 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002417 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00002418 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002419 des_filepath(n_URL, URL, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00002420 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002421 des_int(n_options, options, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002422 xmlResetLastError();
2423 if (mem_base != xmlMemBlocks()) {
2424 printf("Leak of %d blocks found in htmlReadDoc",
2425 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002426 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002427 printf(" %d", n_cur);
2428 printf(" %d", n_URL);
2429 printf(" %d", n_encoding);
2430 printf(" %d", n_options);
2431 printf("\n");
2432 }
2433 }
2434 }
2435 }
2436 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002437 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002438#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00002439
Daniel Veillard42595322004-11-08 10:52:06 +00002440 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002441}
2442
2443
2444static int
2445test_htmlReadFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002446 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002447
William M. Brack21e4ef22005-01-02 09:53:13 +00002448#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002449 int mem_base;
2450 htmlDocPtr ret_val;
2451 const char * filename; /* a file or URL */
2452 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002453 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002454 int n_encoding;
2455 int options; /* a combination of htmlParserOption(s) */
2456 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002457
Daniel Veillarda03e3652004-11-02 18:45:30 +00002458 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
2459 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2460 for (n_options = 0;n_options < gen_nb_int;n_options++) {
2461 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002462 filename = gen_filepath(n_filename, 0);
2463 encoding = gen_const_char_ptr(n_encoding, 1);
2464 options = gen_int(n_options, 2);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002465
William M. Brackf13f77f2004-11-12 16:03:48 +00002466 ret_val = htmlReadFile(filename, (const char *)encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00002467 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002468 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002469 des_filepath(n_filename, filename, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002470 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002471 des_int(n_options, options, 2);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002472 xmlResetLastError();
2473 if (mem_base != xmlMemBlocks()) {
2474 printf("Leak of %d blocks found in htmlReadFile",
2475 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002476 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002477 printf(" %d", n_filename);
2478 printf(" %d", n_encoding);
2479 printf(" %d", n_options);
2480 printf("\n");
2481 }
2482 }
2483 }
2484 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002485 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002486#endif
2487
Daniel Veillard42595322004-11-08 10:52:06 +00002488 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002489}
2490
2491
2492static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00002493test_htmlReadMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002494 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002495
William M. Brack21e4ef22005-01-02 09:53:13 +00002496#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002497 int mem_base;
2498 htmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002499 char * buffer; /* a pointer to a char array */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002500 int n_buffer;
2501 int size; /* the size of the array */
2502 int n_size;
2503 const char * URL; /* the base URL to use for the document */
2504 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002505 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002506 int n_encoding;
2507 int options; /* a combination of htmlParserOption(s) */
2508 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002509
Daniel Veillarda03e3652004-11-02 18:45:30 +00002510 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
2511 for (n_size = 0;n_size < gen_nb_int;n_size++) {
2512 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
2513 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2514 for (n_options = 0;n_options < gen_nb_int;n_options++) {
2515 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002516 buffer = gen_const_char_ptr(n_buffer, 0);
2517 size = gen_int(n_size, 1);
2518 URL = gen_filepath(n_URL, 2);
2519 encoding = gen_const_char_ptr(n_encoding, 3);
2520 options = gen_int(n_options, 4);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002521
William M. Brackf13f77f2004-11-12 16:03:48 +00002522 ret_val = htmlReadMemory((const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00002523 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002524 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00002525 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002526 des_int(n_size, size, 1);
2527 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00002528 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002529 des_int(n_options, options, 4);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002530 xmlResetLastError();
2531 if (mem_base != xmlMemBlocks()) {
2532 printf("Leak of %d blocks found in htmlReadMemory",
2533 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002534 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002535 printf(" %d", n_buffer);
2536 printf(" %d", n_size);
2537 printf(" %d", n_URL);
2538 printf(" %d", n_encoding);
2539 printf(" %d", n_options);
2540 printf("\n");
2541 }
2542 }
2543 }
2544 }
2545 }
2546 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002547 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002548#endif
2549
Daniel Veillard42595322004-11-08 10:52:06 +00002550 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002551}
2552
2553
2554static int
2555test_htmlSAXParseDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002556 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002557
William M. Brack21e4ef22005-01-02 09:53:13 +00002558#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00002559 int mem_base;
2560 htmlDocPtr ret_val;
2561 xmlChar * cur; /* a pointer to an array of xmlChar */
2562 int n_cur;
2563 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
2564 int n_encoding;
2565 htmlSAXHandlerPtr sax; /* the SAX handler block */
2566 int n_sax;
2567 void * userData; /* if using SAX, this pointer will be provided on callbacks. */
2568 int n_userData;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002569
Daniel Veillardce682bc2004-11-05 17:22:25 +00002570 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
2571 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2572 for (n_sax = 0;n_sax < gen_nb_htmlSAXHandlerPtr;n_sax++) {
2573 for (n_userData = 0;n_userData < gen_nb_userdata;n_userData++) {
2574 mem_base = xmlMemBlocks();
2575 cur = gen_xmlChar_ptr(n_cur, 0);
2576 encoding = gen_const_char_ptr(n_encoding, 1);
2577 sax = gen_htmlSAXHandlerPtr(n_sax, 2);
2578 userData = gen_userdata(n_userData, 3);
2579
William M. Brackf13f77f2004-11-12 16:03:48 +00002580 ret_val = htmlSAXParseDoc(cur, (const char *)encoding, sax, userData);
Daniel Veillarda521d282004-11-09 14:59:59 +00002581 desret_htmlDocPtr(ret_val);
Daniel Veillardce682bc2004-11-05 17:22:25 +00002582 call_tests++;
2583 des_xmlChar_ptr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002584 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00002585 des_htmlSAXHandlerPtr(n_sax, sax, 2);
2586 des_userdata(n_userData, userData, 3);
2587 xmlResetLastError();
2588 if (mem_base != xmlMemBlocks()) {
2589 printf("Leak of %d blocks found in htmlSAXParseDoc",
2590 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002591 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002592 printf(" %d", n_cur);
2593 printf(" %d", n_encoding);
2594 printf(" %d", n_sax);
2595 printf(" %d", n_userData);
2596 printf("\n");
2597 }
2598 }
2599 }
2600 }
2601 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002602 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002603#endif
2604
Daniel Veillard42595322004-11-08 10:52:06 +00002605 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002606}
2607
2608
2609static int
2610test_htmlSAXParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002611 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002612
William M. Brack21e4ef22005-01-02 09:53:13 +00002613#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00002614 int mem_base;
2615 htmlDocPtr ret_val;
2616 const char * filename; /* the filename */
2617 int n_filename;
2618 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
2619 int n_encoding;
2620 htmlSAXHandlerPtr sax; /* the SAX handler block */
2621 int n_sax;
2622 void * userData; /* if using SAX, this pointer will be provided on callbacks. */
2623 int n_userData;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002624
Daniel Veillardce682bc2004-11-05 17:22:25 +00002625 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
2626 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2627 for (n_sax = 0;n_sax < gen_nb_htmlSAXHandlerPtr;n_sax++) {
2628 for (n_userData = 0;n_userData < gen_nb_userdata;n_userData++) {
2629 mem_base = xmlMemBlocks();
2630 filename = gen_filepath(n_filename, 0);
2631 encoding = gen_const_char_ptr(n_encoding, 1);
2632 sax = gen_htmlSAXHandlerPtr(n_sax, 2);
2633 userData = gen_userdata(n_userData, 3);
2634
William M. Brackf13f77f2004-11-12 16:03:48 +00002635 ret_val = htmlSAXParseFile(filename, (const char *)encoding, sax, userData);
Daniel Veillarda521d282004-11-09 14:59:59 +00002636 desret_htmlDocPtr(ret_val);
Daniel Veillardce682bc2004-11-05 17:22:25 +00002637 call_tests++;
2638 des_filepath(n_filename, filename, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002639 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00002640 des_htmlSAXHandlerPtr(n_sax, sax, 2);
2641 des_userdata(n_userData, userData, 3);
2642 xmlResetLastError();
2643 if (mem_base != xmlMemBlocks()) {
2644 printf("Leak of %d blocks found in htmlSAXParseFile",
2645 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002646 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002647 printf(" %d", n_filename);
2648 printf(" %d", n_encoding);
2649 printf(" %d", n_sax);
2650 printf(" %d", n_userData);
2651 printf("\n");
2652 }
2653 }
2654 }
2655 }
2656 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002657 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002658#endif
2659
Daniel Veillard42595322004-11-08 10:52:06 +00002660 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002661}
2662
2663
2664static int
2665test_htmlTagLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002666 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002667
2668
2669 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00002670 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002671}
2672
2673static int
2674test_HTMLparser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002675 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002676
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002677 if (quiet == 0) printf("Testing HTMLparser : 31 of 37 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00002678 test_ret += test_UTF8ToHtml();
2679 test_ret += test_htmlAttrAllowed();
2680 test_ret += test_htmlAutoCloseTag();
2681 test_ret += test_htmlCreateMemoryParserCtxt();
2682 test_ret += test_htmlCreatePushParserCtxt();
2683 test_ret += test_htmlCtxtReadDoc();
2684 test_ret += test_htmlCtxtReadFile();
2685 test_ret += test_htmlCtxtReadMemory();
2686 test_ret += test_htmlCtxtReset();
2687 test_ret += test_htmlCtxtUseOptions();
2688 test_ret += test_htmlElementAllowedHere();
2689 test_ret += test_htmlElementStatusHere();
2690 test_ret += test_htmlEncodeEntities();
2691 test_ret += test_htmlEntityLookup();
2692 test_ret += test_htmlEntityValueLookup();
2693 test_ret += test_htmlHandleOmittedElem();
2694 test_ret += test_htmlIsAutoClosed();
2695 test_ret += test_htmlIsScriptAttribute();
2696 test_ret += test_htmlNodeStatus();
2697 test_ret += test_htmlParseCharRef();
2698 test_ret += test_htmlParseChunk();
2699 test_ret += test_htmlParseDoc();
2700 test_ret += test_htmlParseDocument();
2701 test_ret += test_htmlParseElement();
2702 test_ret += test_htmlParseEntityRef();
2703 test_ret += test_htmlParseFile();
2704 test_ret += test_htmlReadDoc();
2705 test_ret += test_htmlReadFile();
2706 test_ret += test_htmlReadMemory();
2707 test_ret += test_htmlSAXParseDoc();
2708 test_ret += test_htmlSAXParseFile();
2709 test_ret += test_htmlTagLookup();
Daniel Veillardd93f6252004-11-02 15:53:51 +00002710
Daniel Veillard42595322004-11-08 10:52:06 +00002711 if (test_ret != 0)
2712 printf("Module HTMLparser: %d errors\n", test_ret);
2713 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002714}
2715
2716static int
2717test_htmlDocContentDumpFormatOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002718 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002719
William M. Brack21e4ef22005-01-02 09:53:13 +00002720#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +00002721 int mem_base;
2722 xmlOutputBufferPtr buf; /* the HTML buffer output */
2723 int n_buf;
2724 xmlDocPtr cur; /* the document */
2725 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002726 char * encoding; /* the encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +00002727 int n_encoding;
2728 int format; /* should formatting spaces been added */
2729 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002730
Daniel Veillard3d97e662004-11-04 10:49:00 +00002731 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
2732 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
2733 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2734 for (n_format = 0;n_format < gen_nb_int;n_format++) {
2735 mem_base = xmlMemBlocks();
2736 buf = gen_xmlOutputBufferPtr(n_buf, 0);
2737 cur = gen_xmlDocPtr(n_cur, 1);
2738 encoding = gen_const_char_ptr(n_encoding, 2);
2739 format = gen_int(n_format, 3);
2740
William M. Brackf13f77f2004-11-12 16:03:48 +00002741 htmlDocContentDumpFormatOutput(buf, cur, (const char *)encoding, format);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002742 call_tests++;
2743 des_xmlOutputBufferPtr(n_buf, buf, 0);
2744 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00002745 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002746 des_int(n_format, format, 3);
2747 xmlResetLastError();
2748 if (mem_base != xmlMemBlocks()) {
2749 printf("Leak of %d blocks found in htmlDocContentDumpFormatOutput",
2750 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002751 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002752 printf(" %d", n_buf);
2753 printf(" %d", n_cur);
2754 printf(" %d", n_encoding);
2755 printf(" %d", n_format);
2756 printf("\n");
2757 }
2758 }
2759 }
2760 }
2761 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002762 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002763#endif
Daniel Veillard3d97e662004-11-04 10:49:00 +00002764
Daniel Veillard42595322004-11-08 10:52:06 +00002765 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002766}
2767
2768
2769static int
2770test_htmlDocContentDumpOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002771 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002772
William M. Brack21e4ef22005-01-02 09:53:13 +00002773#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +00002774 int mem_base;
2775 xmlOutputBufferPtr buf; /* the HTML buffer output */
2776 int n_buf;
2777 xmlDocPtr cur; /* the document */
2778 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002779 char * encoding; /* the encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +00002780 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002781
Daniel Veillard3d97e662004-11-04 10:49:00 +00002782 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
2783 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
2784 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2785 mem_base = xmlMemBlocks();
2786 buf = gen_xmlOutputBufferPtr(n_buf, 0);
2787 cur = gen_xmlDocPtr(n_cur, 1);
2788 encoding = gen_const_char_ptr(n_encoding, 2);
2789
William M. Brackf13f77f2004-11-12 16:03:48 +00002790 htmlDocContentDumpOutput(buf, cur, (const char *)encoding);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002791 call_tests++;
2792 des_xmlOutputBufferPtr(n_buf, buf, 0);
2793 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00002794 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002795 xmlResetLastError();
2796 if (mem_base != xmlMemBlocks()) {
2797 printf("Leak of %d blocks found in htmlDocContentDumpOutput",
2798 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002799 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002800 printf(" %d", n_buf);
2801 printf(" %d", n_cur);
2802 printf(" %d", n_encoding);
2803 printf("\n");
2804 }
2805 }
2806 }
2807 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002808 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002809#endif
Daniel Veillard3d97e662004-11-04 10:49:00 +00002810
Daniel Veillard42595322004-11-08 10:52:06 +00002811 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002812}
2813
2814
2815static int
2816test_htmlDocDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002817 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002818
William M. Brack21e4ef22005-01-02 09:53:13 +00002819#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00002820 int mem_base;
2821 int ret_val;
2822 FILE * f; /* the FILE* */
2823 int n_f;
2824 xmlDocPtr cur; /* the document */
2825 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002826
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00002827 for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) {
2828 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
2829 mem_base = xmlMemBlocks();
2830 f = gen_FILE_ptr(n_f, 0);
2831 cur = gen_xmlDocPtr(n_cur, 1);
2832
2833 ret_val = htmlDocDump(f, cur);
2834 desret_int(ret_val);
2835 call_tests++;
2836 des_FILE_ptr(n_f, f, 0);
2837 des_xmlDocPtr(n_cur, cur, 1);
2838 xmlResetLastError();
2839 if (mem_base != xmlMemBlocks()) {
2840 printf("Leak of %d blocks found in htmlDocDump",
2841 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002842 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00002843 printf(" %d", n_f);
2844 printf(" %d", n_cur);
2845 printf("\n");
2846 }
2847 }
2848 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002849 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00002850#endif
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00002851
Daniel Veillard42595322004-11-08 10:52:06 +00002852 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002853}
2854
2855
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00002856#define gen_nb_xmlChar_ptr_ptr 1
2857static xmlChar ** gen_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
2858 return(NULL);
2859}
2860static void des_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, xmlChar ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
2861}
2862
Daniel Veillardd93f6252004-11-02 15:53:51 +00002863static int
2864test_htmlDocDumpMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002865 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002866
William M. Brack21e4ef22005-01-02 09:53:13 +00002867#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00002868 int mem_base;
2869 xmlDocPtr cur; /* the document */
2870 int n_cur;
2871 xmlChar ** mem; /* OUT: the memory pointer */
2872 int n_mem;
2873 int * size; /* OUT: the memory length */
2874 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002875
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00002876 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
2877 for (n_mem = 0;n_mem < gen_nb_xmlChar_ptr_ptr;n_mem++) {
2878 for (n_size = 0;n_size < gen_nb_int_ptr;n_size++) {
2879 mem_base = xmlMemBlocks();
2880 cur = gen_xmlDocPtr(n_cur, 0);
2881 mem = gen_xmlChar_ptr_ptr(n_mem, 1);
2882 size = gen_int_ptr(n_size, 2);
2883
2884 htmlDocDumpMemory(cur, mem, size);
2885 call_tests++;
2886 des_xmlDocPtr(n_cur, cur, 0);
2887 des_xmlChar_ptr_ptr(n_mem, mem, 1);
2888 des_int_ptr(n_size, size, 2);
2889 xmlResetLastError();
2890 if (mem_base != xmlMemBlocks()) {
2891 printf("Leak of %d blocks found in htmlDocDumpMemory",
2892 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002893 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00002894 printf(" %d", n_cur);
2895 printf(" %d", n_mem);
2896 printf(" %d", n_size);
2897 printf("\n");
2898 }
2899 }
2900 }
2901 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002902 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00002903#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00002904
Daniel Veillard42595322004-11-08 10:52:06 +00002905 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002906}
2907
2908
2909static int
2910test_htmlGetMetaEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002911 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002912
William M. Brack21e4ef22005-01-02 09:53:13 +00002913#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +00002914 int mem_base;
2915 const xmlChar * ret_val;
2916 htmlDocPtr doc; /* the document */
2917 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002918
Daniel Veillarda521d282004-11-09 14:59:59 +00002919 for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +00002920 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002921 doc = gen_htmlDocPtr(n_doc, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00002922
2923 ret_val = htmlGetMetaEncoding(doc);
2924 desret_const_xmlChar_ptr(ret_val);
2925 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002926 des_htmlDocPtr(n_doc, doc, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00002927 xmlResetLastError();
2928 if (mem_base != xmlMemBlocks()) {
2929 printf("Leak of %d blocks found in htmlGetMetaEncoding",
2930 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002931 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00002932 printf(" %d", n_doc);
2933 printf("\n");
2934 }
2935 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002936 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00002937#endif
2938
Daniel Veillard42595322004-11-08 10:52:06 +00002939 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002940}
2941
2942
2943static int
2944test_htmlIsBooleanAttr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002945 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002946
William M. Brack21e4ef22005-01-02 09:53:13 +00002947#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00002948 int mem_base;
2949 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002950 xmlChar * name; /* the name of the attribute to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +00002951 int n_name;
2952
2953 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
2954 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002955 name = gen_const_xmlChar_ptr(n_name, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002956
William M. Brackf13f77f2004-11-12 16:03:48 +00002957 ret_val = htmlIsBooleanAttr((const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002958 desret_int(ret_val);
2959 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00002960 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002961 xmlResetLastError();
2962 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002963 printf("Leak of %d blocks found in htmlIsBooleanAttr",
Daniel Veillardd93f6252004-11-02 15:53:51 +00002964 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002965 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002966 printf(" %d", n_name);
2967 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00002968 }
2969 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002970 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002971#endif
2972
Daniel Veillard42595322004-11-08 10:52:06 +00002973 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002974}
2975
2976
2977static int
2978test_htmlNewDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002979 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002980
William M. Brack21e4ef22005-01-02 09:53:13 +00002981#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002982 int mem_base;
2983 htmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002984 xmlChar * URI; /* URI for the dtd, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002985 int n_URI;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002986 xmlChar * ExternalID; /* the external ID of the DTD, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002987 int n_ExternalID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002988
Daniel Veillarda03e3652004-11-02 18:45:30 +00002989 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
2990 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
2991 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002992 URI = gen_const_xmlChar_ptr(n_URI, 0);
2993 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002994
William M. Brackf13f77f2004-11-12 16:03:48 +00002995 ret_val = htmlNewDoc((const xmlChar *)URI, (const xmlChar *)ExternalID);
Daniel Veillarda521d282004-11-09 14:59:59 +00002996 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002997 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00002998 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0);
2999 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003000 xmlResetLastError();
3001 if (mem_base != xmlMemBlocks()) {
3002 printf("Leak of %d blocks found in htmlNewDoc",
3003 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003004 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003005 printf(" %d", n_URI);
3006 printf(" %d", n_ExternalID);
3007 printf("\n");
3008 }
3009 }
3010 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003011 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003012#endif
3013
Daniel Veillard42595322004-11-08 10:52:06 +00003014 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003015}
3016
3017
3018static int
3019test_htmlNewDocNoDtD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003020 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003021
William M. Brack21e4ef22005-01-02 09:53:13 +00003022#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00003023 int mem_base;
3024 htmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003025 xmlChar * URI; /* URI for the dtd, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00003026 int n_URI;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003027 xmlChar * ExternalID; /* the external ID of the DTD, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00003028 int n_ExternalID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003029
Daniel Veillarda03e3652004-11-02 18:45:30 +00003030 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
3031 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
3032 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003033 URI = gen_const_xmlChar_ptr(n_URI, 0);
3034 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003035
William M. Brackf13f77f2004-11-12 16:03:48 +00003036 ret_val = htmlNewDocNoDtD((const xmlChar *)URI, (const xmlChar *)ExternalID);
Daniel Veillarda521d282004-11-09 14:59:59 +00003037 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003038 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00003039 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0);
3040 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003041 xmlResetLastError();
3042 if (mem_base != xmlMemBlocks()) {
3043 printf("Leak of %d blocks found in htmlNewDocNoDtD",
3044 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003045 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003046 printf(" %d", n_URI);
3047 printf(" %d", n_ExternalID);
3048 printf("\n");
3049 }
3050 }
3051 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003052 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003053#endif
3054
Daniel Veillard42595322004-11-08 10:52:06 +00003055 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003056}
3057
3058
3059static int
3060test_htmlNodeDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003061 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003062
William M. Brack21e4ef22005-01-02 09:53:13 +00003063#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003064 int mem_base;
3065 int ret_val;
3066 xmlBufferPtr buf; /* the HTML buffer output */
3067 int n_buf;
3068 xmlDocPtr doc; /* the document */
3069 int n_doc;
3070 xmlNodePtr cur; /* the current node */
3071 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003072
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003073 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
3074 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3075 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3076 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003077 buf = gen_xmlBufferPtr(n_buf, 0);
3078 doc = gen_xmlDocPtr(n_doc, 1);
3079 cur = gen_xmlNodePtr(n_cur, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003080
3081 ret_val = htmlNodeDump(buf, doc, cur);
3082 desret_int(ret_val);
3083 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003084 des_xmlBufferPtr(n_buf, buf, 0);
3085 des_xmlDocPtr(n_doc, doc, 1);
3086 des_xmlNodePtr(n_cur, cur, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003087 xmlResetLastError();
3088 if (mem_base != xmlMemBlocks()) {
3089 printf("Leak of %d blocks found in htmlNodeDump",
3090 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003091 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003092 printf(" %d", n_buf);
3093 printf(" %d", n_doc);
3094 printf(" %d", n_cur);
3095 printf("\n");
3096 }
3097 }
3098 }
3099 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003100 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003101#endif
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003102
Daniel Veillard42595322004-11-08 10:52:06 +00003103 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003104}
3105
3106
3107static int
3108test_htmlNodeDumpFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003109 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003110
William M. Brack21e4ef22005-01-02 09:53:13 +00003111#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003112 int mem_base;
3113 FILE * out; /* the FILE pointer */
3114 int n_out;
3115 xmlDocPtr doc; /* the document */
3116 int n_doc;
3117 xmlNodePtr cur; /* the current node */
3118 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003119
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003120 for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) {
3121 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3122 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3123 mem_base = xmlMemBlocks();
3124 out = gen_FILE_ptr(n_out, 0);
3125 doc = gen_xmlDocPtr(n_doc, 1);
3126 cur = gen_xmlNodePtr(n_cur, 2);
3127
3128 htmlNodeDumpFile(out, doc, cur);
3129 call_tests++;
3130 des_FILE_ptr(n_out, out, 0);
3131 des_xmlDocPtr(n_doc, doc, 1);
3132 des_xmlNodePtr(n_cur, cur, 2);
3133 xmlResetLastError();
3134 if (mem_base != xmlMemBlocks()) {
3135 printf("Leak of %d blocks found in htmlNodeDumpFile",
3136 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003137 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003138 printf(" %d", n_out);
3139 printf(" %d", n_doc);
3140 printf(" %d", n_cur);
3141 printf("\n");
3142 }
3143 }
3144 }
3145 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003146 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003147#endif
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003148
Daniel Veillard42595322004-11-08 10:52:06 +00003149 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003150}
3151
3152
3153static int
3154test_htmlNodeDumpFileFormat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003155 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003156
William M. Brack21e4ef22005-01-02 09:53:13 +00003157#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003158 int mem_base;
3159 int ret_val;
3160 FILE * out; /* the FILE pointer */
3161 int n_out;
3162 xmlDocPtr doc; /* the document */
3163 int n_doc;
3164 xmlNodePtr cur; /* the current node */
3165 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003166 char * encoding; /* the document encoding */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003167 int n_encoding;
3168 int format; /* should formatting spaces been added */
3169 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003170
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003171 for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) {
3172 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3173 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3174 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3175 for (n_format = 0;n_format < gen_nb_int;n_format++) {
3176 mem_base = xmlMemBlocks();
3177 out = gen_FILE_ptr(n_out, 0);
3178 doc = gen_xmlDocPtr(n_doc, 1);
3179 cur = gen_xmlNodePtr(n_cur, 2);
3180 encoding = gen_const_char_ptr(n_encoding, 3);
3181 format = gen_int(n_format, 4);
3182
William M. Brackf13f77f2004-11-12 16:03:48 +00003183 ret_val = htmlNodeDumpFileFormat(out, doc, cur, (const char *)encoding, format);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003184 desret_int(ret_val);
3185 call_tests++;
3186 des_FILE_ptr(n_out, out, 0);
3187 des_xmlDocPtr(n_doc, doc, 1);
3188 des_xmlNodePtr(n_cur, cur, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00003189 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003190 des_int(n_format, format, 4);
3191 xmlResetLastError();
3192 if (mem_base != xmlMemBlocks()) {
3193 printf("Leak of %d blocks found in htmlNodeDumpFileFormat",
3194 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003195 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003196 printf(" %d", n_out);
3197 printf(" %d", n_doc);
3198 printf(" %d", n_cur);
3199 printf(" %d", n_encoding);
3200 printf(" %d", n_format);
3201 printf("\n");
3202 }
3203 }
3204 }
3205 }
3206 }
3207 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003208 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003209#endif
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003210
Daniel Veillard42595322004-11-08 10:52:06 +00003211 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003212}
3213
3214
3215static int
3216test_htmlNodeDumpFormatOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003217 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003218
William M. Brack21e4ef22005-01-02 09:53:13 +00003219#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +00003220 int mem_base;
3221 xmlOutputBufferPtr buf; /* the HTML buffer output */
3222 int n_buf;
3223 xmlDocPtr doc; /* the document */
3224 int n_doc;
3225 xmlNodePtr cur; /* the current node */
3226 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003227 char * encoding; /* the encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +00003228 int n_encoding;
3229 int format; /* should formatting spaces been added */
3230 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003231
Daniel Veillard3d97e662004-11-04 10:49:00 +00003232 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
3233 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3234 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3235 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3236 for (n_format = 0;n_format < gen_nb_int;n_format++) {
3237 mem_base = xmlMemBlocks();
3238 buf = gen_xmlOutputBufferPtr(n_buf, 0);
3239 doc = gen_xmlDocPtr(n_doc, 1);
3240 cur = gen_xmlNodePtr(n_cur, 2);
3241 encoding = gen_const_char_ptr(n_encoding, 3);
3242 format = gen_int(n_format, 4);
3243
William M. Brackf13f77f2004-11-12 16:03:48 +00003244 htmlNodeDumpFormatOutput(buf, doc, cur, (const char *)encoding, format);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003245 call_tests++;
3246 des_xmlOutputBufferPtr(n_buf, buf, 0);
3247 des_xmlDocPtr(n_doc, doc, 1);
3248 des_xmlNodePtr(n_cur, cur, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00003249 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003250 des_int(n_format, format, 4);
3251 xmlResetLastError();
3252 if (mem_base != xmlMemBlocks()) {
3253 printf("Leak of %d blocks found in htmlNodeDumpFormatOutput",
3254 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003255 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003256 printf(" %d", n_buf);
3257 printf(" %d", n_doc);
3258 printf(" %d", n_cur);
3259 printf(" %d", n_encoding);
3260 printf(" %d", n_format);
3261 printf("\n");
3262 }
3263 }
3264 }
3265 }
3266 }
3267 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003268 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003269#endif
Daniel Veillard3d97e662004-11-04 10:49:00 +00003270
Daniel Veillard42595322004-11-08 10:52:06 +00003271 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003272}
3273
3274
3275static int
3276test_htmlNodeDumpOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003277 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003278
William M. Brack21e4ef22005-01-02 09:53:13 +00003279#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +00003280 int mem_base;
3281 xmlOutputBufferPtr buf; /* the HTML buffer output */
3282 int n_buf;
3283 xmlDocPtr doc; /* the document */
3284 int n_doc;
3285 xmlNodePtr cur; /* the current node */
3286 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003287 char * encoding; /* the encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +00003288 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003289
Daniel Veillard3d97e662004-11-04 10:49:00 +00003290 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
3291 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3292 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3293 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3294 mem_base = xmlMemBlocks();
3295 buf = gen_xmlOutputBufferPtr(n_buf, 0);
3296 doc = gen_xmlDocPtr(n_doc, 1);
3297 cur = gen_xmlNodePtr(n_cur, 2);
3298 encoding = gen_const_char_ptr(n_encoding, 3);
3299
William M. Brackf13f77f2004-11-12 16:03:48 +00003300 htmlNodeDumpOutput(buf, doc, cur, (const char *)encoding);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003301 call_tests++;
3302 des_xmlOutputBufferPtr(n_buf, buf, 0);
3303 des_xmlDocPtr(n_doc, doc, 1);
3304 des_xmlNodePtr(n_cur, cur, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00003305 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003306 xmlResetLastError();
3307 if (mem_base != xmlMemBlocks()) {
3308 printf("Leak of %d blocks found in htmlNodeDumpOutput",
3309 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003310 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003311 printf(" %d", n_buf);
3312 printf(" %d", n_doc);
3313 printf(" %d", n_cur);
3314 printf(" %d", n_encoding);
3315 printf("\n");
3316 }
3317 }
3318 }
3319 }
3320 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003321 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003322#endif
Daniel Veillard3d97e662004-11-04 10:49:00 +00003323
Daniel Veillard42595322004-11-08 10:52:06 +00003324 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003325}
3326
3327
3328static int
3329test_htmlSaveFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003330 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003331
William M. Brack21e4ef22005-01-02 09:53:13 +00003332#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00003333 int mem_base;
3334 int ret_val;
3335 const char * filename; /* the filename (or URL) */
3336 int n_filename;
3337 xmlDocPtr cur; /* the document */
3338 int n_cur;
3339
3340 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
3341 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
3342 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003343 filename = gen_fileoutput(n_filename, 0);
3344 cur = gen_xmlDocPtr(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003345
3346 ret_val = htmlSaveFile(filename, cur);
3347 desret_int(ret_val);
3348 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003349 des_fileoutput(n_filename, filename, 0);
3350 des_xmlDocPtr(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003351 xmlResetLastError();
3352 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00003353 printf("Leak of %d blocks found in htmlSaveFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +00003354 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003355 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003356 printf(" %d", n_filename);
3357 printf(" %d", n_cur);
3358 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00003359 }
3360 }
3361 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003362 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003363#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00003364
Daniel Veillard42595322004-11-08 10:52:06 +00003365 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003366}
3367
3368
3369static int
3370test_htmlSaveFileEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003371 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003372
William M. Brack21e4ef22005-01-02 09:53:13 +00003373#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00003374 int mem_base;
3375 int ret_val;
3376 const char * filename; /* the filename */
3377 int n_filename;
3378 xmlDocPtr cur; /* the document */
3379 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003380 char * encoding; /* the document encoding */
Daniel Veillardd93f6252004-11-02 15:53:51 +00003381 int n_encoding;
3382
3383 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
3384 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
3385 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3386 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003387 filename = gen_fileoutput(n_filename, 0);
3388 cur = gen_xmlDocPtr(n_cur, 1);
3389 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003390
William M. Brackf13f77f2004-11-12 16:03:48 +00003391 ret_val = htmlSaveFileEnc(filename, cur, (const char *)encoding);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003392 desret_int(ret_val);
3393 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003394 des_fileoutput(n_filename, filename, 0);
3395 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00003396 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003397 xmlResetLastError();
3398 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00003399 printf("Leak of %d blocks found in htmlSaveFileEnc",
Daniel Veillardd93f6252004-11-02 15:53:51 +00003400 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003401 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003402 printf(" %d", n_filename);
3403 printf(" %d", n_cur);
3404 printf(" %d", n_encoding);
3405 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00003406 }
3407 }
3408 }
3409 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003410 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003411#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00003412
Daniel Veillard42595322004-11-08 10:52:06 +00003413 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003414}
3415
3416
3417static int
3418test_htmlSaveFileFormat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003419 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003420
William M. Brack21e4ef22005-01-02 09:53:13 +00003421#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00003422 int mem_base;
3423 int ret_val;
3424 const char * filename; /* the filename */
3425 int n_filename;
3426 xmlDocPtr cur; /* the document */
3427 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003428 char * encoding; /* the document encoding */
Daniel Veillardd93f6252004-11-02 15:53:51 +00003429 int n_encoding;
3430 int format; /* should formatting spaces been added */
3431 int n_format;
3432
3433 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
3434 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
3435 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3436 for (n_format = 0;n_format < gen_nb_int;n_format++) {
3437 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003438 filename = gen_fileoutput(n_filename, 0);
3439 cur = gen_xmlDocPtr(n_cur, 1);
3440 encoding = gen_const_char_ptr(n_encoding, 2);
3441 format = gen_int(n_format, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003442
William M. Brackf13f77f2004-11-12 16:03:48 +00003443 ret_val = htmlSaveFileFormat(filename, cur, (const char *)encoding, format);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003444 desret_int(ret_val);
3445 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003446 des_fileoutput(n_filename, filename, 0);
3447 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00003448 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003449 des_int(n_format, format, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003450 xmlResetLastError();
3451 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00003452 printf("Leak of %d blocks found in htmlSaveFileFormat",
Daniel Veillardd93f6252004-11-02 15:53:51 +00003453 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003454 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003455 printf(" %d", n_filename);
3456 printf(" %d", n_cur);
3457 printf(" %d", n_encoding);
3458 printf(" %d", n_format);
3459 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00003460 }
3461 }
3462 }
3463 }
3464 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003465 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003466#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00003467
Daniel Veillard42595322004-11-08 10:52:06 +00003468 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003469}
3470
3471
3472static int
3473test_htmlSetMetaEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003474 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003475
William M. Brack21e4ef22005-01-02 09:53:13 +00003476#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00003477 int mem_base;
3478 int ret_val;
3479 htmlDocPtr doc; /* the document */
3480 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003481 xmlChar * encoding; /* the encoding string */
Daniel Veillarda03e3652004-11-02 18:45:30 +00003482 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003483
Daniel Veillarda521d282004-11-09 14:59:59 +00003484 for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00003485 for (n_encoding = 0;n_encoding < gen_nb_const_xmlChar_ptr;n_encoding++) {
3486 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00003487 doc = gen_htmlDocPtr(n_doc, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003488 encoding = gen_const_xmlChar_ptr(n_encoding, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003489
William M. Brackf13f77f2004-11-12 16:03:48 +00003490 ret_val = htmlSetMetaEncoding(doc, (const xmlChar *)encoding);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003491 desret_int(ret_val);
3492 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00003493 des_htmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003494 des_const_xmlChar_ptr(n_encoding, (const xmlChar *)encoding, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003495 xmlResetLastError();
3496 if (mem_base != xmlMemBlocks()) {
3497 printf("Leak of %d blocks found in htmlSetMetaEncoding",
3498 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003499 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003500 printf(" %d", n_doc);
3501 printf(" %d", n_encoding);
3502 printf("\n");
3503 }
3504 }
3505 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003506 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003507#endif
3508
Daniel Veillard42595322004-11-08 10:52:06 +00003509 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003510}
3511
3512static int
3513test_HTMLtree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003514 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003515
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003516 if (quiet == 0) printf("Testing HTMLtree : 17 of 17 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00003517 test_ret += test_htmlDocContentDumpFormatOutput();
3518 test_ret += test_htmlDocContentDumpOutput();
3519 test_ret += test_htmlDocDump();
3520 test_ret += test_htmlDocDumpMemory();
3521 test_ret += test_htmlGetMetaEncoding();
3522 test_ret += test_htmlIsBooleanAttr();
3523 test_ret += test_htmlNewDoc();
3524 test_ret += test_htmlNewDocNoDtD();
3525 test_ret += test_htmlNodeDump();
3526 test_ret += test_htmlNodeDumpFile();
3527 test_ret += test_htmlNodeDumpFileFormat();
3528 test_ret += test_htmlNodeDumpFormatOutput();
3529 test_ret += test_htmlNodeDumpOutput();
3530 test_ret += test_htmlSaveFile();
3531 test_ret += test_htmlSaveFileEnc();
3532 test_ret += test_htmlSaveFileFormat();
3533 test_ret += test_htmlSetMetaEncoding();
Daniel Veillardd93f6252004-11-02 15:53:51 +00003534
Daniel Veillard42595322004-11-08 10:52:06 +00003535 if (test_ret != 0)
3536 printf("Module HTMLtree: %d errors\n", test_ret);
3537 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003538}
3539
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003540static int
3541test_docbDefaultSAXHandlerInit(void) {
3542 int test_ret = 0;
3543
William M. Brack21e4ef22005-01-02 09:53:13 +00003544#if defined(LIBXML_DOCB_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00003545#ifdef LIBXML_DOCB_ENABLED
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003546 int mem_base;
3547
3548 mem_base = xmlMemBlocks();
3549
3550 docbDefaultSAXHandlerInit();
3551 call_tests++;
3552 xmlResetLastError();
3553 if (mem_base != xmlMemBlocks()) {
3554 printf("Leak of %d blocks found in docbDefaultSAXHandlerInit",
3555 xmlMemBlocks() - mem_base);
3556 test_ret++;
3557 printf("\n");
3558 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003559 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00003560#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00003561#endif
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003562
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003563 return(test_ret);
3564}
3565
3566
3567static int
3568test_htmlDefaultSAXHandlerInit(void) {
3569 int test_ret = 0;
3570
William M. Brack21e4ef22005-01-02 09:53:13 +00003571#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00003572#ifdef LIBXML_HTML_ENABLED
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003573 int mem_base;
3574
3575 mem_base = xmlMemBlocks();
3576
3577 htmlDefaultSAXHandlerInit();
3578 call_tests++;
3579 xmlResetLastError();
3580 if (mem_base != xmlMemBlocks()) {
3581 printf("Leak of %d blocks found in htmlDefaultSAXHandlerInit",
3582 xmlMemBlocks() - mem_base);
3583 test_ret++;
3584 printf("\n");
3585 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003586 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00003587#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00003588#endif
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003589
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003590 return(test_ret);
3591}
3592
3593
3594static int
3595test_xmlDefaultSAXHandlerInit(void) {
3596 int test_ret = 0;
3597
3598 int mem_base;
3599
3600 mem_base = xmlMemBlocks();
3601
3602 xmlDefaultSAXHandlerInit();
3603 call_tests++;
3604 xmlResetLastError();
3605 if (mem_base != xmlMemBlocks()) {
3606 printf("Leak of %d blocks found in xmlDefaultSAXHandlerInit",
3607 xmlMemBlocks() - mem_base);
3608 test_ret++;
3609 printf("\n");
3610 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003611 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003612
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003613 return(test_ret);
3614}
3615
3616
3617#define gen_nb_xmlEnumerationPtr 1
3618static xmlEnumerationPtr gen_xmlEnumerationPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
3619 return(NULL);
3620}
3621static void des_xmlEnumerationPtr(int no ATTRIBUTE_UNUSED, xmlEnumerationPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
3622}
3623
3624static int
3625test_xmlSAX2AttributeDecl(void) {
3626 int test_ret = 0;
3627
3628 int mem_base;
3629 void * ctx; /* the user data (XML parser context) */
3630 int n_ctx;
3631 xmlChar * elem; /* the name of the element */
3632 int n_elem;
3633 xmlChar * fullname; /* the attribute name */
3634 int n_fullname;
3635 int type; /* the attribute type */
3636 int n_type;
3637 int def; /* the type of default value */
3638 int n_def;
3639 xmlChar * defaultValue; /* the attribute default value */
3640 int n_defaultValue;
3641 xmlEnumerationPtr tree; /* the tree of enumerated value set */
3642 int n_tree;
3643
3644 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3645 for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) {
3646 for (n_fullname = 0;n_fullname < gen_nb_const_xmlChar_ptr;n_fullname++) {
3647 for (n_type = 0;n_type < gen_nb_int;n_type++) {
3648 for (n_def = 0;n_def < gen_nb_int;n_def++) {
3649 for (n_defaultValue = 0;n_defaultValue < gen_nb_const_xmlChar_ptr;n_defaultValue++) {
3650 for (n_tree = 0;n_tree < gen_nb_xmlEnumerationPtr;n_tree++) {
3651 mem_base = xmlMemBlocks();
3652 ctx = gen_void_ptr(n_ctx, 0);
3653 elem = gen_const_xmlChar_ptr(n_elem, 1);
3654 fullname = gen_const_xmlChar_ptr(n_fullname, 2);
3655 type = gen_int(n_type, 3);
3656 def = gen_int(n_def, 4);
3657 defaultValue = gen_const_xmlChar_ptr(n_defaultValue, 5);
3658 tree = gen_xmlEnumerationPtr(n_tree, 6);
3659
William M. Brackf13f77f2004-11-12 16:03:48 +00003660 xmlSAX2AttributeDecl(ctx, (const xmlChar *)elem, (const xmlChar *)fullname, type, def, (const xmlChar *)defaultValue, tree);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003661 call_tests++;
3662 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003663 des_const_xmlChar_ptr(n_elem, (const xmlChar *)elem, 1);
3664 des_const_xmlChar_ptr(n_fullname, (const xmlChar *)fullname, 2);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003665 des_int(n_type, type, 3);
3666 des_int(n_def, def, 4);
William M. Brackf13f77f2004-11-12 16:03:48 +00003667 des_const_xmlChar_ptr(n_defaultValue, (const xmlChar *)defaultValue, 5);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003668 des_xmlEnumerationPtr(n_tree, tree, 6);
3669 xmlResetLastError();
3670 if (mem_base != xmlMemBlocks()) {
3671 printf("Leak of %d blocks found in xmlSAX2AttributeDecl",
3672 xmlMemBlocks() - mem_base);
3673 test_ret++;
3674 printf(" %d", n_ctx);
3675 printf(" %d", n_elem);
3676 printf(" %d", n_fullname);
3677 printf(" %d", n_type);
3678 printf(" %d", n_def);
3679 printf(" %d", n_defaultValue);
3680 printf(" %d", n_tree);
3681 printf("\n");
3682 }
3683 }
3684 }
3685 }
3686 }
3687 }
3688 }
3689 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003690 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003691
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003692 return(test_ret);
3693}
3694
3695
3696static int
3697test_xmlSAX2CDataBlock(void) {
3698 int test_ret = 0;
3699
3700 int mem_base;
3701 void * ctx; /* the user data (XML parser context) */
3702 int n_ctx;
3703 xmlChar * value; /* The pcdata content */
3704 int n_value;
3705 int len; /* the block length */
3706 int n_len;
3707
3708 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3709 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
3710 for (n_len = 0;n_len < gen_nb_int;n_len++) {
3711 mem_base = xmlMemBlocks();
3712 ctx = gen_void_ptr(n_ctx, 0);
3713 value = gen_const_xmlChar_ptr(n_value, 1);
3714 len = gen_int(n_len, 2);
3715
William M. Brackf13f77f2004-11-12 16:03:48 +00003716 xmlSAX2CDataBlock(ctx, (const xmlChar *)value, len);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003717 call_tests++;
3718 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003719 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003720 des_int(n_len, len, 2);
3721 xmlResetLastError();
3722 if (mem_base != xmlMemBlocks()) {
3723 printf("Leak of %d blocks found in xmlSAX2CDataBlock",
3724 xmlMemBlocks() - mem_base);
3725 test_ret++;
3726 printf(" %d", n_ctx);
3727 printf(" %d", n_value);
3728 printf(" %d", n_len);
3729 printf("\n");
3730 }
3731 }
3732 }
3733 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003734 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003735
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003736 return(test_ret);
3737}
3738
3739
3740static int
3741test_xmlSAX2Characters(void) {
3742 int test_ret = 0;
3743
3744 int mem_base;
3745 void * ctx; /* the user data (XML parser context) */
3746 int n_ctx;
3747 xmlChar * ch; /* a xmlChar string */
3748 int n_ch;
3749 int len; /* the number of xmlChar */
3750 int n_len;
3751
3752 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3753 for (n_ch = 0;n_ch < gen_nb_const_xmlChar_ptr;n_ch++) {
3754 for (n_len = 0;n_len < gen_nb_int;n_len++) {
3755 mem_base = xmlMemBlocks();
3756 ctx = gen_void_ptr(n_ctx, 0);
3757 ch = gen_const_xmlChar_ptr(n_ch, 1);
3758 len = gen_int(n_len, 2);
3759
William M. Brackf13f77f2004-11-12 16:03:48 +00003760 xmlSAX2Characters(ctx, (const xmlChar *)ch, len);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003761 call_tests++;
3762 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003763 des_const_xmlChar_ptr(n_ch, (const xmlChar *)ch, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003764 des_int(n_len, len, 2);
3765 xmlResetLastError();
3766 if (mem_base != xmlMemBlocks()) {
3767 printf("Leak of %d blocks found in xmlSAX2Characters",
3768 xmlMemBlocks() - mem_base);
3769 test_ret++;
3770 printf(" %d", n_ctx);
3771 printf(" %d", n_ch);
3772 printf(" %d", n_len);
3773 printf("\n");
3774 }
3775 }
3776 }
3777 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003778 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003779
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003780 return(test_ret);
3781}
3782
3783
3784static int
3785test_xmlSAX2Comment(void) {
3786 int test_ret = 0;
3787
3788 int mem_base;
3789 void * ctx; /* the user data (XML parser context) */
3790 int n_ctx;
3791 xmlChar * value; /* the xmlSAX2Comment content */
3792 int n_value;
3793
3794 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3795 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
3796 mem_base = xmlMemBlocks();
3797 ctx = gen_void_ptr(n_ctx, 0);
3798 value = gen_const_xmlChar_ptr(n_value, 1);
3799
William M. Brackf13f77f2004-11-12 16:03:48 +00003800 xmlSAX2Comment(ctx, (const xmlChar *)value);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003801 call_tests++;
3802 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003803 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003804 xmlResetLastError();
3805 if (mem_base != xmlMemBlocks()) {
3806 printf("Leak of %d blocks found in xmlSAX2Comment",
3807 xmlMemBlocks() - mem_base);
3808 test_ret++;
3809 printf(" %d", n_ctx);
3810 printf(" %d", n_value);
3811 printf("\n");
3812 }
3813 }
3814 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003815 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003816
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003817 return(test_ret);
3818}
3819
3820
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003821static int
3822test_xmlSAX2ElementDecl(void) {
3823 int test_ret = 0;
3824
3825 int mem_base;
3826 void * ctx; /* the user data (XML parser context) */
3827 int n_ctx;
3828 xmlChar * name; /* the element name */
3829 int n_name;
3830 int type; /* the element type */
3831 int n_type;
3832 xmlElementContentPtr content; /* the element value tree */
3833 int n_content;
3834
3835 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3836 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
3837 for (n_type = 0;n_type < gen_nb_int;n_type++) {
3838 for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) {
3839 mem_base = xmlMemBlocks();
3840 ctx = gen_void_ptr(n_ctx, 0);
3841 name = gen_const_xmlChar_ptr(n_name, 1);
3842 type = gen_int(n_type, 2);
3843 content = gen_xmlElementContentPtr(n_content, 3);
3844
William M. Brackf13f77f2004-11-12 16:03:48 +00003845 xmlSAX2ElementDecl(ctx, (const xmlChar *)name, type, content);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003846 call_tests++;
3847 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003848 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003849 des_int(n_type, type, 2);
3850 des_xmlElementContentPtr(n_content, content, 3);
3851 xmlResetLastError();
3852 if (mem_base != xmlMemBlocks()) {
3853 printf("Leak of %d blocks found in xmlSAX2ElementDecl",
3854 xmlMemBlocks() - mem_base);
3855 test_ret++;
3856 printf(" %d", n_ctx);
3857 printf(" %d", n_name);
3858 printf(" %d", n_type);
3859 printf(" %d", n_content);
3860 printf("\n");
3861 }
3862 }
3863 }
3864 }
3865 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003866 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003867
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003868 return(test_ret);
3869}
3870
3871
3872static int
3873test_xmlSAX2EndDocument(void) {
3874 int test_ret = 0;
3875
3876 int mem_base;
3877 void * ctx; /* the user data (XML parser context) */
3878 int n_ctx;
3879
3880 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3881 mem_base = xmlMemBlocks();
3882 ctx = gen_void_ptr(n_ctx, 0);
3883
3884 xmlSAX2EndDocument(ctx);
3885 call_tests++;
3886 des_void_ptr(n_ctx, ctx, 0);
3887 xmlResetLastError();
3888 if (mem_base != xmlMemBlocks()) {
3889 printf("Leak of %d blocks found in xmlSAX2EndDocument",
3890 xmlMemBlocks() - mem_base);
3891 test_ret++;
3892 printf(" %d", n_ctx);
3893 printf("\n");
3894 }
3895 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003896 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003897
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003898 return(test_ret);
3899}
3900
3901
3902static int
3903test_xmlSAX2EndElement(void) {
3904 int test_ret = 0;
3905
William M. Brack21e4ef22005-01-02 09:53:13 +00003906#if defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00003907#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003908 int mem_base;
3909 void * ctx; /* the user data (XML parser context) */
3910 int n_ctx;
3911 xmlChar * name; /* The element name */
3912 int n_name;
3913
3914 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3915 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
3916 mem_base = xmlMemBlocks();
3917 ctx = gen_void_ptr(n_ctx, 0);
3918 name = gen_const_xmlChar_ptr(n_name, 1);
3919
William M. Brackf13f77f2004-11-12 16:03:48 +00003920 xmlSAX2EndElement(ctx, (const xmlChar *)name);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003921 call_tests++;
3922 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003923 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003924 xmlResetLastError();
3925 if (mem_base != xmlMemBlocks()) {
3926 printf("Leak of %d blocks found in xmlSAX2EndElement",
3927 xmlMemBlocks() - mem_base);
3928 test_ret++;
3929 printf(" %d", n_ctx);
3930 printf(" %d", n_name);
3931 printf("\n");
3932 }
3933 }
3934 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003935 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00003936#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00003937#endif
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003938
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003939 return(test_ret);
3940}
3941
3942
3943static int
3944test_xmlSAX2EndElementNs(void) {
3945 int test_ret = 0;
3946
3947 int mem_base;
3948 void * ctx; /* the user data (XML parser context) */
3949 int n_ctx;
3950 xmlChar * localname; /* the local name of the element */
3951 int n_localname;
3952 xmlChar * prefix; /* the element namespace prefix if available */
3953 int n_prefix;
3954 xmlChar * URI; /* the element namespace name if available */
3955 int n_URI;
3956
3957 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3958 for (n_localname = 0;n_localname < gen_nb_const_xmlChar_ptr;n_localname++) {
3959 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
3960 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
3961 mem_base = xmlMemBlocks();
3962 ctx = gen_void_ptr(n_ctx, 0);
3963 localname = gen_const_xmlChar_ptr(n_localname, 1);
3964 prefix = gen_const_xmlChar_ptr(n_prefix, 2);
3965 URI = gen_const_xmlChar_ptr(n_URI, 3);
3966
William M. Brackf13f77f2004-11-12 16:03:48 +00003967 xmlSAX2EndElementNs(ctx, (const xmlChar *)localname, (const xmlChar *)prefix, (const xmlChar *)URI);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003968 call_tests++;
3969 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003970 des_const_xmlChar_ptr(n_localname, (const xmlChar *)localname, 1);
3971 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 2);
3972 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 3);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003973 xmlResetLastError();
3974 if (mem_base != xmlMemBlocks()) {
3975 printf("Leak of %d blocks found in xmlSAX2EndElementNs",
3976 xmlMemBlocks() - mem_base);
3977 test_ret++;
3978 printf(" %d", n_ctx);
3979 printf(" %d", n_localname);
3980 printf(" %d", n_prefix);
3981 printf(" %d", n_URI);
3982 printf("\n");
3983 }
3984 }
3985 }
3986 }
3987 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003988 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003989
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003990 return(test_ret);
3991}
3992
3993
3994static int
3995test_xmlSAX2EntityDecl(void) {
3996 int test_ret = 0;
3997
3998 int mem_base;
3999 void * ctx; /* the user data (XML parser context) */
4000 int n_ctx;
4001 xmlChar * name; /* the entity name */
4002 int n_name;
4003 int type; /* the entity type */
4004 int n_type;
4005 xmlChar * publicId; /* The public ID of the entity */
4006 int n_publicId;
4007 xmlChar * systemId; /* The system ID of the entity */
4008 int n_systemId;
4009 xmlChar * content; /* the entity value (without processing). */
4010 int n_content;
4011
4012 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4013 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4014 for (n_type = 0;n_type < gen_nb_int;n_type++) {
4015 for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) {
4016 for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) {
4017 for (n_content = 0;n_content < gen_nb_xmlChar_ptr;n_content++) {
4018 mem_base = xmlMemBlocks();
4019 ctx = gen_void_ptr(n_ctx, 0);
4020 name = gen_const_xmlChar_ptr(n_name, 1);
4021 type = gen_int(n_type, 2);
4022 publicId = gen_const_xmlChar_ptr(n_publicId, 3);
4023 systemId = gen_const_xmlChar_ptr(n_systemId, 4);
4024 content = gen_xmlChar_ptr(n_content, 5);
4025
William M. Brackf13f77f2004-11-12 16:03:48 +00004026 xmlSAX2EntityDecl(ctx, (const xmlChar *)name, type, (const xmlChar *)publicId, (const xmlChar *)systemId, content);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004027 call_tests++;
4028 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004029 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004030 des_int(n_type, type, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00004031 des_const_xmlChar_ptr(n_publicId, (const xmlChar *)publicId, 3);
4032 des_const_xmlChar_ptr(n_systemId, (const xmlChar *)systemId, 4);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004033 des_xmlChar_ptr(n_content, content, 5);
4034 xmlResetLastError();
4035 if (mem_base != xmlMemBlocks()) {
4036 printf("Leak of %d blocks found in xmlSAX2EntityDecl",
4037 xmlMemBlocks() - mem_base);
4038 test_ret++;
4039 printf(" %d", n_ctx);
4040 printf(" %d", n_name);
4041 printf(" %d", n_type);
4042 printf(" %d", n_publicId);
4043 printf(" %d", n_systemId);
4044 printf(" %d", n_content);
4045 printf("\n");
4046 }
4047 }
4048 }
4049 }
4050 }
4051 }
4052 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004053 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004054
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004055 return(test_ret);
4056}
4057
4058
4059static int
4060test_xmlSAX2ExternalSubset(void) {
4061 int test_ret = 0;
4062
4063 int mem_base;
4064 void * ctx; /* the user data (XML parser context) */
4065 int n_ctx;
4066 xmlChar * name; /* the root element name */
4067 int n_name;
4068 xmlChar * ExternalID; /* the external ID */
4069 int n_ExternalID;
4070 xmlChar * SystemID; /* the SYSTEM ID (e.g. filename or URL) */
4071 int n_SystemID;
4072
4073 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4074 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4075 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
4076 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
4077 mem_base = xmlMemBlocks();
4078 ctx = gen_void_ptr(n_ctx, 0);
4079 name = gen_const_xmlChar_ptr(n_name, 1);
4080 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2);
4081 SystemID = gen_const_xmlChar_ptr(n_SystemID, 3);
4082
William M. Brackf13f77f2004-11-12 16:03:48 +00004083 xmlSAX2ExternalSubset(ctx, (const xmlChar *)name, (const xmlChar *)ExternalID, (const xmlChar *)SystemID);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004084 call_tests++;
4085 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004086 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
4087 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 2);
4088 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 3);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004089 xmlResetLastError();
4090 if (mem_base != xmlMemBlocks()) {
4091 printf("Leak of %d blocks found in xmlSAX2ExternalSubset",
4092 xmlMemBlocks() - mem_base);
4093 test_ret++;
4094 printf(" %d", n_ctx);
4095 printf(" %d", n_name);
4096 printf(" %d", n_ExternalID);
4097 printf(" %d", n_SystemID);
4098 printf("\n");
4099 }
4100 }
4101 }
4102 }
4103 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004104 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004105
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004106 return(test_ret);
4107}
4108
4109
4110static int
4111test_xmlSAX2GetColumnNumber(void) {
4112 int test_ret = 0;
4113
4114 int mem_base;
4115 int ret_val;
4116 void * ctx; /* the user data (XML parser context) */
4117 int n_ctx;
4118
4119 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4120 mem_base = xmlMemBlocks();
4121 ctx = gen_void_ptr(n_ctx, 0);
4122
4123 ret_val = xmlSAX2GetColumnNumber(ctx);
4124 desret_int(ret_val);
4125 call_tests++;
4126 des_void_ptr(n_ctx, ctx, 0);
4127 xmlResetLastError();
4128 if (mem_base != xmlMemBlocks()) {
4129 printf("Leak of %d blocks found in xmlSAX2GetColumnNumber",
4130 xmlMemBlocks() - mem_base);
4131 test_ret++;
4132 printf(" %d", n_ctx);
4133 printf("\n");
4134 }
4135 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004136 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004137
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004138 return(test_ret);
4139}
4140
4141
4142static int
4143test_xmlSAX2GetEntity(void) {
4144 int test_ret = 0;
4145
4146 int mem_base;
4147 xmlEntityPtr ret_val;
4148 void * ctx; /* the user data (XML parser context) */
4149 int n_ctx;
4150 xmlChar * name; /* The entity name */
4151 int n_name;
4152
4153 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4154 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4155 mem_base = xmlMemBlocks();
4156 ctx = gen_void_ptr(n_ctx, 0);
4157 name = gen_const_xmlChar_ptr(n_name, 1);
4158
William M. Brackf13f77f2004-11-12 16:03:48 +00004159 ret_val = xmlSAX2GetEntity(ctx, (const xmlChar *)name);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004160 desret_xmlEntityPtr(ret_val);
4161 call_tests++;
4162 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004163 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004164 xmlResetLastError();
4165 if (mem_base != xmlMemBlocks()) {
4166 printf("Leak of %d blocks found in xmlSAX2GetEntity",
4167 xmlMemBlocks() - mem_base);
4168 test_ret++;
4169 printf(" %d", n_ctx);
4170 printf(" %d", n_name);
4171 printf("\n");
4172 }
4173 }
4174 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004175 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004176
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004177 return(test_ret);
4178}
4179
4180
4181static int
4182test_xmlSAX2GetLineNumber(void) {
4183 int test_ret = 0;
4184
4185 int mem_base;
4186 int ret_val;
4187 void * ctx; /* the user data (XML parser context) */
4188 int n_ctx;
4189
4190 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4191 mem_base = xmlMemBlocks();
4192 ctx = gen_void_ptr(n_ctx, 0);
4193
4194 ret_val = xmlSAX2GetLineNumber(ctx);
4195 desret_int(ret_val);
4196 call_tests++;
4197 des_void_ptr(n_ctx, ctx, 0);
4198 xmlResetLastError();
4199 if (mem_base != xmlMemBlocks()) {
4200 printf("Leak of %d blocks found in xmlSAX2GetLineNumber",
4201 xmlMemBlocks() - mem_base);
4202 test_ret++;
4203 printf(" %d", n_ctx);
4204 printf("\n");
4205 }
4206 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004207 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004208
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004209 return(test_ret);
4210}
4211
4212
4213static int
4214test_xmlSAX2GetParameterEntity(void) {
4215 int test_ret = 0;
4216
4217 int mem_base;
4218 xmlEntityPtr ret_val;
4219 void * ctx; /* the user data (XML parser context) */
4220 int n_ctx;
4221 xmlChar * name; /* The entity name */
4222 int n_name;
4223
4224 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4225 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4226 mem_base = xmlMemBlocks();
4227 ctx = gen_void_ptr(n_ctx, 0);
4228 name = gen_const_xmlChar_ptr(n_name, 1);
4229
William M. Brackf13f77f2004-11-12 16:03:48 +00004230 ret_val = xmlSAX2GetParameterEntity(ctx, (const xmlChar *)name);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004231 desret_xmlEntityPtr(ret_val);
4232 call_tests++;
4233 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004234 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004235 xmlResetLastError();
4236 if (mem_base != xmlMemBlocks()) {
4237 printf("Leak of %d blocks found in xmlSAX2GetParameterEntity",
4238 xmlMemBlocks() - mem_base);
4239 test_ret++;
4240 printf(" %d", n_ctx);
4241 printf(" %d", n_name);
4242 printf("\n");
4243 }
4244 }
4245 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004246 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004247
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004248 return(test_ret);
4249}
4250
4251
4252static int
4253test_xmlSAX2GetPublicId(void) {
4254 int test_ret = 0;
4255
4256 int mem_base;
4257 const xmlChar * ret_val;
4258 void * ctx; /* the user data (XML parser context) */
4259 int n_ctx;
4260
4261 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4262 mem_base = xmlMemBlocks();
4263 ctx = gen_void_ptr(n_ctx, 0);
4264
4265 ret_val = xmlSAX2GetPublicId(ctx);
4266 desret_const_xmlChar_ptr(ret_val);
4267 call_tests++;
4268 des_void_ptr(n_ctx, ctx, 0);
4269 xmlResetLastError();
4270 if (mem_base != xmlMemBlocks()) {
4271 printf("Leak of %d blocks found in xmlSAX2GetPublicId",
4272 xmlMemBlocks() - mem_base);
4273 test_ret++;
4274 printf(" %d", n_ctx);
4275 printf("\n");
4276 }
4277 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004278 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004279
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004280 return(test_ret);
4281}
4282
4283
4284static int
4285test_xmlSAX2GetSystemId(void) {
4286 int test_ret = 0;
4287
4288 int mem_base;
4289 const xmlChar * ret_val;
4290 void * ctx; /* the user data (XML parser context) */
4291 int n_ctx;
4292
4293 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4294 mem_base = xmlMemBlocks();
4295 ctx = gen_void_ptr(n_ctx, 0);
4296
4297 ret_val = xmlSAX2GetSystemId(ctx);
4298 desret_const_xmlChar_ptr(ret_val);
4299 call_tests++;
4300 des_void_ptr(n_ctx, ctx, 0);
4301 xmlResetLastError();
4302 if (mem_base != xmlMemBlocks()) {
4303 printf("Leak of %d blocks found in xmlSAX2GetSystemId",
4304 xmlMemBlocks() - mem_base);
4305 test_ret++;
4306 printf(" %d", n_ctx);
4307 printf("\n");
4308 }
4309 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004310 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004311
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004312 return(test_ret);
4313}
4314
4315
4316static int
4317test_xmlSAX2HasExternalSubset(void) {
4318 int test_ret = 0;
4319
4320 int mem_base;
4321 int ret_val;
4322 void * ctx; /* the user data (XML parser context) */
4323 int n_ctx;
4324
4325 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4326 mem_base = xmlMemBlocks();
4327 ctx = gen_void_ptr(n_ctx, 0);
4328
4329 ret_val = xmlSAX2HasExternalSubset(ctx);
4330 desret_int(ret_val);
4331 call_tests++;
4332 des_void_ptr(n_ctx, ctx, 0);
4333 xmlResetLastError();
4334 if (mem_base != xmlMemBlocks()) {
4335 printf("Leak of %d blocks found in xmlSAX2HasExternalSubset",
4336 xmlMemBlocks() - mem_base);
4337 test_ret++;
4338 printf(" %d", n_ctx);
4339 printf("\n");
4340 }
4341 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004342 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004343
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004344 return(test_ret);
4345}
4346
4347
4348static int
4349test_xmlSAX2HasInternalSubset(void) {
4350 int test_ret = 0;
4351
4352 int mem_base;
4353 int ret_val;
4354 void * ctx; /* the user data (XML parser context) */
4355 int n_ctx;
4356
4357 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4358 mem_base = xmlMemBlocks();
4359 ctx = gen_void_ptr(n_ctx, 0);
4360
4361 ret_val = xmlSAX2HasInternalSubset(ctx);
4362 desret_int(ret_val);
4363 call_tests++;
4364 des_void_ptr(n_ctx, ctx, 0);
4365 xmlResetLastError();
4366 if (mem_base != xmlMemBlocks()) {
4367 printf("Leak of %d blocks found in xmlSAX2HasInternalSubset",
4368 xmlMemBlocks() - mem_base);
4369 test_ret++;
4370 printf(" %d", n_ctx);
4371 printf("\n");
4372 }
4373 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004374 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004375
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004376 return(test_ret);
4377}
4378
4379
4380static int
4381test_xmlSAX2IgnorableWhitespace(void) {
4382 int test_ret = 0;
4383
4384 int mem_base;
4385 void * ctx; /* the user data (XML parser context) */
4386 int n_ctx;
4387 xmlChar * ch; /* a xmlChar string */
4388 int n_ch;
4389 int len; /* the number of xmlChar */
4390 int n_len;
4391
4392 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4393 for (n_ch = 0;n_ch < gen_nb_const_xmlChar_ptr;n_ch++) {
4394 for (n_len = 0;n_len < gen_nb_int;n_len++) {
4395 mem_base = xmlMemBlocks();
4396 ctx = gen_void_ptr(n_ctx, 0);
4397 ch = gen_const_xmlChar_ptr(n_ch, 1);
4398 len = gen_int(n_len, 2);
4399
William M. Brackf13f77f2004-11-12 16:03:48 +00004400 xmlSAX2IgnorableWhitespace(ctx, (const xmlChar *)ch, len);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004401 call_tests++;
4402 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004403 des_const_xmlChar_ptr(n_ch, (const xmlChar *)ch, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004404 des_int(n_len, len, 2);
4405 xmlResetLastError();
4406 if (mem_base != xmlMemBlocks()) {
4407 printf("Leak of %d blocks found in xmlSAX2IgnorableWhitespace",
4408 xmlMemBlocks() - mem_base);
4409 test_ret++;
4410 printf(" %d", n_ctx);
4411 printf(" %d", n_ch);
4412 printf(" %d", n_len);
4413 printf("\n");
4414 }
4415 }
4416 }
4417 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004418 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004419
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004420 return(test_ret);
4421}
4422
4423
4424#define gen_nb_xmlSAXHandler_ptr 1
4425static xmlSAXHandler * gen_xmlSAXHandler_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
4426 return(NULL);
4427}
4428static void des_xmlSAXHandler_ptr(int no ATTRIBUTE_UNUSED, xmlSAXHandler * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
4429}
4430
4431static int
4432test_xmlSAX2InitDefaultSAXHandler(void) {
4433 int test_ret = 0;
4434
4435 int mem_base;
4436 xmlSAXHandler * hdlr; /* the SAX handler */
4437 int n_hdlr;
4438 int warning; /* flag if non-zero sets the handler warning procedure */
4439 int n_warning;
4440
4441 for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) {
4442 for (n_warning = 0;n_warning < gen_nb_int;n_warning++) {
4443 mem_base = xmlMemBlocks();
4444 hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0);
4445 warning = gen_int(n_warning, 1);
4446
4447 xmlSAX2InitDefaultSAXHandler(hdlr, warning);
4448 call_tests++;
4449 des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0);
4450 des_int(n_warning, warning, 1);
4451 xmlResetLastError();
4452 if (mem_base != xmlMemBlocks()) {
4453 printf("Leak of %d blocks found in xmlSAX2InitDefaultSAXHandler",
4454 xmlMemBlocks() - mem_base);
4455 test_ret++;
4456 printf(" %d", n_hdlr);
4457 printf(" %d", n_warning);
4458 printf("\n");
4459 }
4460 }
4461 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004462 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004463
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004464 return(test_ret);
4465}
4466
4467
4468static int
4469test_xmlSAX2InitDocbDefaultSAXHandler(void) {
4470 int test_ret = 0;
4471
William M. Brack21e4ef22005-01-02 09:53:13 +00004472#if defined(LIBXML_DOCB_ENABLED)
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004473 int mem_base;
4474 xmlSAXHandler * hdlr; /* the SAX handler */
4475 int n_hdlr;
4476
4477 for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) {
4478 mem_base = xmlMemBlocks();
4479 hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0);
4480
4481 xmlSAX2InitDocbDefaultSAXHandler(hdlr);
4482 call_tests++;
4483 des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0);
4484 xmlResetLastError();
4485 if (mem_base != xmlMemBlocks()) {
4486 printf("Leak of %d blocks found in xmlSAX2InitDocbDefaultSAXHandler",
4487 xmlMemBlocks() - mem_base);
4488 test_ret++;
4489 printf(" %d", n_hdlr);
4490 printf("\n");
4491 }
4492 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004493 function_tests++;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004494#endif
4495
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004496 return(test_ret);
4497}
4498
4499
4500static int
4501test_xmlSAX2InitHtmlDefaultSAXHandler(void) {
4502 int test_ret = 0;
4503
William M. Brack21e4ef22005-01-02 09:53:13 +00004504#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004505 int mem_base;
4506 xmlSAXHandler * hdlr; /* the SAX handler */
4507 int n_hdlr;
4508
4509 for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) {
4510 mem_base = xmlMemBlocks();
4511 hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0);
4512
4513 xmlSAX2InitHtmlDefaultSAXHandler(hdlr);
4514 call_tests++;
4515 des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0);
4516 xmlResetLastError();
4517 if (mem_base != xmlMemBlocks()) {
4518 printf("Leak of %d blocks found in xmlSAX2InitHtmlDefaultSAXHandler",
4519 xmlMemBlocks() - mem_base);
4520 test_ret++;
4521 printf(" %d", n_hdlr);
4522 printf("\n");
4523 }
4524 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004525 function_tests++;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004526#endif
4527
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004528 return(test_ret);
4529}
4530
4531
4532static int
4533test_xmlSAX2InternalSubset(void) {
4534 int test_ret = 0;
4535
4536 int mem_base;
4537 void * ctx; /* the user data (XML parser context) */
4538 int n_ctx;
4539 xmlChar * name; /* the root element name */
4540 int n_name;
4541 xmlChar * ExternalID; /* the external ID */
4542 int n_ExternalID;
4543 xmlChar * SystemID; /* the SYSTEM ID (e.g. filename or URL) */
4544 int n_SystemID;
4545
4546 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4547 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4548 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
4549 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
4550 mem_base = xmlMemBlocks();
4551 ctx = gen_void_ptr(n_ctx, 0);
4552 name = gen_const_xmlChar_ptr(n_name, 1);
4553 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2);
4554 SystemID = gen_const_xmlChar_ptr(n_SystemID, 3);
4555
William M. Brackf13f77f2004-11-12 16:03:48 +00004556 xmlSAX2InternalSubset(ctx, (const xmlChar *)name, (const xmlChar *)ExternalID, (const xmlChar *)SystemID);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004557 call_tests++;
4558 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004559 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
4560 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 2);
4561 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 3);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004562 xmlResetLastError();
4563 if (mem_base != xmlMemBlocks()) {
4564 printf("Leak of %d blocks found in xmlSAX2InternalSubset",
4565 xmlMemBlocks() - mem_base);
4566 test_ret++;
4567 printf(" %d", n_ctx);
4568 printf(" %d", n_name);
4569 printf(" %d", n_ExternalID);
4570 printf(" %d", n_SystemID);
4571 printf("\n");
4572 }
4573 }
4574 }
4575 }
4576 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004577 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004578
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004579 return(test_ret);
4580}
4581
4582
4583static int
4584test_xmlSAX2IsStandalone(void) {
4585 int test_ret = 0;
4586
4587 int mem_base;
4588 int ret_val;
4589 void * ctx; /* the user data (XML parser context) */
4590 int n_ctx;
4591
4592 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4593 mem_base = xmlMemBlocks();
4594 ctx = gen_void_ptr(n_ctx, 0);
4595
4596 ret_val = xmlSAX2IsStandalone(ctx);
4597 desret_int(ret_val);
4598 call_tests++;
4599 des_void_ptr(n_ctx, ctx, 0);
4600 xmlResetLastError();
4601 if (mem_base != xmlMemBlocks()) {
4602 printf("Leak of %d blocks found in xmlSAX2IsStandalone",
4603 xmlMemBlocks() - mem_base);
4604 test_ret++;
4605 printf(" %d", n_ctx);
4606 printf("\n");
4607 }
4608 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004609 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004610
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004611 return(test_ret);
4612}
4613
4614
4615static int
4616test_xmlSAX2NotationDecl(void) {
4617 int test_ret = 0;
4618
4619 int mem_base;
4620 void * ctx; /* the user data (XML parser context) */
4621 int n_ctx;
4622 xmlChar * name; /* The name of the notation */
4623 int n_name;
4624 xmlChar * publicId; /* The public ID of the entity */
4625 int n_publicId;
4626 xmlChar * systemId; /* The system ID of the entity */
4627 int n_systemId;
4628
4629 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4630 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4631 for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) {
4632 for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) {
4633 mem_base = xmlMemBlocks();
4634 ctx = gen_void_ptr(n_ctx, 0);
4635 name = gen_const_xmlChar_ptr(n_name, 1);
4636 publicId = gen_const_xmlChar_ptr(n_publicId, 2);
4637 systemId = gen_const_xmlChar_ptr(n_systemId, 3);
4638
William M. Brackf13f77f2004-11-12 16:03:48 +00004639 xmlSAX2NotationDecl(ctx, (const xmlChar *)name, (const xmlChar *)publicId, (const xmlChar *)systemId);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004640 call_tests++;
4641 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004642 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
4643 des_const_xmlChar_ptr(n_publicId, (const xmlChar *)publicId, 2);
4644 des_const_xmlChar_ptr(n_systemId, (const xmlChar *)systemId, 3);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004645 xmlResetLastError();
4646 if (mem_base != xmlMemBlocks()) {
4647 printf("Leak of %d blocks found in xmlSAX2NotationDecl",
4648 xmlMemBlocks() - mem_base);
4649 test_ret++;
4650 printf(" %d", n_ctx);
4651 printf(" %d", n_name);
4652 printf(" %d", n_publicId);
4653 printf(" %d", n_systemId);
4654 printf("\n");
4655 }
4656 }
4657 }
4658 }
4659 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004660 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004661
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004662 return(test_ret);
4663}
4664
4665
4666static int
4667test_xmlSAX2ProcessingInstruction(void) {
4668 int test_ret = 0;
4669
4670 int mem_base;
4671 void * ctx; /* the user data (XML parser context) */
4672 int n_ctx;
4673 xmlChar * target; /* the target name */
4674 int n_target;
4675 xmlChar * data; /* the PI data's */
4676 int n_data;
4677
4678 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4679 for (n_target = 0;n_target < gen_nb_const_xmlChar_ptr;n_target++) {
4680 for (n_data = 0;n_data < gen_nb_const_xmlChar_ptr;n_data++) {
4681 mem_base = xmlMemBlocks();
4682 ctx = gen_void_ptr(n_ctx, 0);
4683 target = gen_const_xmlChar_ptr(n_target, 1);
4684 data = gen_const_xmlChar_ptr(n_data, 2);
4685
William M. Brackf13f77f2004-11-12 16:03:48 +00004686 xmlSAX2ProcessingInstruction(ctx, (const xmlChar *)target, (const xmlChar *)data);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004687 call_tests++;
4688 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004689 des_const_xmlChar_ptr(n_target, (const xmlChar *)target, 1);
4690 des_const_xmlChar_ptr(n_data, (const xmlChar *)data, 2);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004691 xmlResetLastError();
4692 if (mem_base != xmlMemBlocks()) {
4693 printf("Leak of %d blocks found in xmlSAX2ProcessingInstruction",
4694 xmlMemBlocks() - mem_base);
4695 test_ret++;
4696 printf(" %d", n_ctx);
4697 printf(" %d", n_target);
4698 printf(" %d", n_data);
4699 printf("\n");
4700 }
4701 }
4702 }
4703 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004704 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004705
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004706 return(test_ret);
4707}
4708
4709
4710static int
4711test_xmlSAX2Reference(void) {
4712 int test_ret = 0;
4713
4714 int mem_base;
4715 void * ctx; /* the user data (XML parser context) */
4716 int n_ctx;
4717 xmlChar * name; /* The entity name */
4718 int n_name;
4719
4720 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4721 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4722 mem_base = xmlMemBlocks();
4723 ctx = gen_void_ptr(n_ctx, 0);
4724 name = gen_const_xmlChar_ptr(n_name, 1);
4725
William M. Brackf13f77f2004-11-12 16:03:48 +00004726 xmlSAX2Reference(ctx, (const xmlChar *)name);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004727 call_tests++;
4728 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004729 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004730 xmlResetLastError();
4731 if (mem_base != xmlMemBlocks()) {
4732 printf("Leak of %d blocks found in xmlSAX2Reference",
4733 xmlMemBlocks() - mem_base);
4734 test_ret++;
4735 printf(" %d", n_ctx);
4736 printf(" %d", n_name);
4737 printf("\n");
4738 }
4739 }
4740 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004741 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004742
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004743 return(test_ret);
4744}
4745
4746
4747static int
4748test_xmlSAX2ResolveEntity(void) {
4749 int test_ret = 0;
4750
4751 int mem_base;
4752 xmlParserInputPtr ret_val;
4753 void * ctx; /* the user data (XML parser context) */
4754 int n_ctx;
4755 xmlChar * publicId; /* The public ID of the entity */
4756 int n_publicId;
4757 xmlChar * systemId; /* The system ID of the entity */
4758 int n_systemId;
4759
4760 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4761 for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) {
4762 for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) {
4763 mem_base = xmlMemBlocks();
4764 ctx = gen_void_ptr(n_ctx, 0);
4765 publicId = gen_const_xmlChar_ptr(n_publicId, 1);
4766 systemId = gen_const_xmlChar_ptr(n_systemId, 2);
4767
William M. Brackf13f77f2004-11-12 16:03:48 +00004768 ret_val = xmlSAX2ResolveEntity(ctx, (const xmlChar *)publicId, (const xmlChar *)systemId);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004769 desret_xmlParserInputPtr(ret_val);
4770 call_tests++;
4771 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004772 des_const_xmlChar_ptr(n_publicId, (const xmlChar *)publicId, 1);
4773 des_const_xmlChar_ptr(n_systemId, (const xmlChar *)systemId, 2);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004774 xmlResetLastError();
4775 if (mem_base != xmlMemBlocks()) {
4776 printf("Leak of %d blocks found in xmlSAX2ResolveEntity",
4777 xmlMemBlocks() - mem_base);
4778 test_ret++;
4779 printf(" %d", n_ctx);
4780 printf(" %d", n_publicId);
4781 printf(" %d", n_systemId);
4782 printf("\n");
4783 }
4784 }
4785 }
4786 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004787 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004788
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004789 return(test_ret);
4790}
4791
4792
4793#define gen_nb_xmlSAXLocatorPtr 1
4794static xmlSAXLocatorPtr gen_xmlSAXLocatorPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
4795 return(NULL);
4796}
4797static void des_xmlSAXLocatorPtr(int no ATTRIBUTE_UNUSED, xmlSAXLocatorPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
4798}
4799
4800static int
4801test_xmlSAX2SetDocumentLocator(void) {
4802 int test_ret = 0;
4803
4804 int mem_base;
4805 void * ctx; /* the user data (XML parser context) */
4806 int n_ctx;
4807 xmlSAXLocatorPtr loc; /* A SAX Locator */
4808 int n_loc;
4809
4810 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4811 for (n_loc = 0;n_loc < gen_nb_xmlSAXLocatorPtr;n_loc++) {
4812 mem_base = xmlMemBlocks();
4813 ctx = gen_void_ptr(n_ctx, 0);
4814 loc = gen_xmlSAXLocatorPtr(n_loc, 1);
4815
4816 xmlSAX2SetDocumentLocator(ctx, loc);
4817 call_tests++;
4818 des_void_ptr(n_ctx, ctx, 0);
4819 des_xmlSAXLocatorPtr(n_loc, loc, 1);
4820 xmlResetLastError();
4821 if (mem_base != xmlMemBlocks()) {
4822 printf("Leak of %d blocks found in xmlSAX2SetDocumentLocator",
4823 xmlMemBlocks() - mem_base);
4824 test_ret++;
4825 printf(" %d", n_ctx);
4826 printf(" %d", n_loc);
4827 printf("\n");
4828 }
4829 }
4830 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004831 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004832
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004833 return(test_ret);
4834}
4835
4836
4837static int
4838test_xmlSAX2StartDocument(void) {
4839 int test_ret = 0;
4840
4841 int mem_base;
4842 void * ctx; /* the user data (XML parser context) */
4843 int n_ctx;
4844
4845 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4846 mem_base = xmlMemBlocks();
4847 ctx = gen_void_ptr(n_ctx, 0);
4848
4849 xmlSAX2StartDocument(ctx);
4850 call_tests++;
4851 des_void_ptr(n_ctx, ctx, 0);
4852 xmlResetLastError();
4853 if (mem_base != xmlMemBlocks()) {
4854 printf("Leak of %d blocks found in xmlSAX2StartDocument",
4855 xmlMemBlocks() - mem_base);
4856 test_ret++;
4857 printf(" %d", n_ctx);
4858 printf("\n");
4859 }
4860 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004861 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004862
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004863 return(test_ret);
4864}
4865
4866
4867static int
4868test_xmlSAX2StartElement(void) {
4869 int test_ret = 0;
4870
William M. Brack21e4ef22005-01-02 09:53:13 +00004871#if defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00004872#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004873 int mem_base;
4874 void * ctx; /* the user data (XML parser context) */
4875 int n_ctx;
4876 xmlChar * fullname; /* The element name, including namespace prefix */
4877 int n_fullname;
4878 xmlChar ** atts; /* An array of name/value attributes pairs, NULL terminated */
4879 int n_atts;
4880
4881 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4882 for (n_fullname = 0;n_fullname < gen_nb_const_xmlChar_ptr;n_fullname++) {
4883 for (n_atts = 0;n_atts < gen_nb_const_xmlChar_ptr_ptr;n_atts++) {
4884 mem_base = xmlMemBlocks();
4885 ctx = gen_void_ptr(n_ctx, 0);
4886 fullname = gen_const_xmlChar_ptr(n_fullname, 1);
4887 atts = gen_const_xmlChar_ptr_ptr(n_atts, 2);
4888
William M. Brackf13f77f2004-11-12 16:03:48 +00004889 xmlSAX2StartElement(ctx, (const xmlChar *)fullname, (const xmlChar **)atts);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004890 call_tests++;
4891 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004892 des_const_xmlChar_ptr(n_fullname, (const xmlChar *)fullname, 1);
4893 des_const_xmlChar_ptr_ptr(n_atts, (const xmlChar **)atts, 2);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004894 xmlResetLastError();
4895 if (mem_base != xmlMemBlocks()) {
4896 printf("Leak of %d blocks found in xmlSAX2StartElement",
4897 xmlMemBlocks() - mem_base);
4898 test_ret++;
4899 printf(" %d", n_ctx);
4900 printf(" %d", n_fullname);
4901 printf(" %d", n_atts);
4902 printf("\n");
4903 }
4904 }
4905 }
4906 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004907 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00004908#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00004909#endif
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004910
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004911 return(test_ret);
4912}
4913
4914
4915static int
4916test_xmlSAX2StartElementNs(void) {
4917 int test_ret = 0;
4918
4919 int mem_base;
4920 void * ctx; /* the user data (XML parser context) */
4921 int n_ctx;
4922 xmlChar * localname; /* the local name of the element */
4923 int n_localname;
4924 xmlChar * prefix; /* the element namespace prefix if available */
4925 int n_prefix;
4926 xmlChar * URI; /* the element namespace name if available */
4927 int n_URI;
4928 int nb_namespaces; /* number of namespace definitions on that node */
4929 int n_nb_namespaces;
4930 xmlChar ** namespaces; /* pointer to the array of prefix/URI pairs namespace definitions */
4931 int n_namespaces;
4932 int nb_attributes; /* the number of attributes on that node */
4933 int n_nb_attributes;
4934 int nb_defaulted; /* the number of defaulted attributes. */
4935 int n_nb_defaulted;
4936 xmlChar ** attributes; /* pointer to the array of (localname/prefix/URI/value/end) attribute values. */
4937 int n_attributes;
4938
4939 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4940 for (n_localname = 0;n_localname < gen_nb_const_xmlChar_ptr;n_localname++) {
4941 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
4942 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
4943 for (n_nb_namespaces = 0;n_nb_namespaces < gen_nb_int;n_nb_namespaces++) {
4944 for (n_namespaces = 0;n_namespaces < gen_nb_const_xmlChar_ptr_ptr;n_namespaces++) {
4945 for (n_nb_attributes = 0;n_nb_attributes < gen_nb_int;n_nb_attributes++) {
4946 for (n_nb_defaulted = 0;n_nb_defaulted < gen_nb_int;n_nb_defaulted++) {
4947 for (n_attributes = 0;n_attributes < gen_nb_const_xmlChar_ptr_ptr;n_attributes++) {
4948 mem_base = xmlMemBlocks();
4949 ctx = gen_void_ptr(n_ctx, 0);
4950 localname = gen_const_xmlChar_ptr(n_localname, 1);
4951 prefix = gen_const_xmlChar_ptr(n_prefix, 2);
4952 URI = gen_const_xmlChar_ptr(n_URI, 3);
4953 nb_namespaces = gen_int(n_nb_namespaces, 4);
4954 namespaces = gen_const_xmlChar_ptr_ptr(n_namespaces, 5);
4955 nb_attributes = gen_int(n_nb_attributes, 6);
4956 nb_defaulted = gen_int(n_nb_defaulted, 7);
4957 attributes = gen_const_xmlChar_ptr_ptr(n_attributes, 8);
4958
William M. Brackf13f77f2004-11-12 16:03:48 +00004959 xmlSAX2StartElementNs(ctx, (const xmlChar *)localname, (const xmlChar *)prefix, (const xmlChar *)URI, nb_namespaces, (const xmlChar **)namespaces, nb_attributes, nb_defaulted, (const xmlChar **)attributes);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004960 call_tests++;
4961 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004962 des_const_xmlChar_ptr(n_localname, (const xmlChar *)localname, 1);
4963 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 2);
4964 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 3);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004965 des_int(n_nb_namespaces, nb_namespaces, 4);
William M. Brackf13f77f2004-11-12 16:03:48 +00004966 des_const_xmlChar_ptr_ptr(n_namespaces, (const xmlChar **)namespaces, 5);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004967 des_int(n_nb_attributes, nb_attributes, 6);
4968 des_int(n_nb_defaulted, nb_defaulted, 7);
William M. Brackf13f77f2004-11-12 16:03:48 +00004969 des_const_xmlChar_ptr_ptr(n_attributes, (const xmlChar **)attributes, 8);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004970 xmlResetLastError();
4971 if (mem_base != xmlMemBlocks()) {
4972 printf("Leak of %d blocks found in xmlSAX2StartElementNs",
4973 xmlMemBlocks() - mem_base);
4974 test_ret++;
4975 printf(" %d", n_ctx);
4976 printf(" %d", n_localname);
4977 printf(" %d", n_prefix);
4978 printf(" %d", n_URI);
4979 printf(" %d", n_nb_namespaces);
4980 printf(" %d", n_namespaces);
4981 printf(" %d", n_nb_attributes);
4982 printf(" %d", n_nb_defaulted);
4983 printf(" %d", n_attributes);
4984 printf("\n");
4985 }
4986 }
4987 }
4988 }
4989 }
4990 }
4991 }
4992 }
4993 }
4994 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004995 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004996
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004997 return(test_ret);
4998}
4999
5000
5001static int
5002test_xmlSAX2UnparsedEntityDecl(void) {
5003 int test_ret = 0;
5004
5005 int mem_base;
5006 void * ctx; /* the user data (XML parser context) */
5007 int n_ctx;
5008 xmlChar * name; /* The name of the entity */
5009 int n_name;
5010 xmlChar * publicId; /* The public ID of the entity */
5011 int n_publicId;
5012 xmlChar * systemId; /* The system ID of the entity */
5013 int n_systemId;
5014 xmlChar * notationName; /* the name of the notation */
5015 int n_notationName;
5016
5017 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
5018 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
5019 for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) {
5020 for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) {
5021 for (n_notationName = 0;n_notationName < gen_nb_const_xmlChar_ptr;n_notationName++) {
5022 mem_base = xmlMemBlocks();
5023 ctx = gen_void_ptr(n_ctx, 0);
5024 name = gen_const_xmlChar_ptr(n_name, 1);
5025 publicId = gen_const_xmlChar_ptr(n_publicId, 2);
5026 systemId = gen_const_xmlChar_ptr(n_systemId, 3);
5027 notationName = gen_const_xmlChar_ptr(n_notationName, 4);
5028
William M. Brackf13f77f2004-11-12 16:03:48 +00005029 xmlSAX2UnparsedEntityDecl(ctx, (const xmlChar *)name, (const xmlChar *)publicId, (const xmlChar *)systemId, (const xmlChar *)notationName);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005030 call_tests++;
5031 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005032 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
5033 des_const_xmlChar_ptr(n_publicId, (const xmlChar *)publicId, 2);
5034 des_const_xmlChar_ptr(n_systemId, (const xmlChar *)systemId, 3);
5035 des_const_xmlChar_ptr(n_notationName, (const xmlChar *)notationName, 4);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005036 xmlResetLastError();
5037 if (mem_base != xmlMemBlocks()) {
5038 printf("Leak of %d blocks found in xmlSAX2UnparsedEntityDecl",
5039 xmlMemBlocks() - mem_base);
5040 test_ret++;
5041 printf(" %d", n_ctx);
5042 printf(" %d", n_name);
5043 printf(" %d", n_publicId);
5044 printf(" %d", n_systemId);
5045 printf(" %d", n_notationName);
5046 printf("\n");
5047 }
5048 }
5049 }
5050 }
5051 }
5052 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005053 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005054
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005055 return(test_ret);
5056}
5057
5058
5059static int
5060test_xmlSAXDefaultVersion(void) {
5061 int test_ret = 0;
5062
William M. Brack21e4ef22005-01-02 09:53:13 +00005063#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00005064#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005065 int mem_base;
5066 int ret_val;
5067 int version; /* the version, 1 or 2 */
5068 int n_version;
5069
5070 for (n_version = 0;n_version < gen_nb_int;n_version++) {
5071 mem_base = xmlMemBlocks();
5072 version = gen_int(n_version, 0);
5073
5074 ret_val = xmlSAXDefaultVersion(version);
5075 desret_int(ret_val);
5076 call_tests++;
5077 des_int(n_version, version, 0);
5078 xmlResetLastError();
5079 if (mem_base != xmlMemBlocks()) {
5080 printf("Leak of %d blocks found in xmlSAXDefaultVersion",
5081 xmlMemBlocks() - mem_base);
5082 test_ret++;
5083 printf(" %d", n_version);
5084 printf("\n");
5085 }
5086 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005087 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00005088#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00005089#endif
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005090
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005091 return(test_ret);
5092}
5093
5094
5095static int
5096test_xmlSAXVersion(void) {
5097 int test_ret = 0;
5098
5099 int mem_base;
5100 int ret_val;
5101 xmlSAXHandler * hdlr; /* the SAX handler */
5102 int n_hdlr;
5103 int version; /* the version, 1 or 2 */
5104 int n_version;
5105
5106 for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) {
5107 for (n_version = 0;n_version < gen_nb_int;n_version++) {
5108 mem_base = xmlMemBlocks();
5109 hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0);
5110 version = gen_int(n_version, 1);
5111
5112 ret_val = xmlSAXVersion(hdlr, version);
5113 desret_int(ret_val);
5114 call_tests++;
5115 des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0);
5116 des_int(n_version, version, 1);
5117 xmlResetLastError();
5118 if (mem_base != xmlMemBlocks()) {
5119 printf("Leak of %d blocks found in xmlSAXVersion",
5120 xmlMemBlocks() - mem_base);
5121 test_ret++;
5122 printf(" %d", n_hdlr);
5123 printf(" %d", n_version);
5124 printf("\n");
5125 }
5126 }
5127 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005128 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005129
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005130 return(test_ret);
5131}
5132
5133static int
5134test_SAX2(void) {
5135 int test_ret = 0;
5136
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005137 if (quiet == 0) printf("Testing SAX2 : 38 of 38 functions ...\n");
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005138 test_ret += test_docbDefaultSAXHandlerInit();
5139 test_ret += test_htmlDefaultSAXHandlerInit();
5140 test_ret += test_xmlDefaultSAXHandlerInit();
5141 test_ret += test_xmlSAX2AttributeDecl();
5142 test_ret += test_xmlSAX2CDataBlock();
5143 test_ret += test_xmlSAX2Characters();
5144 test_ret += test_xmlSAX2Comment();
5145 test_ret += test_xmlSAX2ElementDecl();
5146 test_ret += test_xmlSAX2EndDocument();
5147 test_ret += test_xmlSAX2EndElement();
5148 test_ret += test_xmlSAX2EndElementNs();
5149 test_ret += test_xmlSAX2EntityDecl();
5150 test_ret += test_xmlSAX2ExternalSubset();
5151 test_ret += test_xmlSAX2GetColumnNumber();
5152 test_ret += test_xmlSAX2GetEntity();
5153 test_ret += test_xmlSAX2GetLineNumber();
5154 test_ret += test_xmlSAX2GetParameterEntity();
5155 test_ret += test_xmlSAX2GetPublicId();
5156 test_ret += test_xmlSAX2GetSystemId();
5157 test_ret += test_xmlSAX2HasExternalSubset();
5158 test_ret += test_xmlSAX2HasInternalSubset();
5159 test_ret += test_xmlSAX2IgnorableWhitespace();
5160 test_ret += test_xmlSAX2InitDefaultSAXHandler();
5161 test_ret += test_xmlSAX2InitDocbDefaultSAXHandler();
5162 test_ret += test_xmlSAX2InitHtmlDefaultSAXHandler();
5163 test_ret += test_xmlSAX2InternalSubset();
5164 test_ret += test_xmlSAX2IsStandalone();
5165 test_ret += test_xmlSAX2NotationDecl();
5166 test_ret += test_xmlSAX2ProcessingInstruction();
5167 test_ret += test_xmlSAX2Reference();
5168 test_ret += test_xmlSAX2ResolveEntity();
5169 test_ret += test_xmlSAX2SetDocumentLocator();
5170 test_ret += test_xmlSAX2StartDocument();
5171 test_ret += test_xmlSAX2StartElement();
5172 test_ret += test_xmlSAX2StartElementNs();
5173 test_ret += test_xmlSAX2UnparsedEntityDecl();
5174 test_ret += test_xmlSAXDefaultVersion();
5175 test_ret += test_xmlSAXVersion();
5176
5177 if (test_ret != 0)
5178 printf("Module SAX2: %d errors\n", test_ret);
5179 return(test_ret);
5180}
5181
Daniel Veillarda82b1822004-11-08 16:24:57 +00005182static int
5183test_xmlC14NDocDumpMemory(void) {
5184 int test_ret = 0;
5185
William M. Brack21e4ef22005-01-02 09:53:13 +00005186#if defined(LIBXML_C14N_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00005187 int mem_base;
5188 int ret_val;
5189 xmlDocPtr doc; /* the XML document for canonization */
5190 int n_doc;
5191 xmlNodeSetPtr nodes; /* the nodes set to be included in the canonized image or NULL if all document nodes should be included */
5192 int n_nodes;
5193 int exclusive; /* the exclusive flag (0 - non-exclusive canonicalization; otherwise - exclusive canonicalization) */
5194 int n_exclusive;
5195 xmlChar ** inclusive_ns_prefixes; /* the list of inclusive namespace prefixes ended with a NULL or NULL if there is no inclusive namespaces (only for exclusive canonicalization, ignored otherwise) */
5196 int n_inclusive_ns_prefixes;
5197 int with_comments; /* include comments in the result (!=0) or not (==0) */
5198 int n_with_comments;
5199 xmlChar ** doc_txt_ptr; /* the memory pointer for allocated canonical XML text; the caller of this functions is responsible for calling xmlFree() to free allocated memory */
5200 int n_doc_txt_ptr;
5201
5202 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
5203 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
5204 for (n_exclusive = 0;n_exclusive < gen_nb_int;n_exclusive++) {
5205 for (n_inclusive_ns_prefixes = 0;n_inclusive_ns_prefixes < gen_nb_xmlChar_ptr_ptr;n_inclusive_ns_prefixes++) {
5206 for (n_with_comments = 0;n_with_comments < gen_nb_int;n_with_comments++) {
5207 for (n_doc_txt_ptr = 0;n_doc_txt_ptr < gen_nb_xmlChar_ptr_ptr;n_doc_txt_ptr++) {
5208 mem_base = xmlMemBlocks();
5209 doc = gen_xmlDocPtr(n_doc, 0);
5210 nodes = gen_xmlNodeSetPtr(n_nodes, 1);
5211 exclusive = gen_int(n_exclusive, 2);
5212 inclusive_ns_prefixes = gen_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, 3);
5213 with_comments = gen_int(n_with_comments, 4);
5214 doc_txt_ptr = gen_xmlChar_ptr_ptr(n_doc_txt_ptr, 5);
5215
5216 ret_val = xmlC14NDocDumpMemory(doc, nodes, exclusive, inclusive_ns_prefixes, with_comments, doc_txt_ptr);
5217 desret_int(ret_val);
5218 call_tests++;
5219 des_xmlDocPtr(n_doc, doc, 0);
5220 des_xmlNodeSetPtr(n_nodes, nodes, 1);
5221 des_int(n_exclusive, exclusive, 2);
5222 des_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, inclusive_ns_prefixes, 3);
5223 des_int(n_with_comments, with_comments, 4);
5224 des_xmlChar_ptr_ptr(n_doc_txt_ptr, doc_txt_ptr, 5);
5225 xmlResetLastError();
5226 if (mem_base != xmlMemBlocks()) {
5227 printf("Leak of %d blocks found in xmlC14NDocDumpMemory",
5228 xmlMemBlocks() - mem_base);
5229 test_ret++;
5230 printf(" %d", n_doc);
5231 printf(" %d", n_nodes);
5232 printf(" %d", n_exclusive);
5233 printf(" %d", n_inclusive_ns_prefixes);
5234 printf(" %d", n_with_comments);
5235 printf(" %d", n_doc_txt_ptr);
5236 printf("\n");
5237 }
5238 }
5239 }
5240 }
5241 }
5242 }
5243 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005244 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00005245#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00005246
Daniel Veillarda82b1822004-11-08 16:24:57 +00005247 return(test_ret);
5248}
5249
5250
5251static int
5252test_xmlC14NDocSave(void) {
5253 int test_ret = 0;
5254
William M. Brack21e4ef22005-01-02 09:53:13 +00005255#if defined(LIBXML_C14N_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00005256 int mem_base;
5257 int ret_val;
5258 xmlDocPtr doc; /* the XML document for canonization */
5259 int n_doc;
5260 xmlNodeSetPtr nodes; /* the nodes set to be included in the canonized image or NULL if all document nodes should be included */
5261 int n_nodes;
5262 int exclusive; /* the exclusive flag (0 - non-exclusive canonicalization; otherwise - exclusive canonicalization) */
5263 int n_exclusive;
5264 xmlChar ** inclusive_ns_prefixes; /* the list of inclusive namespace prefixes ended with a NULL or NULL if there is no inclusive namespaces (only for exclusive canonicalization, ignored otherwise) */
5265 int n_inclusive_ns_prefixes;
5266 int with_comments; /* include comments in the result (!=0) or not (==0) */
5267 int n_with_comments;
5268 const char * filename; /* the filename to store canonical XML image */
5269 int n_filename;
5270 int compression; /* the compression level (zlib requred): -1 - libxml default, 0 - uncompressed, >0 - compression level */
5271 int n_compression;
5272
5273 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
5274 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
5275 for (n_exclusive = 0;n_exclusive < gen_nb_int;n_exclusive++) {
5276 for (n_inclusive_ns_prefixes = 0;n_inclusive_ns_prefixes < gen_nb_xmlChar_ptr_ptr;n_inclusive_ns_prefixes++) {
5277 for (n_with_comments = 0;n_with_comments < gen_nb_int;n_with_comments++) {
5278 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
5279 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
5280 mem_base = xmlMemBlocks();
5281 doc = gen_xmlDocPtr(n_doc, 0);
5282 nodes = gen_xmlNodeSetPtr(n_nodes, 1);
5283 exclusive = gen_int(n_exclusive, 2);
5284 inclusive_ns_prefixes = gen_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, 3);
5285 with_comments = gen_int(n_with_comments, 4);
5286 filename = gen_fileoutput(n_filename, 5);
5287 compression = gen_int(n_compression, 6);
5288
5289 ret_val = xmlC14NDocSave(doc, nodes, exclusive, inclusive_ns_prefixes, with_comments, filename, compression);
5290 desret_int(ret_val);
5291 call_tests++;
5292 des_xmlDocPtr(n_doc, doc, 0);
5293 des_xmlNodeSetPtr(n_nodes, nodes, 1);
5294 des_int(n_exclusive, exclusive, 2);
5295 des_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, inclusive_ns_prefixes, 3);
5296 des_int(n_with_comments, with_comments, 4);
5297 des_fileoutput(n_filename, filename, 5);
5298 des_int(n_compression, compression, 6);
5299 xmlResetLastError();
5300 if (mem_base != xmlMemBlocks()) {
5301 printf("Leak of %d blocks found in xmlC14NDocSave",
5302 xmlMemBlocks() - mem_base);
5303 test_ret++;
5304 printf(" %d", n_doc);
5305 printf(" %d", n_nodes);
5306 printf(" %d", n_exclusive);
5307 printf(" %d", n_inclusive_ns_prefixes);
5308 printf(" %d", n_with_comments);
5309 printf(" %d", n_filename);
5310 printf(" %d", n_compression);
5311 printf("\n");
5312 }
5313 }
5314 }
5315 }
5316 }
5317 }
5318 }
5319 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005320 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00005321#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00005322
Daniel Veillarda82b1822004-11-08 16:24:57 +00005323 return(test_ret);
5324}
5325
5326
5327static int
5328test_xmlC14NDocSaveTo(void) {
5329 int test_ret = 0;
5330
William M. Brack21e4ef22005-01-02 09:53:13 +00005331#if defined(LIBXML_C14N_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00005332 int mem_base;
5333 int ret_val;
5334 xmlDocPtr doc; /* the XML document for canonization */
5335 int n_doc;
5336 xmlNodeSetPtr nodes; /* the nodes set to be included in the canonized image or NULL if all document nodes should be included */
5337 int n_nodes;
5338 int exclusive; /* the exclusive flag (0 - non-exclusive canonicalization; otherwise - exclusive canonicalization) */
5339 int n_exclusive;
5340 xmlChar ** inclusive_ns_prefixes; /* the list of inclusive namespace prefixes ended with a NULL or NULL if there is no inclusive namespaces (only for exclusive canonicalization, ignored otherwise) */
5341 int n_inclusive_ns_prefixes;
5342 int with_comments; /* include comments in the result (!=0) or not (==0) */
5343 int n_with_comments;
5344 xmlOutputBufferPtr buf; /* the output buffer to store canonical XML; this buffer MUST have encoder==NULL because C14N requires UTF-8 output */
5345 int n_buf;
5346
5347 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
5348 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
5349 for (n_exclusive = 0;n_exclusive < gen_nb_int;n_exclusive++) {
5350 for (n_inclusive_ns_prefixes = 0;n_inclusive_ns_prefixes < gen_nb_xmlChar_ptr_ptr;n_inclusive_ns_prefixes++) {
5351 for (n_with_comments = 0;n_with_comments < gen_nb_int;n_with_comments++) {
5352 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
5353 mem_base = xmlMemBlocks();
5354 doc = gen_xmlDocPtr(n_doc, 0);
5355 nodes = gen_xmlNodeSetPtr(n_nodes, 1);
5356 exclusive = gen_int(n_exclusive, 2);
5357 inclusive_ns_prefixes = gen_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, 3);
5358 with_comments = gen_int(n_with_comments, 4);
5359 buf = gen_xmlOutputBufferPtr(n_buf, 5);
5360
5361 ret_val = xmlC14NDocSaveTo(doc, nodes, exclusive, inclusive_ns_prefixes, with_comments, buf);
5362 desret_int(ret_val);
5363 call_tests++;
5364 des_xmlDocPtr(n_doc, doc, 0);
5365 des_xmlNodeSetPtr(n_nodes, nodes, 1);
5366 des_int(n_exclusive, exclusive, 2);
5367 des_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, inclusive_ns_prefixes, 3);
5368 des_int(n_with_comments, with_comments, 4);
5369 des_xmlOutputBufferPtr(n_buf, buf, 5);
5370 xmlResetLastError();
5371 if (mem_base != xmlMemBlocks()) {
5372 printf("Leak of %d blocks found in xmlC14NDocSaveTo",
5373 xmlMemBlocks() - mem_base);
5374 test_ret++;
5375 printf(" %d", n_doc);
5376 printf(" %d", n_nodes);
5377 printf(" %d", n_exclusive);
5378 printf(" %d", n_inclusive_ns_prefixes);
5379 printf(" %d", n_with_comments);
5380 printf(" %d", n_buf);
5381 printf("\n");
5382 }
5383 }
5384 }
5385 }
5386 }
5387 }
5388 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005389 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00005390#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00005391
Daniel Veillarda82b1822004-11-08 16:24:57 +00005392 return(test_ret);
5393}
5394
5395
5396static int
5397test_xmlC14NExecute(void) {
5398 int test_ret = 0;
5399
5400
5401 /* missing type support */
5402 return(test_ret);
5403}
5404
5405static int
5406test_c14n(void) {
5407 int test_ret = 0;
5408
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005409 if (quiet == 0) printf("Testing c14n : 3 of 4 functions ...\n");
Daniel Veillarda82b1822004-11-08 16:24:57 +00005410 test_ret += test_xmlC14NDocDumpMemory();
5411 test_ret += test_xmlC14NDocSave();
5412 test_ret += test_xmlC14NDocSaveTo();
5413 test_ret += test_xmlC14NExecute();
5414
5415 if (test_ret != 0)
5416 printf("Module c14n: %d errors\n", test_ret);
5417 return(test_ret);
5418}
Daniel Veillarda521d282004-11-09 14:59:59 +00005419#ifdef LIBXML_CATALOG_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +00005420
Daniel Veillardce682bc2004-11-05 17:22:25 +00005421#define gen_nb_xmlCatalogPtr 1
5422static xmlCatalogPtr gen_xmlCatalogPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
5423 return(NULL);
5424}
5425static void des_xmlCatalogPtr(int no ATTRIBUTE_UNUSED, xmlCatalogPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
5426}
Daniel Veillarda521d282004-11-09 14:59:59 +00005427#endif
5428
Daniel Veillardce682bc2004-11-05 17:22:25 +00005429
Daniel Veillardd93f6252004-11-02 15:53:51 +00005430static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00005431test_xmlACatalogAdd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005432 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005433
William M. Brack21e4ef22005-01-02 09:53:13 +00005434#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00005435 int mem_base;
5436 int ret_val;
5437 xmlCatalogPtr catal; /* a Catalog */
5438 int n_catal;
5439 xmlChar * type; /* the type of record to add to the catalog */
5440 int n_type;
5441 xmlChar * orig; /* the system, public or prefix to match */
5442 int n_orig;
5443 xmlChar * replace; /* the replacement value for the match */
5444 int n_replace;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005445
Daniel Veillardce682bc2004-11-05 17:22:25 +00005446 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5447 for (n_type = 0;n_type < gen_nb_const_xmlChar_ptr;n_type++) {
5448 for (n_orig = 0;n_orig < gen_nb_const_xmlChar_ptr;n_orig++) {
5449 for (n_replace = 0;n_replace < gen_nb_const_xmlChar_ptr;n_replace++) {
5450 mem_base = xmlMemBlocks();
5451 catal = gen_xmlCatalogPtr(n_catal, 0);
5452 type = gen_const_xmlChar_ptr(n_type, 1);
5453 orig = gen_const_xmlChar_ptr(n_orig, 2);
5454 replace = gen_const_xmlChar_ptr(n_replace, 3);
5455
William M. Brackf13f77f2004-11-12 16:03:48 +00005456 ret_val = xmlACatalogAdd(catal, (const xmlChar *)type, (const xmlChar *)orig, (const xmlChar *)replace);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005457 desret_int(ret_val);
5458 call_tests++;
5459 des_xmlCatalogPtr(n_catal, catal, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005460 des_const_xmlChar_ptr(n_type, (const xmlChar *)type, 1);
5461 des_const_xmlChar_ptr(n_orig, (const xmlChar *)orig, 2);
5462 des_const_xmlChar_ptr(n_replace, (const xmlChar *)replace, 3);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005463 xmlResetLastError();
5464 if (mem_base != xmlMemBlocks()) {
5465 printf("Leak of %d blocks found in xmlACatalogAdd",
5466 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005467 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005468 printf(" %d", n_catal);
5469 printf(" %d", n_type);
5470 printf(" %d", n_orig);
5471 printf(" %d", n_replace);
5472 printf("\n");
5473 }
5474 }
5475 }
5476 }
5477 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005478 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005479#endif
5480
Daniel Veillard42595322004-11-08 10:52:06 +00005481 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005482}
5483
5484
5485static int
5486test_xmlACatalogDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005487 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005488
William M. Brack21e4ef22005-01-02 09:53:13 +00005489#if defined(LIBXML_CATALOG_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00005490 int mem_base;
5491 xmlCatalogPtr catal; /* a Catalog */
5492 int n_catal;
5493 FILE * out; /* the file. */
5494 int n_out;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005495
Daniel Veillardce682bc2004-11-05 17:22:25 +00005496 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5497 for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) {
5498 mem_base = xmlMemBlocks();
5499 catal = gen_xmlCatalogPtr(n_catal, 0);
5500 out = gen_FILE_ptr(n_out, 1);
5501
5502 xmlACatalogDump(catal, out);
5503 call_tests++;
5504 des_xmlCatalogPtr(n_catal, catal, 0);
5505 des_FILE_ptr(n_out, out, 1);
5506 xmlResetLastError();
5507 if (mem_base != xmlMemBlocks()) {
5508 printf("Leak of %d blocks found in xmlACatalogDump",
5509 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005510 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005511 printf(" %d", n_catal);
5512 printf(" %d", n_out);
5513 printf("\n");
5514 }
5515 }
5516 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005517 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005518#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +00005519
Daniel Veillard42595322004-11-08 10:52:06 +00005520 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005521}
5522
5523
5524static int
5525test_xmlACatalogRemove(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005526 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005527
William M. Brack21e4ef22005-01-02 09:53:13 +00005528#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00005529 int mem_base;
5530 int ret_val;
5531 xmlCatalogPtr catal; /* a Catalog */
5532 int n_catal;
5533 xmlChar * value; /* the value to remove */
5534 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005535
Daniel Veillardce682bc2004-11-05 17:22:25 +00005536 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5537 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
5538 mem_base = xmlMemBlocks();
5539 catal = gen_xmlCatalogPtr(n_catal, 0);
5540 value = gen_const_xmlChar_ptr(n_value, 1);
5541
William M. Brackf13f77f2004-11-12 16:03:48 +00005542 ret_val = xmlACatalogRemove(catal, (const xmlChar *)value);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005543 desret_int(ret_val);
5544 call_tests++;
5545 des_xmlCatalogPtr(n_catal, catal, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005546 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005547 xmlResetLastError();
5548 if (mem_base != xmlMemBlocks()) {
5549 printf("Leak of %d blocks found in xmlACatalogRemove",
5550 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005551 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005552 printf(" %d", n_catal);
5553 printf(" %d", n_value);
5554 printf("\n");
5555 }
5556 }
5557 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005558 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005559#endif
5560
Daniel Veillard42595322004-11-08 10:52:06 +00005561 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005562}
5563
5564
5565static int
5566test_xmlACatalogResolve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005567 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005568
William M. Brack21e4ef22005-01-02 09:53:13 +00005569#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00005570 int mem_base;
5571 xmlChar * ret_val;
5572 xmlCatalogPtr catal; /* a Catalog */
5573 int n_catal;
5574 xmlChar * pubID; /* the public ID string */
5575 int n_pubID;
5576 xmlChar * sysID; /* the system ID string */
5577 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005578
Daniel Veillardce682bc2004-11-05 17:22:25 +00005579 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5580 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
5581 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
5582 mem_base = xmlMemBlocks();
5583 catal = gen_xmlCatalogPtr(n_catal, 0);
5584 pubID = gen_const_xmlChar_ptr(n_pubID, 1);
5585 sysID = gen_const_xmlChar_ptr(n_sysID, 2);
5586
William M. Brackf13f77f2004-11-12 16:03:48 +00005587 ret_val = xmlACatalogResolve(catal, (const xmlChar *)pubID, (const xmlChar *)sysID);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005588 desret_xmlChar_ptr(ret_val);
5589 call_tests++;
5590 des_xmlCatalogPtr(n_catal, catal, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005591 des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 1);
5592 des_const_xmlChar_ptr(n_sysID, (const xmlChar *)sysID, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005593 xmlResetLastError();
5594 if (mem_base != xmlMemBlocks()) {
5595 printf("Leak of %d blocks found in xmlACatalogResolve",
5596 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005597 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005598 printf(" %d", n_catal);
5599 printf(" %d", n_pubID);
5600 printf(" %d", n_sysID);
5601 printf("\n");
5602 }
5603 }
5604 }
5605 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005606 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005607#endif
5608
Daniel Veillard42595322004-11-08 10:52:06 +00005609 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005610}
5611
5612
5613static int
5614test_xmlACatalogResolvePublic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005615 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005616
William M. Brack21e4ef22005-01-02 09:53:13 +00005617#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00005618 int mem_base;
5619 xmlChar * ret_val;
5620 xmlCatalogPtr catal; /* a Catalog */
5621 int n_catal;
5622 xmlChar * pubID; /* the public ID string */
5623 int n_pubID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005624
Daniel Veillardce682bc2004-11-05 17:22:25 +00005625 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5626 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
5627 mem_base = xmlMemBlocks();
5628 catal = gen_xmlCatalogPtr(n_catal, 0);
5629 pubID = gen_const_xmlChar_ptr(n_pubID, 1);
5630
William M. Brackf13f77f2004-11-12 16:03:48 +00005631 ret_val = xmlACatalogResolvePublic(catal, (const xmlChar *)pubID);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005632 desret_xmlChar_ptr(ret_val);
5633 call_tests++;
5634 des_xmlCatalogPtr(n_catal, catal, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005635 des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005636 xmlResetLastError();
5637 if (mem_base != xmlMemBlocks()) {
5638 printf("Leak of %d blocks found in xmlACatalogResolvePublic",
5639 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005640 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005641 printf(" %d", n_catal);
5642 printf(" %d", n_pubID);
5643 printf("\n");
5644 }
5645 }
5646 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005647 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005648#endif
5649
Daniel Veillard42595322004-11-08 10:52:06 +00005650 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005651}
5652
5653
5654static int
5655test_xmlACatalogResolveSystem(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005656 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005657
William M. Brack21e4ef22005-01-02 09:53:13 +00005658#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00005659 int mem_base;
5660 xmlChar * ret_val;
5661 xmlCatalogPtr catal; /* a Catalog */
5662 int n_catal;
5663 xmlChar * sysID; /* the system ID string */
5664 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005665
Daniel Veillardce682bc2004-11-05 17:22:25 +00005666 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5667 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
5668 mem_base = xmlMemBlocks();
5669 catal = gen_xmlCatalogPtr(n_catal, 0);
5670 sysID = gen_const_xmlChar_ptr(n_sysID, 1);
5671
William M. Brackf13f77f2004-11-12 16:03:48 +00005672 ret_val = xmlACatalogResolveSystem(catal, (const xmlChar *)sysID);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005673 desret_xmlChar_ptr(ret_val);
5674 call_tests++;
5675 des_xmlCatalogPtr(n_catal, catal, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005676 des_const_xmlChar_ptr(n_sysID, (const xmlChar *)sysID, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005677 xmlResetLastError();
5678 if (mem_base != xmlMemBlocks()) {
5679 printf("Leak of %d blocks found in xmlACatalogResolveSystem",
5680 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005681 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005682 printf(" %d", n_catal);
5683 printf(" %d", n_sysID);
5684 printf("\n");
5685 }
5686 }
5687 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005688 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005689#endif
5690
Daniel Veillard42595322004-11-08 10:52:06 +00005691 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005692}
5693
5694
5695static int
5696test_xmlACatalogResolveURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005697 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005698
William M. Brack21e4ef22005-01-02 09:53:13 +00005699#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00005700 int mem_base;
5701 xmlChar * ret_val;
5702 xmlCatalogPtr catal; /* a Catalog */
5703 int n_catal;
5704 xmlChar * URI; /* the URI */
5705 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005706
Daniel Veillardce682bc2004-11-05 17:22:25 +00005707 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5708 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
5709 mem_base = xmlMemBlocks();
5710 catal = gen_xmlCatalogPtr(n_catal, 0);
5711 URI = gen_const_xmlChar_ptr(n_URI, 1);
5712
William M. Brackf13f77f2004-11-12 16:03:48 +00005713 ret_val = xmlACatalogResolveURI(catal, (const xmlChar *)URI);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005714 desret_xmlChar_ptr(ret_val);
5715 call_tests++;
5716 des_xmlCatalogPtr(n_catal, catal, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005717 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005718 xmlResetLastError();
5719 if (mem_base != xmlMemBlocks()) {
5720 printf("Leak of %d blocks found in xmlACatalogResolveURI",
5721 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005722 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005723 printf(" %d", n_catal);
5724 printf(" %d", n_URI);
5725 printf("\n");
5726 }
5727 }
5728 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005729 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005730#endif
5731
Daniel Veillard42595322004-11-08 10:52:06 +00005732 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005733}
5734
5735
5736static int
5737test_xmlCatalogAdd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005738 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005739
William M. Brack21e4ef22005-01-02 09:53:13 +00005740#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00005741 int mem_base;
5742 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005743 xmlChar * type; /* the type of record to add to the catalog */
Daniel Veillardd93f6252004-11-02 15:53:51 +00005744 int n_type;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005745 xmlChar * orig; /* the system, public or prefix to match */
Daniel Veillardd93f6252004-11-02 15:53:51 +00005746 int n_orig;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005747 xmlChar * replace; /* the replacement value for the match */
Daniel Veillardd93f6252004-11-02 15:53:51 +00005748 int n_replace;
5749
5750 for (n_type = 0;n_type < gen_nb_const_xmlChar_ptr;n_type++) {
5751 for (n_orig = 0;n_orig < gen_nb_const_xmlChar_ptr;n_orig++) {
5752 for (n_replace = 0;n_replace < gen_nb_const_xmlChar_ptr;n_replace++) {
5753 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00005754 type = gen_const_xmlChar_ptr(n_type, 0);
5755 orig = gen_const_xmlChar_ptr(n_orig, 1);
5756 replace = gen_const_xmlChar_ptr(n_replace, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005757
William M. Brackf13f77f2004-11-12 16:03:48 +00005758 ret_val = xmlCatalogAdd((const xmlChar *)type, (const xmlChar *)orig, (const xmlChar *)replace);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005759 desret_int(ret_val);
5760 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00005761 des_const_xmlChar_ptr(n_type, (const xmlChar *)type, 0);
5762 des_const_xmlChar_ptr(n_orig, (const xmlChar *)orig, 1);
5763 des_const_xmlChar_ptr(n_replace, (const xmlChar *)replace, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005764 xmlResetLastError();
5765 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00005766 printf("Leak of %d blocks found in xmlCatalogAdd",
Daniel Veillardd93f6252004-11-02 15:53:51 +00005767 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005768 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00005769 printf(" %d", n_type);
5770 printf(" %d", n_orig);
5771 printf(" %d", n_replace);
5772 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00005773 }
5774 }
5775 }
5776 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005777 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005778#endif
5779
Daniel Veillard42595322004-11-08 10:52:06 +00005780 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005781}
5782
5783
5784static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00005785test_xmlCatalogCleanup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005786 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005787
William M. Brack21e4ef22005-01-02 09:53:13 +00005788#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00005789
Daniel Veillardd93f6252004-11-02 15:53:51 +00005790
5791 xmlCatalogCleanup();
5792 call_tests++;
5793 xmlResetLastError();
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005794 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005795#endif
5796
Daniel Veillard42595322004-11-08 10:52:06 +00005797 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005798}
5799
5800
5801static int
5802test_xmlCatalogConvert(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005803 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005804
William M. Brack21e4ef22005-01-02 09:53:13 +00005805#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00005806 int ret_val;
5807
5808
5809 ret_val = xmlCatalogConvert();
5810 desret_int(ret_val);
5811 call_tests++;
5812 xmlResetLastError();
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005813 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005814#endif
5815
Daniel Veillard42595322004-11-08 10:52:06 +00005816 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005817}
5818
5819
5820static int
5821test_xmlCatalogDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005822 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005823
William M. Brack21e4ef22005-01-02 09:53:13 +00005824#if defined(LIBXML_CATALOG_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005825 int mem_base;
5826 FILE * out; /* the file. */
5827 int n_out;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005828
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005829 for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) {
5830 mem_base = xmlMemBlocks();
5831 out = gen_FILE_ptr(n_out, 0);
5832
5833 xmlCatalogDump(out);
5834 call_tests++;
5835 des_FILE_ptr(n_out, out, 0);
5836 xmlResetLastError();
5837 if (mem_base != xmlMemBlocks()) {
5838 printf("Leak of %d blocks found in xmlCatalogDump",
5839 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005840 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005841 printf(" %d", n_out);
5842 printf("\n");
5843 }
5844 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005845 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005846#endif
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005847
Daniel Veillard42595322004-11-08 10:52:06 +00005848 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005849}
5850
5851
5852static int
5853test_xmlCatalogGetDefaults(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005854 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005855
William M. Brack21e4ef22005-01-02 09:53:13 +00005856#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +00005857 int mem_base;
5858 xmlCatalogAllow ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005859
Daniel Veillard57b25162004-11-06 14:50:18 +00005860 mem_base = xmlMemBlocks();
5861
5862 ret_val = xmlCatalogGetDefaults();
5863 desret_xmlCatalogAllow(ret_val);
5864 call_tests++;
5865 xmlResetLastError();
5866 if (mem_base != xmlMemBlocks()) {
5867 printf("Leak of %d blocks found in xmlCatalogGetDefaults",
5868 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005869 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00005870 printf("\n");
5871 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005872 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00005873#endif
5874
Daniel Veillard42595322004-11-08 10:52:06 +00005875 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005876}
5877
5878
5879static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00005880test_xmlCatalogIsEmpty(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005881 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005882
William M. Brack21e4ef22005-01-02 09:53:13 +00005883#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00005884 int mem_base;
5885 int ret_val;
5886 xmlCatalogPtr catal; /* should this create an SGML catalog */
5887 int n_catal;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005888
Daniel Veillardce682bc2004-11-05 17:22:25 +00005889 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5890 mem_base = xmlMemBlocks();
5891 catal = gen_xmlCatalogPtr(n_catal, 0);
5892
5893 ret_val = xmlCatalogIsEmpty(catal);
5894 desret_int(ret_val);
5895 call_tests++;
5896 des_xmlCatalogPtr(n_catal, catal, 0);
5897 xmlResetLastError();
5898 if (mem_base != xmlMemBlocks()) {
5899 printf("Leak of %d blocks found in xmlCatalogIsEmpty",
5900 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005901 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005902 printf(" %d", n_catal);
5903 printf("\n");
5904 }
5905 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005906 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005907#endif
5908
Daniel Veillard42595322004-11-08 10:52:06 +00005909 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005910}
5911
5912
5913static int
5914test_xmlCatalogLocalResolve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005915 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005916
William M. Brack21e4ef22005-01-02 09:53:13 +00005917#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005918 int mem_base;
5919 xmlChar * ret_val;
5920 void * catalogs; /* a document's list of catalogs */
5921 int n_catalogs;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005922 xmlChar * pubID; /* the public ID string */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005923 int n_pubID;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005924 xmlChar * sysID; /* the system ID string */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005925 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005926
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005927 for (n_catalogs = 0;n_catalogs < gen_nb_void_ptr;n_catalogs++) {
5928 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
5929 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
5930 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00005931 catalogs = gen_void_ptr(n_catalogs, 0);
5932 pubID = gen_const_xmlChar_ptr(n_pubID, 1);
5933 sysID = gen_const_xmlChar_ptr(n_sysID, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005934
William M. Brackf13f77f2004-11-12 16:03:48 +00005935 ret_val = xmlCatalogLocalResolve(catalogs, (const xmlChar *)pubID, (const xmlChar *)sysID);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005936 desret_xmlChar_ptr(ret_val);
5937 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00005938 des_void_ptr(n_catalogs, catalogs, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005939 des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 1);
5940 des_const_xmlChar_ptr(n_sysID, (const xmlChar *)sysID, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005941 xmlResetLastError();
5942 if (mem_base != xmlMemBlocks()) {
5943 printf("Leak of %d blocks found in xmlCatalogLocalResolve",
5944 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005945 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005946 printf(" %d", n_catalogs);
5947 printf(" %d", n_pubID);
5948 printf(" %d", n_sysID);
5949 printf("\n");
5950 }
5951 }
5952 }
5953 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005954 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005955#endif
5956
Daniel Veillard42595322004-11-08 10:52:06 +00005957 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005958}
5959
5960
5961static int
5962test_xmlCatalogLocalResolveURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005963 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005964
William M. Brack21e4ef22005-01-02 09:53:13 +00005965#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005966 int mem_base;
5967 xmlChar * ret_val;
5968 void * catalogs; /* a document's list of catalogs */
5969 int n_catalogs;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005970 xmlChar * URI; /* the URI */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005971 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005972
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005973 for (n_catalogs = 0;n_catalogs < gen_nb_void_ptr;n_catalogs++) {
5974 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
5975 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00005976 catalogs = gen_void_ptr(n_catalogs, 0);
5977 URI = gen_const_xmlChar_ptr(n_URI, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005978
William M. Brackf13f77f2004-11-12 16:03:48 +00005979 ret_val = xmlCatalogLocalResolveURI(catalogs, (const xmlChar *)URI);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005980 desret_xmlChar_ptr(ret_val);
5981 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00005982 des_void_ptr(n_catalogs, catalogs, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005983 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005984 xmlResetLastError();
5985 if (mem_base != xmlMemBlocks()) {
5986 printf("Leak of %d blocks found in xmlCatalogLocalResolveURI",
5987 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005988 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005989 printf(" %d", n_catalogs);
5990 printf(" %d", n_URI);
5991 printf("\n");
5992 }
5993 }
5994 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005995 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005996#endif
5997
Daniel Veillard42595322004-11-08 10:52:06 +00005998 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005999}
6000
6001
6002static int
6003test_xmlCatalogRemove(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006004 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006005
William M. Brack21e4ef22005-01-02 09:53:13 +00006006#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00006007 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006008 xmlChar * value; /* the value to remove */
Daniel Veillardd93f6252004-11-02 15:53:51 +00006009 int n_value;
6010
6011 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00006012 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006013
William M. Brackf13f77f2004-11-12 16:03:48 +00006014 ret_val = xmlCatalogRemove((const xmlChar *)value);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006015 desret_int(ret_val);
6016 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00006017 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006018 xmlResetLastError();
6019 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006020 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006021#endif
6022
Daniel Veillard42595322004-11-08 10:52:06 +00006023 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006024}
6025
6026
6027static int
6028test_xmlCatalogResolve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006029 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006030
William M. Brack21e4ef22005-01-02 09:53:13 +00006031#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006032 int mem_base;
6033 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006034 xmlChar * pubID; /* the public ID string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006035 int n_pubID;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006036 xmlChar * sysID; /* the system ID string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006037 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006038
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006039 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
6040 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
6041 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006042 pubID = gen_const_xmlChar_ptr(n_pubID, 0);
6043 sysID = gen_const_xmlChar_ptr(n_sysID, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006044
William M. Brackf13f77f2004-11-12 16:03:48 +00006045 ret_val = xmlCatalogResolve((const xmlChar *)pubID, (const xmlChar *)sysID);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006046 desret_xmlChar_ptr(ret_val);
6047 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00006048 des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 0);
6049 des_const_xmlChar_ptr(n_sysID, (const xmlChar *)sysID, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006050 xmlResetLastError();
6051 if (mem_base != xmlMemBlocks()) {
6052 printf("Leak of %d blocks found in xmlCatalogResolve",
6053 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006054 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006055 printf(" %d", n_pubID);
6056 printf(" %d", n_sysID);
6057 printf("\n");
6058 }
6059 }
6060 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006061 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006062#endif
6063
Daniel Veillard42595322004-11-08 10:52:06 +00006064 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006065}
6066
6067
6068static int
6069test_xmlCatalogResolvePublic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006070 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006071
William M. Brack21e4ef22005-01-02 09:53:13 +00006072#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006073 int mem_base;
6074 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006075 xmlChar * pubID; /* the public ID string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006076 int n_pubID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006077
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006078 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
6079 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006080 pubID = gen_const_xmlChar_ptr(n_pubID, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006081
William M. Brackf13f77f2004-11-12 16:03:48 +00006082 ret_val = xmlCatalogResolvePublic((const xmlChar *)pubID);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006083 desret_xmlChar_ptr(ret_val);
6084 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00006085 des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006086 xmlResetLastError();
6087 if (mem_base != xmlMemBlocks()) {
6088 printf("Leak of %d blocks found in xmlCatalogResolvePublic",
6089 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006090 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006091 printf(" %d", n_pubID);
6092 printf("\n");
6093 }
6094 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006095 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006096#endif
6097
Daniel Veillard42595322004-11-08 10:52:06 +00006098 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006099}
6100
6101
6102static int
6103test_xmlCatalogResolveSystem(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006104 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006105
William M. Brack21e4ef22005-01-02 09:53:13 +00006106#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006107 int mem_base;
6108 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006109 xmlChar * sysID; /* the system ID string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006110 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006111
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006112 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
6113 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006114 sysID = gen_const_xmlChar_ptr(n_sysID, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006115
William M. Brackf13f77f2004-11-12 16:03:48 +00006116 ret_val = xmlCatalogResolveSystem((const xmlChar *)sysID);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006117 desret_xmlChar_ptr(ret_val);
6118 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00006119 des_const_xmlChar_ptr(n_sysID, (const xmlChar *)sysID, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006120 xmlResetLastError();
6121 if (mem_base != xmlMemBlocks()) {
6122 printf("Leak of %d blocks found in xmlCatalogResolveSystem",
6123 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006124 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006125 printf(" %d", n_sysID);
6126 printf("\n");
6127 }
6128 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006129 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006130#endif
6131
Daniel Veillard42595322004-11-08 10:52:06 +00006132 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006133}
6134
6135
6136static int
6137test_xmlCatalogResolveURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006138 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006139
William M. Brack21e4ef22005-01-02 09:53:13 +00006140#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006141 int mem_base;
6142 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006143 xmlChar * URI; /* the URI */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006144 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006145
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006146 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
6147 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006148 URI = gen_const_xmlChar_ptr(n_URI, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006149
William M. Brackf13f77f2004-11-12 16:03:48 +00006150 ret_val = xmlCatalogResolveURI((const xmlChar *)URI);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006151 desret_xmlChar_ptr(ret_val);
6152 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00006153 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006154 xmlResetLastError();
6155 if (mem_base != xmlMemBlocks()) {
6156 printf("Leak of %d blocks found in xmlCatalogResolveURI",
6157 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006158 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006159 printf(" %d", n_URI);
6160 printf("\n");
6161 }
6162 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006163 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006164#endif
6165
Daniel Veillard42595322004-11-08 10:52:06 +00006166 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006167}
6168
6169
6170static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00006171test_xmlCatalogSetDefaultPrefer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006172 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006173
William M. Brack21e4ef22005-01-02 09:53:13 +00006174#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +00006175 int mem_base;
6176 xmlCatalogPrefer ret_val;
6177 xmlCatalogPrefer prefer; /* the default preference for delegation */
6178 int n_prefer;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006179
Daniel Veillard57b25162004-11-06 14:50:18 +00006180 for (n_prefer = 0;n_prefer < gen_nb_xmlCatalogPrefer;n_prefer++) {
6181 mem_base = xmlMemBlocks();
6182 prefer = gen_xmlCatalogPrefer(n_prefer, 0);
6183
6184 ret_val = xmlCatalogSetDefaultPrefer(prefer);
6185 desret_xmlCatalogPrefer(ret_val);
6186 call_tests++;
6187 des_xmlCatalogPrefer(n_prefer, prefer, 0);
6188 xmlResetLastError();
6189 if (mem_base != xmlMemBlocks()) {
6190 printf("Leak of %d blocks found in xmlCatalogSetDefaultPrefer",
6191 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006192 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00006193 printf(" %d", n_prefer);
6194 printf("\n");
6195 }
6196 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006197 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00006198#endif
6199
Daniel Veillard42595322004-11-08 10:52:06 +00006200 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006201}
6202
6203
6204static int
6205test_xmlCatalogSetDefaults(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006206 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006207
William M. Brack21e4ef22005-01-02 09:53:13 +00006208#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +00006209 int mem_base;
6210 xmlCatalogAllow allow; /* what catalogs should be accepted */
6211 int n_allow;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006212
Daniel Veillard57b25162004-11-06 14:50:18 +00006213 for (n_allow = 0;n_allow < gen_nb_xmlCatalogAllow;n_allow++) {
6214 mem_base = xmlMemBlocks();
6215 allow = gen_xmlCatalogAllow(n_allow, 0);
6216
6217 xmlCatalogSetDefaults(allow);
6218 call_tests++;
6219 des_xmlCatalogAllow(n_allow, allow, 0);
6220 xmlResetLastError();
6221 if (mem_base != xmlMemBlocks()) {
6222 printf("Leak of %d blocks found in xmlCatalogSetDefaults",
6223 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006224 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00006225 printf(" %d", n_allow);
6226 printf("\n");
6227 }
6228 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006229 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00006230#endif
6231
Daniel Veillard42595322004-11-08 10:52:06 +00006232 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006233}
6234
6235
6236static int
6237test_xmlConvertSGMLCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006238 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006239
William M. Brack21e4ef22005-01-02 09:53:13 +00006240#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00006241 int mem_base;
6242 int ret_val;
6243 xmlCatalogPtr catal; /* the catalog */
6244 int n_catal;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006245
Daniel Veillardce682bc2004-11-05 17:22:25 +00006246 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
6247 mem_base = xmlMemBlocks();
6248 catal = gen_xmlCatalogPtr(n_catal, 0);
6249
6250 ret_val = xmlConvertSGMLCatalog(catal);
6251 desret_int(ret_val);
6252 call_tests++;
6253 des_xmlCatalogPtr(n_catal, catal, 0);
6254 xmlResetLastError();
6255 if (mem_base != xmlMemBlocks()) {
6256 printf("Leak of %d blocks found in xmlConvertSGMLCatalog",
6257 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006258 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006259 printf(" %d", n_catal);
6260 printf("\n");
6261 }
6262 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006263 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006264#endif
6265
Daniel Veillard42595322004-11-08 10:52:06 +00006266 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006267}
6268
6269
6270static int
6271test_xmlInitializeCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006272 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006273
William M. Brack21e4ef22005-01-02 09:53:13 +00006274#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00006275 int mem_base;
6276
6277 mem_base = xmlMemBlocks();
6278
6279 xmlInitializeCatalog();
6280 call_tests++;
6281 xmlResetLastError();
6282 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00006283 printf("Leak of %d blocks found in xmlInitializeCatalog",
Daniel Veillardd93f6252004-11-02 15:53:51 +00006284 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006285 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00006286 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00006287 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006288 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006289#endif
6290
Daniel Veillard42595322004-11-08 10:52:06 +00006291 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006292}
6293
6294
6295static int
6296test_xmlLoadACatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006297 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006298
6299
6300 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00006301 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006302}
6303
6304
6305static int
6306test_xmlLoadCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006307 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006308
William M. Brack21e4ef22005-01-02 09:53:13 +00006309#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00006310 int ret_val;
6311 const char * filename; /* a file path */
6312 int n_filename;
6313
6314 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00006315 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006316
6317 ret_val = xmlLoadCatalog(filename);
6318 desret_int(ret_val);
6319 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006320 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006321 xmlResetLastError();
6322 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006323 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006324#endif
6325
Daniel Veillard42595322004-11-08 10:52:06 +00006326 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006327}
6328
6329
6330static int
6331test_xmlLoadCatalogs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006332 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006333
William M. Brack21e4ef22005-01-02 09:53:13 +00006334#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00006335 char * pathss; /* a list of directories separated by a colon or a space. */
Daniel Veillardd93f6252004-11-02 15:53:51 +00006336 int n_pathss;
6337
6338 for (n_pathss = 0;n_pathss < gen_nb_const_char_ptr;n_pathss++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00006339 pathss = gen_const_char_ptr(n_pathss, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006340
William M. Brackf13f77f2004-11-12 16:03:48 +00006341 xmlLoadCatalogs((const char *)pathss);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006342 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00006343 des_const_char_ptr(n_pathss, (const char *)pathss, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006344 xmlResetLastError();
6345 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006346 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006347#endif
6348
Daniel Veillard42595322004-11-08 10:52:06 +00006349 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006350}
6351
6352
6353static int
6354test_xmlLoadSGMLSuperCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006355 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006356
6357
6358 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00006359 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006360}
6361
6362
6363static int
6364test_xmlNewCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006365 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006366
6367
6368 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00006369 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006370}
6371
6372
6373static int
6374test_xmlParseCatalogFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006375 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006376
William M. Brack21e4ef22005-01-02 09:53:13 +00006377#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00006378 int mem_base;
6379 xmlDocPtr ret_val;
6380 const char * filename; /* the filename */
6381 int n_filename;
6382
6383 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
6384 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006385 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006386
6387 ret_val = xmlParseCatalogFile(filename);
6388 desret_xmlDocPtr(ret_val);
6389 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006390 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006391 xmlResetLastError();
6392 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00006393 printf("Leak of %d blocks found in xmlParseCatalogFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +00006394 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006395 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00006396 printf(" %d", n_filename);
6397 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00006398 }
6399 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006400 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006401#endif
6402
Daniel Veillard42595322004-11-08 10:52:06 +00006403 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006404}
6405
6406static int
6407test_catalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006408 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006409
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006410 if (quiet == 0) printf("Testing catalog : 27 of 36 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00006411 test_ret += test_xmlACatalogAdd();
6412 test_ret += test_xmlACatalogDump();
6413 test_ret += test_xmlACatalogRemove();
6414 test_ret += test_xmlACatalogResolve();
6415 test_ret += test_xmlACatalogResolvePublic();
6416 test_ret += test_xmlACatalogResolveSystem();
6417 test_ret += test_xmlACatalogResolveURI();
6418 test_ret += test_xmlCatalogAdd();
6419 test_ret += test_xmlCatalogCleanup();
6420 test_ret += test_xmlCatalogConvert();
6421 test_ret += test_xmlCatalogDump();
6422 test_ret += test_xmlCatalogGetDefaults();
6423 test_ret += test_xmlCatalogIsEmpty();
6424 test_ret += test_xmlCatalogLocalResolve();
6425 test_ret += test_xmlCatalogLocalResolveURI();
6426 test_ret += test_xmlCatalogRemove();
6427 test_ret += test_xmlCatalogResolve();
6428 test_ret += test_xmlCatalogResolvePublic();
6429 test_ret += test_xmlCatalogResolveSystem();
6430 test_ret += test_xmlCatalogResolveURI();
6431 test_ret += test_xmlCatalogSetDefaultPrefer();
6432 test_ret += test_xmlCatalogSetDefaults();
6433 test_ret += test_xmlConvertSGMLCatalog();
6434 test_ret += test_xmlInitializeCatalog();
6435 test_ret += test_xmlLoadACatalog();
6436 test_ret += test_xmlLoadCatalog();
6437 test_ret += test_xmlLoadCatalogs();
6438 test_ret += test_xmlLoadSGMLSuperCatalog();
6439 test_ret += test_xmlNewCatalog();
6440 test_ret += test_xmlParseCatalogFile();
Daniel Veillardd93f6252004-11-02 15:53:51 +00006441
Daniel Veillard42595322004-11-08 10:52:06 +00006442 if (test_ret != 0)
6443 printf("Module catalog: %d errors\n", test_ret);
6444 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006445}
6446
Daniel Veillardce682bc2004-11-05 17:22:25 +00006447#define gen_nb_const_xmlChRangeGroupPtr 1
6448static xmlChRangeGroupPtr gen_const_xmlChRangeGroupPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
6449 return(NULL);
6450}
6451static void des_const_xmlChRangeGroupPtr(int no ATTRIBUTE_UNUSED, const xmlChRangeGroupPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
6452}
6453
Daniel Veillardd93f6252004-11-02 15:53:51 +00006454static int
6455test_xmlCharInRange(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006456 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006457
Daniel Veillardce682bc2004-11-05 17:22:25 +00006458 int mem_base;
6459 int ret_val;
6460 unsigned int val; /* character to be validated */
6461 int n_val;
6462 xmlChRangeGroupPtr rptr; /* pointer to range to be used to validate */
6463 int n_rptr;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006464
Daniel Veillardce682bc2004-11-05 17:22:25 +00006465 for (n_val = 0;n_val < gen_nb_unsigned_int;n_val++) {
6466 for (n_rptr = 0;n_rptr < gen_nb_const_xmlChRangeGroupPtr;n_rptr++) {
6467 mem_base = xmlMemBlocks();
6468 val = gen_unsigned_int(n_val, 0);
6469 rptr = gen_const_xmlChRangeGroupPtr(n_rptr, 1);
6470
William M. Brackf13f77f2004-11-12 16:03:48 +00006471 ret_val = xmlCharInRange(val, (const xmlChRangeGroupPtr)rptr);
Daniel Veillardce682bc2004-11-05 17:22:25 +00006472 desret_int(ret_val);
6473 call_tests++;
6474 des_unsigned_int(n_val, val, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00006475 des_const_xmlChRangeGroupPtr(n_rptr, (const xmlChRangeGroupPtr)rptr, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00006476 xmlResetLastError();
6477 if (mem_base != xmlMemBlocks()) {
6478 printf("Leak of %d blocks found in xmlCharInRange",
6479 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006480 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006481 printf(" %d", n_val);
6482 printf(" %d", n_rptr);
6483 printf("\n");
6484 }
6485 }
6486 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00006487 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006488
Daniel Veillard42595322004-11-08 10:52:06 +00006489 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006490}
6491
6492
6493static int
6494test_xmlIsBaseChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006495 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006496
Daniel Veillard3d97e662004-11-04 10:49:00 +00006497 int mem_base;
6498 int ret_val;
6499 unsigned int ch; /* character to validate */
6500 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006501
Daniel Veillard3d97e662004-11-04 10:49:00 +00006502 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6503 mem_base = xmlMemBlocks();
6504 ch = gen_unsigned_int(n_ch, 0);
6505
6506 ret_val = xmlIsBaseChar(ch);
6507 desret_int(ret_val);
6508 call_tests++;
6509 des_unsigned_int(n_ch, ch, 0);
6510 xmlResetLastError();
6511 if (mem_base != xmlMemBlocks()) {
6512 printf("Leak of %d blocks found in xmlIsBaseChar",
6513 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006514 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006515 printf(" %d", n_ch);
6516 printf("\n");
6517 }
6518 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006519 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006520
Daniel Veillard42595322004-11-08 10:52:06 +00006521 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006522}
6523
6524
6525static int
6526test_xmlIsBlank(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006527 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006528
Daniel Veillard3d97e662004-11-04 10:49:00 +00006529 int mem_base;
6530 int ret_val;
6531 unsigned int ch; /* character to validate */
6532 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006533
Daniel Veillard3d97e662004-11-04 10:49:00 +00006534 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6535 mem_base = xmlMemBlocks();
6536 ch = gen_unsigned_int(n_ch, 0);
6537
6538 ret_val = xmlIsBlank(ch);
6539 desret_int(ret_val);
6540 call_tests++;
6541 des_unsigned_int(n_ch, ch, 0);
6542 xmlResetLastError();
6543 if (mem_base != xmlMemBlocks()) {
6544 printf("Leak of %d blocks found in xmlIsBlank",
6545 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006546 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006547 printf(" %d", n_ch);
6548 printf("\n");
6549 }
6550 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006551 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006552
Daniel Veillard42595322004-11-08 10:52:06 +00006553 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006554}
6555
6556
6557static int
6558test_xmlIsChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006559 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006560
Daniel Veillard3d97e662004-11-04 10:49:00 +00006561 int mem_base;
6562 int ret_val;
6563 unsigned int ch; /* character to validate */
6564 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006565
Daniel Veillard3d97e662004-11-04 10:49:00 +00006566 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6567 mem_base = xmlMemBlocks();
6568 ch = gen_unsigned_int(n_ch, 0);
6569
6570 ret_val = xmlIsChar(ch);
6571 desret_int(ret_val);
6572 call_tests++;
6573 des_unsigned_int(n_ch, ch, 0);
6574 xmlResetLastError();
6575 if (mem_base != xmlMemBlocks()) {
6576 printf("Leak of %d blocks found in xmlIsChar",
6577 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006578 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006579 printf(" %d", n_ch);
6580 printf("\n");
6581 }
6582 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006583 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006584
Daniel Veillard42595322004-11-08 10:52:06 +00006585 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006586}
6587
6588
6589static int
6590test_xmlIsCombining(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006591 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006592
Daniel Veillard3d97e662004-11-04 10:49:00 +00006593 int mem_base;
6594 int ret_val;
6595 unsigned int ch; /* character to validate */
6596 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006597
Daniel Veillard3d97e662004-11-04 10:49:00 +00006598 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6599 mem_base = xmlMemBlocks();
6600 ch = gen_unsigned_int(n_ch, 0);
6601
6602 ret_val = xmlIsCombining(ch);
6603 desret_int(ret_val);
6604 call_tests++;
6605 des_unsigned_int(n_ch, ch, 0);
6606 xmlResetLastError();
6607 if (mem_base != xmlMemBlocks()) {
6608 printf("Leak of %d blocks found in xmlIsCombining",
6609 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006610 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006611 printf(" %d", n_ch);
6612 printf("\n");
6613 }
6614 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006615 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006616
Daniel Veillard42595322004-11-08 10:52:06 +00006617 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006618}
6619
6620
6621static int
6622test_xmlIsDigit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006623 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006624
Daniel Veillard3d97e662004-11-04 10:49:00 +00006625 int mem_base;
6626 int ret_val;
6627 unsigned int ch; /* character to validate */
6628 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006629
Daniel Veillard3d97e662004-11-04 10:49:00 +00006630 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6631 mem_base = xmlMemBlocks();
6632 ch = gen_unsigned_int(n_ch, 0);
6633
6634 ret_val = xmlIsDigit(ch);
6635 desret_int(ret_val);
6636 call_tests++;
6637 des_unsigned_int(n_ch, ch, 0);
6638 xmlResetLastError();
6639 if (mem_base != xmlMemBlocks()) {
6640 printf("Leak of %d blocks found in xmlIsDigit",
6641 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006642 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006643 printf(" %d", n_ch);
6644 printf("\n");
6645 }
6646 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006647 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006648
Daniel Veillard42595322004-11-08 10:52:06 +00006649 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006650}
6651
6652
6653static int
6654test_xmlIsExtender(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006655 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006656
Daniel Veillard3d97e662004-11-04 10:49:00 +00006657 int mem_base;
6658 int ret_val;
6659 unsigned int ch; /* character to validate */
6660 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006661
Daniel Veillard3d97e662004-11-04 10:49:00 +00006662 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6663 mem_base = xmlMemBlocks();
6664 ch = gen_unsigned_int(n_ch, 0);
6665
6666 ret_val = xmlIsExtender(ch);
6667 desret_int(ret_val);
6668 call_tests++;
6669 des_unsigned_int(n_ch, ch, 0);
6670 xmlResetLastError();
6671 if (mem_base != xmlMemBlocks()) {
6672 printf("Leak of %d blocks found in xmlIsExtender",
6673 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006674 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006675 printf(" %d", n_ch);
6676 printf("\n");
6677 }
6678 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006679 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006680
Daniel Veillard42595322004-11-08 10:52:06 +00006681 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006682}
6683
6684
6685static int
6686test_xmlIsIdeographic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006687 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006688
Daniel Veillard3d97e662004-11-04 10:49:00 +00006689 int mem_base;
6690 int ret_val;
6691 unsigned int ch; /* character to validate */
6692 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006693
Daniel Veillard3d97e662004-11-04 10:49:00 +00006694 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6695 mem_base = xmlMemBlocks();
6696 ch = gen_unsigned_int(n_ch, 0);
6697
6698 ret_val = xmlIsIdeographic(ch);
6699 desret_int(ret_val);
6700 call_tests++;
6701 des_unsigned_int(n_ch, ch, 0);
6702 xmlResetLastError();
6703 if (mem_base != xmlMemBlocks()) {
6704 printf("Leak of %d blocks found in xmlIsIdeographic",
6705 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006706 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006707 printf(" %d", n_ch);
6708 printf("\n");
6709 }
6710 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006711 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006712
Daniel Veillard42595322004-11-08 10:52:06 +00006713 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006714}
6715
6716
6717static int
6718test_xmlIsPubidChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006719 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006720
Daniel Veillard3d97e662004-11-04 10:49:00 +00006721 int mem_base;
6722 int ret_val;
6723 unsigned int ch; /* character to validate */
6724 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006725
Daniel Veillard3d97e662004-11-04 10:49:00 +00006726 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6727 mem_base = xmlMemBlocks();
6728 ch = gen_unsigned_int(n_ch, 0);
6729
6730 ret_val = xmlIsPubidChar(ch);
6731 desret_int(ret_val);
6732 call_tests++;
6733 des_unsigned_int(n_ch, ch, 0);
6734 xmlResetLastError();
6735 if (mem_base != xmlMemBlocks()) {
6736 printf("Leak of %d blocks found in xmlIsPubidChar",
6737 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006738 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006739 printf(" %d", n_ch);
6740 printf("\n");
6741 }
6742 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006743 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006744
Daniel Veillard42595322004-11-08 10:52:06 +00006745 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006746}
6747
6748static int
6749test_chvalid(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006750 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006751
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006752 if (quiet == 0) printf("Testing chvalid : 9 of 9 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00006753 test_ret += test_xmlCharInRange();
6754 test_ret += test_xmlIsBaseChar();
6755 test_ret += test_xmlIsBlank();
6756 test_ret += test_xmlIsChar();
6757 test_ret += test_xmlIsCombining();
6758 test_ret += test_xmlIsDigit();
6759 test_ret += test_xmlIsExtender();
6760 test_ret += test_xmlIsIdeographic();
6761 test_ret += test_xmlIsPubidChar();
Daniel Veillardd93f6252004-11-02 15:53:51 +00006762
Daniel Veillard42595322004-11-08 10:52:06 +00006763 if (test_ret != 0)
6764 printf("Module chvalid: %d errors\n", test_ret);
6765 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006766}
6767
6768static int
Daniel Veillarda82b1822004-11-08 16:24:57 +00006769test_xmlBoolToText(void) {
6770 int test_ret = 0;
6771
William M. Brack21e4ef22005-01-02 09:53:13 +00006772#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00006773 int mem_base;
6774 const char * ret_val;
6775 int boolval; /* a bool to turn into text */
6776 int n_boolval;
6777
6778 for (n_boolval = 0;n_boolval < gen_nb_int;n_boolval++) {
6779 mem_base = xmlMemBlocks();
6780 boolval = gen_int(n_boolval, 0);
6781
6782 ret_val = xmlBoolToText(boolval);
6783 desret_const_char_ptr(ret_val);
6784 call_tests++;
6785 des_int(n_boolval, boolval, 0);
6786 xmlResetLastError();
6787 if (mem_base != xmlMemBlocks()) {
6788 printf("Leak of %d blocks found in xmlBoolToText",
6789 xmlMemBlocks() - mem_base);
6790 test_ret++;
6791 printf(" %d", n_boolval);
6792 printf("\n");
6793 }
6794 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006795 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00006796#endif
6797
Daniel Veillarda82b1822004-11-08 16:24:57 +00006798 return(test_ret);
6799}
6800
6801
6802static int
6803test_xmlDebugCheckDocument(void) {
6804 int test_ret = 0;
6805
William M. Brack21e4ef22005-01-02 09:53:13 +00006806#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00006807 int mem_base;
6808 int ret_val;
6809 FILE * output; /* the FILE * for the output */
6810 int n_output;
6811 xmlDocPtr doc; /* the document */
6812 int n_doc;
6813
6814 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
6815 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
6816 mem_base = xmlMemBlocks();
6817 output = gen_debug_FILE_ptr(n_output, 0);
6818 doc = gen_xmlDocPtr(n_doc, 1);
6819
6820 ret_val = xmlDebugCheckDocument(output, doc);
6821 desret_int(ret_val);
6822 call_tests++;
6823 des_debug_FILE_ptr(n_output, output, 0);
6824 des_xmlDocPtr(n_doc, doc, 1);
6825 xmlResetLastError();
6826 if (mem_base != xmlMemBlocks()) {
6827 printf("Leak of %d blocks found in xmlDebugCheckDocument",
6828 xmlMemBlocks() - mem_base);
6829 test_ret++;
6830 printf(" %d", n_output);
6831 printf(" %d", n_doc);
6832 printf("\n");
6833 }
6834 }
6835 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006836 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00006837#endif
6838
Daniel Veillarda82b1822004-11-08 16:24:57 +00006839 return(test_ret);
6840}
6841
6842
6843static int
6844test_xmlDebugDumpAttr(void) {
6845 int test_ret = 0;
6846
William M. Brack21e4ef22005-01-02 09:53:13 +00006847#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00006848 int mem_base;
6849 FILE * output; /* the FILE * for the output */
6850 int n_output;
6851 xmlAttrPtr attr; /* the attribute */
6852 int n_attr;
6853 int depth; /* the indentation level. */
6854 int n_depth;
6855
6856 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
6857 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
6858 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
6859 mem_base = xmlMemBlocks();
6860 output = gen_debug_FILE_ptr(n_output, 0);
6861 attr = gen_xmlAttrPtr(n_attr, 1);
6862 depth = gen_int(n_depth, 2);
6863
6864 xmlDebugDumpAttr(output, attr, depth);
6865 call_tests++;
6866 des_debug_FILE_ptr(n_output, output, 0);
6867 des_xmlAttrPtr(n_attr, attr, 1);
6868 des_int(n_depth, depth, 2);
6869 xmlResetLastError();
6870 if (mem_base != xmlMemBlocks()) {
6871 printf("Leak of %d blocks found in xmlDebugDumpAttr",
6872 xmlMemBlocks() - mem_base);
6873 test_ret++;
6874 printf(" %d", n_output);
6875 printf(" %d", n_attr);
6876 printf(" %d", n_depth);
6877 printf("\n");
6878 }
6879 }
6880 }
6881 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006882 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00006883#endif
6884
Daniel Veillarda82b1822004-11-08 16:24:57 +00006885 return(test_ret);
6886}
6887
6888
6889static int
6890test_xmlDebugDumpAttrList(void) {
6891 int test_ret = 0;
6892
William M. Brack21e4ef22005-01-02 09:53:13 +00006893#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00006894 int mem_base;
6895 FILE * output; /* the FILE * for the output */
6896 int n_output;
6897 xmlAttrPtr attr; /* the attribute list */
6898 int n_attr;
6899 int depth; /* the indentation level. */
6900 int n_depth;
6901
6902 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
6903 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
6904 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
6905 mem_base = xmlMemBlocks();
6906 output = gen_debug_FILE_ptr(n_output, 0);
6907 attr = gen_xmlAttrPtr(n_attr, 1);
6908 depth = gen_int(n_depth, 2);
6909
6910 xmlDebugDumpAttrList(output, attr, depth);
6911 call_tests++;
6912 des_debug_FILE_ptr(n_output, output, 0);
6913 des_xmlAttrPtr(n_attr, attr, 1);
6914 des_int(n_depth, depth, 2);
6915 xmlResetLastError();
6916 if (mem_base != xmlMemBlocks()) {
6917 printf("Leak of %d blocks found in xmlDebugDumpAttrList",
6918 xmlMemBlocks() - mem_base);
6919 test_ret++;
6920 printf(" %d", n_output);
6921 printf(" %d", n_attr);
6922 printf(" %d", n_depth);
6923 printf("\n");
6924 }
6925 }
6926 }
6927 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006928 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00006929#endif
6930
Daniel Veillarda82b1822004-11-08 16:24:57 +00006931 return(test_ret);
6932}
6933
6934
6935static int
6936test_xmlDebugDumpDTD(void) {
6937 int test_ret = 0;
6938
William M. Brack21e4ef22005-01-02 09:53:13 +00006939#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00006940 int mem_base;
6941 FILE * output; /* the FILE * for the output */
6942 int n_output;
6943 xmlDtdPtr dtd; /* the DTD */
6944 int n_dtd;
6945
6946 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
6947 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
6948 mem_base = xmlMemBlocks();
6949 output = gen_debug_FILE_ptr(n_output, 0);
6950 dtd = gen_xmlDtdPtr(n_dtd, 1);
6951
6952 xmlDebugDumpDTD(output, dtd);
6953 call_tests++;
6954 des_debug_FILE_ptr(n_output, output, 0);
6955 des_xmlDtdPtr(n_dtd, dtd, 1);
6956 xmlResetLastError();
6957 if (mem_base != xmlMemBlocks()) {
6958 printf("Leak of %d blocks found in xmlDebugDumpDTD",
6959 xmlMemBlocks() - mem_base);
6960 test_ret++;
6961 printf(" %d", n_output);
6962 printf(" %d", n_dtd);
6963 printf("\n");
6964 }
6965 }
6966 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006967 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00006968#endif
6969
Daniel Veillarda82b1822004-11-08 16:24:57 +00006970 return(test_ret);
6971}
6972
6973
6974static int
6975test_xmlDebugDumpDocument(void) {
6976 int test_ret = 0;
6977
William M. Brack21e4ef22005-01-02 09:53:13 +00006978#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00006979 int mem_base;
6980 FILE * output; /* the FILE * for the output */
6981 int n_output;
6982 xmlDocPtr doc; /* the document */
6983 int n_doc;
6984
6985 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
6986 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
6987 mem_base = xmlMemBlocks();
6988 output = gen_debug_FILE_ptr(n_output, 0);
6989 doc = gen_xmlDocPtr(n_doc, 1);
6990
6991 xmlDebugDumpDocument(output, doc);
6992 call_tests++;
6993 des_debug_FILE_ptr(n_output, output, 0);
6994 des_xmlDocPtr(n_doc, doc, 1);
6995 xmlResetLastError();
6996 if (mem_base != xmlMemBlocks()) {
6997 printf("Leak of %d blocks found in xmlDebugDumpDocument",
6998 xmlMemBlocks() - mem_base);
6999 test_ret++;
7000 printf(" %d", n_output);
7001 printf(" %d", n_doc);
7002 printf("\n");
7003 }
7004 }
7005 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007006 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007007#endif
7008
Daniel Veillarda82b1822004-11-08 16:24:57 +00007009 return(test_ret);
7010}
7011
7012
7013static int
7014test_xmlDebugDumpDocumentHead(void) {
7015 int test_ret = 0;
7016
William M. Brack21e4ef22005-01-02 09:53:13 +00007017#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007018 int mem_base;
7019 FILE * output; /* the FILE * for the output */
7020 int n_output;
7021 xmlDocPtr doc; /* the document */
7022 int n_doc;
7023
7024 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7025 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
7026 mem_base = xmlMemBlocks();
7027 output = gen_debug_FILE_ptr(n_output, 0);
7028 doc = gen_xmlDocPtr(n_doc, 1);
7029
7030 xmlDebugDumpDocumentHead(output, doc);
7031 call_tests++;
7032 des_debug_FILE_ptr(n_output, output, 0);
7033 des_xmlDocPtr(n_doc, doc, 1);
7034 xmlResetLastError();
7035 if (mem_base != xmlMemBlocks()) {
7036 printf("Leak of %d blocks found in xmlDebugDumpDocumentHead",
7037 xmlMemBlocks() - mem_base);
7038 test_ret++;
7039 printf(" %d", n_output);
7040 printf(" %d", n_doc);
7041 printf("\n");
7042 }
7043 }
7044 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007045 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007046#endif
7047
Daniel Veillarda82b1822004-11-08 16:24:57 +00007048 return(test_ret);
7049}
7050
7051
7052static int
7053test_xmlDebugDumpEntities(void) {
7054 int test_ret = 0;
7055
William M. Brack21e4ef22005-01-02 09:53:13 +00007056#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007057 int mem_base;
7058 FILE * output; /* the FILE * for the output */
7059 int n_output;
7060 xmlDocPtr doc; /* the document */
7061 int n_doc;
7062
7063 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7064 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
7065 mem_base = xmlMemBlocks();
7066 output = gen_debug_FILE_ptr(n_output, 0);
7067 doc = gen_xmlDocPtr(n_doc, 1);
7068
7069 xmlDebugDumpEntities(output, doc);
7070 call_tests++;
7071 des_debug_FILE_ptr(n_output, output, 0);
7072 des_xmlDocPtr(n_doc, doc, 1);
7073 xmlResetLastError();
7074 if (mem_base != xmlMemBlocks()) {
7075 printf("Leak of %d blocks found in xmlDebugDumpEntities",
7076 xmlMemBlocks() - mem_base);
7077 test_ret++;
7078 printf(" %d", n_output);
7079 printf(" %d", n_doc);
7080 printf("\n");
7081 }
7082 }
7083 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007084 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007085#endif
7086
Daniel Veillarda82b1822004-11-08 16:24:57 +00007087 return(test_ret);
7088}
7089
7090
7091static int
7092test_xmlDebugDumpNode(void) {
7093 int test_ret = 0;
7094
William M. Brack21e4ef22005-01-02 09:53:13 +00007095#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007096 int mem_base;
7097 FILE * output; /* the FILE * for the output */
7098 int n_output;
7099 xmlNodePtr node; /* the node */
7100 int n_node;
7101 int depth; /* the indentation level. */
7102 int n_depth;
7103
7104 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7105 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7106 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
7107 mem_base = xmlMemBlocks();
7108 output = gen_debug_FILE_ptr(n_output, 0);
7109 node = gen_xmlNodePtr(n_node, 1);
7110 depth = gen_int(n_depth, 2);
7111
7112 xmlDebugDumpNode(output, node, depth);
7113 call_tests++;
7114 des_debug_FILE_ptr(n_output, output, 0);
7115 des_xmlNodePtr(n_node, node, 1);
7116 des_int(n_depth, depth, 2);
7117 xmlResetLastError();
7118 if (mem_base != xmlMemBlocks()) {
7119 printf("Leak of %d blocks found in xmlDebugDumpNode",
7120 xmlMemBlocks() - mem_base);
7121 test_ret++;
7122 printf(" %d", n_output);
7123 printf(" %d", n_node);
7124 printf(" %d", n_depth);
7125 printf("\n");
7126 }
7127 }
7128 }
7129 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007130 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007131#endif
7132
Daniel Veillarda82b1822004-11-08 16:24:57 +00007133 return(test_ret);
7134}
7135
7136
7137static int
7138test_xmlDebugDumpNodeList(void) {
7139 int test_ret = 0;
7140
William M. Brack21e4ef22005-01-02 09:53:13 +00007141#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007142 int mem_base;
7143 FILE * output; /* the FILE * for the output */
7144 int n_output;
7145 xmlNodePtr node; /* the node list */
7146 int n_node;
7147 int depth; /* the indentation level. */
7148 int n_depth;
7149
7150 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7151 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7152 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
7153 mem_base = xmlMemBlocks();
7154 output = gen_debug_FILE_ptr(n_output, 0);
7155 node = gen_xmlNodePtr(n_node, 1);
7156 depth = gen_int(n_depth, 2);
7157
7158 xmlDebugDumpNodeList(output, node, depth);
7159 call_tests++;
7160 des_debug_FILE_ptr(n_output, output, 0);
7161 des_xmlNodePtr(n_node, node, 1);
7162 des_int(n_depth, depth, 2);
7163 xmlResetLastError();
7164 if (mem_base != xmlMemBlocks()) {
7165 printf("Leak of %d blocks found in xmlDebugDumpNodeList",
7166 xmlMemBlocks() - mem_base);
7167 test_ret++;
7168 printf(" %d", n_output);
7169 printf(" %d", n_node);
7170 printf(" %d", n_depth);
7171 printf("\n");
7172 }
7173 }
7174 }
7175 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007176 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007177#endif
7178
Daniel Veillarda82b1822004-11-08 16:24:57 +00007179 return(test_ret);
7180}
7181
7182
7183static int
7184test_xmlDebugDumpOneNode(void) {
7185 int test_ret = 0;
7186
William M. Brack21e4ef22005-01-02 09:53:13 +00007187#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007188 int mem_base;
7189 FILE * output; /* the FILE * for the output */
7190 int n_output;
7191 xmlNodePtr node; /* the node */
7192 int n_node;
7193 int depth; /* the indentation level. */
7194 int n_depth;
7195
7196 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7197 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7198 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
7199 mem_base = xmlMemBlocks();
7200 output = gen_debug_FILE_ptr(n_output, 0);
7201 node = gen_xmlNodePtr(n_node, 1);
7202 depth = gen_int(n_depth, 2);
7203
7204 xmlDebugDumpOneNode(output, node, depth);
7205 call_tests++;
7206 des_debug_FILE_ptr(n_output, output, 0);
7207 des_xmlNodePtr(n_node, node, 1);
7208 des_int(n_depth, depth, 2);
7209 xmlResetLastError();
7210 if (mem_base != xmlMemBlocks()) {
7211 printf("Leak of %d blocks found in xmlDebugDumpOneNode",
7212 xmlMemBlocks() - mem_base);
7213 test_ret++;
7214 printf(" %d", n_output);
7215 printf(" %d", n_node);
7216 printf(" %d", n_depth);
7217 printf("\n");
7218 }
7219 }
7220 }
7221 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007222 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007223#endif
7224
Daniel Veillarda82b1822004-11-08 16:24:57 +00007225 return(test_ret);
7226}
7227
7228
7229static int
7230test_xmlDebugDumpString(void) {
7231 int test_ret = 0;
7232
William M. Brack21e4ef22005-01-02 09:53:13 +00007233#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007234 int mem_base;
7235 FILE * output; /* the FILE * for the output */
7236 int n_output;
7237 xmlChar * str; /* the string */
7238 int n_str;
7239
7240 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7241 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
7242 mem_base = xmlMemBlocks();
7243 output = gen_debug_FILE_ptr(n_output, 0);
7244 str = gen_const_xmlChar_ptr(n_str, 1);
7245
William M. Brackf13f77f2004-11-12 16:03:48 +00007246 xmlDebugDumpString(output, (const xmlChar *)str);
Daniel Veillarda82b1822004-11-08 16:24:57 +00007247 call_tests++;
7248 des_debug_FILE_ptr(n_output, output, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00007249 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +00007250 xmlResetLastError();
7251 if (mem_base != xmlMemBlocks()) {
7252 printf("Leak of %d blocks found in xmlDebugDumpString",
7253 xmlMemBlocks() - mem_base);
7254 test_ret++;
7255 printf(" %d", n_output);
7256 printf(" %d", n_str);
7257 printf("\n");
7258 }
7259 }
7260 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007261 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007262#endif
7263
Daniel Veillarda82b1822004-11-08 16:24:57 +00007264 return(test_ret);
7265}
7266
7267
7268static int
7269test_xmlLsCountNode(void) {
7270 int test_ret = 0;
7271
William M. Brack21e4ef22005-01-02 09:53:13 +00007272#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007273 int mem_base;
7274 int ret_val;
7275 xmlNodePtr node; /* the node to count */
7276 int n_node;
7277
7278 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7279 mem_base = xmlMemBlocks();
7280 node = gen_xmlNodePtr(n_node, 0);
7281
7282 ret_val = xmlLsCountNode(node);
7283 desret_int(ret_val);
7284 call_tests++;
7285 des_xmlNodePtr(n_node, node, 0);
7286 xmlResetLastError();
7287 if (mem_base != xmlMemBlocks()) {
7288 printf("Leak of %d blocks found in xmlLsCountNode",
7289 xmlMemBlocks() - mem_base);
7290 test_ret++;
7291 printf(" %d", n_node);
7292 printf("\n");
7293 }
7294 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007295 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007296#endif
7297
Daniel Veillarda82b1822004-11-08 16:24:57 +00007298 return(test_ret);
7299}
7300
7301
7302static int
7303test_xmlLsOneNode(void) {
7304 int test_ret = 0;
7305
William M. Brack21e4ef22005-01-02 09:53:13 +00007306#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007307 int mem_base;
7308 FILE * output; /* the FILE * for the output */
7309 int n_output;
7310 xmlNodePtr node; /* the node to dump */
7311 int n_node;
7312
7313 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7314 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7315 mem_base = xmlMemBlocks();
7316 output = gen_debug_FILE_ptr(n_output, 0);
7317 node = gen_xmlNodePtr(n_node, 1);
7318
7319 xmlLsOneNode(output, node);
7320 call_tests++;
7321 des_debug_FILE_ptr(n_output, output, 0);
7322 des_xmlNodePtr(n_node, node, 1);
7323 xmlResetLastError();
7324 if (mem_base != xmlMemBlocks()) {
7325 printf("Leak of %d blocks found in xmlLsOneNode",
7326 xmlMemBlocks() - mem_base);
7327 test_ret++;
7328 printf(" %d", n_output);
7329 printf(" %d", n_node);
7330 printf("\n");
7331 }
7332 }
7333 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007334 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007335#endif
7336
Daniel Veillarda82b1822004-11-08 16:24:57 +00007337 return(test_ret);
7338}
7339
7340
7341#define gen_nb_char_ptr 1
7342static char * gen_char_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
7343 return(NULL);
7344}
7345static void des_char_ptr(int no ATTRIBUTE_UNUSED, char * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
7346}
7347
7348static int
7349test_xmlShell(void) {
7350 int test_ret = 0;
7351
7352
7353 /* missing type support */
7354 return(test_ret);
7355}
7356
7357
Daniel Veillarda82b1822004-11-08 16:24:57 +00007358static int
7359test_xmlShellBase(void) {
7360 int test_ret = 0;
7361
William M. Brack21e4ef22005-01-02 09:53:13 +00007362#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007363 int mem_base;
7364 int ret_val;
7365 xmlShellCtxtPtr ctxt; /* the shell context */
7366 int n_ctxt;
7367 char * arg; /* unused */
7368 int n_arg;
7369 xmlNodePtr node; /* a node */
7370 int n_node;
7371 xmlNodePtr node2; /* unused */
7372 int n_node2;
7373
7374 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7375 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7376 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7377 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7378 mem_base = xmlMemBlocks();
7379 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7380 arg = gen_char_ptr(n_arg, 1);
7381 node = gen_xmlNodePtr(n_node, 2);
7382 node2 = gen_xmlNodePtr(n_node2, 3);
7383
7384 ret_val = xmlShellBase(ctxt, arg, node, node2);
7385 desret_int(ret_val);
7386 call_tests++;
7387 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7388 des_char_ptr(n_arg, arg, 1);
7389 des_xmlNodePtr(n_node, node, 2);
7390 des_xmlNodePtr(n_node2, node2, 3);
7391 xmlResetLastError();
7392 if (mem_base != xmlMemBlocks()) {
7393 printf("Leak of %d blocks found in xmlShellBase",
7394 xmlMemBlocks() - mem_base);
7395 test_ret++;
7396 printf(" %d", n_ctxt);
7397 printf(" %d", n_arg);
7398 printf(" %d", n_node);
7399 printf(" %d", n_node2);
7400 printf("\n");
7401 }
7402 }
7403 }
7404 }
7405 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007406 function_tests++;
7407#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007408
Daniel Veillarda82b1822004-11-08 16:24:57 +00007409 return(test_ret);
7410}
7411
7412
7413static int
7414test_xmlShellCat(void) {
7415 int test_ret = 0;
7416
William M. Brack21e4ef22005-01-02 09:53:13 +00007417#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007418 int mem_base;
7419 int ret_val;
7420 xmlShellCtxtPtr ctxt; /* the shell context */
7421 int n_ctxt;
7422 char * arg; /* unused */
7423 int n_arg;
7424 xmlNodePtr node; /* a node */
7425 int n_node;
7426 xmlNodePtr node2; /* unused */
7427 int n_node2;
7428
7429 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7430 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7431 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7432 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7433 mem_base = xmlMemBlocks();
7434 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7435 arg = gen_char_ptr(n_arg, 1);
7436 node = gen_xmlNodePtr(n_node, 2);
7437 node2 = gen_xmlNodePtr(n_node2, 3);
7438
7439 ret_val = xmlShellCat(ctxt, arg, node, node2);
7440 desret_int(ret_val);
7441 call_tests++;
7442 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7443 des_char_ptr(n_arg, arg, 1);
7444 des_xmlNodePtr(n_node, node, 2);
7445 des_xmlNodePtr(n_node2, node2, 3);
7446 xmlResetLastError();
7447 if (mem_base != xmlMemBlocks()) {
7448 printf("Leak of %d blocks found in xmlShellCat",
7449 xmlMemBlocks() - mem_base);
7450 test_ret++;
7451 printf(" %d", n_ctxt);
7452 printf(" %d", n_arg);
7453 printf(" %d", n_node);
7454 printf(" %d", n_node2);
7455 printf("\n");
7456 }
7457 }
7458 }
7459 }
7460 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007461 function_tests++;
7462#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007463
Daniel Veillarda82b1822004-11-08 16:24:57 +00007464 return(test_ret);
7465}
7466
7467
7468static int
7469test_xmlShellDir(void) {
7470 int test_ret = 0;
7471
William M. Brack21e4ef22005-01-02 09:53:13 +00007472#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007473 int mem_base;
7474 int ret_val;
7475 xmlShellCtxtPtr ctxt; /* the shell context */
7476 int n_ctxt;
7477 char * arg; /* unused */
7478 int n_arg;
7479 xmlNodePtr node; /* a node */
7480 int n_node;
7481 xmlNodePtr node2; /* unused */
7482 int n_node2;
7483
7484 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7485 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7486 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7487 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7488 mem_base = xmlMemBlocks();
7489 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7490 arg = gen_char_ptr(n_arg, 1);
7491 node = gen_xmlNodePtr(n_node, 2);
7492 node2 = gen_xmlNodePtr(n_node2, 3);
7493
7494 ret_val = xmlShellDir(ctxt, arg, node, node2);
7495 desret_int(ret_val);
7496 call_tests++;
7497 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7498 des_char_ptr(n_arg, arg, 1);
7499 des_xmlNodePtr(n_node, node, 2);
7500 des_xmlNodePtr(n_node2, node2, 3);
7501 xmlResetLastError();
7502 if (mem_base != xmlMemBlocks()) {
7503 printf("Leak of %d blocks found in xmlShellDir",
7504 xmlMemBlocks() - mem_base);
7505 test_ret++;
7506 printf(" %d", n_ctxt);
7507 printf(" %d", n_arg);
7508 printf(" %d", n_node);
7509 printf(" %d", n_node2);
7510 printf("\n");
7511 }
7512 }
7513 }
7514 }
7515 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007516 function_tests++;
7517#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007518
Daniel Veillarda82b1822004-11-08 16:24:57 +00007519 return(test_ret);
7520}
7521
7522
7523static int
7524test_xmlShellDu(void) {
7525 int test_ret = 0;
7526
William M. Brack21e4ef22005-01-02 09:53:13 +00007527#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007528 int mem_base;
7529 int ret_val;
7530 xmlShellCtxtPtr ctxt; /* the shell context */
7531 int n_ctxt;
7532 char * arg; /* unused */
7533 int n_arg;
7534 xmlNodePtr tree; /* a node defining a subtree */
7535 int n_tree;
7536 xmlNodePtr node2; /* unused */
7537 int n_node2;
7538
7539 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7540 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7541 for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) {
7542 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7543 mem_base = xmlMemBlocks();
7544 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7545 arg = gen_char_ptr(n_arg, 1);
7546 tree = gen_xmlNodePtr(n_tree, 2);
7547 node2 = gen_xmlNodePtr(n_node2, 3);
7548
7549 ret_val = xmlShellDu(ctxt, arg, tree, node2);
7550 desret_int(ret_val);
7551 call_tests++;
7552 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7553 des_char_ptr(n_arg, arg, 1);
7554 des_xmlNodePtr(n_tree, tree, 2);
7555 des_xmlNodePtr(n_node2, node2, 3);
7556 xmlResetLastError();
7557 if (mem_base != xmlMemBlocks()) {
7558 printf("Leak of %d blocks found in xmlShellDu",
7559 xmlMemBlocks() - mem_base);
7560 test_ret++;
7561 printf(" %d", n_ctxt);
7562 printf(" %d", n_arg);
7563 printf(" %d", n_tree);
7564 printf(" %d", n_node2);
7565 printf("\n");
7566 }
7567 }
7568 }
7569 }
7570 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007571 function_tests++;
7572#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007573
Daniel Veillarda82b1822004-11-08 16:24:57 +00007574 return(test_ret);
7575}
7576
7577
7578static int
7579test_xmlShellList(void) {
7580 int test_ret = 0;
7581
William M. Brack21e4ef22005-01-02 09:53:13 +00007582#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007583 int mem_base;
7584 int ret_val;
7585 xmlShellCtxtPtr ctxt; /* the shell context */
7586 int n_ctxt;
7587 char * arg; /* unused */
7588 int n_arg;
7589 xmlNodePtr node; /* a node */
7590 int n_node;
7591 xmlNodePtr node2; /* unused */
7592 int n_node2;
7593
7594 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7595 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7596 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7597 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7598 mem_base = xmlMemBlocks();
7599 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7600 arg = gen_char_ptr(n_arg, 1);
7601 node = gen_xmlNodePtr(n_node, 2);
7602 node2 = gen_xmlNodePtr(n_node2, 3);
7603
7604 ret_val = xmlShellList(ctxt, arg, node, node2);
7605 desret_int(ret_val);
7606 call_tests++;
7607 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7608 des_char_ptr(n_arg, arg, 1);
7609 des_xmlNodePtr(n_node, node, 2);
7610 des_xmlNodePtr(n_node2, node2, 3);
7611 xmlResetLastError();
7612 if (mem_base != xmlMemBlocks()) {
7613 printf("Leak of %d blocks found in xmlShellList",
7614 xmlMemBlocks() - mem_base);
7615 test_ret++;
7616 printf(" %d", n_ctxt);
7617 printf(" %d", n_arg);
7618 printf(" %d", n_node);
7619 printf(" %d", n_node2);
7620 printf("\n");
7621 }
7622 }
7623 }
7624 }
7625 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007626 function_tests++;
7627#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007628
Daniel Veillarda82b1822004-11-08 16:24:57 +00007629 return(test_ret);
7630}
7631
7632
7633static int
7634test_xmlShellLoad(void) {
7635 int test_ret = 0;
7636
William M. Brack21e4ef22005-01-02 09:53:13 +00007637#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007638 int mem_base;
7639 int ret_val;
7640 xmlShellCtxtPtr ctxt; /* the shell context */
7641 int n_ctxt;
7642 char * filename; /* the file name */
7643 int n_filename;
7644 xmlNodePtr node; /* unused */
7645 int n_node;
7646 xmlNodePtr node2; /* unused */
7647 int n_node2;
7648
7649 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7650 for (n_filename = 0;n_filename < gen_nb_char_ptr;n_filename++) {
7651 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7652 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7653 mem_base = xmlMemBlocks();
7654 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7655 filename = gen_char_ptr(n_filename, 1);
7656 node = gen_xmlNodePtr(n_node, 2);
7657 node2 = gen_xmlNodePtr(n_node2, 3);
7658
7659 ret_val = xmlShellLoad(ctxt, filename, node, node2);
7660 desret_int(ret_val);
7661 call_tests++;
7662 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7663 des_char_ptr(n_filename, filename, 1);
7664 des_xmlNodePtr(n_node, node, 2);
7665 des_xmlNodePtr(n_node2, node2, 3);
7666 xmlResetLastError();
7667 if (mem_base != xmlMemBlocks()) {
7668 printf("Leak of %d blocks found in xmlShellLoad",
7669 xmlMemBlocks() - mem_base);
7670 test_ret++;
7671 printf(" %d", n_ctxt);
7672 printf(" %d", n_filename);
7673 printf(" %d", n_node);
7674 printf(" %d", n_node2);
7675 printf("\n");
7676 }
7677 }
7678 }
7679 }
7680 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007681 function_tests++;
7682#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007683
Daniel Veillarda82b1822004-11-08 16:24:57 +00007684 return(test_ret);
7685}
7686
7687
7688static int
7689test_xmlShellPrintXPathResult(void) {
7690 int test_ret = 0;
7691
William M. Brack21e4ef22005-01-02 09:53:13 +00007692#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007693 int mem_base;
7694 xmlXPathObjectPtr list; /* a valid result generated by an xpath evaluation */
7695 int n_list;
7696
7697 for (n_list = 0;n_list < gen_nb_xmlXPathObjectPtr;n_list++) {
7698 mem_base = xmlMemBlocks();
7699 list = gen_xmlXPathObjectPtr(n_list, 0);
7700
7701 xmlShellPrintXPathResult(list);
7702 call_tests++;
7703 des_xmlXPathObjectPtr(n_list, list, 0);
7704 xmlResetLastError();
7705 if (mem_base != xmlMemBlocks()) {
7706 printf("Leak of %d blocks found in xmlShellPrintXPathResult",
7707 xmlMemBlocks() - mem_base);
7708 test_ret++;
7709 printf(" %d", n_list);
7710 printf("\n");
7711 }
7712 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007713 function_tests++;
7714#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007715
Daniel Veillarda82b1822004-11-08 16:24:57 +00007716 return(test_ret);
7717}
7718
7719
7720static int
7721test_xmlShellPwd(void) {
7722 int test_ret = 0;
7723
William M. Brack21e4ef22005-01-02 09:53:13 +00007724#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007725 int mem_base;
7726 int ret_val;
7727 xmlShellCtxtPtr ctxt; /* the shell context */
7728 int n_ctxt;
7729 char * buffer; /* the output buffer */
7730 int n_buffer;
7731 xmlNodePtr node; /* a node */
7732 int n_node;
7733 xmlNodePtr node2; /* unused */
7734 int n_node2;
7735
7736 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7737 for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) {
7738 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7739 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7740 mem_base = xmlMemBlocks();
7741 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7742 buffer = gen_char_ptr(n_buffer, 1);
7743 node = gen_xmlNodePtr(n_node, 2);
7744 node2 = gen_xmlNodePtr(n_node2, 3);
7745
7746 ret_val = xmlShellPwd(ctxt, buffer, node, node2);
7747 desret_int(ret_val);
7748 call_tests++;
7749 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7750 des_char_ptr(n_buffer, buffer, 1);
7751 des_xmlNodePtr(n_node, node, 2);
7752 des_xmlNodePtr(n_node2, node2, 3);
7753 xmlResetLastError();
7754 if (mem_base != xmlMemBlocks()) {
7755 printf("Leak of %d blocks found in xmlShellPwd",
7756 xmlMemBlocks() - mem_base);
7757 test_ret++;
7758 printf(" %d", n_ctxt);
7759 printf(" %d", n_buffer);
7760 printf(" %d", n_node);
7761 printf(" %d", n_node2);
7762 printf("\n");
7763 }
7764 }
7765 }
7766 }
7767 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007768 function_tests++;
7769#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007770
Daniel Veillarda82b1822004-11-08 16:24:57 +00007771 return(test_ret);
7772}
7773
7774
7775static int
7776test_xmlShellSave(void) {
7777 int test_ret = 0;
7778
William M. Brack21e4ef22005-01-02 09:53:13 +00007779#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007780 int mem_base;
7781 int ret_val;
7782 xmlShellCtxtPtr ctxt; /* the shell context */
7783 int n_ctxt;
7784 char * filename; /* the file name (optional) */
7785 int n_filename;
7786 xmlNodePtr node; /* unused */
7787 int n_node;
7788 xmlNodePtr node2; /* unused */
7789 int n_node2;
7790
7791 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7792 for (n_filename = 0;n_filename < gen_nb_char_ptr;n_filename++) {
7793 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7794 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7795 mem_base = xmlMemBlocks();
7796 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7797 filename = gen_char_ptr(n_filename, 1);
7798 node = gen_xmlNodePtr(n_node, 2);
7799 node2 = gen_xmlNodePtr(n_node2, 3);
7800
7801 ret_val = xmlShellSave(ctxt, filename, node, node2);
7802 desret_int(ret_val);
7803 call_tests++;
7804 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7805 des_char_ptr(n_filename, filename, 1);
7806 des_xmlNodePtr(n_node, node, 2);
7807 des_xmlNodePtr(n_node2, node2, 3);
7808 xmlResetLastError();
7809 if (mem_base != xmlMemBlocks()) {
7810 printf("Leak of %d blocks found in xmlShellSave",
7811 xmlMemBlocks() - mem_base);
7812 test_ret++;
7813 printf(" %d", n_ctxt);
7814 printf(" %d", n_filename);
7815 printf(" %d", n_node);
7816 printf(" %d", n_node2);
7817 printf("\n");
7818 }
7819 }
7820 }
7821 }
7822 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007823 function_tests++;
7824#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007825
Daniel Veillarda82b1822004-11-08 16:24:57 +00007826 return(test_ret);
7827}
7828
7829
7830static int
7831test_xmlShellValidate(void) {
7832 int test_ret = 0;
7833
William M. Brack21e4ef22005-01-02 09:53:13 +00007834#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_VALID_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007835 int mem_base;
7836 int ret_val;
7837 xmlShellCtxtPtr ctxt; /* the shell context */
7838 int n_ctxt;
7839 char * dtd; /* the DTD URI (optional) */
7840 int n_dtd;
7841 xmlNodePtr node; /* unused */
7842 int n_node;
7843 xmlNodePtr node2; /* unused */
7844 int n_node2;
7845
7846 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7847 for (n_dtd = 0;n_dtd < gen_nb_char_ptr;n_dtd++) {
7848 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7849 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7850 mem_base = xmlMemBlocks();
7851 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7852 dtd = gen_char_ptr(n_dtd, 1);
7853 node = gen_xmlNodePtr(n_node, 2);
7854 node2 = gen_xmlNodePtr(n_node2, 3);
7855
7856 ret_val = xmlShellValidate(ctxt, dtd, node, node2);
7857 desret_int(ret_val);
7858 call_tests++;
7859 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7860 des_char_ptr(n_dtd, dtd, 1);
7861 des_xmlNodePtr(n_node, node, 2);
7862 des_xmlNodePtr(n_node2, node2, 3);
7863 xmlResetLastError();
7864 if (mem_base != xmlMemBlocks()) {
7865 printf("Leak of %d blocks found in xmlShellValidate",
7866 xmlMemBlocks() - mem_base);
7867 test_ret++;
7868 printf(" %d", n_ctxt);
7869 printf(" %d", n_dtd);
7870 printf(" %d", n_node);
7871 printf(" %d", n_node2);
7872 printf("\n");
7873 }
7874 }
7875 }
7876 }
7877 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007878 function_tests++;
7879#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007880
Daniel Veillarda82b1822004-11-08 16:24:57 +00007881 return(test_ret);
7882}
7883
7884
7885static int
7886test_xmlShellWrite(void) {
7887 int test_ret = 0;
7888
William M. Brack21e4ef22005-01-02 09:53:13 +00007889#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007890 int mem_base;
7891 int ret_val;
7892 xmlShellCtxtPtr ctxt; /* the shell context */
7893 int n_ctxt;
7894 char * filename; /* the file name */
7895 int n_filename;
7896 xmlNodePtr node; /* a node in the tree */
7897 int n_node;
7898 xmlNodePtr node2; /* unused */
7899 int n_node2;
7900
7901 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7902 for (n_filename = 0;n_filename < gen_nb_char_ptr;n_filename++) {
7903 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7904 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7905 mem_base = xmlMemBlocks();
7906 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7907 filename = gen_char_ptr(n_filename, 1);
7908 node = gen_xmlNodePtr(n_node, 2);
7909 node2 = gen_xmlNodePtr(n_node2, 3);
7910
7911 ret_val = xmlShellWrite(ctxt, filename, node, node2);
7912 desret_int(ret_val);
7913 call_tests++;
7914 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7915 des_char_ptr(n_filename, filename, 1);
7916 des_xmlNodePtr(n_node, node, 2);
7917 des_xmlNodePtr(n_node2, node2, 3);
7918 xmlResetLastError();
7919 if (mem_base != xmlMemBlocks()) {
7920 printf("Leak of %d blocks found in xmlShellWrite",
7921 xmlMemBlocks() - mem_base);
7922 test_ret++;
7923 printf(" %d", n_ctxt);
7924 printf(" %d", n_filename);
7925 printf(" %d", n_node);
7926 printf(" %d", n_node2);
7927 printf("\n");
7928 }
7929 }
7930 }
7931 }
7932 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007933 function_tests++;
7934#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007935
Daniel Veillarda82b1822004-11-08 16:24:57 +00007936 return(test_ret);
7937}
7938
7939static int
7940test_debugXML(void) {
7941 int test_ret = 0;
7942
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007943 if (quiet == 0) printf("Testing debugXML : 25 of 28 functions ...\n");
Daniel Veillarda82b1822004-11-08 16:24:57 +00007944 test_ret += test_xmlBoolToText();
7945 test_ret += test_xmlDebugCheckDocument();
7946 test_ret += test_xmlDebugDumpAttr();
7947 test_ret += test_xmlDebugDumpAttrList();
7948 test_ret += test_xmlDebugDumpDTD();
7949 test_ret += test_xmlDebugDumpDocument();
7950 test_ret += test_xmlDebugDumpDocumentHead();
7951 test_ret += test_xmlDebugDumpEntities();
7952 test_ret += test_xmlDebugDumpNode();
7953 test_ret += test_xmlDebugDumpNodeList();
7954 test_ret += test_xmlDebugDumpOneNode();
7955 test_ret += test_xmlDebugDumpString();
7956 test_ret += test_xmlLsCountNode();
7957 test_ret += test_xmlLsOneNode();
7958 test_ret += test_xmlShell();
7959 test_ret += test_xmlShellBase();
7960 test_ret += test_xmlShellCat();
7961 test_ret += test_xmlShellDir();
7962 test_ret += test_xmlShellDu();
7963 test_ret += test_xmlShellList();
7964 test_ret += test_xmlShellLoad();
7965 test_ret += test_xmlShellPrintXPathResult();
7966 test_ret += test_xmlShellPwd();
7967 test_ret += test_xmlShellSave();
7968 test_ret += test_xmlShellValidate();
7969 test_ret += test_xmlShellWrite();
7970
7971 if (test_ret != 0)
7972 printf("Module debugXML: %d errors\n", test_ret);
7973 return(test_ret);
7974}
7975
7976static int
Daniel Veillard2ae13382005-01-25 23:45:06 +00007977test_xmlDictCleanup(void) {
7978 int test_ret = 0;
7979
7980 int mem_base;
7981
7982 mem_base = xmlMemBlocks();
7983
7984 xmlDictCleanup();
7985 call_tests++;
7986 xmlResetLastError();
7987 if (mem_base != xmlMemBlocks()) {
7988 printf("Leak of %d blocks found in xmlDictCleanup",
7989 xmlMemBlocks() - mem_base);
7990 test_ret++;
7991 printf("\n");
7992 }
7993 function_tests++;
7994
7995 return(test_ret);
7996}
7997
7998
7999static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00008000test_xmlDictCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008001 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008002
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008003 int mem_base;
8004 xmlDictPtr ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008005
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008006 mem_base = xmlMemBlocks();
8007
8008 ret_val = xmlDictCreate();
8009 desret_xmlDictPtr(ret_val);
8010 call_tests++;
8011 xmlResetLastError();
8012 if (mem_base != xmlMemBlocks()) {
8013 printf("Leak of %d blocks found in xmlDictCreate",
8014 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008015 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008016 printf("\n");
8017 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008018 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008019
Daniel Veillard42595322004-11-08 10:52:06 +00008020 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008021}
8022
8023
8024static int
8025test_xmlDictCreateSub(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008026 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008027
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008028 int mem_base;
8029 xmlDictPtr ret_val;
8030 xmlDictPtr sub; /* an existing dictionnary */
8031 int n_sub;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008032
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008033 for (n_sub = 0;n_sub < gen_nb_xmlDictPtr;n_sub++) {
8034 mem_base = xmlMemBlocks();
8035 sub = gen_xmlDictPtr(n_sub, 0);
8036
8037 ret_val = xmlDictCreateSub(sub);
8038 desret_xmlDictPtr(ret_val);
8039 call_tests++;
8040 des_xmlDictPtr(n_sub, sub, 0);
8041 xmlResetLastError();
8042 if (mem_base != xmlMemBlocks()) {
8043 printf("Leak of %d blocks found in xmlDictCreateSub",
8044 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008045 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008046 printf(" %d", n_sub);
8047 printf("\n");
8048 }
8049 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008050 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008051
Daniel Veillard42595322004-11-08 10:52:06 +00008052 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008053}
8054
8055
8056static int
Daniel Veillard91b955c2004-12-10 10:26:42 +00008057test_xmlDictExists(void) {
8058 int test_ret = 0;
8059
8060 int mem_base;
8061 const xmlChar * ret_val;
8062 xmlDictPtr dict; /* the dictionnary */
8063 int n_dict;
8064 xmlChar * name; /* the name of the userdata */
8065 int n_name;
8066 int len; /* the length of the name, if -1 it is recomputed */
8067 int n_len;
8068
8069 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8070 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
8071 for (n_len = 0;n_len < gen_nb_int;n_len++) {
8072 mem_base = xmlMemBlocks();
8073 dict = gen_xmlDictPtr(n_dict, 0);
8074 name = gen_const_xmlChar_ptr(n_name, 1);
8075 len = gen_int(n_len, 2);
8076
8077 ret_val = xmlDictExists(dict, (const xmlChar *)name, len);
8078 desret_const_xmlChar_ptr(ret_val);
8079 call_tests++;
8080 des_xmlDictPtr(n_dict, dict, 0);
8081 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
8082 des_int(n_len, len, 2);
8083 xmlResetLastError();
8084 if (mem_base != xmlMemBlocks()) {
8085 printf("Leak of %d blocks found in xmlDictExists",
8086 xmlMemBlocks() - mem_base);
8087 test_ret++;
8088 printf(" %d", n_dict);
8089 printf(" %d", n_name);
8090 printf(" %d", n_len);
8091 printf("\n");
8092 }
8093 }
8094 }
8095 }
8096 function_tests++;
8097
8098 return(test_ret);
8099}
8100
8101
8102static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00008103test_xmlDictLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008104 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008105
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008106 int mem_base;
8107 const xmlChar * ret_val;
8108 xmlDictPtr dict; /* the dictionnary */
8109 int n_dict;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008110 xmlChar * name; /* the name of the userdata */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008111 int n_name;
8112 int len; /* the length of the name, if -1 it is recomputed */
8113 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008114
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008115 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8116 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
8117 for (n_len = 0;n_len < gen_nb_int;n_len++) {
8118 mem_base = xmlMemBlocks();
8119 dict = gen_xmlDictPtr(n_dict, 0);
8120 name = gen_const_xmlChar_ptr(n_name, 1);
8121 len = gen_int(n_len, 2);
8122
William M. Brackf13f77f2004-11-12 16:03:48 +00008123 ret_val = xmlDictLookup(dict, (const xmlChar *)name, len);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008124 desret_const_xmlChar_ptr(ret_val);
8125 call_tests++;
8126 des_xmlDictPtr(n_dict, dict, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00008127 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008128 des_int(n_len, len, 2);
8129 xmlResetLastError();
8130 if (mem_base != xmlMemBlocks()) {
8131 printf("Leak of %d blocks found in xmlDictLookup",
8132 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008133 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008134 printf(" %d", n_dict);
8135 printf(" %d", n_name);
8136 printf(" %d", n_len);
8137 printf("\n");
8138 }
8139 }
8140 }
8141 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008142 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008143
Daniel Veillard42595322004-11-08 10:52:06 +00008144 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008145}
8146
8147
8148static int
8149test_xmlDictOwns(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008150 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008151
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008152 int mem_base;
8153 int ret_val;
8154 xmlDictPtr dict; /* the dictionnary */
8155 int n_dict;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008156 xmlChar * str; /* the string */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008157 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008158
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008159 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8160 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
8161 mem_base = xmlMemBlocks();
8162 dict = gen_xmlDictPtr(n_dict, 0);
8163 str = gen_const_xmlChar_ptr(n_str, 1);
8164
William M. Brackf13f77f2004-11-12 16:03:48 +00008165 ret_val = xmlDictOwns(dict, (const xmlChar *)str);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008166 desret_int(ret_val);
8167 call_tests++;
8168 des_xmlDictPtr(n_dict, dict, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00008169 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008170 xmlResetLastError();
8171 if (mem_base != xmlMemBlocks()) {
8172 printf("Leak of %d blocks found in xmlDictOwns",
8173 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008174 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008175 printf(" %d", n_dict);
8176 printf(" %d", n_str);
8177 printf("\n");
8178 }
8179 }
8180 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008181 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008182
Daniel Veillard42595322004-11-08 10:52:06 +00008183 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008184}
8185
8186
8187static int
8188test_xmlDictQLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008189 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008190
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008191 int mem_base;
8192 const xmlChar * ret_val;
8193 xmlDictPtr dict; /* the dictionnary */
8194 int n_dict;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008195 xmlChar * prefix; /* the prefix */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008196 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008197 xmlChar * name; /* the name */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008198 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008199
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008200 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8201 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
8202 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
8203 mem_base = xmlMemBlocks();
8204 dict = gen_xmlDictPtr(n_dict, 0);
8205 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
8206 name = gen_const_xmlChar_ptr(n_name, 2);
8207
William M. Brackf13f77f2004-11-12 16:03:48 +00008208 ret_val = xmlDictQLookup(dict, (const xmlChar *)prefix, (const xmlChar *)name);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008209 desret_const_xmlChar_ptr(ret_val);
8210 call_tests++;
8211 des_xmlDictPtr(n_dict, dict, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00008212 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
8213 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008214 xmlResetLastError();
8215 if (mem_base != xmlMemBlocks()) {
8216 printf("Leak of %d blocks found in xmlDictQLookup",
8217 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008218 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008219 printf(" %d", n_dict);
8220 printf(" %d", n_prefix);
8221 printf(" %d", n_name);
8222 printf("\n");
8223 }
8224 }
8225 }
8226 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008227 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008228
Daniel Veillard42595322004-11-08 10:52:06 +00008229 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008230}
8231
8232
8233static int
8234test_xmlDictReference(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008235 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008236
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008237 int mem_base;
8238 int ret_val;
8239 xmlDictPtr dict; /* the dictionnary */
8240 int n_dict;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008241
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008242 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8243 mem_base = xmlMemBlocks();
8244 dict = gen_xmlDictPtr(n_dict, 0);
8245
8246 ret_val = xmlDictReference(dict);
8247 xmlDictFree(dict);
8248 desret_int(ret_val);
8249 call_tests++;
8250 des_xmlDictPtr(n_dict, dict, 0);
8251 xmlResetLastError();
8252 if (mem_base != xmlMemBlocks()) {
8253 printf("Leak of %d blocks found in xmlDictReference",
8254 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008255 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008256 printf(" %d", n_dict);
8257 printf("\n");
8258 }
8259 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008260 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008261
Daniel Veillard42595322004-11-08 10:52:06 +00008262 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008263}
8264
8265
8266static int
8267test_xmlDictSize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008268 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008269
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008270 int mem_base;
8271 int ret_val;
8272 xmlDictPtr dict; /* the dictionnary */
8273 int n_dict;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008274
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008275 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8276 mem_base = xmlMemBlocks();
8277 dict = gen_xmlDictPtr(n_dict, 0);
8278
8279 ret_val = xmlDictSize(dict);
8280 desret_int(ret_val);
8281 call_tests++;
8282 des_xmlDictPtr(n_dict, dict, 0);
8283 xmlResetLastError();
8284 if (mem_base != xmlMemBlocks()) {
8285 printf("Leak of %d blocks found in xmlDictSize",
8286 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008287 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008288 printf(" %d", n_dict);
8289 printf("\n");
8290 }
8291 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008292 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008293
Daniel Veillard42595322004-11-08 10:52:06 +00008294 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008295}
8296
8297static int
8298test_dict(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008299 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008300
Daniel Veillard2ae13382005-01-25 23:45:06 +00008301 if (quiet == 0) printf("Testing dict : 9 of 10 functions ...\n");
8302 test_ret += test_xmlDictCleanup();
Daniel Veillard42595322004-11-08 10:52:06 +00008303 test_ret += test_xmlDictCreate();
8304 test_ret += test_xmlDictCreateSub();
Daniel Veillard91b955c2004-12-10 10:26:42 +00008305 test_ret += test_xmlDictExists();
Daniel Veillard42595322004-11-08 10:52:06 +00008306 test_ret += test_xmlDictLookup();
8307 test_ret += test_xmlDictOwns();
8308 test_ret += test_xmlDictQLookup();
8309 test_ret += test_xmlDictReference();
8310 test_ret += test_xmlDictSize();
Daniel Veillardd93f6252004-11-02 15:53:51 +00008311
Daniel Veillard42595322004-11-08 10:52:06 +00008312 if (test_ret != 0)
8313 printf("Module dict: %d errors\n", test_ret);
8314 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008315}
8316
8317static int
8318test_UTF8Toisolat1(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008319 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008320
William M. Brack21e4ef22005-01-02 09:53:13 +00008321#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00008322#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +00008323 int mem_base;
8324 int ret_val;
8325 unsigned char * out; /* a pointer to an array of bytes to store the result */
8326 int n_out;
8327 int * outlen; /* the length of @out */
8328 int n_outlen;
8329 unsigned char * in; /* a pointer to an array of UTF-8 chars */
8330 int n_in;
8331 int * inlen; /* the length of @in */
8332 int n_inlen;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008333
Daniel Veillardce682bc2004-11-05 17:22:25 +00008334 for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
8335 for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
8336 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
8337 for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
8338 mem_base = xmlMemBlocks();
8339 out = gen_unsigned_char_ptr(n_out, 0);
8340 outlen = gen_int_ptr(n_outlen, 1);
8341 in = gen_const_unsigned_char_ptr(n_in, 2);
8342 inlen = gen_int_ptr(n_inlen, 3);
8343
William M. Brackf13f77f2004-11-12 16:03:48 +00008344 ret_val = UTF8Toisolat1(out, outlen, (const unsigned char *)in, inlen);
Daniel Veillardce682bc2004-11-05 17:22:25 +00008345 desret_int(ret_val);
8346 call_tests++;
8347 des_unsigned_char_ptr(n_out, out, 0);
8348 des_int_ptr(n_outlen, outlen, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00008349 des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +00008350 des_int_ptr(n_inlen, inlen, 3);
8351 xmlResetLastError();
8352 if (mem_base != xmlMemBlocks()) {
8353 printf("Leak of %d blocks found in UTF8Toisolat1",
8354 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008355 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008356 printf(" %d", n_out);
8357 printf(" %d", n_outlen);
8358 printf(" %d", n_in);
8359 printf(" %d", n_inlen);
8360 printf("\n");
8361 }
8362 }
8363 }
8364 }
8365 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008366 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00008367#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00008368#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +00008369
Daniel Veillard42595322004-11-08 10:52:06 +00008370 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008371}
8372
8373
8374static int
8375test_isolat1ToUTF8(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008376 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008377
Daniel Veillardce682bc2004-11-05 17:22:25 +00008378 int mem_base;
8379 int ret_val;
8380 unsigned char * out; /* a pointer to an array of bytes to store the result */
8381 int n_out;
8382 int * outlen; /* the length of @out */
8383 int n_outlen;
8384 unsigned char * in; /* a pointer to an array of ISO Latin 1 chars */
8385 int n_in;
8386 int * inlen; /* the length of @in */
8387 int n_inlen;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008388
Daniel Veillardce682bc2004-11-05 17:22:25 +00008389 for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
8390 for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
8391 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
8392 for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
8393 mem_base = xmlMemBlocks();
8394 out = gen_unsigned_char_ptr(n_out, 0);
8395 outlen = gen_int_ptr(n_outlen, 1);
8396 in = gen_const_unsigned_char_ptr(n_in, 2);
8397 inlen = gen_int_ptr(n_inlen, 3);
8398
William M. Brackf13f77f2004-11-12 16:03:48 +00008399 ret_val = isolat1ToUTF8(out, outlen, (const unsigned char *)in, inlen);
Daniel Veillardce682bc2004-11-05 17:22:25 +00008400 desret_int(ret_val);
8401 call_tests++;
8402 des_unsigned_char_ptr(n_out, out, 0);
8403 des_int_ptr(n_outlen, outlen, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00008404 des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +00008405 des_int_ptr(n_inlen, inlen, 3);
8406 xmlResetLastError();
8407 if (mem_base != xmlMemBlocks()) {
8408 printf("Leak of %d blocks found in isolat1ToUTF8",
8409 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008410 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008411 printf(" %d", n_out);
8412 printf(" %d", n_outlen);
8413 printf(" %d", n_in);
8414 printf(" %d", n_inlen);
8415 printf("\n");
8416 }
8417 }
8418 }
8419 }
8420 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008421 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008422
Daniel Veillard42595322004-11-08 10:52:06 +00008423 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008424}
8425
8426
8427static int
8428test_xmlAddEncodingAlias(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008429 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008430
8431 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008432 char * name; /* the encoding name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillardd93f6252004-11-02 15:53:51 +00008433 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008434 char * alias; /* the alias name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillardd93f6252004-11-02 15:53:51 +00008435 int n_alias;
8436
8437 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
8438 for (n_alias = 0;n_alias < gen_nb_const_char_ptr;n_alias++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00008439 name = gen_const_char_ptr(n_name, 0);
8440 alias = gen_const_char_ptr(n_alias, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008441
William M. Brackf13f77f2004-11-12 16:03:48 +00008442 ret_val = xmlAddEncodingAlias((const char *)name, (const char *)alias);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008443 desret_int(ret_val);
8444 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00008445 des_const_char_ptr(n_name, (const char *)name, 0);
8446 des_const_char_ptr(n_alias, (const char *)alias, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008447 xmlResetLastError();
8448 }
8449 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008450 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008451
Daniel Veillard42595322004-11-08 10:52:06 +00008452 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008453}
8454
8455
Daniel Veillardce682bc2004-11-05 17:22:25 +00008456#define gen_nb_xmlCharEncodingHandler_ptr 1
8457static xmlCharEncodingHandler * gen_xmlCharEncodingHandler_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
8458 return(NULL);
8459}
8460static void des_xmlCharEncodingHandler_ptr(int no ATTRIBUTE_UNUSED, xmlCharEncodingHandler * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
8461}
8462
Daniel Veillardd93f6252004-11-02 15:53:51 +00008463static int
8464test_xmlCharEncCloseFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008465 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008466
Daniel Veillardce682bc2004-11-05 17:22:25 +00008467 int mem_base;
8468 int ret_val;
8469 xmlCharEncodingHandler * handler; /* char enconding transformation data structure */
8470 int n_handler;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008471
Daniel Veillardce682bc2004-11-05 17:22:25 +00008472 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) {
8473 mem_base = xmlMemBlocks();
8474 handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0);
8475
8476 ret_val = xmlCharEncCloseFunc(handler);
8477 desret_int(ret_val);
8478 call_tests++;
8479 des_xmlCharEncodingHandler_ptr(n_handler, handler, 0);
8480 xmlResetLastError();
8481 if (mem_base != xmlMemBlocks()) {
8482 printf("Leak of %d blocks found in xmlCharEncCloseFunc",
8483 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008484 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008485 printf(" %d", n_handler);
8486 printf("\n");
8487 }
8488 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008489 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008490
Daniel Veillard42595322004-11-08 10:52:06 +00008491 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008492}
8493
8494
8495static int
8496test_xmlCharEncFirstLine(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008497 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008498
Daniel Veillardce682bc2004-11-05 17:22:25 +00008499 int mem_base;
8500 int ret_val;
8501 xmlCharEncodingHandler * handler; /* char enconding transformation data structure */
8502 int n_handler;
8503 xmlBufferPtr out; /* an xmlBuffer for the output. */
8504 int n_out;
8505 xmlBufferPtr in; /* an xmlBuffer for the input */
8506 int n_in;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008507
Daniel Veillardce682bc2004-11-05 17:22:25 +00008508 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) {
8509 for (n_out = 0;n_out < gen_nb_xmlBufferPtr;n_out++) {
8510 for (n_in = 0;n_in < gen_nb_xmlBufferPtr;n_in++) {
8511 mem_base = xmlMemBlocks();
8512 handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0);
8513 out = gen_xmlBufferPtr(n_out, 1);
8514 in = gen_xmlBufferPtr(n_in, 2);
8515
8516 ret_val = xmlCharEncFirstLine(handler, out, in);
8517 desret_int(ret_val);
8518 call_tests++;
8519 des_xmlCharEncodingHandler_ptr(n_handler, handler, 0);
8520 des_xmlBufferPtr(n_out, out, 1);
8521 des_xmlBufferPtr(n_in, in, 2);
8522 xmlResetLastError();
8523 if (mem_base != xmlMemBlocks()) {
8524 printf("Leak of %d blocks found in xmlCharEncFirstLine",
8525 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008526 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008527 printf(" %d", n_handler);
8528 printf(" %d", n_out);
8529 printf(" %d", n_in);
8530 printf("\n");
8531 }
8532 }
8533 }
8534 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008535 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008536
Daniel Veillard42595322004-11-08 10:52:06 +00008537 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008538}
8539
8540
8541static int
8542test_xmlCharEncInFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008543 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008544
Daniel Veillardce682bc2004-11-05 17:22:25 +00008545 int mem_base;
8546 int ret_val;
8547 xmlCharEncodingHandler * handler; /* char encoding transformation data structure */
8548 int n_handler;
8549 xmlBufferPtr out; /* an xmlBuffer for the output. */
8550 int n_out;
8551 xmlBufferPtr in; /* an xmlBuffer for the input */
8552 int n_in;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008553
Daniel Veillardce682bc2004-11-05 17:22:25 +00008554 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) {
8555 for (n_out = 0;n_out < gen_nb_xmlBufferPtr;n_out++) {
8556 for (n_in = 0;n_in < gen_nb_xmlBufferPtr;n_in++) {
8557 mem_base = xmlMemBlocks();
8558 handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0);
8559 out = gen_xmlBufferPtr(n_out, 1);
8560 in = gen_xmlBufferPtr(n_in, 2);
8561
8562 ret_val = xmlCharEncInFunc(handler, out, in);
8563 desret_int(ret_val);
8564 call_tests++;
8565 des_xmlCharEncodingHandler_ptr(n_handler, handler, 0);
8566 des_xmlBufferPtr(n_out, out, 1);
8567 des_xmlBufferPtr(n_in, in, 2);
8568 xmlResetLastError();
8569 if (mem_base != xmlMemBlocks()) {
8570 printf("Leak of %d blocks found in xmlCharEncInFunc",
8571 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008572 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008573 printf(" %d", n_handler);
8574 printf(" %d", n_out);
8575 printf(" %d", n_in);
8576 printf("\n");
8577 }
8578 }
8579 }
8580 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008581 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008582
Daniel Veillard42595322004-11-08 10:52:06 +00008583 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008584}
8585
8586
8587static int
8588test_xmlCharEncOutFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008589 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008590
Daniel Veillardce682bc2004-11-05 17:22:25 +00008591 int mem_base;
8592 int ret_val;
8593 xmlCharEncodingHandler * handler; /* char enconding transformation data structure */
8594 int n_handler;
8595 xmlBufferPtr out; /* an xmlBuffer for the output. */
8596 int n_out;
8597 xmlBufferPtr in; /* an xmlBuffer for the input */
8598 int n_in;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008599
Daniel Veillardce682bc2004-11-05 17:22:25 +00008600 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) {
8601 for (n_out = 0;n_out < gen_nb_xmlBufferPtr;n_out++) {
8602 for (n_in = 0;n_in < gen_nb_xmlBufferPtr;n_in++) {
8603 mem_base = xmlMemBlocks();
8604 handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0);
8605 out = gen_xmlBufferPtr(n_out, 1);
8606 in = gen_xmlBufferPtr(n_in, 2);
8607
8608 ret_val = xmlCharEncOutFunc(handler, out, in);
8609 desret_int(ret_val);
8610 call_tests++;
8611 des_xmlCharEncodingHandler_ptr(n_handler, handler, 0);
8612 des_xmlBufferPtr(n_out, out, 1);
8613 des_xmlBufferPtr(n_in, in, 2);
8614 xmlResetLastError();
8615 if (mem_base != xmlMemBlocks()) {
8616 printf("Leak of %d blocks found in xmlCharEncOutFunc",
8617 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008618 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008619 printf(" %d", n_handler);
8620 printf(" %d", n_out);
8621 printf(" %d", n_in);
8622 printf("\n");
8623 }
8624 }
8625 }
8626 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008627 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008628
Daniel Veillard42595322004-11-08 10:52:06 +00008629 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008630}
8631
8632
8633static int
8634test_xmlCleanupCharEncodingHandlers(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008635 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008636
8637
8638
8639 xmlCleanupCharEncodingHandlers();
8640 call_tests++;
8641 xmlResetLastError();
Daniel Veillard3d97e662004-11-04 10:49:00 +00008642 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008643
Daniel Veillard42595322004-11-08 10:52:06 +00008644 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008645}
8646
8647
8648static int
8649test_xmlCleanupEncodingAliases(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008650 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008651
8652 int mem_base;
8653
8654 mem_base = xmlMemBlocks();
8655
8656 xmlCleanupEncodingAliases();
8657 call_tests++;
8658 xmlResetLastError();
8659 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00008660 printf("Leak of %d blocks found in xmlCleanupEncodingAliases",
Daniel Veillardd93f6252004-11-02 15:53:51 +00008661 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008662 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00008663 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00008664 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008665 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008666
Daniel Veillard42595322004-11-08 10:52:06 +00008667 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008668}
8669
8670
8671static int
8672test_xmlDelEncodingAlias(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008673 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008674
8675 int mem_base;
8676 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008677 char * alias; /* the alias name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillardd93f6252004-11-02 15:53:51 +00008678 int n_alias;
8679
8680 for (n_alias = 0;n_alias < gen_nb_const_char_ptr;n_alias++) {
8681 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00008682 alias = gen_const_char_ptr(n_alias, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008683
William M. Brackf13f77f2004-11-12 16:03:48 +00008684 ret_val = xmlDelEncodingAlias((const char *)alias);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008685 desret_int(ret_val);
8686 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00008687 des_const_char_ptr(n_alias, (const char *)alias, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008688 xmlResetLastError();
8689 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00008690 printf("Leak of %d blocks found in xmlDelEncodingAlias",
Daniel Veillardd93f6252004-11-02 15:53:51 +00008691 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008692 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00008693 printf(" %d", n_alias);
8694 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00008695 }
8696 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008697 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008698
Daniel Veillard42595322004-11-08 10:52:06 +00008699 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008700}
8701
8702
8703static int
8704test_xmlDetectCharEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008705 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008706
Daniel Veillardce682bc2004-11-05 17:22:25 +00008707 int mem_base;
8708 xmlCharEncoding ret_val;
8709 unsigned char * in; /* a pointer to the first bytes of the XML entity, must be at least 2 bytes long (at least 4 if encoding is UTF4 variant). */
8710 int n_in;
8711 int len; /* pointer to the length of the buffer */
8712 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008713
Daniel Veillardce682bc2004-11-05 17:22:25 +00008714 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
8715 for (n_len = 0;n_len < gen_nb_int;n_len++) {
8716 mem_base = xmlMemBlocks();
8717 in = gen_const_unsigned_char_ptr(n_in, 0);
8718 len = gen_int(n_len, 1);
8719
William M. Brackf13f77f2004-11-12 16:03:48 +00008720 ret_val = xmlDetectCharEncoding((const unsigned char *)in, len);
Daniel Veillardce682bc2004-11-05 17:22:25 +00008721 desret_xmlCharEncoding(ret_val);
8722 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00008723 des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +00008724 des_int(n_len, len, 1);
8725 xmlResetLastError();
8726 if (mem_base != xmlMemBlocks()) {
8727 printf("Leak of %d blocks found in xmlDetectCharEncoding",
8728 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008729 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008730 printf(" %d", n_in);
8731 printf(" %d", n_len);
8732 printf("\n");
8733 }
8734 }
8735 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008736 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008737
Daniel Veillard42595322004-11-08 10:52:06 +00008738 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008739}
8740
8741
8742static int
8743test_xmlFindCharEncodingHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008744 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008745
8746
8747 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00008748 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008749}
8750
8751
8752static int
8753test_xmlGetCharEncodingHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008754 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008755
8756
8757 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00008758 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008759}
8760
8761
8762static int
8763test_xmlGetCharEncodingName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008764 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008765
Daniel Veillard3d97e662004-11-04 10:49:00 +00008766 int mem_base;
8767 const char * ret_val;
8768 xmlCharEncoding enc; /* the encoding */
8769 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008770
Daniel Veillard3d97e662004-11-04 10:49:00 +00008771 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
8772 mem_base = xmlMemBlocks();
8773 enc = gen_xmlCharEncoding(n_enc, 0);
8774
8775 ret_val = xmlGetCharEncodingName(enc);
8776 desret_const_char_ptr(ret_val);
8777 call_tests++;
8778 des_xmlCharEncoding(n_enc, enc, 0);
8779 xmlResetLastError();
8780 if (mem_base != xmlMemBlocks()) {
8781 printf("Leak of %d blocks found in xmlGetCharEncodingName",
8782 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008783 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00008784 printf(" %d", n_enc);
8785 printf("\n");
8786 }
8787 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008788 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008789
Daniel Veillard42595322004-11-08 10:52:06 +00008790 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008791}
8792
8793
8794static int
8795test_xmlGetEncodingAlias(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008796 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008797
8798 int mem_base;
8799 const char * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008800 char * alias; /* the alias name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillardd93f6252004-11-02 15:53:51 +00008801 int n_alias;
8802
8803 for (n_alias = 0;n_alias < gen_nb_const_char_ptr;n_alias++) {
8804 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00008805 alias = gen_const_char_ptr(n_alias, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008806
William M. Brackf13f77f2004-11-12 16:03:48 +00008807 ret_val = xmlGetEncodingAlias((const char *)alias);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008808 desret_const_char_ptr(ret_val);
8809 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00008810 des_const_char_ptr(n_alias, (const char *)alias, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008811 xmlResetLastError();
8812 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00008813 printf("Leak of %d blocks found in xmlGetEncodingAlias",
Daniel Veillardd93f6252004-11-02 15:53:51 +00008814 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008815 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00008816 printf(" %d", n_alias);
8817 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00008818 }
8819 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008820 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008821
Daniel Veillard42595322004-11-08 10:52:06 +00008822 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008823}
8824
8825
8826static int
8827test_xmlInitCharEncodingHandlers(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008828 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008829
8830
8831
8832 xmlInitCharEncodingHandlers();
8833 call_tests++;
8834 xmlResetLastError();
Daniel Veillard3d97e662004-11-04 10:49:00 +00008835 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008836
Daniel Veillard42595322004-11-08 10:52:06 +00008837 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008838}
8839
8840
8841static int
8842test_xmlNewCharEncodingHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008843 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008844
8845
8846 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00008847 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008848}
8849
8850
8851static int
8852test_xmlParseCharEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008853 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008854
Daniel Veillard3d97e662004-11-04 10:49:00 +00008855 int mem_base;
8856 xmlCharEncoding ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008857 char * name; /* the encoding name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillard3d97e662004-11-04 10:49:00 +00008858 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008859
Daniel Veillard3d97e662004-11-04 10:49:00 +00008860 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
8861 mem_base = xmlMemBlocks();
8862 name = gen_const_char_ptr(n_name, 0);
8863
William M. Brackf13f77f2004-11-12 16:03:48 +00008864 ret_val = xmlParseCharEncoding((const char *)name);
Daniel Veillard3d97e662004-11-04 10:49:00 +00008865 desret_xmlCharEncoding(ret_val);
8866 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00008867 des_const_char_ptr(n_name, (const char *)name, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00008868 xmlResetLastError();
8869 if (mem_base != xmlMemBlocks()) {
8870 printf("Leak of %d blocks found in xmlParseCharEncoding",
8871 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008872 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00008873 printf(" %d", n_name);
8874 printf("\n");
8875 }
8876 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008877 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008878
Daniel Veillard42595322004-11-08 10:52:06 +00008879 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008880}
8881
8882
Daniel Veillardce682bc2004-11-05 17:22:25 +00008883#define gen_nb_xmlCharEncodingHandlerPtr 1
8884static xmlCharEncodingHandlerPtr gen_xmlCharEncodingHandlerPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
8885 return(NULL);
8886}
8887static void des_xmlCharEncodingHandlerPtr(int no ATTRIBUTE_UNUSED, xmlCharEncodingHandlerPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
8888}
8889
Daniel Veillardd93f6252004-11-02 15:53:51 +00008890static int
8891test_xmlRegisterCharEncodingHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008892 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008893
Daniel Veillardce682bc2004-11-05 17:22:25 +00008894 int mem_base;
8895 xmlCharEncodingHandlerPtr handler; /* the xmlCharEncodingHandlerPtr handler block */
8896 int n_handler;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008897
Daniel Veillardce682bc2004-11-05 17:22:25 +00008898 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandlerPtr;n_handler++) {
8899 mem_base = xmlMemBlocks();
8900 handler = gen_xmlCharEncodingHandlerPtr(n_handler, 0);
8901
8902 xmlRegisterCharEncodingHandler(handler);
8903 call_tests++;
8904 des_xmlCharEncodingHandlerPtr(n_handler, handler, 0);
8905 xmlResetLastError();
8906 if (mem_base != xmlMemBlocks()) {
8907 printf("Leak of %d blocks found in xmlRegisterCharEncodingHandler",
8908 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008909 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008910 printf(" %d", n_handler);
8911 printf("\n");
8912 }
8913 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008914 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008915
Daniel Veillard42595322004-11-08 10:52:06 +00008916 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008917}
8918
8919static int
8920test_encoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008921 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008922
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008923 if (quiet == 0) printf("Testing encoding : 16 of 19 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00008924 test_ret += test_UTF8Toisolat1();
8925 test_ret += test_isolat1ToUTF8();
8926 test_ret += test_xmlAddEncodingAlias();
8927 test_ret += test_xmlCharEncCloseFunc();
8928 test_ret += test_xmlCharEncFirstLine();
8929 test_ret += test_xmlCharEncInFunc();
8930 test_ret += test_xmlCharEncOutFunc();
8931 test_ret += test_xmlCleanupCharEncodingHandlers();
8932 test_ret += test_xmlCleanupEncodingAliases();
8933 test_ret += test_xmlDelEncodingAlias();
8934 test_ret += test_xmlDetectCharEncoding();
8935 test_ret += test_xmlFindCharEncodingHandler();
8936 test_ret += test_xmlGetCharEncodingHandler();
8937 test_ret += test_xmlGetCharEncodingName();
8938 test_ret += test_xmlGetEncodingAlias();
8939 test_ret += test_xmlInitCharEncodingHandlers();
8940 test_ret += test_xmlNewCharEncodingHandler();
8941 test_ret += test_xmlParseCharEncoding();
8942 test_ret += test_xmlRegisterCharEncodingHandler();
Daniel Veillardd93f6252004-11-02 15:53:51 +00008943
Daniel Veillard42595322004-11-08 10:52:06 +00008944 if (test_ret != 0)
8945 printf("Module encoding: %d errors\n", test_ret);
8946 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008947}
8948
8949static int
8950test_xmlAddDocEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008951 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008952
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008953 int mem_base;
8954 xmlEntityPtr ret_val;
8955 xmlDocPtr doc; /* the document */
8956 int n_doc;
8957 xmlChar * name; /* the entity name */
8958 int n_name;
8959 int type; /* the entity type XML_xxx_yyy_ENTITY */
8960 int n_type;
8961 xmlChar * ExternalID; /* the entity external ID if available */
8962 int n_ExternalID;
8963 xmlChar * SystemID; /* the entity system ID if available */
8964 int n_SystemID;
8965 xmlChar * content; /* the entity content */
8966 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008967
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008968 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
8969 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
8970 for (n_type = 0;n_type < gen_nb_int;n_type++) {
8971 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
8972 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
8973 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
8974 mem_base = xmlMemBlocks();
8975 doc = gen_xmlDocPtr(n_doc, 0);
8976 name = gen_const_xmlChar_ptr(n_name, 1);
8977 type = gen_int(n_type, 2);
8978 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 3);
8979 SystemID = gen_const_xmlChar_ptr(n_SystemID, 4);
8980 content = gen_const_xmlChar_ptr(n_content, 5);
8981
William M. Brackf13f77f2004-11-12 16:03:48 +00008982 ret_val = xmlAddDocEntity(doc, (const xmlChar *)name, type, (const xmlChar *)ExternalID, (const xmlChar *)SystemID, (const xmlChar *)content);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008983 desret_xmlEntityPtr(ret_val);
8984 call_tests++;
8985 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00008986 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008987 des_int(n_type, type, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00008988 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 3);
8989 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 4);
8990 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 5);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008991 xmlResetLastError();
8992 if (mem_base != xmlMemBlocks()) {
8993 printf("Leak of %d blocks found in xmlAddDocEntity",
8994 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008995 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008996 printf(" %d", n_doc);
8997 printf(" %d", n_name);
8998 printf(" %d", n_type);
8999 printf(" %d", n_ExternalID);
9000 printf(" %d", n_SystemID);
9001 printf(" %d", n_content);
9002 printf("\n");
9003 }
9004 }
9005 }
9006 }
9007 }
9008 }
9009 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009010 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009011
Daniel Veillard42595322004-11-08 10:52:06 +00009012 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009013}
9014
9015
9016static int
9017test_xmlAddDtdEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009018 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009019
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009020 int mem_base;
9021 xmlEntityPtr ret_val;
9022 xmlDocPtr doc; /* the document */
9023 int n_doc;
9024 xmlChar * name; /* the entity name */
9025 int n_name;
9026 int type; /* the entity type XML_xxx_yyy_ENTITY */
9027 int n_type;
9028 xmlChar * ExternalID; /* the entity external ID if available */
9029 int n_ExternalID;
9030 xmlChar * SystemID; /* the entity system ID if available */
9031 int n_SystemID;
9032 xmlChar * content; /* the entity content */
9033 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009034
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009035 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9036 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9037 for (n_type = 0;n_type < gen_nb_int;n_type++) {
9038 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
9039 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
9040 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
9041 mem_base = xmlMemBlocks();
9042 doc = gen_xmlDocPtr(n_doc, 0);
9043 name = gen_const_xmlChar_ptr(n_name, 1);
9044 type = gen_int(n_type, 2);
9045 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 3);
9046 SystemID = gen_const_xmlChar_ptr(n_SystemID, 4);
9047 content = gen_const_xmlChar_ptr(n_content, 5);
9048
William M. Brackf13f77f2004-11-12 16:03:48 +00009049 ret_val = xmlAddDtdEntity(doc, (const xmlChar *)name, type, (const xmlChar *)ExternalID, (const xmlChar *)SystemID, (const xmlChar *)content);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009050 desret_xmlEntityPtr(ret_val);
9051 call_tests++;
9052 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009053 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009054 des_int(n_type, type, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00009055 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 3);
9056 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 4);
9057 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 5);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009058 xmlResetLastError();
9059 if (mem_base != xmlMemBlocks()) {
9060 printf("Leak of %d blocks found in xmlAddDtdEntity",
9061 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009062 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009063 printf(" %d", n_doc);
9064 printf(" %d", n_name);
9065 printf(" %d", n_type);
9066 printf(" %d", n_ExternalID);
9067 printf(" %d", n_SystemID);
9068 printf(" %d", n_content);
9069 printf("\n");
9070 }
9071 }
9072 }
9073 }
9074 }
9075 }
9076 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009077 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009078
Daniel Veillard42595322004-11-08 10:52:06 +00009079 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009080}
9081
9082
9083static int
9084test_xmlCleanupPredefinedEntities(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009085 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009086
William M. Brack21e4ef22005-01-02 09:53:13 +00009087#if defined(LIBXML_LEGACY_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00009088#ifdef LIBXML_LEGACY_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +00009089 int mem_base;
9090
9091 mem_base = xmlMemBlocks();
9092
9093 xmlCleanupPredefinedEntities();
9094 call_tests++;
9095 xmlResetLastError();
9096 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00009097 printf("Leak of %d blocks found in xmlCleanupPredefinedEntities",
Daniel Veillardd93f6252004-11-02 15:53:51 +00009098 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009099 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00009100 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00009101 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009102 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00009103#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00009104#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00009105
Daniel Veillard42595322004-11-08 10:52:06 +00009106 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009107}
9108
9109
Daniel Veillardce682bc2004-11-05 17:22:25 +00009110#define gen_nb_xmlEntitiesTablePtr 1
9111static xmlEntitiesTablePtr gen_xmlEntitiesTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9112 return(NULL);
9113}
9114static void des_xmlEntitiesTablePtr(int no ATTRIBUTE_UNUSED, xmlEntitiesTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9115}
9116
Daniel Veillardd93f6252004-11-02 15:53:51 +00009117static int
9118test_xmlCopyEntitiesTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009119 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009120
9121
9122 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009123 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009124}
9125
9126
9127static int
9128test_xmlCreateEntitiesTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009129 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009130
9131
9132 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009133 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009134}
9135
9136
9137static int
9138test_xmlDumpEntitiesTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009139 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009140
William M. Brack21e4ef22005-01-02 09:53:13 +00009141#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00009142 int mem_base;
9143 xmlBufferPtr buf; /* An XML buffer. */
9144 int n_buf;
9145 xmlEntitiesTablePtr table; /* An entity table */
9146 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009147
Daniel Veillardce682bc2004-11-05 17:22:25 +00009148 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
9149 for (n_table = 0;n_table < gen_nb_xmlEntitiesTablePtr;n_table++) {
9150 mem_base = xmlMemBlocks();
9151 buf = gen_xmlBufferPtr(n_buf, 0);
9152 table = gen_xmlEntitiesTablePtr(n_table, 1);
9153
9154 xmlDumpEntitiesTable(buf, table);
9155 call_tests++;
9156 des_xmlBufferPtr(n_buf, buf, 0);
9157 des_xmlEntitiesTablePtr(n_table, table, 1);
9158 xmlResetLastError();
9159 if (mem_base != xmlMemBlocks()) {
9160 printf("Leak of %d blocks found in xmlDumpEntitiesTable",
9161 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009162 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009163 printf(" %d", n_buf);
9164 printf(" %d", n_table);
9165 printf("\n");
9166 }
9167 }
9168 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009169 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009170#endif
9171
Daniel Veillard42595322004-11-08 10:52:06 +00009172 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009173}
9174
9175
Daniel Veillardce682bc2004-11-05 17:22:25 +00009176#define gen_nb_xmlEntityPtr 1
9177static xmlEntityPtr gen_xmlEntityPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9178 return(NULL);
9179}
9180static void des_xmlEntityPtr(int no ATTRIBUTE_UNUSED, xmlEntityPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9181}
9182
Daniel Veillardd93f6252004-11-02 15:53:51 +00009183static int
9184test_xmlDumpEntityDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009185 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009186
William M. Brack21e4ef22005-01-02 09:53:13 +00009187#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00009188 int mem_base;
9189 xmlBufferPtr buf; /* An XML buffer. */
9190 int n_buf;
9191 xmlEntityPtr ent; /* An entity table */
9192 int n_ent;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009193
Daniel Veillardce682bc2004-11-05 17:22:25 +00009194 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
9195 for (n_ent = 0;n_ent < gen_nb_xmlEntityPtr;n_ent++) {
9196 mem_base = xmlMemBlocks();
9197 buf = gen_xmlBufferPtr(n_buf, 0);
9198 ent = gen_xmlEntityPtr(n_ent, 1);
9199
9200 xmlDumpEntityDecl(buf, ent);
9201 call_tests++;
9202 des_xmlBufferPtr(n_buf, buf, 0);
9203 des_xmlEntityPtr(n_ent, ent, 1);
9204 xmlResetLastError();
9205 if (mem_base != xmlMemBlocks()) {
9206 printf("Leak of %d blocks found in xmlDumpEntityDecl",
9207 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009208 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009209 printf(" %d", n_buf);
9210 printf(" %d", n_ent);
9211 printf("\n");
9212 }
9213 }
9214 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009215 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009216#endif
9217
Daniel Veillard42595322004-11-08 10:52:06 +00009218 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009219}
9220
9221
9222static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00009223test_xmlEncodeEntitiesReentrant(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009224 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009225
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009226 int mem_base;
9227 xmlChar * ret_val;
9228 xmlDocPtr doc; /* the document containing the string */
9229 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009230 xmlChar * input; /* A string to convert to XML. */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009231 int n_input;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009232
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009233 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9234 for (n_input = 0;n_input < gen_nb_const_xmlChar_ptr;n_input++) {
9235 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009236 doc = gen_xmlDocPtr(n_doc, 0);
9237 input = gen_const_xmlChar_ptr(n_input, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009238
William M. Brackf13f77f2004-11-12 16:03:48 +00009239 ret_val = xmlEncodeEntitiesReentrant(doc, (const xmlChar *)input);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009240 desret_xmlChar_ptr(ret_val);
9241 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009242 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009243 des_const_xmlChar_ptr(n_input, (const xmlChar *)input, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009244 xmlResetLastError();
9245 if (mem_base != xmlMemBlocks()) {
9246 printf("Leak of %d blocks found in xmlEncodeEntitiesReentrant",
9247 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009248 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009249 printf(" %d", n_doc);
9250 printf(" %d", n_input);
9251 printf("\n");
9252 }
9253 }
9254 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009255 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009256
Daniel Veillard42595322004-11-08 10:52:06 +00009257 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009258}
9259
9260
9261static int
9262test_xmlEncodeSpecialChars(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009263 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009264
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009265 int mem_base;
9266 xmlChar * ret_val;
9267 xmlDocPtr doc; /* the document containing the string */
9268 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009269 xmlChar * input; /* A string to convert to XML. */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009270 int n_input;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009271
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009272 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9273 for (n_input = 0;n_input < gen_nb_const_xmlChar_ptr;n_input++) {
9274 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009275 doc = gen_xmlDocPtr(n_doc, 0);
9276 input = gen_const_xmlChar_ptr(n_input, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009277
William M. Brackf13f77f2004-11-12 16:03:48 +00009278 ret_val = xmlEncodeSpecialChars(doc, (const xmlChar *)input);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009279 desret_xmlChar_ptr(ret_val);
9280 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009281 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009282 des_const_xmlChar_ptr(n_input, (const xmlChar *)input, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009283 xmlResetLastError();
9284 if (mem_base != xmlMemBlocks()) {
9285 printf("Leak of %d blocks found in xmlEncodeSpecialChars",
9286 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009287 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009288 printf(" %d", n_doc);
9289 printf(" %d", n_input);
9290 printf("\n");
9291 }
9292 }
9293 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009294 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009295
Daniel Veillard42595322004-11-08 10:52:06 +00009296 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009297}
9298
9299
9300static int
9301test_xmlGetDocEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009302 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009303
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009304 int mem_base;
9305 xmlEntityPtr ret_val;
9306 xmlDocPtr doc; /* the document referencing the entity */
9307 int n_doc;
9308 xmlChar * name; /* the entity name */
9309 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009310
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009311 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9312 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9313 mem_base = xmlMemBlocks();
9314 doc = gen_xmlDocPtr(n_doc, 0);
9315 name = gen_const_xmlChar_ptr(n_name, 1);
9316
William M. Brackf13f77f2004-11-12 16:03:48 +00009317 ret_val = xmlGetDocEntity(doc, (const xmlChar *)name);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009318 desret_xmlEntityPtr(ret_val);
9319 call_tests++;
9320 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009321 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009322 xmlResetLastError();
9323 if (mem_base != xmlMemBlocks()) {
9324 printf("Leak of %d blocks found in xmlGetDocEntity",
9325 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009326 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009327 printf(" %d", n_doc);
9328 printf(" %d", n_name);
9329 printf("\n");
9330 }
9331 }
9332 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009333 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009334
Daniel Veillard42595322004-11-08 10:52:06 +00009335 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009336}
9337
9338
9339static int
9340test_xmlGetDtdEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009341 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009342
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009343 int mem_base;
9344 xmlEntityPtr ret_val;
9345 xmlDocPtr doc; /* the document referencing the entity */
9346 int n_doc;
9347 xmlChar * name; /* the entity name */
9348 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009349
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009350 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9351 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9352 mem_base = xmlMemBlocks();
9353 doc = gen_xmlDocPtr(n_doc, 0);
9354 name = gen_const_xmlChar_ptr(n_name, 1);
9355
William M. Brackf13f77f2004-11-12 16:03:48 +00009356 ret_val = xmlGetDtdEntity(doc, (const xmlChar *)name);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009357 desret_xmlEntityPtr(ret_val);
9358 call_tests++;
9359 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009360 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009361 xmlResetLastError();
9362 if (mem_base != xmlMemBlocks()) {
9363 printf("Leak of %d blocks found in xmlGetDtdEntity",
9364 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009365 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009366 printf(" %d", n_doc);
9367 printf(" %d", n_name);
9368 printf("\n");
9369 }
9370 }
9371 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009372 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009373
Daniel Veillard42595322004-11-08 10:52:06 +00009374 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009375}
9376
9377
9378static int
9379test_xmlGetParameterEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009380 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009381
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009382 int mem_base;
9383 xmlEntityPtr ret_val;
9384 xmlDocPtr doc; /* the document referencing the entity */
9385 int n_doc;
9386 xmlChar * name; /* the entity name */
9387 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009388
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009389 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9390 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9391 mem_base = xmlMemBlocks();
9392 doc = gen_xmlDocPtr(n_doc, 0);
9393 name = gen_const_xmlChar_ptr(n_name, 1);
9394
William M. Brackf13f77f2004-11-12 16:03:48 +00009395 ret_val = xmlGetParameterEntity(doc, (const xmlChar *)name);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009396 desret_xmlEntityPtr(ret_val);
9397 call_tests++;
9398 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009399 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009400 xmlResetLastError();
9401 if (mem_base != xmlMemBlocks()) {
9402 printf("Leak of %d blocks found in xmlGetParameterEntity",
9403 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009404 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009405 printf(" %d", n_doc);
9406 printf(" %d", n_name);
9407 printf("\n");
9408 }
9409 }
9410 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009411 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009412
Daniel Veillard42595322004-11-08 10:52:06 +00009413 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009414}
9415
9416
9417static int
9418test_xmlGetPredefinedEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009419 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009420
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009421 int mem_base;
9422 xmlEntityPtr ret_val;
9423 xmlChar * name; /* the entity name */
9424 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009425
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009426 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9427 mem_base = xmlMemBlocks();
9428 name = gen_const_xmlChar_ptr(n_name, 0);
9429
William M. Brackf13f77f2004-11-12 16:03:48 +00009430 ret_val = xmlGetPredefinedEntity((const xmlChar *)name);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009431 desret_xmlEntityPtr(ret_val);
9432 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00009433 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009434 xmlResetLastError();
9435 if (mem_base != xmlMemBlocks()) {
9436 printf("Leak of %d blocks found in xmlGetPredefinedEntity",
9437 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009438 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009439 printf(" %d", n_name);
9440 printf("\n");
9441 }
9442 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009443 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009444
Daniel Veillard42595322004-11-08 10:52:06 +00009445 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009446}
9447
9448
9449static int
9450test_xmlInitializePredefinedEntities(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009451 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009452
William M. Brack21e4ef22005-01-02 09:53:13 +00009453#if defined(LIBXML_LEGACY_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00009454#ifdef LIBXML_LEGACY_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +00009455 int mem_base;
9456
9457 mem_base = xmlMemBlocks();
9458
9459 xmlInitializePredefinedEntities();
9460 call_tests++;
9461 xmlResetLastError();
9462 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00009463 printf("Leak of %d blocks found in xmlInitializePredefinedEntities",
Daniel Veillardd93f6252004-11-02 15:53:51 +00009464 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009465 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00009466 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00009467 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009468 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00009469#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00009470#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00009471
Daniel Veillard42595322004-11-08 10:52:06 +00009472 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009473}
9474
9475static int
9476test_entities(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009477 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009478
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009479 if (quiet == 0) printf("Testing entities : 12 of 16 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00009480 test_ret += test_xmlAddDocEntity();
9481 test_ret += test_xmlAddDtdEntity();
9482 test_ret += test_xmlCleanupPredefinedEntities();
9483 test_ret += test_xmlCopyEntitiesTable();
9484 test_ret += test_xmlCreateEntitiesTable();
9485 test_ret += test_xmlDumpEntitiesTable();
9486 test_ret += test_xmlDumpEntityDecl();
9487 test_ret += test_xmlEncodeEntitiesReentrant();
9488 test_ret += test_xmlEncodeSpecialChars();
9489 test_ret += test_xmlGetDocEntity();
9490 test_ret += test_xmlGetDtdEntity();
9491 test_ret += test_xmlGetParameterEntity();
9492 test_ret += test_xmlGetPredefinedEntity();
9493 test_ret += test_xmlInitializePredefinedEntities();
Daniel Veillardd93f6252004-11-02 15:53:51 +00009494
Daniel Veillard42595322004-11-08 10:52:06 +00009495 if (test_ret != 0)
9496 printf("Module entities: %d errors\n", test_ret);
9497 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009498}
9499
9500static int
9501test_xmlHashAddEntry(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009502 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009503
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009504 int mem_base;
9505 int ret_val;
9506 xmlHashTablePtr table; /* the hash table */
9507 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009508 xmlChar * name; /* the name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009509 int n_name;
9510 void * userdata; /* a pointer to the userdata */
9511 int n_userdata;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009512
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009513 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9514 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9515 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
9516 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009517 table = gen_xmlHashTablePtr(n_table, 0);
9518 name = gen_const_xmlChar_ptr(n_name, 1);
9519 userdata = gen_userdata(n_userdata, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009520
William M. Brackf13f77f2004-11-12 16:03:48 +00009521 ret_val = xmlHashAddEntry(table, (const xmlChar *)name, userdata);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009522 desret_int(ret_val);
9523 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009524 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009525 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +00009526 des_userdata(n_userdata, userdata, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009527 xmlResetLastError();
9528 if (mem_base != xmlMemBlocks()) {
9529 printf("Leak of %d blocks found in xmlHashAddEntry",
9530 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009531 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009532 printf(" %d", n_table);
9533 printf(" %d", n_name);
9534 printf(" %d", n_userdata);
9535 printf("\n");
9536 }
9537 }
9538 }
9539 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009540 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009541
Daniel Veillard42595322004-11-08 10:52:06 +00009542 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009543}
9544
9545
9546static int
9547test_xmlHashAddEntry2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009548 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009549
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009550 int mem_base;
9551 int ret_val;
9552 xmlHashTablePtr table; /* the hash table */
9553 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009554 xmlChar * name; /* the name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009555 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009556 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009557 int n_name2;
9558 void * userdata; /* a pointer to the userdata */
9559 int n_userdata;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009560
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009561 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9562 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9563 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9564 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
9565 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009566 table = gen_xmlHashTablePtr(n_table, 0);
9567 name = gen_const_xmlChar_ptr(n_name, 1);
9568 name2 = gen_const_xmlChar_ptr(n_name2, 2);
9569 userdata = gen_userdata(n_userdata, 3);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009570
William M. Brackf13f77f2004-11-12 16:03:48 +00009571 ret_val = xmlHashAddEntry2(table, (const xmlChar *)name, (const xmlChar *)name2, userdata);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009572 desret_int(ret_val);
9573 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009574 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009575 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
9576 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +00009577 des_userdata(n_userdata, userdata, 3);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009578 xmlResetLastError();
9579 if (mem_base != xmlMemBlocks()) {
9580 printf("Leak of %d blocks found in xmlHashAddEntry2",
9581 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009582 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009583 printf(" %d", n_table);
9584 printf(" %d", n_name);
9585 printf(" %d", n_name2);
9586 printf(" %d", n_userdata);
9587 printf("\n");
9588 }
9589 }
9590 }
9591 }
9592 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009593 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009594
Daniel Veillard42595322004-11-08 10:52:06 +00009595 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009596}
9597
9598
9599static int
9600test_xmlHashAddEntry3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009601 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009602
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009603 int mem_base;
9604 int ret_val;
9605 xmlHashTablePtr table; /* the hash table */
9606 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009607 xmlChar * name; /* the name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009608 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009609 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009610 int n_name2;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009611 xmlChar * name3; /* a third name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009612 int n_name3;
9613 void * userdata; /* a pointer to the userdata */
9614 int n_userdata;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009615
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009616 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9617 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9618 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9619 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
9620 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
9621 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009622 table = gen_xmlHashTablePtr(n_table, 0);
9623 name = gen_const_xmlChar_ptr(n_name, 1);
9624 name2 = gen_const_xmlChar_ptr(n_name2, 2);
9625 name3 = gen_const_xmlChar_ptr(n_name3, 3);
9626 userdata = gen_userdata(n_userdata, 4);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009627
William M. Brackf13f77f2004-11-12 16:03:48 +00009628 ret_val = xmlHashAddEntry3(table, (const xmlChar *)name, (const xmlChar *)name2, (const xmlChar *)name3, userdata);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009629 desret_int(ret_val);
9630 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009631 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009632 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
9633 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
9634 des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 3);
Daniel Veillard3d97e662004-11-04 10:49:00 +00009635 des_userdata(n_userdata, userdata, 4);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009636 xmlResetLastError();
9637 if (mem_base != xmlMemBlocks()) {
9638 printf("Leak of %d blocks found in xmlHashAddEntry3",
9639 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009640 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009641 printf(" %d", n_table);
9642 printf(" %d", n_name);
9643 printf(" %d", n_name2);
9644 printf(" %d", n_name3);
9645 printf(" %d", n_userdata);
9646 printf("\n");
9647 }
9648 }
9649 }
9650 }
9651 }
9652 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009653 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009654
Daniel Veillard42595322004-11-08 10:52:06 +00009655 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009656}
9657
9658
9659static int
9660test_xmlHashCopy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009661 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009662
9663
9664 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009665 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009666}
9667
9668
9669static int
9670test_xmlHashCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009671 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009672
9673
9674 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009675 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009676}
9677
9678
9679static int
Daniel Veillard2ae13382005-01-25 23:45:06 +00009680test_xmlHashCreateDict(void) {
9681 int test_ret = 0;
9682
9683
9684 /* missing type support */
9685 return(test_ret);
9686}
9687
9688
9689static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00009690test_xmlHashLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009691 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009692
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009693 int mem_base;
9694 void * ret_val;
9695 xmlHashTablePtr table; /* the hash table */
9696 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009697 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009698 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009699
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009700 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9701 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9702 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009703 table = gen_xmlHashTablePtr(n_table, 0);
9704 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009705
William M. Brackf13f77f2004-11-12 16:03:48 +00009706 ret_val = xmlHashLookup(table, (const xmlChar *)name);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009707 desret_void_ptr(ret_val);
9708 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009709 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009710 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009711 xmlResetLastError();
9712 if (mem_base != xmlMemBlocks()) {
9713 printf("Leak of %d blocks found in xmlHashLookup",
9714 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009715 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009716 printf(" %d", n_table);
9717 printf(" %d", n_name);
9718 printf("\n");
9719 }
9720 }
9721 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009722 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009723
Daniel Veillard42595322004-11-08 10:52:06 +00009724 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009725}
9726
9727
9728static int
9729test_xmlHashLookup2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009730 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009731
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009732 int mem_base;
9733 void * ret_val;
9734 xmlHashTablePtr table; /* the hash table */
9735 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009736 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009737 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009738 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009739 int n_name2;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009740
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009741 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9742 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9743 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9744 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009745 table = gen_xmlHashTablePtr(n_table, 0);
9746 name = gen_const_xmlChar_ptr(n_name, 1);
9747 name2 = gen_const_xmlChar_ptr(n_name2, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009748
William M. Brackf13f77f2004-11-12 16:03:48 +00009749 ret_val = xmlHashLookup2(table, (const xmlChar *)name, (const xmlChar *)name2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009750 desret_void_ptr(ret_val);
9751 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009752 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009753 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
9754 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009755 xmlResetLastError();
9756 if (mem_base != xmlMemBlocks()) {
9757 printf("Leak of %d blocks found in xmlHashLookup2",
9758 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009759 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009760 printf(" %d", n_table);
9761 printf(" %d", n_name);
9762 printf(" %d", n_name2);
9763 printf("\n");
9764 }
9765 }
9766 }
9767 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009768 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009769
Daniel Veillard42595322004-11-08 10:52:06 +00009770 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009771}
9772
9773
9774static int
9775test_xmlHashLookup3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009776 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009777
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009778 int mem_base;
9779 void * ret_val;
9780 xmlHashTablePtr table; /* the hash table */
9781 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009782 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009783 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009784 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009785 int n_name2;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009786 xmlChar * name3; /* a third name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009787 int n_name3;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009788
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009789 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9790 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9791 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9792 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
9793 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009794 table = gen_xmlHashTablePtr(n_table, 0);
9795 name = gen_const_xmlChar_ptr(n_name, 1);
9796 name2 = gen_const_xmlChar_ptr(n_name2, 2);
9797 name3 = gen_const_xmlChar_ptr(n_name3, 3);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009798
William M. Brackf13f77f2004-11-12 16:03:48 +00009799 ret_val = xmlHashLookup3(table, (const xmlChar *)name, (const xmlChar *)name2, (const xmlChar *)name3);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009800 desret_void_ptr(ret_val);
9801 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009802 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009803 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
9804 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
9805 des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 3);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009806 xmlResetLastError();
9807 if (mem_base != xmlMemBlocks()) {
9808 printf("Leak of %d blocks found in xmlHashLookup3",
9809 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009810 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009811 printf(" %d", n_table);
9812 printf(" %d", n_name);
9813 printf(" %d", n_name2);
9814 printf(" %d", n_name3);
9815 printf("\n");
9816 }
9817 }
9818 }
9819 }
9820 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009821 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009822
Daniel Veillard42595322004-11-08 10:52:06 +00009823 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009824}
9825
9826
9827static int
9828test_xmlHashQLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009829 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009830
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009831 int mem_base;
9832 void * ret_val;
9833 xmlHashTablePtr table; /* the hash table */
9834 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009835 xmlChar * prefix; /* the prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009836 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009837 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009838 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009839
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009840 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9841 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
9842 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9843 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009844 table = gen_xmlHashTablePtr(n_table, 0);
9845 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
9846 name = gen_const_xmlChar_ptr(n_name, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009847
William M. Brackf13f77f2004-11-12 16:03:48 +00009848 ret_val = xmlHashQLookup(table, (const xmlChar *)prefix, (const xmlChar *)name);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009849 desret_void_ptr(ret_val);
9850 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009851 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009852 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
9853 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009854 xmlResetLastError();
9855 if (mem_base != xmlMemBlocks()) {
9856 printf("Leak of %d blocks found in xmlHashQLookup",
9857 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009858 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009859 printf(" %d", n_table);
9860 printf(" %d", n_prefix);
9861 printf(" %d", n_name);
9862 printf("\n");
9863 }
9864 }
9865 }
9866 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009867 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009868
Daniel Veillard42595322004-11-08 10:52:06 +00009869 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009870}
9871
9872
9873static int
9874test_xmlHashQLookup2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009875 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009876
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009877 int mem_base;
9878 void * ret_val;
9879 xmlHashTablePtr table; /* the hash table */
9880 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009881 xmlChar * prefix; /* the prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009882 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009883 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009884 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009885 xmlChar * prefix2; /* the second prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009886 int n_prefix2;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009887 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009888 int n_name2;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009889
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009890 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9891 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
9892 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9893 for (n_prefix2 = 0;n_prefix2 < gen_nb_const_xmlChar_ptr;n_prefix2++) {
9894 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9895 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009896 table = gen_xmlHashTablePtr(n_table, 0);
9897 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
9898 name = gen_const_xmlChar_ptr(n_name, 2);
9899 prefix2 = gen_const_xmlChar_ptr(n_prefix2, 3);
9900 name2 = gen_const_xmlChar_ptr(n_name2, 4);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009901
William M. Brackf13f77f2004-11-12 16:03:48 +00009902 ret_val = xmlHashQLookup2(table, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)prefix2, (const xmlChar *)name2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009903 desret_void_ptr(ret_val);
9904 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009905 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009906 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
9907 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
9908 des_const_xmlChar_ptr(n_prefix2, (const xmlChar *)prefix2, 3);
9909 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 4);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009910 xmlResetLastError();
9911 if (mem_base != xmlMemBlocks()) {
9912 printf("Leak of %d blocks found in xmlHashQLookup2",
9913 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009914 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009915 printf(" %d", n_table);
9916 printf(" %d", n_prefix);
9917 printf(" %d", n_name);
9918 printf(" %d", n_prefix2);
9919 printf(" %d", n_name2);
9920 printf("\n");
9921 }
9922 }
9923 }
9924 }
9925 }
9926 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009927 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009928
Daniel Veillard42595322004-11-08 10:52:06 +00009929 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009930}
9931
9932
9933static int
9934test_xmlHashQLookup3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009935 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009936
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009937 int mem_base;
9938 void * ret_val;
9939 xmlHashTablePtr table; /* the hash table */
9940 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009941 xmlChar * prefix; /* the prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009942 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009943 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009944 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009945 xmlChar * prefix2; /* the second prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009946 int n_prefix2;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009947 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009948 int n_name2;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009949 xmlChar * prefix3; /* the third prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009950 int n_prefix3;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009951 xmlChar * name3; /* a third name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009952 int n_name3;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009953
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009954 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9955 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
9956 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9957 for (n_prefix2 = 0;n_prefix2 < gen_nb_const_xmlChar_ptr;n_prefix2++) {
9958 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9959 for (n_prefix3 = 0;n_prefix3 < gen_nb_const_xmlChar_ptr;n_prefix3++) {
9960 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
9961 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009962 table = gen_xmlHashTablePtr(n_table, 0);
9963 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
9964 name = gen_const_xmlChar_ptr(n_name, 2);
9965 prefix2 = gen_const_xmlChar_ptr(n_prefix2, 3);
9966 name2 = gen_const_xmlChar_ptr(n_name2, 4);
9967 prefix3 = gen_const_xmlChar_ptr(n_prefix3, 5);
9968 name3 = gen_const_xmlChar_ptr(n_name3, 6);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009969
William M. Brackf13f77f2004-11-12 16:03:48 +00009970 ret_val = xmlHashQLookup3(table, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)prefix2, (const xmlChar *)name2, (const xmlChar *)prefix3, (const xmlChar *)name3);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009971 desret_void_ptr(ret_val);
9972 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009973 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009974 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
9975 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
9976 des_const_xmlChar_ptr(n_prefix2, (const xmlChar *)prefix2, 3);
9977 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 4);
9978 des_const_xmlChar_ptr(n_prefix3, (const xmlChar *)prefix3, 5);
9979 des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 6);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009980 xmlResetLastError();
9981 if (mem_base != xmlMemBlocks()) {
9982 printf("Leak of %d blocks found in xmlHashQLookup3",
9983 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009984 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009985 printf(" %d", n_table);
9986 printf(" %d", n_prefix);
9987 printf(" %d", n_name);
9988 printf(" %d", n_prefix2);
9989 printf(" %d", n_name2);
9990 printf(" %d", n_prefix3);
9991 printf(" %d", n_name3);
9992 printf("\n");
9993 }
9994 }
9995 }
9996 }
9997 }
9998 }
9999 }
10000 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010001 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010002
Daniel Veillard42595322004-11-08 10:52:06 +000010003 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010004}
10005
10006
10007static int
10008test_xmlHashRemoveEntry(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010009 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010010
Daniel Veillard42595322004-11-08 10:52:06 +000010011 int mem_base;
10012 int ret_val;
10013 xmlHashTablePtr table; /* the hash table */
10014 int n_table;
10015 xmlChar * name; /* the name of the userdata */
10016 int n_name;
10017 xmlHashDeallocator f; /* the deallocator function for removed item (if any) */
10018 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010019
Daniel Veillard42595322004-11-08 10:52:06 +000010020 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10021 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10022 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10023 mem_base = xmlMemBlocks();
10024 table = gen_xmlHashTablePtr(n_table, 0);
10025 name = gen_const_xmlChar_ptr(n_name, 1);
10026 f = gen_xmlHashDeallocator(n_f, 2);
10027
William M. Brackf13f77f2004-11-12 16:03:48 +000010028 ret_val = xmlHashRemoveEntry(table, (const xmlChar *)name, f);
Daniel Veillard42595322004-11-08 10:52:06 +000010029 desret_int(ret_val);
10030 call_tests++;
10031 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010032 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard42595322004-11-08 10:52:06 +000010033 des_xmlHashDeallocator(n_f, f, 2);
10034 xmlResetLastError();
10035 if (mem_base != xmlMemBlocks()) {
10036 printf("Leak of %d blocks found in xmlHashRemoveEntry",
10037 xmlMemBlocks() - mem_base);
10038 test_ret++;
10039 printf(" %d", n_table);
10040 printf(" %d", n_name);
10041 printf(" %d", n_f);
10042 printf("\n");
10043 }
10044 }
10045 }
10046 }
Daniel Veillard42595322004-11-08 10:52:06 +000010047 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010048
Daniel Veillard42595322004-11-08 10:52:06 +000010049 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010050}
10051
10052
10053static int
10054test_xmlHashRemoveEntry2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010055 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010056
Daniel Veillard42595322004-11-08 10:52:06 +000010057 int mem_base;
10058 int ret_val;
10059 xmlHashTablePtr table; /* the hash table */
10060 int n_table;
10061 xmlChar * name; /* the name of the userdata */
10062 int n_name;
10063 xmlChar * name2; /* a second name of the userdata */
10064 int n_name2;
10065 xmlHashDeallocator f; /* the deallocator function for removed item (if any) */
10066 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010067
Daniel Veillard42595322004-11-08 10:52:06 +000010068 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10069 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10070 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10071 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10072 mem_base = xmlMemBlocks();
10073 table = gen_xmlHashTablePtr(n_table, 0);
10074 name = gen_const_xmlChar_ptr(n_name, 1);
10075 name2 = gen_const_xmlChar_ptr(n_name2, 2);
10076 f = gen_xmlHashDeallocator(n_f, 3);
10077
William M. Brackf13f77f2004-11-12 16:03:48 +000010078 ret_val = xmlHashRemoveEntry2(table, (const xmlChar *)name, (const xmlChar *)name2, f);
Daniel Veillard42595322004-11-08 10:52:06 +000010079 desret_int(ret_val);
10080 call_tests++;
10081 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010082 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
10083 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
Daniel Veillard42595322004-11-08 10:52:06 +000010084 des_xmlHashDeallocator(n_f, f, 3);
10085 xmlResetLastError();
10086 if (mem_base != xmlMemBlocks()) {
10087 printf("Leak of %d blocks found in xmlHashRemoveEntry2",
10088 xmlMemBlocks() - mem_base);
10089 test_ret++;
10090 printf(" %d", n_table);
10091 printf(" %d", n_name);
10092 printf(" %d", n_name2);
10093 printf(" %d", n_f);
10094 printf("\n");
10095 }
10096 }
10097 }
10098 }
10099 }
Daniel Veillard42595322004-11-08 10:52:06 +000010100 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010101
Daniel Veillard42595322004-11-08 10:52:06 +000010102 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010103}
10104
10105
10106static int
10107test_xmlHashRemoveEntry3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010108 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010109
Daniel Veillard42595322004-11-08 10:52:06 +000010110 int mem_base;
10111 int ret_val;
10112 xmlHashTablePtr table; /* the hash table */
10113 int n_table;
10114 xmlChar * name; /* the name of the userdata */
10115 int n_name;
10116 xmlChar * name2; /* a second name of the userdata */
10117 int n_name2;
10118 xmlChar * name3; /* a third name of the userdata */
10119 int n_name3;
10120 xmlHashDeallocator f; /* the deallocator function for removed item (if any) */
10121 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010122
Daniel Veillard42595322004-11-08 10:52:06 +000010123 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10124 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10125 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10126 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
10127 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10128 mem_base = xmlMemBlocks();
10129 table = gen_xmlHashTablePtr(n_table, 0);
10130 name = gen_const_xmlChar_ptr(n_name, 1);
10131 name2 = gen_const_xmlChar_ptr(n_name2, 2);
10132 name3 = gen_const_xmlChar_ptr(n_name3, 3);
10133 f = gen_xmlHashDeallocator(n_f, 4);
10134
William M. Brackf13f77f2004-11-12 16:03:48 +000010135 ret_val = xmlHashRemoveEntry3(table, (const xmlChar *)name, (const xmlChar *)name2, (const xmlChar *)name3, f);
Daniel Veillard42595322004-11-08 10:52:06 +000010136 desret_int(ret_val);
10137 call_tests++;
10138 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010139 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
10140 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
10141 des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 3);
Daniel Veillard42595322004-11-08 10:52:06 +000010142 des_xmlHashDeallocator(n_f, f, 4);
10143 xmlResetLastError();
10144 if (mem_base != xmlMemBlocks()) {
10145 printf("Leak of %d blocks found in xmlHashRemoveEntry3",
10146 xmlMemBlocks() - mem_base);
10147 test_ret++;
10148 printf(" %d", n_table);
10149 printf(" %d", n_name);
10150 printf(" %d", n_name2);
10151 printf(" %d", n_name3);
10152 printf(" %d", n_f);
10153 printf("\n");
10154 }
10155 }
10156 }
10157 }
10158 }
10159 }
Daniel Veillard42595322004-11-08 10:52:06 +000010160 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010161
Daniel Veillard42595322004-11-08 10:52:06 +000010162 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010163}
10164
10165
10166static int
10167test_xmlHashScan(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010168 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010169
10170
10171 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010172 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010173}
10174
10175
10176static int
10177test_xmlHashScan3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010178 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010179
10180
10181 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010182 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010183}
10184
10185
10186static int
10187test_xmlHashScanFull(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010188 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010189
10190
10191 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010192 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010193}
10194
10195
10196static int
10197test_xmlHashScanFull3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010198 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010199
10200
10201 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010202 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010203}
10204
10205
10206static int
10207test_xmlHashSize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010208 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010209
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010210 int mem_base;
10211 int ret_val;
10212 xmlHashTablePtr table; /* the hash table */
10213 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010214
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010215 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10216 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010217 table = gen_xmlHashTablePtr(n_table, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010218
10219 ret_val = xmlHashSize(table);
10220 desret_int(ret_val);
10221 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010222 des_xmlHashTablePtr(n_table, table, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010223 xmlResetLastError();
10224 if (mem_base != xmlMemBlocks()) {
10225 printf("Leak of %d blocks found in xmlHashSize",
10226 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010227 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010228 printf(" %d", n_table);
10229 printf("\n");
10230 }
10231 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010232 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010233
Daniel Veillard42595322004-11-08 10:52:06 +000010234 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010235}
10236
10237
10238static int
10239test_xmlHashUpdateEntry(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010240 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010241
Daniel Veillard42595322004-11-08 10:52:06 +000010242 int mem_base;
10243 int ret_val;
10244 xmlHashTablePtr table; /* the hash table */
10245 int n_table;
10246 xmlChar * name; /* the name of the userdata */
10247 int n_name;
10248 void * userdata; /* a pointer to the userdata */
10249 int n_userdata;
10250 xmlHashDeallocator f; /* the deallocator function for replaced item (if any) */
10251 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010252
Daniel Veillard42595322004-11-08 10:52:06 +000010253 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10254 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10255 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
10256 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10257 mem_base = xmlMemBlocks();
10258 table = gen_xmlHashTablePtr(n_table, 0);
10259 name = gen_const_xmlChar_ptr(n_name, 1);
10260 userdata = gen_userdata(n_userdata, 2);
10261 f = gen_xmlHashDeallocator(n_f, 3);
10262
William M. Brackf13f77f2004-11-12 16:03:48 +000010263 ret_val = xmlHashUpdateEntry(table, (const xmlChar *)name, userdata, f);
Daniel Veillard42595322004-11-08 10:52:06 +000010264 desret_int(ret_val);
10265 call_tests++;
10266 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010267 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard42595322004-11-08 10:52:06 +000010268 des_userdata(n_userdata, userdata, 2);
10269 des_xmlHashDeallocator(n_f, f, 3);
10270 xmlResetLastError();
10271 if (mem_base != xmlMemBlocks()) {
10272 printf("Leak of %d blocks found in xmlHashUpdateEntry",
10273 xmlMemBlocks() - mem_base);
10274 test_ret++;
10275 printf(" %d", n_table);
10276 printf(" %d", n_name);
10277 printf(" %d", n_userdata);
10278 printf(" %d", n_f);
10279 printf("\n");
10280 }
10281 }
10282 }
10283 }
10284 }
Daniel Veillard42595322004-11-08 10:52:06 +000010285 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010286
Daniel Veillard42595322004-11-08 10:52:06 +000010287 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010288}
10289
10290
10291static int
10292test_xmlHashUpdateEntry2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010293 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010294
Daniel Veillard42595322004-11-08 10:52:06 +000010295 int mem_base;
10296 int ret_val;
10297 xmlHashTablePtr table; /* the hash table */
10298 int n_table;
10299 xmlChar * name; /* the name of the userdata */
10300 int n_name;
10301 xmlChar * name2; /* a second name of the userdata */
10302 int n_name2;
10303 void * userdata; /* a pointer to the userdata */
10304 int n_userdata;
10305 xmlHashDeallocator f; /* the deallocator function for replaced item (if any) */
10306 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010307
Daniel Veillard42595322004-11-08 10:52:06 +000010308 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10309 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10310 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10311 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
10312 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10313 mem_base = xmlMemBlocks();
10314 table = gen_xmlHashTablePtr(n_table, 0);
10315 name = gen_const_xmlChar_ptr(n_name, 1);
10316 name2 = gen_const_xmlChar_ptr(n_name2, 2);
10317 userdata = gen_userdata(n_userdata, 3);
10318 f = gen_xmlHashDeallocator(n_f, 4);
10319
William M. Brackf13f77f2004-11-12 16:03:48 +000010320 ret_val = xmlHashUpdateEntry2(table, (const xmlChar *)name, (const xmlChar *)name2, userdata, f);
Daniel Veillard42595322004-11-08 10:52:06 +000010321 desret_int(ret_val);
10322 call_tests++;
10323 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010324 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
10325 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
Daniel Veillard42595322004-11-08 10:52:06 +000010326 des_userdata(n_userdata, userdata, 3);
10327 des_xmlHashDeallocator(n_f, f, 4);
10328 xmlResetLastError();
10329 if (mem_base != xmlMemBlocks()) {
10330 printf("Leak of %d blocks found in xmlHashUpdateEntry2",
10331 xmlMemBlocks() - mem_base);
10332 test_ret++;
10333 printf(" %d", n_table);
10334 printf(" %d", n_name);
10335 printf(" %d", n_name2);
10336 printf(" %d", n_userdata);
10337 printf(" %d", n_f);
10338 printf("\n");
10339 }
10340 }
10341 }
10342 }
10343 }
10344 }
Daniel Veillard42595322004-11-08 10:52:06 +000010345 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010346
Daniel Veillard42595322004-11-08 10:52:06 +000010347 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010348}
10349
10350
10351static int
10352test_xmlHashUpdateEntry3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010353 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010354
Daniel Veillard42595322004-11-08 10:52:06 +000010355 int mem_base;
10356 int ret_val;
10357 xmlHashTablePtr table; /* the hash table */
10358 int n_table;
10359 xmlChar * name; /* the name of the userdata */
10360 int n_name;
10361 xmlChar * name2; /* a second name of the userdata */
10362 int n_name2;
10363 xmlChar * name3; /* a third name of the userdata */
10364 int n_name3;
10365 void * userdata; /* a pointer to the userdata */
10366 int n_userdata;
10367 xmlHashDeallocator f; /* the deallocator function for replaced item (if any) */
10368 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010369
Daniel Veillard42595322004-11-08 10:52:06 +000010370 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10371 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10372 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10373 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
10374 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
10375 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10376 mem_base = xmlMemBlocks();
10377 table = gen_xmlHashTablePtr(n_table, 0);
10378 name = gen_const_xmlChar_ptr(n_name, 1);
10379 name2 = gen_const_xmlChar_ptr(n_name2, 2);
10380 name3 = gen_const_xmlChar_ptr(n_name3, 3);
10381 userdata = gen_userdata(n_userdata, 4);
10382 f = gen_xmlHashDeallocator(n_f, 5);
10383
William M. Brackf13f77f2004-11-12 16:03:48 +000010384 ret_val = xmlHashUpdateEntry3(table, (const xmlChar *)name, (const xmlChar *)name2, (const xmlChar *)name3, userdata, f);
Daniel Veillard42595322004-11-08 10:52:06 +000010385 desret_int(ret_val);
10386 call_tests++;
10387 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010388 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
10389 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
10390 des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 3);
Daniel Veillard42595322004-11-08 10:52:06 +000010391 des_userdata(n_userdata, userdata, 4);
10392 des_xmlHashDeallocator(n_f, f, 5);
10393 xmlResetLastError();
10394 if (mem_base != xmlMemBlocks()) {
10395 printf("Leak of %d blocks found in xmlHashUpdateEntry3",
10396 xmlMemBlocks() - mem_base);
10397 test_ret++;
10398 printf(" %d", n_table);
10399 printf(" %d", n_name);
10400 printf(" %d", n_name2);
10401 printf(" %d", n_name3);
10402 printf(" %d", n_userdata);
10403 printf(" %d", n_f);
10404 printf("\n");
10405 }
10406 }
10407 }
10408 }
10409 }
10410 }
10411 }
Daniel Veillard42595322004-11-08 10:52:06 +000010412 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010413
Daniel Veillard42595322004-11-08 10:52:06 +000010414 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010415}
10416
10417static int
10418test_hash(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010419 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010420
Daniel Veillard2ae13382005-01-25 23:45:06 +000010421 if (quiet == 0) printf("Testing hash : 16 of 24 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000010422 test_ret += test_xmlHashAddEntry();
10423 test_ret += test_xmlHashAddEntry2();
10424 test_ret += test_xmlHashAddEntry3();
10425 test_ret += test_xmlHashCopy();
10426 test_ret += test_xmlHashCreate();
Daniel Veillard2ae13382005-01-25 23:45:06 +000010427 test_ret += test_xmlHashCreateDict();
Daniel Veillard42595322004-11-08 10:52:06 +000010428 test_ret += test_xmlHashLookup();
10429 test_ret += test_xmlHashLookup2();
10430 test_ret += test_xmlHashLookup3();
10431 test_ret += test_xmlHashQLookup();
10432 test_ret += test_xmlHashQLookup2();
10433 test_ret += test_xmlHashQLookup3();
10434 test_ret += test_xmlHashRemoveEntry();
10435 test_ret += test_xmlHashRemoveEntry2();
10436 test_ret += test_xmlHashRemoveEntry3();
10437 test_ret += test_xmlHashScan();
10438 test_ret += test_xmlHashScan3();
10439 test_ret += test_xmlHashScanFull();
10440 test_ret += test_xmlHashScanFull3();
10441 test_ret += test_xmlHashSize();
10442 test_ret += test_xmlHashUpdateEntry();
10443 test_ret += test_xmlHashUpdateEntry2();
10444 test_ret += test_xmlHashUpdateEntry3();
Daniel Veillardd93f6252004-11-02 15:53:51 +000010445
Daniel Veillard42595322004-11-08 10:52:06 +000010446 if (test_ret != 0)
10447 printf("Module hash: %d errors\n", test_ret);
10448 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010449}
10450
Daniel Veillardce682bc2004-11-05 17:22:25 +000010451#define gen_nb_xmlLinkPtr 1
10452static xmlLinkPtr gen_xmlLinkPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
10453 return(NULL);
10454}
10455static void des_xmlLinkPtr(int no ATTRIBUTE_UNUSED, xmlLinkPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
10456}
10457
Daniel Veillardd93f6252004-11-02 15:53:51 +000010458static int
10459test_xmlLinkGetData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010460 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010461
Daniel Veillardce682bc2004-11-05 17:22:25 +000010462 int mem_base;
10463 void * ret_val;
10464 xmlLinkPtr lk; /* a link */
10465 int n_lk;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010466
Daniel Veillardce682bc2004-11-05 17:22:25 +000010467 for (n_lk = 0;n_lk < gen_nb_xmlLinkPtr;n_lk++) {
10468 mem_base = xmlMemBlocks();
10469 lk = gen_xmlLinkPtr(n_lk, 0);
10470
10471 ret_val = xmlLinkGetData(lk);
10472 desret_void_ptr(ret_val);
10473 call_tests++;
10474 des_xmlLinkPtr(n_lk, lk, 0);
10475 xmlResetLastError();
10476 if (mem_base != xmlMemBlocks()) {
10477 printf("Leak of %d blocks found in xmlLinkGetData",
10478 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010479 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010480 printf(" %d", n_lk);
10481 printf("\n");
10482 }
10483 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000010484 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010485
Daniel Veillard42595322004-11-08 10:52:06 +000010486 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010487}
10488
10489
10490static int
10491test_xmlListAppend(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010492 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010493
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010494 int mem_base;
10495 int ret_val;
10496 xmlListPtr l; /* a list */
10497 int n_l;
10498 void * data; /* the data */
10499 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010500
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010501 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10502 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10503 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010504 l = gen_xmlListPtr(n_l, 0);
10505 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010506
10507 ret_val = xmlListAppend(l, data);
10508 desret_int(ret_val);
10509 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010510 des_xmlListPtr(n_l, l, 0);
10511 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010512 xmlResetLastError();
10513 if (mem_base != xmlMemBlocks()) {
10514 printf("Leak of %d blocks found in xmlListAppend",
10515 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010516 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010517 printf(" %d", n_l);
10518 printf(" %d", n_data);
10519 printf("\n");
10520 }
10521 }
10522 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010523 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010524
Daniel Veillard42595322004-11-08 10:52:06 +000010525 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010526}
10527
10528
10529static int
10530test_xmlListClear(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010531 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010532
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010533 int mem_base;
10534 xmlListPtr l; /* a list */
10535 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010536
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010537 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10538 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010539 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010540
10541 xmlListClear(l);
10542 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010543 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010544 xmlResetLastError();
10545 if (mem_base != xmlMemBlocks()) {
10546 printf("Leak of %d blocks found in xmlListClear",
10547 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010548 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010549 printf(" %d", n_l);
10550 printf("\n");
10551 }
10552 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010553 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010554
Daniel Veillard42595322004-11-08 10:52:06 +000010555 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010556}
10557
10558
Daniel Veillardce682bc2004-11-05 17:22:25 +000010559#define gen_nb_const_xmlListPtr 1
10560static xmlListPtr gen_const_xmlListPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
10561 return(NULL);
10562}
10563static void des_const_xmlListPtr(int no ATTRIBUTE_UNUSED, const xmlListPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
10564}
10565
Daniel Veillardd93f6252004-11-02 15:53:51 +000010566static int
10567test_xmlListCopy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010568 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010569
Daniel Veillardce682bc2004-11-05 17:22:25 +000010570 int mem_base;
10571 int ret_val;
10572 xmlListPtr cur; /* the new list */
10573 int n_cur;
10574 xmlListPtr old; /* the old list */
10575 int n_old;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010576
Daniel Veillardce682bc2004-11-05 17:22:25 +000010577 for (n_cur = 0;n_cur < gen_nb_xmlListPtr;n_cur++) {
10578 for (n_old = 0;n_old < gen_nb_const_xmlListPtr;n_old++) {
10579 mem_base = xmlMemBlocks();
10580 cur = gen_xmlListPtr(n_cur, 0);
10581 old = gen_const_xmlListPtr(n_old, 1);
10582
William M. Brackf13f77f2004-11-12 16:03:48 +000010583 ret_val = xmlListCopy(cur, (const xmlListPtr)old);
Daniel Veillardce682bc2004-11-05 17:22:25 +000010584 desret_int(ret_val);
10585 call_tests++;
10586 des_xmlListPtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010587 des_const_xmlListPtr(n_old, (const xmlListPtr)old, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000010588 xmlResetLastError();
10589 if (mem_base != xmlMemBlocks()) {
10590 printf("Leak of %d blocks found in xmlListCopy",
10591 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010592 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010593 printf(" %d", n_cur);
10594 printf(" %d", n_old);
10595 printf("\n");
10596 }
10597 }
10598 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000010599 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010600
Daniel Veillard42595322004-11-08 10:52:06 +000010601 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010602}
10603
10604
10605static int
10606test_xmlListCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010607 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010608
10609
10610 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010611 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010612}
10613
10614
10615static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000010616test_xmlListDup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010617 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010618
10619
10620 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010621 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010622}
10623
10624
10625static int
10626test_xmlListEmpty(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010627 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010628
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010629 int mem_base;
10630 int ret_val;
10631 xmlListPtr l; /* a list */
10632 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010633
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010634 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10635 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010636 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010637
10638 ret_val = xmlListEmpty(l);
10639 desret_int(ret_val);
10640 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010641 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010642 xmlResetLastError();
10643 if (mem_base != xmlMemBlocks()) {
10644 printf("Leak of %d blocks found in xmlListEmpty",
10645 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010646 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010647 printf(" %d", n_l);
10648 printf("\n");
10649 }
10650 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010651 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010652
Daniel Veillard42595322004-11-08 10:52:06 +000010653 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010654}
10655
10656
10657static int
10658test_xmlListEnd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010659 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010660
10661
10662 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010663 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010664}
10665
10666
10667static int
10668test_xmlListFront(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010669 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010670
10671
10672 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010673 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010674}
10675
10676
10677static int
10678test_xmlListInsert(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010679 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010680
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010681 int mem_base;
10682 int ret_val;
10683 xmlListPtr l; /* a list */
10684 int n_l;
10685 void * data; /* the data */
10686 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010687
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010688 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10689 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10690 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010691 l = gen_xmlListPtr(n_l, 0);
10692 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010693
10694 ret_val = xmlListInsert(l, data);
10695 desret_int(ret_val);
10696 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010697 des_xmlListPtr(n_l, l, 0);
10698 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010699 xmlResetLastError();
10700 if (mem_base != xmlMemBlocks()) {
10701 printf("Leak of %d blocks found in xmlListInsert",
10702 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010703 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010704 printf(" %d", n_l);
10705 printf(" %d", n_data);
10706 printf("\n");
10707 }
10708 }
10709 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010710 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010711
Daniel Veillard42595322004-11-08 10:52:06 +000010712 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010713}
10714
10715
10716static int
10717test_xmlListMerge(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010718 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010719
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010720 int mem_base;
10721 xmlListPtr l1; /* the original list */
10722 int n_l1;
10723 xmlListPtr l2; /* the new list */
10724 int n_l2;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010725
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010726 for (n_l1 = 0;n_l1 < gen_nb_xmlListPtr;n_l1++) {
10727 for (n_l2 = 0;n_l2 < gen_nb_xmlListPtr;n_l2++) {
10728 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010729 l1 = gen_xmlListPtr(n_l1, 0);
10730 l2 = gen_xmlListPtr(n_l2, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010731
10732 xmlListMerge(l1, l2);
10733 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010734 des_xmlListPtr(n_l1, l1, 0);
10735 des_xmlListPtr(n_l2, l2, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010736 xmlResetLastError();
10737 if (mem_base != xmlMemBlocks()) {
10738 printf("Leak of %d blocks found in xmlListMerge",
10739 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010740 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010741 printf(" %d", n_l1);
10742 printf(" %d", n_l2);
10743 printf("\n");
10744 }
10745 }
10746 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010747 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010748
Daniel Veillard42595322004-11-08 10:52:06 +000010749 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010750}
10751
10752
10753static int
10754test_xmlListPopBack(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010755 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010756
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010757 int mem_base;
10758 xmlListPtr l; /* a list */
10759 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010760
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010761 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10762 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010763 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010764
10765 xmlListPopBack(l);
10766 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010767 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010768 xmlResetLastError();
10769 if (mem_base != xmlMemBlocks()) {
10770 printf("Leak of %d blocks found in xmlListPopBack",
10771 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010772 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010773 printf(" %d", n_l);
10774 printf("\n");
10775 }
10776 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010777 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010778
Daniel Veillard42595322004-11-08 10:52:06 +000010779 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010780}
10781
10782
10783static int
10784test_xmlListPopFront(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010785 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010786
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010787 int mem_base;
10788 xmlListPtr l; /* a list */
10789 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010790
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010791 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10792 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010793 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010794
10795 xmlListPopFront(l);
10796 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010797 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010798 xmlResetLastError();
10799 if (mem_base != xmlMemBlocks()) {
10800 printf("Leak of %d blocks found in xmlListPopFront",
10801 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010802 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010803 printf(" %d", n_l);
10804 printf("\n");
10805 }
10806 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010807 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010808
Daniel Veillard42595322004-11-08 10:52:06 +000010809 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010810}
10811
10812
10813static int
10814test_xmlListPushBack(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010815 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010816
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010817 int mem_base;
10818 int ret_val;
10819 xmlListPtr l; /* a list */
10820 int n_l;
10821 void * data; /* new data */
10822 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010823
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010824 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10825 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10826 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010827 l = gen_xmlListPtr(n_l, 0);
10828 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010829
10830 ret_val = xmlListPushBack(l, data);
10831 desret_int(ret_val);
10832 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010833 des_xmlListPtr(n_l, l, 0);
10834 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010835 xmlResetLastError();
10836 if (mem_base != xmlMemBlocks()) {
10837 printf("Leak of %d blocks found in xmlListPushBack",
10838 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010839 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010840 printf(" %d", n_l);
10841 printf(" %d", n_data);
10842 printf("\n");
10843 }
10844 }
10845 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010846 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010847
Daniel Veillard42595322004-11-08 10:52:06 +000010848 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010849}
10850
10851
10852static int
10853test_xmlListPushFront(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010854 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010855
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010856 int mem_base;
10857 int ret_val;
10858 xmlListPtr l; /* a list */
10859 int n_l;
10860 void * data; /* new data */
10861 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010862
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010863 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10864 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10865 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010866 l = gen_xmlListPtr(n_l, 0);
10867 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010868
10869 ret_val = xmlListPushFront(l, data);
10870 desret_int(ret_val);
10871 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010872 des_xmlListPtr(n_l, l, 0);
10873 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010874 xmlResetLastError();
10875 if (mem_base != xmlMemBlocks()) {
10876 printf("Leak of %d blocks found in xmlListPushFront",
10877 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010878 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010879 printf(" %d", n_l);
10880 printf(" %d", n_data);
10881 printf("\n");
10882 }
10883 }
10884 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010885 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010886
Daniel Veillard42595322004-11-08 10:52:06 +000010887 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010888}
10889
10890
10891static int
10892test_xmlListRemoveAll(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010893 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010894
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010895 int mem_base;
10896 int ret_val;
10897 xmlListPtr l; /* a list */
10898 int n_l;
10899 void * data; /* list data */
10900 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010901
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010902 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10903 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10904 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010905 l = gen_xmlListPtr(n_l, 0);
10906 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010907
10908 ret_val = xmlListRemoveAll(l, data);
10909 desret_int(ret_val);
10910 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010911 des_xmlListPtr(n_l, l, 0);
10912 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010913 xmlResetLastError();
10914 if (mem_base != xmlMemBlocks()) {
10915 printf("Leak of %d blocks found in xmlListRemoveAll",
10916 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010917 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010918 printf(" %d", n_l);
10919 printf(" %d", n_data);
10920 printf("\n");
10921 }
10922 }
10923 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010924 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010925
Daniel Veillard42595322004-11-08 10:52:06 +000010926 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010927}
10928
10929
10930static int
10931test_xmlListRemoveFirst(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010932 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010933
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010934 int mem_base;
10935 int ret_val;
10936 xmlListPtr l; /* a list */
10937 int n_l;
10938 void * data; /* list data */
10939 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010940
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010941 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10942 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10943 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010944 l = gen_xmlListPtr(n_l, 0);
10945 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010946
10947 ret_val = xmlListRemoveFirst(l, data);
10948 desret_int(ret_val);
10949 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010950 des_xmlListPtr(n_l, l, 0);
10951 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010952 xmlResetLastError();
10953 if (mem_base != xmlMemBlocks()) {
10954 printf("Leak of %d blocks found in xmlListRemoveFirst",
10955 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010956 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010957 printf(" %d", n_l);
10958 printf(" %d", n_data);
10959 printf("\n");
10960 }
10961 }
10962 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010963 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010964
Daniel Veillard42595322004-11-08 10:52:06 +000010965 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010966}
10967
10968
10969static int
10970test_xmlListRemoveLast(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010971 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010972
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010973 int mem_base;
10974 int ret_val;
10975 xmlListPtr l; /* a list */
10976 int n_l;
10977 void * data; /* list data */
10978 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010979
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010980 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10981 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10982 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010983 l = gen_xmlListPtr(n_l, 0);
10984 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010985
10986 ret_val = xmlListRemoveLast(l, data);
10987 desret_int(ret_val);
10988 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010989 des_xmlListPtr(n_l, l, 0);
10990 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010991 xmlResetLastError();
10992 if (mem_base != xmlMemBlocks()) {
10993 printf("Leak of %d blocks found in xmlListRemoveLast",
10994 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010995 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010996 printf(" %d", n_l);
10997 printf(" %d", n_data);
10998 printf("\n");
10999 }
11000 }
11001 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011002 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011003
Daniel Veillard42595322004-11-08 10:52:06 +000011004 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011005}
11006
11007
11008static int
11009test_xmlListReverse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011010 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011011
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011012 int mem_base;
11013 xmlListPtr l; /* a list */
11014 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011015
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011016 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11017 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011018 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011019
11020 xmlListReverse(l);
11021 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011022 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011023 xmlResetLastError();
11024 if (mem_base != xmlMemBlocks()) {
11025 printf("Leak of %d blocks found in xmlListReverse",
11026 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011027 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011028 printf(" %d", n_l);
11029 printf("\n");
11030 }
11031 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011032 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011033
Daniel Veillard42595322004-11-08 10:52:06 +000011034 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011035}
11036
11037
11038static int
11039test_xmlListReverseSearch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011040 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011041
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011042 int mem_base;
11043 void * ret_val;
11044 xmlListPtr l; /* a list */
11045 int n_l;
11046 void * data; /* a search value */
11047 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011048
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011049 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11050 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
11051 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011052 l = gen_xmlListPtr(n_l, 0);
11053 data = gen_userdata(n_data, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011054
11055 ret_val = xmlListReverseSearch(l, data);
11056 desret_void_ptr(ret_val);
11057 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011058 des_xmlListPtr(n_l, l, 0);
11059 des_userdata(n_data, data, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011060 xmlResetLastError();
11061 if (mem_base != xmlMemBlocks()) {
11062 printf("Leak of %d blocks found in xmlListReverseSearch",
11063 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011064 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011065 printf(" %d", n_l);
11066 printf(" %d", n_data);
11067 printf("\n");
11068 }
11069 }
11070 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011071 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011072
Daniel Veillard42595322004-11-08 10:52:06 +000011073 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011074}
11075
11076
11077static int
11078test_xmlListReverseWalk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011079 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011080
11081
11082 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011083 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011084}
11085
11086
11087static int
11088test_xmlListSearch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011089 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011090
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011091 int mem_base;
11092 void * ret_val;
11093 xmlListPtr l; /* a list */
11094 int n_l;
11095 void * data; /* a search value */
11096 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011097
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011098 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11099 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
11100 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011101 l = gen_xmlListPtr(n_l, 0);
11102 data = gen_userdata(n_data, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011103
11104 ret_val = xmlListSearch(l, data);
11105 desret_void_ptr(ret_val);
11106 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011107 des_xmlListPtr(n_l, l, 0);
11108 des_userdata(n_data, data, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011109 xmlResetLastError();
11110 if (mem_base != xmlMemBlocks()) {
11111 printf("Leak of %d blocks found in xmlListSearch",
11112 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011113 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011114 printf(" %d", n_l);
11115 printf(" %d", n_data);
11116 printf("\n");
11117 }
11118 }
11119 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011120 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011121
Daniel Veillard42595322004-11-08 10:52:06 +000011122 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011123}
11124
11125
11126static int
11127test_xmlListSize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011128 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011129
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011130 int mem_base;
11131 int ret_val;
11132 xmlListPtr l; /* a list */
11133 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011134
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011135 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11136 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011137 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011138
11139 ret_val = xmlListSize(l);
11140 desret_int(ret_val);
11141 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011142 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011143 xmlResetLastError();
11144 if (mem_base != xmlMemBlocks()) {
11145 printf("Leak of %d blocks found in xmlListSize",
11146 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011147 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011148 printf(" %d", n_l);
11149 printf("\n");
11150 }
11151 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011152 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011153
Daniel Veillard42595322004-11-08 10:52:06 +000011154 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011155}
11156
11157
11158static int
11159test_xmlListSort(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011160 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011161
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011162 int mem_base;
11163 xmlListPtr l; /* a list */
11164 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011165
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011166 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11167 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011168 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011169
11170 xmlListSort(l);
11171 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011172 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011173 xmlResetLastError();
11174 if (mem_base != xmlMemBlocks()) {
11175 printf("Leak of %d blocks found in xmlListSort",
11176 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011177 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011178 printf(" %d", n_l);
11179 printf("\n");
11180 }
11181 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011182 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011183
Daniel Veillard42595322004-11-08 10:52:06 +000011184 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011185}
11186
11187
11188static int
11189test_xmlListWalk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011190 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011191
11192
11193 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011194 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011195}
11196
11197static int
11198test_list(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011199 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011200
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011201 if (quiet == 0) printf("Testing list : 19 of 26 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000011202 test_ret += test_xmlLinkGetData();
11203 test_ret += test_xmlListAppend();
11204 test_ret += test_xmlListClear();
11205 test_ret += test_xmlListCopy();
11206 test_ret += test_xmlListCreate();
11207 test_ret += test_xmlListDup();
11208 test_ret += test_xmlListEmpty();
11209 test_ret += test_xmlListEnd();
11210 test_ret += test_xmlListFront();
11211 test_ret += test_xmlListInsert();
11212 test_ret += test_xmlListMerge();
11213 test_ret += test_xmlListPopBack();
11214 test_ret += test_xmlListPopFront();
11215 test_ret += test_xmlListPushBack();
11216 test_ret += test_xmlListPushFront();
11217 test_ret += test_xmlListRemoveAll();
11218 test_ret += test_xmlListRemoveFirst();
11219 test_ret += test_xmlListRemoveLast();
11220 test_ret += test_xmlListReverse();
11221 test_ret += test_xmlListReverseSearch();
11222 test_ret += test_xmlListReverseWalk();
11223 test_ret += test_xmlListSearch();
11224 test_ret += test_xmlListSize();
11225 test_ret += test_xmlListSort();
11226 test_ret += test_xmlListWalk();
Daniel Veillardd93f6252004-11-02 15:53:51 +000011227
Daniel Veillard42595322004-11-08 10:52:06 +000011228 if (test_ret != 0)
11229 printf("Module list: %d errors\n", test_ret);
11230 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011231}
11232
11233static int
11234test_xmlNanoFTPCheckResponse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011235 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011236
William M. Brack21e4ef22005-01-02 09:53:13 +000011237#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011238 int mem_base;
11239 int ret_val;
11240 void * ctx; /* an FTP context */
11241 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011242
Daniel Veillard27f20102004-11-05 11:50:11 +000011243 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11244 mem_base = xmlMemBlocks();
11245 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11246
11247 ret_val = xmlNanoFTPCheckResponse(ctx);
11248 desret_int(ret_val);
11249 call_tests++;
11250 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11251 xmlResetLastError();
11252 if (mem_base != xmlMemBlocks()) {
11253 printf("Leak of %d blocks found in xmlNanoFTPCheckResponse",
11254 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011255 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011256 printf(" %d", n_ctx);
11257 printf("\n");
11258 }
11259 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011260 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011261#endif
11262
Daniel Veillard42595322004-11-08 10:52:06 +000011263 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011264}
11265
11266
11267static int
11268test_xmlNanoFTPCleanup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011269 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011270
William M. Brack21e4ef22005-01-02 09:53:13 +000011271#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000011272 int mem_base;
11273
11274 mem_base = xmlMemBlocks();
11275
11276 xmlNanoFTPCleanup();
11277 call_tests++;
11278 xmlResetLastError();
11279 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000011280 printf("Leak of %d blocks found in xmlNanoFTPCleanup",
Daniel Veillardd93f6252004-11-02 15:53:51 +000011281 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011282 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000011283 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000011284 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011285 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011286#endif
11287
Daniel Veillard42595322004-11-08 10:52:06 +000011288 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011289}
11290
11291
11292static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000011293test_xmlNanoFTPCloseConnection(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011294 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011295
William M. Brack21e4ef22005-01-02 09:53:13 +000011296#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011297 int mem_base;
Daniel Veillard27f20102004-11-05 11:50:11 +000011298 int ret_val;
11299 void * ctx; /* an FTP context */
11300 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011301
Daniel Veillard27f20102004-11-05 11:50:11 +000011302 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011303 mem_base = xmlMemBlocks();
Daniel Veillard27f20102004-11-05 11:50:11 +000011304 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011305
Daniel Veillard27f20102004-11-05 11:50:11 +000011306 ret_val = xmlNanoFTPCloseConnection(ctx);
11307 desret_int(ret_val);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011308 call_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011309 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011310 xmlResetLastError();
11311 if (mem_base != xmlMemBlocks()) {
Daniel Veillard27f20102004-11-05 11:50:11 +000011312 printf("Leak of %d blocks found in xmlNanoFTPCloseConnection",
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011313 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011314 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011315 printf(" %d", n_ctx);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011316 printf("\n");
11317 }
11318 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011319 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011320#endif
11321
Daniel Veillard42595322004-11-08 10:52:06 +000011322 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011323}
11324
11325
11326static int
11327test_xmlNanoFTPCwd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011328 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011329
William M. Brack21e4ef22005-01-02 09:53:13 +000011330#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011331 int mem_base;
11332 int ret_val;
11333 void * ctx; /* an FTP context */
11334 int n_ctx;
Daniel Veillardce682bc2004-11-05 17:22:25 +000011335 char * directory; /* a directory on the server */
Daniel Veillard27f20102004-11-05 11:50:11 +000011336 int n_directory;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011337
Daniel Veillard27f20102004-11-05 11:50:11 +000011338 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11339 for (n_directory = 0;n_directory < gen_nb_const_char_ptr;n_directory++) {
11340 mem_base = xmlMemBlocks();
11341 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11342 directory = gen_const_char_ptr(n_directory, 1);
11343
William M. Brackf13f77f2004-11-12 16:03:48 +000011344 ret_val = xmlNanoFTPCwd(ctx, (const char *)directory);
Daniel Veillard27f20102004-11-05 11:50:11 +000011345 desret_int(ret_val);
11346 call_tests++;
11347 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000011348 des_const_char_ptr(n_directory, (const char *)directory, 1);
Daniel Veillard27f20102004-11-05 11:50:11 +000011349 xmlResetLastError();
11350 if (mem_base != xmlMemBlocks()) {
11351 printf("Leak of %d blocks found in xmlNanoFTPCwd",
11352 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011353 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011354 printf(" %d", n_ctx);
11355 printf(" %d", n_directory);
11356 printf("\n");
11357 }
11358 }
11359 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011360 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011361#endif
11362
Daniel Veillard42595322004-11-08 10:52:06 +000011363 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011364}
11365
11366
11367static int
11368test_xmlNanoFTPDele(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011369 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011370
William M. Brack21e4ef22005-01-02 09:53:13 +000011371#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011372 int mem_base;
11373 int ret_val;
11374 void * ctx; /* an FTP context */
11375 int n_ctx;
11376 const char * file; /* a file or directory on the server */
11377 int n_file;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011378
Daniel Veillard27f20102004-11-05 11:50:11 +000011379 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11380 for (n_file = 0;n_file < gen_nb_filepath;n_file++) {
11381 mem_base = xmlMemBlocks();
11382 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11383 file = gen_filepath(n_file, 1);
11384
11385 ret_val = xmlNanoFTPDele(ctx, file);
11386 desret_int(ret_val);
11387 call_tests++;
11388 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11389 des_filepath(n_file, file, 1);
11390 xmlResetLastError();
11391 if (mem_base != xmlMemBlocks()) {
11392 printf("Leak of %d blocks found in xmlNanoFTPDele",
11393 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011394 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011395 printf(" %d", n_ctx);
11396 printf(" %d", n_file);
11397 printf("\n");
11398 }
11399 }
11400 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011401 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011402#endif
11403
Daniel Veillard42595322004-11-08 10:52:06 +000011404 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011405}
11406
11407
11408static int
11409test_xmlNanoFTPGet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011410 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011411
11412
11413 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011414 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011415}
11416
11417
11418static int
11419test_xmlNanoFTPGetConnection(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011420 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011421
William M. Brack21e4ef22005-01-02 09:53:13 +000011422#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011423 int mem_base;
11424 int ret_val;
11425 void * ctx; /* an FTP context */
11426 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011427
Daniel Veillard27f20102004-11-05 11:50:11 +000011428 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11429 mem_base = xmlMemBlocks();
11430 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11431
11432 ret_val = xmlNanoFTPGetConnection(ctx);
11433 desret_int(ret_val);
11434 call_tests++;
11435 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11436 xmlResetLastError();
11437 if (mem_base != xmlMemBlocks()) {
11438 printf("Leak of %d blocks found in xmlNanoFTPGetConnection",
11439 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011440 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011441 printf(" %d", n_ctx);
11442 printf("\n");
11443 }
11444 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011445 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011446#endif
11447
Daniel Veillard42595322004-11-08 10:52:06 +000011448 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011449}
11450
11451
11452static int
11453test_xmlNanoFTPGetResponse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011454 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011455
William M. Brack21e4ef22005-01-02 09:53:13 +000011456#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011457 int mem_base;
11458 int ret_val;
11459 void * ctx; /* an FTP context */
11460 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011461
Daniel Veillard27f20102004-11-05 11:50:11 +000011462 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11463 mem_base = xmlMemBlocks();
11464 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11465
11466 ret_val = xmlNanoFTPGetResponse(ctx);
11467 desret_int(ret_val);
11468 call_tests++;
11469 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11470 xmlResetLastError();
11471 if (mem_base != xmlMemBlocks()) {
11472 printf("Leak of %d blocks found in xmlNanoFTPGetResponse",
11473 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011474 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011475 printf(" %d", n_ctx);
11476 printf("\n");
11477 }
11478 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011479 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011480#endif
11481
Daniel Veillard42595322004-11-08 10:52:06 +000011482 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011483}
11484
11485
11486static int
11487test_xmlNanoFTPGetSocket(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011488 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011489
William M. Brack21e4ef22005-01-02 09:53:13 +000011490#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011491 int mem_base;
11492 int ret_val;
11493 void * ctx; /* an FTP context */
11494 int n_ctx;
11495 const char * filename; /* the file to retrieve (or NULL if path is in context). */
11496 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011497
Daniel Veillard27f20102004-11-05 11:50:11 +000011498 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11499 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
11500 mem_base = xmlMemBlocks();
11501 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11502 filename = gen_filepath(n_filename, 1);
11503
11504 ret_val = xmlNanoFTPGetSocket(ctx, filename);
11505 desret_int(ret_val);
11506 call_tests++;
11507 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11508 des_filepath(n_filename, filename, 1);
11509 xmlResetLastError();
11510 if (mem_base != xmlMemBlocks()) {
11511 printf("Leak of %d blocks found in xmlNanoFTPGetSocket",
11512 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011513 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011514 printf(" %d", n_ctx);
11515 printf(" %d", n_filename);
11516 printf("\n");
11517 }
11518 }
11519 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011520 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011521#endif
11522
Daniel Veillard42595322004-11-08 10:52:06 +000011523 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011524}
11525
11526
11527static int
11528test_xmlNanoFTPInit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011529 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011530
William M. Brack21e4ef22005-01-02 09:53:13 +000011531#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000011532 int mem_base;
11533
11534 mem_base = xmlMemBlocks();
11535
11536 xmlNanoFTPInit();
11537 call_tests++;
11538 xmlResetLastError();
11539 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000011540 printf("Leak of %d blocks found in xmlNanoFTPInit",
Daniel Veillardd93f6252004-11-02 15:53:51 +000011541 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011542 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000011543 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000011544 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011545 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011546#endif
11547
Daniel Veillard42595322004-11-08 10:52:06 +000011548 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011549}
11550
11551
11552static int
11553test_xmlNanoFTPList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011554 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011555
11556
11557 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011558 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011559}
11560
11561
11562static int
11563test_xmlNanoFTPNewCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011564 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011565
William M. Brack015ccb22005-02-13 08:18:52 +000011566#if defined(LIBXML_FTP_ENABLED)
11567 int mem_base;
11568 void * ret_val;
11569 const char * URL; /* The URL used to initialize the context */
11570 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011571
William M. Brack015ccb22005-02-13 08:18:52 +000011572 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
11573 mem_base = xmlMemBlocks();
11574 URL = gen_filepath(n_URL, 0);
11575
11576 ret_val = xmlNanoFTPNewCtxt(URL);
11577 desret_xmlNanoFTPCtxtPtr(ret_val);
11578 call_tests++;
11579 des_filepath(n_URL, URL, 0);
11580 xmlResetLastError();
11581 if (mem_base != xmlMemBlocks()) {
11582 printf("Leak of %d blocks found in xmlNanoFTPNewCtxt",
11583 xmlMemBlocks() - mem_base);
11584 test_ret++;
11585 printf(" %d", n_URL);
11586 printf("\n");
11587 }
11588 }
11589 function_tests++;
11590#endif
11591
Daniel Veillard42595322004-11-08 10:52:06 +000011592 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011593}
11594
11595
11596static int
11597test_xmlNanoFTPOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011598 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011599
William M. Brack21e4ef22005-01-02 09:53:13 +000011600#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011601 int mem_base;
11602 void * ret_val;
11603 const char * URL; /* the URL to the resource */
11604 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011605
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011606 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
11607 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011608 URL = gen_filepath(n_URL, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011609
11610 ret_val = xmlNanoFTPOpen(URL);
William M. Brack015ccb22005-02-13 08:18:52 +000011611 desret_xmlNanoFTPCtxtPtr(ret_val);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011612 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011613 des_filepath(n_URL, URL, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011614 xmlResetLastError();
11615 if (mem_base != xmlMemBlocks()) {
11616 printf("Leak of %d blocks found in xmlNanoFTPOpen",
11617 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011618 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011619 printf(" %d", n_URL);
11620 printf("\n");
11621 }
11622 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011623 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011624#endif
11625
Daniel Veillard42595322004-11-08 10:52:06 +000011626 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011627}
11628
11629
11630static int
11631test_xmlNanoFTPProxy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011632 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011633
William M. Brack21e4ef22005-01-02 09:53:13 +000011634#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000011635 char * host; /* the proxy host name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000011636 int n_host;
11637 int port; /* the proxy port */
11638 int n_port;
Daniel Veillardce682bc2004-11-05 17:22:25 +000011639 char * user; /* the proxy user name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000011640 int n_user;
Daniel Veillardce682bc2004-11-05 17:22:25 +000011641 char * passwd; /* the proxy password */
Daniel Veillardd93f6252004-11-02 15:53:51 +000011642 int n_passwd;
11643 int type; /* the type of proxy 1 for using SITE, 2 for USER a@b */
11644 int n_type;
11645
11646 for (n_host = 0;n_host < gen_nb_const_char_ptr;n_host++) {
11647 for (n_port = 0;n_port < gen_nb_int;n_port++) {
11648 for (n_user = 0;n_user < gen_nb_const_char_ptr;n_user++) {
11649 for (n_passwd = 0;n_passwd < gen_nb_const_char_ptr;n_passwd++) {
11650 for (n_type = 0;n_type < gen_nb_int;n_type++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +000011651 host = gen_const_char_ptr(n_host, 0);
11652 port = gen_int(n_port, 1);
11653 user = gen_const_char_ptr(n_user, 2);
11654 passwd = gen_const_char_ptr(n_passwd, 3);
11655 type = gen_int(n_type, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011656
William M. Brackf13f77f2004-11-12 16:03:48 +000011657 xmlNanoFTPProxy((const char *)host, port, (const char *)user, (const char *)passwd, type);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011658 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000011659 des_const_char_ptr(n_host, (const char *)host, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000011660 des_int(n_port, port, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000011661 des_const_char_ptr(n_user, (const char *)user, 2);
11662 des_const_char_ptr(n_passwd, (const char *)passwd, 3);
Daniel Veillard3d97e662004-11-04 10:49:00 +000011663 des_int(n_type, type, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011664 xmlResetLastError();
11665 }
11666 }
11667 }
11668 }
11669 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011670 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011671#endif
11672
Daniel Veillard42595322004-11-08 10:52:06 +000011673 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011674}
11675
11676
11677static int
11678test_xmlNanoFTPQuit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011679 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011680
William M. Brack21e4ef22005-01-02 09:53:13 +000011681#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011682 int mem_base;
11683 int ret_val;
11684 void * ctx; /* an FTP context */
11685 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011686
Daniel Veillard27f20102004-11-05 11:50:11 +000011687 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11688 mem_base = xmlMemBlocks();
11689 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11690
11691 ret_val = xmlNanoFTPQuit(ctx);
11692 desret_int(ret_val);
11693 call_tests++;
11694 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11695 xmlResetLastError();
11696 if (mem_base != xmlMemBlocks()) {
11697 printf("Leak of %d blocks found in xmlNanoFTPQuit",
11698 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011699 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011700 printf(" %d", n_ctx);
11701 printf("\n");
11702 }
11703 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011704 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011705#endif
11706
Daniel Veillard42595322004-11-08 10:52:06 +000011707 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011708}
11709
11710
11711static int
11712test_xmlNanoFTPRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011713 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011714
William M. Brack21e4ef22005-01-02 09:53:13 +000011715#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011716 int mem_base;
11717 int ret_val;
11718 void * ctx; /* the FTP context */
11719 int n_ctx;
11720 void * dest; /* a buffer */
11721 int n_dest;
11722 int len; /* the buffer length */
11723 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011724
Daniel Veillard27f20102004-11-05 11:50:11 +000011725 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11726 for (n_dest = 0;n_dest < gen_nb_void_ptr;n_dest++) {
11727 for (n_len = 0;n_len < gen_nb_int;n_len++) {
11728 mem_base = xmlMemBlocks();
11729 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11730 dest = gen_void_ptr(n_dest, 1);
11731 len = gen_int(n_len, 2);
11732
11733 ret_val = xmlNanoFTPRead(ctx, dest, len);
11734 desret_int(ret_val);
11735 call_tests++;
11736 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11737 des_void_ptr(n_dest, dest, 1);
11738 des_int(n_len, len, 2);
11739 xmlResetLastError();
11740 if (mem_base != xmlMemBlocks()) {
11741 printf("Leak of %d blocks found in xmlNanoFTPRead",
11742 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011743 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011744 printf(" %d", n_ctx);
11745 printf(" %d", n_dest);
11746 printf(" %d", n_len);
11747 printf("\n");
11748 }
11749 }
11750 }
11751 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011752 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011753#endif
11754
Daniel Veillard42595322004-11-08 10:52:06 +000011755 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011756}
11757
11758
11759static int
11760test_xmlNanoFTPScanProxy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011761 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011762
William M. Brack21e4ef22005-01-02 09:53:13 +000011763#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000011764 const char * URL; /* The proxy URL used to initialize the proxy context */
11765 int n_URL;
11766
11767 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +000011768 URL = gen_filepath(n_URL, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011769
11770 xmlNanoFTPScanProxy(URL);
11771 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011772 des_filepath(n_URL, URL, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011773 xmlResetLastError();
11774 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011775 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011776#endif
11777
Daniel Veillard42595322004-11-08 10:52:06 +000011778 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011779}
11780
11781
11782static int
11783test_xmlNanoFTPUpdateURL(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011784 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011785
William M. Brack21e4ef22005-01-02 09:53:13 +000011786#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011787 int mem_base;
11788 int ret_val;
11789 void * ctx; /* an FTP context */
11790 int n_ctx;
11791 const char * URL; /* The URL used to update the context */
11792 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011793
Daniel Veillard27f20102004-11-05 11:50:11 +000011794 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11795 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
11796 mem_base = xmlMemBlocks();
11797 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11798 URL = gen_filepath(n_URL, 1);
11799
11800 ret_val = xmlNanoFTPUpdateURL(ctx, URL);
11801 desret_int(ret_val);
11802 call_tests++;
11803 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11804 des_filepath(n_URL, URL, 1);
11805 xmlResetLastError();
11806 if (mem_base != xmlMemBlocks()) {
11807 printf("Leak of %d blocks found in xmlNanoFTPUpdateURL",
11808 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011809 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011810 printf(" %d", n_ctx);
11811 printf(" %d", n_URL);
11812 printf("\n");
11813 }
11814 }
11815 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011816 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011817#endif
11818
Daniel Veillard42595322004-11-08 10:52:06 +000011819 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011820}
11821
11822static int
11823test_nanoftp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011824 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011825
William M. Brack015ccb22005-02-13 08:18:52 +000011826 if (quiet == 0) printf("Testing nanoftp : 16 of 22 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000011827 test_ret += test_xmlNanoFTPCheckResponse();
11828 test_ret += test_xmlNanoFTPCleanup();
11829 test_ret += test_xmlNanoFTPCloseConnection();
11830 test_ret += test_xmlNanoFTPCwd();
11831 test_ret += test_xmlNanoFTPDele();
11832 test_ret += test_xmlNanoFTPGet();
11833 test_ret += test_xmlNanoFTPGetConnection();
11834 test_ret += test_xmlNanoFTPGetResponse();
11835 test_ret += test_xmlNanoFTPGetSocket();
11836 test_ret += test_xmlNanoFTPInit();
11837 test_ret += test_xmlNanoFTPList();
11838 test_ret += test_xmlNanoFTPNewCtxt();
11839 test_ret += test_xmlNanoFTPOpen();
11840 test_ret += test_xmlNanoFTPProxy();
11841 test_ret += test_xmlNanoFTPQuit();
11842 test_ret += test_xmlNanoFTPRead();
11843 test_ret += test_xmlNanoFTPScanProxy();
11844 test_ret += test_xmlNanoFTPUpdateURL();
Daniel Veillardd93f6252004-11-02 15:53:51 +000011845
Daniel Veillard42595322004-11-08 10:52:06 +000011846 if (test_ret != 0)
11847 printf("Module nanoftp: %d errors\n", test_ret);
11848 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011849}
11850
11851static int
11852test_xmlNanoHTTPAuthHeader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011853 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011854
William M. Brack21e4ef22005-01-02 09:53:13 +000011855#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011856 int mem_base;
11857 const char * ret_val;
11858 void * ctx; /* the HTTP context */
11859 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011860
Daniel Veillard27f20102004-11-05 11:50:11 +000011861 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
11862 mem_base = xmlMemBlocks();
11863 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
11864
11865 ret_val = xmlNanoHTTPAuthHeader(ctx);
11866 desret_const_char_ptr(ret_val);
11867 call_tests++;
11868 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
11869 xmlResetLastError();
11870 if (mem_base != xmlMemBlocks()) {
11871 printf("Leak of %d blocks found in xmlNanoHTTPAuthHeader",
11872 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011873 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011874 printf(" %d", n_ctx);
11875 printf("\n");
11876 }
11877 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011878 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011879#endif
11880
Daniel Veillard42595322004-11-08 10:52:06 +000011881 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011882}
11883
11884
11885static int
11886test_xmlNanoHTTPCleanup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011887 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011888
William M. Brack21e4ef22005-01-02 09:53:13 +000011889#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000011890 int mem_base;
11891
11892 mem_base = xmlMemBlocks();
11893
11894 xmlNanoHTTPCleanup();
11895 call_tests++;
11896 xmlResetLastError();
11897 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000011898 printf("Leak of %d blocks found in xmlNanoHTTPCleanup",
Daniel Veillardd93f6252004-11-02 15:53:51 +000011899 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011900 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000011901 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000011902 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011903 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011904#endif
11905
Daniel Veillard42595322004-11-08 10:52:06 +000011906 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011907}
11908
11909
11910static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000011911test_xmlNanoHTTPContentLength(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011912 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011913
William M. Brack21e4ef22005-01-02 09:53:13 +000011914#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011915 int mem_base;
11916 int ret_val;
11917 void * ctx; /* the HTTP context */
11918 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011919
Daniel Veillard27f20102004-11-05 11:50:11 +000011920 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
11921 mem_base = xmlMemBlocks();
11922 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
11923
11924 ret_val = xmlNanoHTTPContentLength(ctx);
11925 desret_int(ret_val);
11926 call_tests++;
11927 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
11928 xmlResetLastError();
11929 if (mem_base != xmlMemBlocks()) {
11930 printf("Leak of %d blocks found in xmlNanoHTTPContentLength",
11931 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011932 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011933 printf(" %d", n_ctx);
11934 printf("\n");
11935 }
11936 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011937 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011938#endif
11939
Daniel Veillard42595322004-11-08 10:52:06 +000011940 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011941}
11942
11943
11944static int
11945test_xmlNanoHTTPEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011946 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011947
William M. Brack21e4ef22005-01-02 09:53:13 +000011948#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011949 int mem_base;
11950 const char * ret_val;
11951 void * ctx; /* the HTTP context */
11952 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011953
Daniel Veillard27f20102004-11-05 11:50:11 +000011954 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
11955 mem_base = xmlMemBlocks();
11956 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
11957
11958 ret_val = xmlNanoHTTPEncoding(ctx);
11959 desret_const_char_ptr(ret_val);
11960 call_tests++;
11961 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
11962 xmlResetLastError();
11963 if (mem_base != xmlMemBlocks()) {
11964 printf("Leak of %d blocks found in xmlNanoHTTPEncoding",
11965 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011966 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011967 printf(" %d", n_ctx);
11968 printf("\n");
11969 }
11970 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011971 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011972#endif
11973
Daniel Veillard42595322004-11-08 10:52:06 +000011974 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011975}
11976
11977
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000011978#define gen_nb_char_ptr_ptr 1
11979static char ** gen_char_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
11980 return(NULL);
11981}
11982static void des_char_ptr_ptr(int no ATTRIBUTE_UNUSED, char ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
11983}
11984
Daniel Veillardd93f6252004-11-02 15:53:51 +000011985static int
11986test_xmlNanoHTTPFetch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011987 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011988
William M. Brack21e4ef22005-01-02 09:53:13 +000011989#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000011990 int mem_base;
11991 int ret_val;
11992 const char * URL; /* The URL to load */
11993 int n_URL;
11994 const char * filename; /* the filename where the content should be saved */
11995 int n_filename;
11996 char ** contentType; /* if available the Content-Type information will be returned at that location */
11997 int n_contentType;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011998
William M. Brack015ccb22005-02-13 08:18:52 +000011999 for (n_URL = 0;n_URL < gen_nb_fileoutput;n_URL++) {
12000 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012001 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
12002 mem_base = xmlMemBlocks();
William M. Brack015ccb22005-02-13 08:18:52 +000012003 URL = gen_fileoutput(n_URL, 0);
12004 filename = gen_fileoutput(n_filename, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012005 contentType = gen_char_ptr_ptr(n_contentType, 2);
12006
12007 ret_val = xmlNanoHTTPFetch(URL, filename, contentType);
12008 desret_int(ret_val);
12009 call_tests++;
William M. Brack015ccb22005-02-13 08:18:52 +000012010 des_fileoutput(n_URL, URL, 0);
12011 des_fileoutput(n_filename, filename, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012012 des_char_ptr_ptr(n_contentType, contentType, 2);
12013 xmlResetLastError();
12014 if (mem_base != xmlMemBlocks()) {
12015 printf("Leak of %d blocks found in xmlNanoHTTPFetch",
12016 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012017 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012018 printf(" %d", n_URL);
12019 printf(" %d", n_filename);
12020 printf(" %d", n_contentType);
12021 printf("\n");
12022 }
12023 }
12024 }
12025 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012026 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012027#endif
12028
Daniel Veillard42595322004-11-08 10:52:06 +000012029 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012030}
12031
12032
12033static int
12034test_xmlNanoHTTPInit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012035 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012036
William M. Brack21e4ef22005-01-02 09:53:13 +000012037#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000012038 int mem_base;
12039
12040 mem_base = xmlMemBlocks();
12041
12042 xmlNanoHTTPInit();
12043 call_tests++;
12044 xmlResetLastError();
12045 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012046 printf("Leak of %d blocks found in xmlNanoHTTPInit",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012047 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012048 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012049 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012050 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012051 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012052#endif
12053
Daniel Veillard42595322004-11-08 10:52:06 +000012054 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012055}
12056
12057
12058static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000012059test_xmlNanoHTTPMimeType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012060 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012061
William M. Brack21e4ef22005-01-02 09:53:13 +000012062#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000012063 int mem_base;
12064 const char * ret_val;
12065 void * ctx; /* the HTTP context */
12066 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012067
Daniel Veillard27f20102004-11-05 11:50:11 +000012068 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
12069 mem_base = xmlMemBlocks();
12070 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
12071
12072 ret_val = xmlNanoHTTPMimeType(ctx);
12073 desret_const_char_ptr(ret_val);
12074 call_tests++;
12075 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
12076 xmlResetLastError();
12077 if (mem_base != xmlMemBlocks()) {
12078 printf("Leak of %d blocks found in xmlNanoHTTPMimeType",
12079 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012080 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012081 printf(" %d", n_ctx);
12082 printf("\n");
12083 }
12084 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012085 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012086#endif
12087
Daniel Veillard42595322004-11-08 10:52:06 +000012088 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012089}
12090
12091
12092static int
12093test_xmlNanoHTTPOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012094 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012095
William M. Brack21e4ef22005-01-02 09:53:13 +000012096#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012097 int mem_base;
12098 void * ret_val;
12099 const char * URL; /* The URL to load */
12100 int n_URL;
12101 char ** contentType; /* if available the Content-Type information will be returned at that location */
12102 int n_contentType;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012103
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012104 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12105 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
12106 mem_base = xmlMemBlocks();
12107 URL = gen_filepath(n_URL, 0);
12108 contentType = gen_char_ptr_ptr(n_contentType, 1);
12109
12110 ret_val = xmlNanoHTTPOpen(URL, contentType);
William M. Brack015ccb22005-02-13 08:18:52 +000012111 desret_xmlNanoHTTPCtxtPtr(ret_val);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012112 call_tests++;
12113 des_filepath(n_URL, URL, 0);
12114 des_char_ptr_ptr(n_contentType, contentType, 1);
12115 xmlResetLastError();
12116 if (mem_base != xmlMemBlocks()) {
12117 printf("Leak of %d blocks found in xmlNanoHTTPOpen",
12118 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012119 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012120 printf(" %d", n_URL);
12121 printf(" %d", n_contentType);
12122 printf("\n");
12123 }
12124 }
12125 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012126 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012127#endif
12128
Daniel Veillard42595322004-11-08 10:52:06 +000012129 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012130}
12131
12132
12133static int
12134test_xmlNanoHTTPOpenRedir(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012135 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012136
William M. Brack21e4ef22005-01-02 09:53:13 +000012137#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012138 int mem_base;
12139 void * ret_val;
12140 const char * URL; /* The URL to load */
12141 int n_URL;
12142 char ** contentType; /* if available the Content-Type information will be returned at that location */
12143 int n_contentType;
12144 char ** redir; /* if available the redirected URL will be returned */
12145 int n_redir;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012146
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012147 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12148 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
12149 for (n_redir = 0;n_redir < gen_nb_char_ptr_ptr;n_redir++) {
12150 mem_base = xmlMemBlocks();
12151 URL = gen_filepath(n_URL, 0);
12152 contentType = gen_char_ptr_ptr(n_contentType, 1);
12153 redir = gen_char_ptr_ptr(n_redir, 2);
12154
12155 ret_val = xmlNanoHTTPOpenRedir(URL, contentType, redir);
William M. Brack015ccb22005-02-13 08:18:52 +000012156 desret_xmlNanoHTTPCtxtPtr(ret_val);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012157 call_tests++;
12158 des_filepath(n_URL, URL, 0);
12159 des_char_ptr_ptr(n_contentType, contentType, 1);
12160 des_char_ptr_ptr(n_redir, redir, 2);
12161 xmlResetLastError();
12162 if (mem_base != xmlMemBlocks()) {
12163 printf("Leak of %d blocks found in xmlNanoHTTPOpenRedir",
12164 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012165 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012166 printf(" %d", n_URL);
12167 printf(" %d", n_contentType);
12168 printf(" %d", n_redir);
12169 printf("\n");
12170 }
12171 }
12172 }
12173 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012174 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012175#endif
12176
Daniel Veillard42595322004-11-08 10:52:06 +000012177 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012178}
12179
12180
12181static int
12182test_xmlNanoHTTPRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012183 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012184
William M. Brack21e4ef22005-01-02 09:53:13 +000012185#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000012186 int mem_base;
12187 int ret_val;
12188 void * ctx; /* the HTTP context */
12189 int n_ctx;
12190 void * dest; /* a buffer */
12191 int n_dest;
12192 int len; /* the buffer length */
12193 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012194
Daniel Veillard27f20102004-11-05 11:50:11 +000012195 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
12196 for (n_dest = 0;n_dest < gen_nb_void_ptr;n_dest++) {
12197 for (n_len = 0;n_len < gen_nb_int;n_len++) {
12198 mem_base = xmlMemBlocks();
12199 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
12200 dest = gen_void_ptr(n_dest, 1);
12201 len = gen_int(n_len, 2);
12202
12203 ret_val = xmlNanoHTTPRead(ctx, dest, len);
12204 desret_int(ret_val);
12205 call_tests++;
12206 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
12207 des_void_ptr(n_dest, dest, 1);
12208 des_int(n_len, len, 2);
12209 xmlResetLastError();
12210 if (mem_base != xmlMemBlocks()) {
12211 printf("Leak of %d blocks found in xmlNanoHTTPRead",
12212 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012213 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012214 printf(" %d", n_ctx);
12215 printf(" %d", n_dest);
12216 printf(" %d", n_len);
12217 printf("\n");
12218 }
12219 }
12220 }
12221 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012222 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012223#endif
12224
Daniel Veillard42595322004-11-08 10:52:06 +000012225 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012226}
12227
12228
12229static int
12230test_xmlNanoHTTPRedir(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012231 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012232
12233
12234 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000012235 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012236}
12237
12238
12239static int
12240test_xmlNanoHTTPReturnCode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012241 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012242
William M. Brack21e4ef22005-01-02 09:53:13 +000012243#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000012244 int mem_base;
12245 int ret_val;
12246 void * ctx; /* the HTTP context */
12247 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012248
Daniel Veillard27f20102004-11-05 11:50:11 +000012249 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
12250 mem_base = xmlMemBlocks();
12251 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
12252
12253 ret_val = xmlNanoHTTPReturnCode(ctx);
12254 desret_int(ret_val);
12255 call_tests++;
12256 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
12257 xmlResetLastError();
12258 if (mem_base != xmlMemBlocks()) {
12259 printf("Leak of %d blocks found in xmlNanoHTTPReturnCode",
12260 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012261 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012262 printf(" %d", n_ctx);
12263 printf("\n");
12264 }
12265 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012266 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012267#endif
12268
Daniel Veillard42595322004-11-08 10:52:06 +000012269 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012270}
12271
12272
12273static int
12274test_xmlNanoHTTPSave(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012275 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012276
William M. Brack21e4ef22005-01-02 09:53:13 +000012277#if defined(LIBXML_HTTP_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012278 int mem_base;
12279 int ret_val;
12280 void * ctxt; /* the HTTP context */
12281 int n_ctxt;
12282 const char * filename; /* the filename where the content should be saved */
12283 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012284
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012285 for (n_ctxt = 0;n_ctxt < gen_nb_void_ptr;n_ctxt++) {
12286 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
12287 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012288 ctxt = gen_void_ptr(n_ctxt, 0);
12289 filename = gen_fileoutput(n_filename, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012290
12291 ret_val = xmlNanoHTTPSave(ctxt, filename);
12292 desret_int(ret_val);
12293 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012294 des_void_ptr(n_ctxt, ctxt, 0);
12295 des_fileoutput(n_filename, filename, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012296 xmlResetLastError();
12297 if (mem_base != xmlMemBlocks()) {
12298 printf("Leak of %d blocks found in xmlNanoHTTPSave",
12299 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012300 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012301 printf(" %d", n_ctxt);
12302 printf(" %d", n_filename);
12303 printf("\n");
12304 }
12305 }
12306 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012307 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012308#endif
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012309
Daniel Veillard42595322004-11-08 10:52:06 +000012310 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012311}
12312
12313
12314static int
12315test_xmlNanoHTTPScanProxy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012316 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012317
William M. Brack21e4ef22005-01-02 09:53:13 +000012318#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000012319 const char * URL; /* The proxy URL used to initialize the proxy context */
12320 int n_URL;
12321
12322 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +000012323 URL = gen_filepath(n_URL, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012324
12325 xmlNanoHTTPScanProxy(URL);
12326 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012327 des_filepath(n_URL, URL, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012328 xmlResetLastError();
12329 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012330 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012331#endif
12332
Daniel Veillard42595322004-11-08 10:52:06 +000012333 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012334}
12335
12336static int
12337test_nanohttp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012338 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012339
William M. Brack015ccb22005-02-13 08:18:52 +000012340 if (quiet == 0) printf("Testing nanohttp : 13 of 17 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000012341 test_ret += test_xmlNanoHTTPAuthHeader();
12342 test_ret += test_xmlNanoHTTPCleanup();
Daniel Veillard42595322004-11-08 10:52:06 +000012343 test_ret += test_xmlNanoHTTPContentLength();
12344 test_ret += test_xmlNanoHTTPEncoding();
12345 test_ret += test_xmlNanoHTTPFetch();
12346 test_ret += test_xmlNanoHTTPInit();
Daniel Veillard42595322004-11-08 10:52:06 +000012347 test_ret += test_xmlNanoHTTPMimeType();
12348 test_ret += test_xmlNanoHTTPOpen();
12349 test_ret += test_xmlNanoHTTPOpenRedir();
12350 test_ret += test_xmlNanoHTTPRead();
12351 test_ret += test_xmlNanoHTTPRedir();
12352 test_ret += test_xmlNanoHTTPReturnCode();
12353 test_ret += test_xmlNanoHTTPSave();
12354 test_ret += test_xmlNanoHTTPScanProxy();
Daniel Veillardd93f6252004-11-02 15:53:51 +000012355
Daniel Veillard42595322004-11-08 10:52:06 +000012356 if (test_ret != 0)
12357 printf("Module nanohttp: %d errors\n", test_ret);
12358 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012359}
12360
12361static int
12362test_xmlByteConsumed(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012363 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012364
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000012365 int mem_base;
12366 long ret_val;
12367 xmlParserCtxtPtr ctxt; /* an XML parser context */
12368 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012369
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000012370 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12371 mem_base = xmlMemBlocks();
12372 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12373
12374 ret_val = xmlByteConsumed(ctxt);
12375 desret_long(ret_val);
12376 call_tests++;
12377 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
12378 xmlResetLastError();
12379 if (mem_base != xmlMemBlocks()) {
12380 printf("Leak of %d blocks found in xmlByteConsumed",
12381 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012382 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000012383 printf(" %d", n_ctxt);
12384 printf("\n");
12385 }
12386 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000012387 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012388
Daniel Veillard42595322004-11-08 10:52:06 +000012389 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012390}
12391
12392
12393static int
12394test_xmlClearNodeInfoSeq(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012395 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012396
Daniel Veillardce682bc2004-11-05 17:22:25 +000012397 int mem_base;
12398 xmlParserNodeInfoSeqPtr seq; /* a node info sequence pointer */
12399 int n_seq;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012400
Daniel Veillardce682bc2004-11-05 17:22:25 +000012401 for (n_seq = 0;n_seq < gen_nb_xmlParserNodeInfoSeqPtr;n_seq++) {
12402 mem_base = xmlMemBlocks();
12403 seq = gen_xmlParserNodeInfoSeqPtr(n_seq, 0);
12404
12405 xmlClearNodeInfoSeq(seq);
12406 call_tests++;
12407 des_xmlParserNodeInfoSeqPtr(n_seq, seq, 0);
12408 xmlResetLastError();
12409 if (mem_base != xmlMemBlocks()) {
12410 printf("Leak of %d blocks found in xmlClearNodeInfoSeq",
12411 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012412 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012413 printf(" %d", n_seq);
12414 printf("\n");
12415 }
12416 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000012417 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012418
Daniel Veillard42595322004-11-08 10:52:06 +000012419 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012420}
12421
12422
12423static int
12424test_xmlClearParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012425 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012426
12427 int mem_base;
12428 xmlParserCtxtPtr ctxt; /* an XML parser context */
12429 int n_ctxt;
12430
12431 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12432 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012433 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012434
12435 xmlClearParserCtxt(ctxt);
12436 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012437 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012438 xmlResetLastError();
12439 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012440 printf("Leak of %d blocks found in xmlClearParserCtxt",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012441 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012442 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012443 printf(" %d", n_ctxt);
12444 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012445 }
12446 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012447 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012448
Daniel Veillard42595322004-11-08 10:52:06 +000012449 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012450}
12451
12452
12453static int
12454test_xmlCreateDocParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012455 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012456
Daniel Veillard34099b42004-11-04 17:34:35 +000012457 int mem_base;
12458 xmlParserCtxtPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012459 xmlChar * cur; /* a pointer to an array of xmlChar */
Daniel Veillard34099b42004-11-04 17:34:35 +000012460 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012461
Daniel Veillard34099b42004-11-04 17:34:35 +000012462 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
12463 mem_base = xmlMemBlocks();
12464 cur = gen_const_xmlChar_ptr(n_cur, 0);
12465
William M. Brackf13f77f2004-11-12 16:03:48 +000012466 ret_val = xmlCreateDocParserCtxt((const xmlChar *)cur);
Daniel Veillard34099b42004-11-04 17:34:35 +000012467 desret_xmlParserCtxtPtr(ret_val);
12468 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000012469 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard34099b42004-11-04 17:34:35 +000012470 xmlResetLastError();
12471 if (mem_base != xmlMemBlocks()) {
12472 printf("Leak of %d blocks found in xmlCreateDocParserCtxt",
12473 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012474 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000012475 printf(" %d", n_cur);
12476 printf("\n");
12477 }
12478 }
Daniel Veillard34099b42004-11-04 17:34:35 +000012479 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012480
Daniel Veillard42595322004-11-08 10:52:06 +000012481 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012482}
12483
12484
12485static int
12486test_xmlCreatePushParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012487 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012488
William M. Brack21e4ef22005-01-02 09:53:13 +000012489#if defined(LIBXML_PUSH_ENABLED)
Daniel Veillard34099b42004-11-04 17:34:35 +000012490 int mem_base;
12491 xmlParserCtxtPtr ret_val;
12492 xmlSAXHandlerPtr sax; /* a SAX handler */
12493 int n_sax;
12494 void * user_data; /* The user data returned on SAX callbacks */
12495 int n_user_data;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012496 char * chunk; /* a pointer to an array of chars */
Daniel Veillard34099b42004-11-04 17:34:35 +000012497 int n_chunk;
12498 int size; /* number of chars in the array */
12499 int n_size;
12500 const char * filename; /* an optional file name or URI */
12501 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012502
Daniel Veillard34099b42004-11-04 17:34:35 +000012503 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
12504 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
12505 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
12506 for (n_size = 0;n_size < gen_nb_int;n_size++) {
Daniel Veillard42595322004-11-08 10:52:06 +000012507 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
Daniel Veillard34099b42004-11-04 17:34:35 +000012508 mem_base = xmlMemBlocks();
12509 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
12510 user_data = gen_userdata(n_user_data, 1);
12511 chunk = gen_const_char_ptr(n_chunk, 2);
12512 size = gen_int(n_size, 3);
Daniel Veillard42595322004-11-08 10:52:06 +000012513 filename = gen_fileoutput(n_filename, 4);
Daniel Veillard34099b42004-11-04 17:34:35 +000012514
William M. Brackf13f77f2004-11-12 16:03:48 +000012515 ret_val = xmlCreatePushParserCtxt(sax, user_data, (const char *)chunk, size, filename);
Daniel Veillard34099b42004-11-04 17:34:35 +000012516 desret_xmlParserCtxtPtr(ret_val);
12517 call_tests++;
12518 des_xmlSAXHandlerPtr(n_sax, sax, 0);
12519 des_userdata(n_user_data, user_data, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000012520 des_const_char_ptr(n_chunk, (const char *)chunk, 2);
Daniel Veillard34099b42004-11-04 17:34:35 +000012521 des_int(n_size, size, 3);
Daniel Veillard42595322004-11-08 10:52:06 +000012522 des_fileoutput(n_filename, filename, 4);
Daniel Veillard34099b42004-11-04 17:34:35 +000012523 xmlResetLastError();
12524 if (mem_base != xmlMemBlocks()) {
12525 printf("Leak of %d blocks found in xmlCreatePushParserCtxt",
12526 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012527 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000012528 printf(" %d", n_sax);
12529 printf(" %d", n_user_data);
12530 printf(" %d", n_chunk);
12531 printf(" %d", n_size);
12532 printf(" %d", n_filename);
12533 printf("\n");
12534 }
12535 }
12536 }
12537 }
12538 }
12539 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012540 function_tests++;
Daniel Veillard34099b42004-11-04 17:34:35 +000012541#endif
12542
Daniel Veillard42595322004-11-08 10:52:06 +000012543 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012544}
12545
12546
12547static int
12548test_xmlCtxtReadDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012549 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012550
12551 int mem_base;
12552 xmlDocPtr ret_val;
12553 xmlParserCtxtPtr ctxt; /* an XML parser context */
12554 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012555 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012556 int n_cur;
12557 const char * URL; /* the base URL to use for the document */
12558 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012559 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012560 int n_encoding;
12561 int options; /* a combination of xmlParserOption */
12562 int n_options;
12563
12564 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12565 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
12566 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12567 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000012568 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000012569 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012570 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12571 cur = gen_const_xmlChar_ptr(n_cur, 1);
12572 URL = gen_filepath(n_URL, 2);
12573 encoding = gen_const_char_ptr(n_encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000012574 options = gen_parseroptions(n_options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012575
William M. Brackf13f77f2004-11-12 16:03:48 +000012576 ret_val = xmlCtxtReadDoc(ctxt, (const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012577 desret_xmlDocPtr(ret_val);
12578 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012579 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000012580 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000012581 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000012582 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000012583 des_parseroptions(n_options, options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012584 xmlResetLastError();
12585 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012586 printf("Leak of %d blocks found in xmlCtxtReadDoc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012587 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012588 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012589 printf(" %d", n_ctxt);
12590 printf(" %d", n_cur);
12591 printf(" %d", n_URL);
12592 printf(" %d", n_encoding);
12593 printf(" %d", n_options);
12594 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012595 }
12596 }
12597 }
12598 }
12599 }
12600 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012601 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012602
Daniel Veillard42595322004-11-08 10:52:06 +000012603 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012604}
12605
12606
12607static int
12608test_xmlCtxtReadFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012609 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012610
12611 int mem_base;
12612 xmlDocPtr ret_val;
12613 xmlParserCtxtPtr ctxt; /* an XML parser context */
12614 int n_ctxt;
12615 const char * filename; /* a file or URL */
12616 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012617 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012618 int n_encoding;
12619 int options; /* a combination of xmlParserOption */
12620 int n_options;
12621
12622 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12623 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
12624 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000012625 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000012626 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012627 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12628 filename = gen_filepath(n_filename, 1);
12629 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000012630 options = gen_parseroptions(n_options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012631
William M. Brackf13f77f2004-11-12 16:03:48 +000012632 ret_val = xmlCtxtReadFile(ctxt, filename, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012633 desret_xmlDocPtr(ret_val);
12634 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012635 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
12636 des_filepath(n_filename, filename, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000012637 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000012638 des_parseroptions(n_options, options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012639 xmlResetLastError();
12640 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012641 printf("Leak of %d blocks found in xmlCtxtReadFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012642 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012643 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012644 printf(" %d", n_ctxt);
12645 printf(" %d", n_filename);
12646 printf(" %d", n_encoding);
12647 printf(" %d", n_options);
12648 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012649 }
12650 }
12651 }
12652 }
12653 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012654 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012655
Daniel Veillard42595322004-11-08 10:52:06 +000012656 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012657}
12658
12659
12660static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000012661test_xmlCtxtReadMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012662 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012663
12664 int mem_base;
12665 xmlDocPtr ret_val;
12666 xmlParserCtxtPtr ctxt; /* an XML parser context */
12667 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012668 char * buffer; /* a pointer to a char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012669 int n_buffer;
12670 int size; /* the size of the array */
12671 int n_size;
12672 const char * URL; /* the base URL to use for the document */
12673 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012674 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012675 int n_encoding;
12676 int options; /* a combination of xmlParserOption */
12677 int n_options;
12678
12679 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12680 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
12681 for (n_size = 0;n_size < gen_nb_int;n_size++) {
12682 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12683 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000012684 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000012685 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012686 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12687 buffer = gen_const_char_ptr(n_buffer, 1);
12688 size = gen_int(n_size, 2);
12689 URL = gen_filepath(n_URL, 3);
12690 encoding = gen_const_char_ptr(n_encoding, 4);
Daniel Veillard6128c012004-11-08 17:16:15 +000012691 options = gen_parseroptions(n_options, 5);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012692
William M. Brackf13f77f2004-11-12 16:03:48 +000012693 ret_val = xmlCtxtReadMemory(ctxt, (const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012694 desret_xmlDocPtr(ret_val);
12695 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012696 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000012697 des_const_char_ptr(n_buffer, (const char *)buffer, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000012698 des_int(n_size, size, 2);
12699 des_filepath(n_URL, URL, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000012700 des_const_char_ptr(n_encoding, (const char *)encoding, 4);
Daniel Veillard6128c012004-11-08 17:16:15 +000012701 des_parseroptions(n_options, options, 5);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012702 xmlResetLastError();
12703 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012704 printf("Leak of %d blocks found in xmlCtxtReadMemory",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012705 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012706 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012707 printf(" %d", n_ctxt);
12708 printf(" %d", n_buffer);
12709 printf(" %d", n_size);
12710 printf(" %d", n_URL);
12711 printf(" %d", n_encoding);
12712 printf(" %d", n_options);
12713 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012714 }
12715 }
12716 }
12717 }
12718 }
12719 }
12720 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012721 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012722
Daniel Veillard42595322004-11-08 10:52:06 +000012723 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012724}
12725
12726
12727static int
12728test_xmlCtxtReset(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012729 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012730
12731 int mem_base;
12732 xmlParserCtxtPtr ctxt; /* an XML parser context */
12733 int n_ctxt;
12734
12735 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12736 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012737 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012738
12739 xmlCtxtReset(ctxt);
12740 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012741 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012742 xmlResetLastError();
12743 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012744 printf("Leak of %d blocks found in xmlCtxtReset",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012745 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012746 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012747 printf(" %d", n_ctxt);
12748 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012749 }
12750 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012751 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012752
Daniel Veillard42595322004-11-08 10:52:06 +000012753 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012754}
12755
12756
12757static int
12758test_xmlCtxtResetPush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012759 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012760
12761 int mem_base;
12762 int ret_val;
12763 xmlParserCtxtPtr ctxt; /* an XML parser context */
12764 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012765 char * chunk; /* a pointer to an array of chars */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012766 int n_chunk;
12767 int size; /* number of chars in the array */
12768 int n_size;
12769 const char * filename; /* an optional file name or URI */
12770 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012771 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012772 int n_encoding;
12773
12774 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12775 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
12776 for (n_size = 0;n_size < gen_nb_int;n_size++) {
12777 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
12778 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
12779 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012780 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12781 chunk = gen_const_char_ptr(n_chunk, 1);
12782 size = gen_int(n_size, 2);
12783 filename = gen_filepath(n_filename, 3);
12784 encoding = gen_const_char_ptr(n_encoding, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012785
William M. Brackf13f77f2004-11-12 16:03:48 +000012786 ret_val = xmlCtxtResetPush(ctxt, (const char *)chunk, size, filename, (const char *)encoding);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012787 desret_int(ret_val);
12788 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012789 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000012790 des_const_char_ptr(n_chunk, (const char *)chunk, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000012791 des_int(n_size, size, 2);
12792 des_filepath(n_filename, filename, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000012793 des_const_char_ptr(n_encoding, (const char *)encoding, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012794 xmlResetLastError();
12795 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012796 printf("Leak of %d blocks found in xmlCtxtResetPush",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012797 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012798 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012799 printf(" %d", n_ctxt);
12800 printf(" %d", n_chunk);
12801 printf(" %d", n_size);
12802 printf(" %d", n_filename);
12803 printf(" %d", n_encoding);
12804 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012805 }
12806 }
12807 }
12808 }
12809 }
12810 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012811 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012812
Daniel Veillard42595322004-11-08 10:52:06 +000012813 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012814}
12815
12816
12817static int
12818test_xmlCtxtUseOptions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012819 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012820
12821 int mem_base;
12822 int ret_val;
12823 xmlParserCtxtPtr ctxt; /* an XML parser context */
12824 int n_ctxt;
12825 int options; /* a combination of xmlParserOption */
12826 int n_options;
12827
12828 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000012829 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000012830 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012831 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard6128c012004-11-08 17:16:15 +000012832 options = gen_parseroptions(n_options, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012833
12834 ret_val = xmlCtxtUseOptions(ctxt, options);
12835 desret_int(ret_val);
12836 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012837 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillard6128c012004-11-08 17:16:15 +000012838 des_parseroptions(n_options, options, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012839 xmlResetLastError();
12840 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012841 printf("Leak of %d blocks found in xmlCtxtUseOptions",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012842 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012843 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012844 printf(" %d", n_ctxt);
12845 printf(" %d", n_options);
12846 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012847 }
12848 }
12849 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012850 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012851
Daniel Veillard42595322004-11-08 10:52:06 +000012852 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012853}
12854
12855
12856static int
12857test_xmlGetExternalEntityLoader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012858 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012859
12860
12861 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000012862 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012863}
12864
12865
12866static int
12867test_xmlGetFeature(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012868 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012869
William M. Brack21e4ef22005-01-02 09:53:13 +000012870#if defined(LIBXML_LEGACY_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000012871#ifdef LIBXML_LEGACY_ENABLED
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012872 int mem_base;
12873 int ret_val;
12874 xmlParserCtxtPtr ctxt; /* an XML/HTML parser context */
12875 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012876 char * name; /* the feature name */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012877 int n_name;
12878 void * result; /* location to store the result */
12879 int n_result;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012880
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012881 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12882 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
12883 for (n_result = 0;n_result < gen_nb_void_ptr;n_result++) {
12884 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012885 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12886 name = gen_const_char_ptr(n_name, 1);
12887 result = gen_void_ptr(n_result, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012888
William M. Brackf13f77f2004-11-12 16:03:48 +000012889 ret_val = xmlGetFeature(ctxt, (const char *)name, result);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012890 desret_int(ret_val);
12891 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012892 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000012893 des_const_char_ptr(n_name, (const char *)name, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000012894 des_void_ptr(n_result, result, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012895 xmlResetLastError();
12896 if (mem_base != xmlMemBlocks()) {
12897 printf("Leak of %d blocks found in xmlGetFeature",
12898 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012899 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012900 printf(" %d", n_ctxt);
12901 printf(" %d", n_name);
12902 printf(" %d", n_result);
12903 printf("\n");
12904 }
12905 }
12906 }
12907 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012908 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000012909#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000012910#endif
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012911
Daniel Veillard42595322004-11-08 10:52:06 +000012912 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012913}
12914
12915
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012916#define gen_nb_const_char_ptr_ptr 1
12917static char ** gen_const_char_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
12918 return(NULL);
12919}
12920static void des_const_char_ptr_ptr(int no ATTRIBUTE_UNUSED, const char ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
12921}
12922
Daniel Veillardd93f6252004-11-02 15:53:51 +000012923static int
12924test_xmlGetFeaturesList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012925 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012926
William M. Brack21e4ef22005-01-02 09:53:13 +000012927#if defined(LIBXML_LEGACY_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000012928#ifdef LIBXML_LEGACY_ENABLED
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012929 int mem_base;
12930 int ret_val;
12931 int * len; /* the length of the features name array (input/output) */
12932 int n_len;
12933 char ** result; /* an array of string to be filled with the features name. */
12934 int n_result;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012935
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012936 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
12937 for (n_result = 0;n_result < gen_nb_const_char_ptr_ptr;n_result++) {
12938 mem_base = xmlMemBlocks();
12939 len = gen_int_ptr(n_len, 0);
12940 result = gen_const_char_ptr_ptr(n_result, 1);
12941
William M. Brackf13f77f2004-11-12 16:03:48 +000012942 ret_val = xmlGetFeaturesList(len, (const char **)result);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012943 desret_int(ret_val);
12944 call_tests++;
12945 des_int_ptr(n_len, len, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000012946 des_const_char_ptr_ptr(n_result, (const char **)result, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012947 xmlResetLastError();
12948 if (mem_base != xmlMemBlocks()) {
12949 printf("Leak of %d blocks found in xmlGetFeaturesList",
12950 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012951 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012952 printf(" %d", n_len);
12953 printf(" %d", n_result);
12954 printf("\n");
12955 }
12956 }
12957 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012958 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000012959#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000012960#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012961
Daniel Veillard42595322004-11-08 10:52:06 +000012962 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012963}
12964
12965
12966static int
12967test_xmlIOParseDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012968 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012969
William M. Brack21e4ef22005-01-02 09:53:13 +000012970#if defined(LIBXML_VALID_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000012971#ifdef LIBXML_VALID_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000012972 int mem_base;
12973 xmlDtdPtr ret_val;
12974 xmlSAXHandlerPtr sax; /* the SAX handler block or NULL */
12975 int n_sax;
12976 xmlParserInputBufferPtr input; /* an Input Buffer */
12977 int n_input;
12978 xmlCharEncoding enc; /* the charset encoding if known */
12979 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012980
Daniel Veillard34099b42004-11-04 17:34:35 +000012981 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
12982 for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
12983 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
12984 mem_base = xmlMemBlocks();
12985 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
12986 input = gen_xmlParserInputBufferPtr(n_input, 1);
12987 enc = gen_xmlCharEncoding(n_enc, 2);
12988
12989 ret_val = xmlIOParseDTD(sax, input, enc);
12990 input = NULL;
12991 desret_xmlDtdPtr(ret_val);
12992 call_tests++;
12993 des_xmlSAXHandlerPtr(n_sax, sax, 0);
12994 des_xmlParserInputBufferPtr(n_input, input, 1);
12995 des_xmlCharEncoding(n_enc, enc, 2);
12996 xmlResetLastError();
12997 if (mem_base != xmlMemBlocks()) {
12998 printf("Leak of %d blocks found in xmlIOParseDTD",
12999 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013000 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000013001 printf(" %d", n_sax);
13002 printf(" %d", n_input);
13003 printf(" %d", n_enc);
13004 printf("\n");
13005 }
13006 }
13007 }
13008 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013009 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013010#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013011#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000013012
Daniel Veillard42595322004-11-08 10:52:06 +000013013 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013014}
13015
13016
13017static int
13018test_xmlInitNodeInfoSeq(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013019 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013020
Daniel Veillardce682bc2004-11-05 17:22:25 +000013021 int mem_base;
13022 xmlParserNodeInfoSeqPtr seq; /* a node info sequence pointer */
13023 int n_seq;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013024
Daniel Veillardce682bc2004-11-05 17:22:25 +000013025 for (n_seq = 0;n_seq < gen_nb_xmlParserNodeInfoSeqPtr;n_seq++) {
13026 mem_base = xmlMemBlocks();
13027 seq = gen_xmlParserNodeInfoSeqPtr(n_seq, 0);
13028
13029 xmlInitNodeInfoSeq(seq);
13030 call_tests++;
13031 des_xmlParserNodeInfoSeqPtr(n_seq, seq, 0);
13032 xmlResetLastError();
13033 if (mem_base != xmlMemBlocks()) {
13034 printf("Leak of %d blocks found in xmlInitNodeInfoSeq",
13035 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013036 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013037 printf(" %d", n_seq);
13038 printf("\n");
13039 }
13040 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000013041 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013042
Daniel Veillard42595322004-11-08 10:52:06 +000013043 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013044}
13045
13046
13047static int
13048test_xmlInitParser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013049 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013050
13051 int mem_base;
13052
13053 mem_base = xmlMemBlocks();
13054
13055 xmlInitParser();
13056 call_tests++;
13057 xmlResetLastError();
13058 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013059 printf("Leak of %d blocks found in xmlInitParser",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013060 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013061 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013062 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013063 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013064 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013065
Daniel Veillard42595322004-11-08 10:52:06 +000013066 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013067}
13068
13069
13070static int
13071test_xmlInitParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013072 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013073
13074 int mem_base;
13075 int ret_val;
13076 xmlParserCtxtPtr ctxt; /* an XML parser context */
13077 int n_ctxt;
13078
13079 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13080 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013081 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013082
13083 ret_val = xmlInitParserCtxt(ctxt);
13084 desret_int(ret_val);
13085 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013086 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013087 xmlResetLastError();
13088 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013089 printf("Leak of %d blocks found in xmlInitParserCtxt",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013090 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013091 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013092 printf(" %d", n_ctxt);
13093 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013094 }
13095 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013096 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013097
Daniel Veillard42595322004-11-08 10:52:06 +000013098 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013099}
13100
13101
13102static int
13103test_xmlKeepBlanksDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013104 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013105
13106 int mem_base;
13107 int ret_val;
13108 int val; /* int 0 or 1 */
13109 int n_val;
13110
13111 for (n_val = 0;n_val < gen_nb_int;n_val++) {
13112 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013113 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013114
13115 ret_val = xmlKeepBlanksDefault(val);
13116 desret_int(ret_val);
13117 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013118 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013119 xmlResetLastError();
13120 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013121 printf("Leak of %d blocks found in xmlKeepBlanksDefault",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013122 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013123 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013124 printf(" %d", n_val);
13125 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013126 }
13127 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013128 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013129
Daniel Veillard42595322004-11-08 10:52:06 +000013130 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013131}
13132
13133
13134static int
13135test_xmlLineNumbersDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013136 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013137
13138 int mem_base;
13139 int ret_val;
13140 int val; /* int 0 or 1 */
13141 int n_val;
13142
13143 for (n_val = 0;n_val < gen_nb_int;n_val++) {
13144 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013145 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013146
13147 ret_val = xmlLineNumbersDefault(val);
13148 desret_int(ret_val);
13149 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013150 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013151 xmlResetLastError();
13152 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013153 printf("Leak of %d blocks found in xmlLineNumbersDefault",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013154 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013155 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013156 printf(" %d", n_val);
13157 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013158 }
13159 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013160 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013161
Daniel Veillard42595322004-11-08 10:52:06 +000013162 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013163}
13164
13165
13166static int
13167test_xmlLoadExternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013168 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013169
Daniel Veillard42595322004-11-08 10:52:06 +000013170 int mem_base;
13171 xmlParserInputPtr ret_val;
13172 const char * URL; /* the URL for the entity to load */
13173 int n_URL;
13174 char * ID; /* the Public ID for the entity to load */
13175 int n_ID;
13176 xmlParserCtxtPtr ctxt; /* the context in which the entity is called or NULL */
13177 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013178
Daniel Veillard42595322004-11-08 10:52:06 +000013179 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
13180 for (n_ID = 0;n_ID < gen_nb_const_char_ptr;n_ID++) {
13181 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13182 mem_base = xmlMemBlocks();
13183 URL = gen_filepath(n_URL, 0);
13184 ID = gen_const_char_ptr(n_ID, 1);
13185 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 2);
13186
William M. Brackf13f77f2004-11-12 16:03:48 +000013187 ret_val = xmlLoadExternalEntity(URL, (const char *)ID, ctxt);
Daniel Veillard42595322004-11-08 10:52:06 +000013188 desret_xmlParserInputPtr(ret_val);
13189 call_tests++;
13190 des_filepath(n_URL, URL, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000013191 des_const_char_ptr(n_ID, (const char *)ID, 1);
Daniel Veillard42595322004-11-08 10:52:06 +000013192 des_xmlParserCtxtPtr(n_ctxt, ctxt, 2);
13193 xmlResetLastError();
13194 if (mem_base != xmlMemBlocks()) {
13195 printf("Leak of %d blocks found in xmlLoadExternalEntity",
13196 xmlMemBlocks() - mem_base);
13197 test_ret++;
13198 printf(" %d", n_URL);
13199 printf(" %d", n_ID);
13200 printf(" %d", n_ctxt);
13201 printf("\n");
13202 }
13203 }
13204 }
13205 }
Daniel Veillard42595322004-11-08 10:52:06 +000013206 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013207
Daniel Veillard42595322004-11-08 10:52:06 +000013208 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013209}
13210
13211
13212static int
13213test_xmlNewIOInputStream(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013214 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013215
Daniel Veillard42595322004-11-08 10:52:06 +000013216 int mem_base;
13217 xmlParserInputPtr ret_val;
13218 xmlParserCtxtPtr ctxt; /* an XML parser context */
13219 int n_ctxt;
13220 xmlParserInputBufferPtr input; /* an I/O Input */
13221 int n_input;
13222 xmlCharEncoding enc; /* the charset encoding if known */
13223 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013224
Daniel Veillard42595322004-11-08 10:52:06 +000013225 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13226 for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
13227 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
13228 mem_base = xmlMemBlocks();
13229 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
13230 input = gen_xmlParserInputBufferPtr(n_input, 1);
13231 enc = gen_xmlCharEncoding(n_enc, 2);
13232
13233 ret_val = xmlNewIOInputStream(ctxt, input, enc);
13234 if (ret_val != NULL) input = NULL;
13235 desret_xmlParserInputPtr(ret_val);
13236 call_tests++;
13237 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
13238 des_xmlParserInputBufferPtr(n_input, input, 1);
13239 des_xmlCharEncoding(n_enc, enc, 2);
13240 xmlResetLastError();
13241 if (mem_base != xmlMemBlocks()) {
13242 printf("Leak of %d blocks found in xmlNewIOInputStream",
13243 xmlMemBlocks() - mem_base);
13244 test_ret++;
13245 printf(" %d", n_ctxt);
13246 printf(" %d", n_input);
13247 printf(" %d", n_enc);
13248 printf("\n");
13249 }
13250 }
13251 }
13252 }
Daniel Veillard42595322004-11-08 10:52:06 +000013253 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013254
Daniel Veillard42595322004-11-08 10:52:06 +000013255 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013256}
13257
13258
13259static int
13260test_xmlNewParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013261 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013262
Daniel Veillard34099b42004-11-04 17:34:35 +000013263 int mem_base;
13264 xmlParserCtxtPtr ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013265
Daniel Veillard34099b42004-11-04 17:34:35 +000013266 mem_base = xmlMemBlocks();
13267
13268 ret_val = xmlNewParserCtxt();
13269 desret_xmlParserCtxtPtr(ret_val);
13270 call_tests++;
13271 xmlResetLastError();
13272 if (mem_base != xmlMemBlocks()) {
13273 printf("Leak of %d blocks found in xmlNewParserCtxt",
13274 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013275 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000013276 printf("\n");
13277 }
Daniel Veillard34099b42004-11-04 17:34:35 +000013278 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013279
Daniel Veillard42595322004-11-08 10:52:06 +000013280 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013281}
13282
13283
Daniel Veillardce682bc2004-11-05 17:22:25 +000013284#define gen_nb_xmlNodePtr_ptr 1
13285static xmlNodePtr * gen_xmlNodePtr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
13286 return(NULL);
13287}
13288static void des_xmlNodePtr_ptr(int no ATTRIBUTE_UNUSED, xmlNodePtr * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
13289}
13290
Daniel Veillardd93f6252004-11-02 15:53:51 +000013291static int
13292test_xmlParseBalancedChunkMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013293 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013294
William M. Brack21e4ef22005-01-02 09:53:13 +000013295#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013296#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000013297 int mem_base;
13298 int ret_val;
13299 xmlDocPtr doc; /* the document the chunk pertains to */
13300 int n_doc;
13301 xmlSAXHandlerPtr sax; /* the SAX handler bloc (possibly NULL) */
13302 int n_sax;
13303 void * user_data; /* The user data returned on SAX callbacks (possibly NULL) */
13304 int n_user_data;
13305 int depth; /* Used for loop detection, use 0 */
13306 int n_depth;
13307 xmlChar * string; /* the input string in UTF8 or ISO-Latin (zero terminated) */
13308 int n_string;
13309 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13310 int n_lst;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013311
Daniel Veillardce682bc2004-11-05 17:22:25 +000013312 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
13313 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
13314 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
13315 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
13316 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
13317 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13318 mem_base = xmlMemBlocks();
13319 doc = gen_xmlDocPtr(n_doc, 0);
13320 sax = gen_xmlSAXHandlerPtr(n_sax, 1);
13321 user_data = gen_userdata(n_user_data, 2);
13322 depth = gen_int(n_depth, 3);
13323 string = gen_const_xmlChar_ptr(n_string, 4);
13324 lst = gen_xmlNodePtr_ptr(n_lst, 5);
Daniel Veillarda521d282004-11-09 14:59:59 +000013325
13326#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000013327 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
Daniel Veillarda521d282004-11-09 14:59:59 +000013328#endif
13329
Daniel Veillardce682bc2004-11-05 17:22:25 +000013330
William M. Brackf13f77f2004-11-12 16:03:48 +000013331 ret_val = xmlParseBalancedChunkMemory(doc, sax, user_data, depth, (const xmlChar *)string, lst);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013332 desret_int(ret_val);
13333 call_tests++;
13334 des_xmlDocPtr(n_doc, doc, 0);
13335 des_xmlSAXHandlerPtr(n_sax, sax, 1);
13336 des_userdata(n_user_data, user_data, 2);
13337 des_int(n_depth, depth, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000013338 des_const_xmlChar_ptr(n_string, (const xmlChar *)string, 4);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013339 des_xmlNodePtr_ptr(n_lst, lst, 5);
13340 xmlResetLastError();
13341 if (mem_base != xmlMemBlocks()) {
13342 printf("Leak of %d blocks found in xmlParseBalancedChunkMemory",
13343 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013344 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013345 printf(" %d", n_doc);
13346 printf(" %d", n_sax);
13347 printf(" %d", n_user_data);
13348 printf(" %d", n_depth);
13349 printf(" %d", n_string);
13350 printf(" %d", n_lst);
13351 printf("\n");
13352 }
13353 }
13354 }
13355 }
13356 }
13357 }
13358 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013359 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013360#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013361#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000013362
Daniel Veillard42595322004-11-08 10:52:06 +000013363 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013364}
13365
13366
13367static int
13368test_xmlParseBalancedChunkMemoryRecover(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013369 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013370
William M. Brack21e4ef22005-01-02 09:53:13 +000013371#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013372#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000013373 int mem_base;
13374 int ret_val;
13375 xmlDocPtr doc; /* the document the chunk pertains to */
13376 int n_doc;
13377 xmlSAXHandlerPtr sax; /* the SAX handler bloc (possibly NULL) */
13378 int n_sax;
13379 void * user_data; /* The user data returned on SAX callbacks (possibly NULL) */
13380 int n_user_data;
13381 int depth; /* Used for loop detection, use 0 */
13382 int n_depth;
13383 xmlChar * string; /* the input string in UTF8 or ISO-Latin (zero terminated) */
13384 int n_string;
13385 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13386 int n_lst;
13387 int recover; /* return nodes even if the data is broken (use 0) */
13388 int n_recover;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013389
Daniel Veillardce682bc2004-11-05 17:22:25 +000013390 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
13391 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
13392 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
13393 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
13394 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
13395 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13396 for (n_recover = 0;n_recover < gen_nb_int;n_recover++) {
13397 mem_base = xmlMemBlocks();
13398 doc = gen_xmlDocPtr(n_doc, 0);
13399 sax = gen_xmlSAXHandlerPtr(n_sax, 1);
13400 user_data = gen_userdata(n_user_data, 2);
13401 depth = gen_int(n_depth, 3);
13402 string = gen_const_xmlChar_ptr(n_string, 4);
13403 lst = gen_xmlNodePtr_ptr(n_lst, 5);
13404 recover = gen_int(n_recover, 6);
Daniel Veillarda521d282004-11-09 14:59:59 +000013405
13406#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000013407 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
Daniel Veillarda521d282004-11-09 14:59:59 +000013408#endif
13409
Daniel Veillardce682bc2004-11-05 17:22:25 +000013410
William M. Brackf13f77f2004-11-12 16:03:48 +000013411 ret_val = xmlParseBalancedChunkMemoryRecover(doc, sax, user_data, depth, (const xmlChar *)string, lst, recover);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013412 desret_int(ret_val);
13413 call_tests++;
13414 des_xmlDocPtr(n_doc, doc, 0);
13415 des_xmlSAXHandlerPtr(n_sax, sax, 1);
13416 des_userdata(n_user_data, user_data, 2);
13417 des_int(n_depth, depth, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000013418 des_const_xmlChar_ptr(n_string, (const xmlChar *)string, 4);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013419 des_xmlNodePtr_ptr(n_lst, lst, 5);
13420 des_int(n_recover, recover, 6);
13421 xmlResetLastError();
13422 if (mem_base != xmlMemBlocks()) {
13423 printf("Leak of %d blocks found in xmlParseBalancedChunkMemoryRecover",
13424 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013425 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013426 printf(" %d", n_doc);
13427 printf(" %d", n_sax);
13428 printf(" %d", n_user_data);
13429 printf(" %d", n_depth);
13430 printf(" %d", n_string);
13431 printf(" %d", n_lst);
13432 printf(" %d", n_recover);
13433 printf("\n");
13434 }
13435 }
13436 }
13437 }
13438 }
13439 }
13440 }
13441 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013442 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013443#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013444#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000013445
Daniel Veillard42595322004-11-08 10:52:06 +000013446 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013447}
13448
13449
13450static int
13451test_xmlParseChunk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013452 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013453
William M. Brack21e4ef22005-01-02 09:53:13 +000013454#if defined(LIBXML_PUSH_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000013455 int mem_base;
13456 int ret_val;
13457 xmlParserCtxtPtr ctxt; /* an XML parser context */
13458 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013459 char * chunk; /* an char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000013460 int n_chunk;
13461 int size; /* the size in byte of the chunk */
13462 int n_size;
13463 int terminate; /* last chunk indicator */
13464 int n_terminate;
13465
13466 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13467 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
13468 for (n_size = 0;n_size < gen_nb_int;n_size++) {
13469 for (n_terminate = 0;n_terminate < gen_nb_int;n_terminate++) {
13470 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013471 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
13472 chunk = gen_const_char_ptr(n_chunk, 1);
13473 size = gen_int(n_size, 2);
13474 terminate = gen_int(n_terminate, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013475
William M. Brackf13f77f2004-11-12 16:03:48 +000013476 ret_val = xmlParseChunk(ctxt, (const char *)chunk, size, terminate);
Daniel Veillarda521d282004-11-09 14:59:59 +000013477 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
Daniel Veillardd93f6252004-11-02 15:53:51 +000013478 desret_int(ret_val);
13479 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013480 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000013481 des_const_char_ptr(n_chunk, (const char *)chunk, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000013482 des_int(n_size, size, 2);
13483 des_int(n_terminate, terminate, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013484 xmlResetLastError();
13485 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013486 printf("Leak of %d blocks found in xmlParseChunk",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013487 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013488 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013489 printf(" %d", n_ctxt);
13490 printf(" %d", n_chunk);
13491 printf(" %d", n_size);
13492 printf(" %d", n_terminate);
13493 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013494 }
13495 }
13496 }
13497 }
13498 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013499 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013500#endif
13501
Daniel Veillard42595322004-11-08 10:52:06 +000013502 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013503}
13504
13505
13506static int
13507test_xmlParseCtxtExternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013508 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013509
Daniel Veillardce682bc2004-11-05 17:22:25 +000013510 int mem_base;
13511 int ret_val;
13512 xmlParserCtxtPtr ctx; /* the existing parsing context */
13513 int n_ctx;
13514 xmlChar * URL; /* the URL for the entity to load */
13515 int n_URL;
13516 xmlChar * ID; /* the System ID for the entity to load */
13517 int n_ID;
13518 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13519 int n_lst;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013520
Daniel Veillardce682bc2004-11-05 17:22:25 +000013521 for (n_ctx = 0;n_ctx < gen_nb_xmlParserCtxtPtr;n_ctx++) {
13522 for (n_URL = 0;n_URL < gen_nb_const_xmlChar_ptr;n_URL++) {
13523 for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) {
13524 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13525 mem_base = xmlMemBlocks();
13526 ctx = gen_xmlParserCtxtPtr(n_ctx, 0);
13527 URL = gen_const_xmlChar_ptr(n_URL, 1);
13528 ID = gen_const_xmlChar_ptr(n_ID, 2);
13529 lst = gen_xmlNodePtr_ptr(n_lst, 3);
13530
William M. Brackf13f77f2004-11-12 16:03:48 +000013531 ret_val = xmlParseCtxtExternalEntity(ctx, (const xmlChar *)URL, (const xmlChar *)ID, lst);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013532 desret_int(ret_val);
13533 call_tests++;
13534 des_xmlParserCtxtPtr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000013535 des_const_xmlChar_ptr(n_URL, (const xmlChar *)URL, 1);
13536 des_const_xmlChar_ptr(n_ID, (const xmlChar *)ID, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013537 des_xmlNodePtr_ptr(n_lst, lst, 3);
13538 xmlResetLastError();
13539 if (mem_base != xmlMemBlocks()) {
13540 printf("Leak of %d blocks found in xmlParseCtxtExternalEntity",
13541 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013542 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013543 printf(" %d", n_ctx);
13544 printf(" %d", n_URL);
13545 printf(" %d", n_ID);
13546 printf(" %d", n_lst);
13547 printf("\n");
13548 }
13549 }
13550 }
13551 }
13552 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000013553 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013554
Daniel Veillard42595322004-11-08 10:52:06 +000013555 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013556}
13557
13558
13559static int
13560test_xmlParseDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013561 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013562
William M. Brack21e4ef22005-01-02 09:53:13 +000013563#if defined(LIBXML_VALID_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013564#ifdef LIBXML_VALID_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000013565 int mem_base;
13566 xmlDtdPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013567 xmlChar * ExternalID; /* a NAME* containing the External ID of the DTD */
Daniel Veillard34099b42004-11-04 17:34:35 +000013568 int n_ExternalID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013569 xmlChar * SystemID; /* a NAME* containing the URL to the DTD */
Daniel Veillard34099b42004-11-04 17:34:35 +000013570 int n_SystemID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013571
Daniel Veillard34099b42004-11-04 17:34:35 +000013572 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
13573 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
13574 mem_base = xmlMemBlocks();
13575 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 0);
13576 SystemID = gen_const_xmlChar_ptr(n_SystemID, 1);
13577
William M. Brackf13f77f2004-11-12 16:03:48 +000013578 ret_val = xmlParseDTD((const xmlChar *)ExternalID, (const xmlChar *)SystemID);
Daniel Veillard34099b42004-11-04 17:34:35 +000013579 desret_xmlDtdPtr(ret_val);
13580 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000013581 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 0);
13582 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 1);
Daniel Veillard34099b42004-11-04 17:34:35 +000013583 xmlResetLastError();
13584 if (mem_base != xmlMemBlocks()) {
13585 printf("Leak of %d blocks found in xmlParseDTD",
13586 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013587 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000013588 printf(" %d", n_ExternalID);
13589 printf(" %d", n_SystemID);
13590 printf("\n");
13591 }
13592 }
13593 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013594 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013595#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013596#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000013597
Daniel Veillard42595322004-11-08 10:52:06 +000013598 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013599}
13600
13601
13602static int
13603test_xmlParseDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013604 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013605
William M. Brack21e4ef22005-01-02 09:53:13 +000013606#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013607#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013608 int mem_base;
13609 xmlDocPtr ret_val;
13610 xmlChar * cur; /* a pointer to an array of xmlChar */
13611 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013612
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013613 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
13614 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013615 cur = gen_xmlChar_ptr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013616
13617 ret_val = xmlParseDoc(cur);
13618 desret_xmlDocPtr(ret_val);
13619 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013620 des_xmlChar_ptr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013621 xmlResetLastError();
13622 if (mem_base != xmlMemBlocks()) {
13623 printf("Leak of %d blocks found in xmlParseDoc",
13624 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013625 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013626 printf(" %d", n_cur);
13627 printf("\n");
13628 }
13629 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013630 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013631#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013632#endif
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013633
Daniel Veillard42595322004-11-08 10:52:06 +000013634 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013635}
13636
13637
13638static int
13639test_xmlParseDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013640 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013641
13642 int mem_base;
13643 int ret_val;
13644 xmlParserCtxtPtr ctxt; /* an XML parser context */
13645 int n_ctxt;
13646
13647 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13648 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013649 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013650
13651 ret_val = xmlParseDocument(ctxt);
Daniel Veillarda521d282004-11-09 14:59:59 +000013652 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
Daniel Veillardd93f6252004-11-02 15:53:51 +000013653 desret_int(ret_val);
13654 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013655 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013656 xmlResetLastError();
13657 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013658 printf("Leak of %d blocks found in xmlParseDocument",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013659 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013660 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013661 printf(" %d", n_ctxt);
13662 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013663 }
13664 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013665 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013666
Daniel Veillard42595322004-11-08 10:52:06 +000013667 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013668}
13669
13670
13671static int
13672test_xmlParseEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013673 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013674
William M. Brack21e4ef22005-01-02 09:53:13 +000013675#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013676#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000013677 int mem_base;
13678 xmlDocPtr ret_val;
13679 const char * filename; /* the filename */
13680 int n_filename;
13681
13682 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
13683 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013684 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013685
13686 ret_val = xmlParseEntity(filename);
13687 desret_xmlDocPtr(ret_val);
13688 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013689 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013690 xmlResetLastError();
13691 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013692 printf("Leak of %d blocks found in xmlParseEntity",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013693 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013694 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013695 printf(" %d", n_filename);
13696 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013697 }
13698 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013699 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013700#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013701#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000013702
Daniel Veillard42595322004-11-08 10:52:06 +000013703 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013704}
13705
13706
13707static int
13708test_xmlParseExtParsedEnt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013709 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013710
13711 int mem_base;
13712 int ret_val;
13713 xmlParserCtxtPtr ctxt; /* an XML parser context */
13714 int n_ctxt;
13715
13716 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13717 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013718 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013719
13720 ret_val = xmlParseExtParsedEnt(ctxt);
Daniel Veillarda521d282004-11-09 14:59:59 +000013721 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
Daniel Veillardd93f6252004-11-02 15:53:51 +000013722 desret_int(ret_val);
13723 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013724 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013725 xmlResetLastError();
13726 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013727 printf("Leak of %d blocks found in xmlParseExtParsedEnt",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013728 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013729 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013730 printf(" %d", n_ctxt);
13731 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013732 }
13733 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013734 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013735
Daniel Veillard42595322004-11-08 10:52:06 +000013736 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013737}
13738
13739
13740static int
13741test_xmlParseExternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013742 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013743
William M. Brack21e4ef22005-01-02 09:53:13 +000013744#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013745#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000013746 int mem_base;
13747 int ret_val;
13748 xmlDocPtr doc; /* the document the chunk pertains to */
13749 int n_doc;
13750 xmlSAXHandlerPtr sax; /* the SAX handler bloc (possibly NULL) */
13751 int n_sax;
13752 void * user_data; /* The user data returned on SAX callbacks (possibly NULL) */
13753 int n_user_data;
13754 int depth; /* Used for loop detection, use 0 */
13755 int n_depth;
13756 xmlChar * URL; /* the URL for the entity to load */
13757 int n_URL;
13758 xmlChar * ID; /* the System ID for the entity to load */
13759 int n_ID;
13760 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13761 int n_lst;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013762
Daniel Veillardce682bc2004-11-05 17:22:25 +000013763 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
13764 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
13765 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
13766 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
13767 for (n_URL = 0;n_URL < gen_nb_const_xmlChar_ptr;n_URL++) {
13768 for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) {
13769 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13770 mem_base = xmlMemBlocks();
13771 doc = gen_xmlDocPtr(n_doc, 0);
13772 sax = gen_xmlSAXHandlerPtr(n_sax, 1);
13773 user_data = gen_userdata(n_user_data, 2);
13774 depth = gen_int(n_depth, 3);
13775 URL = gen_const_xmlChar_ptr(n_URL, 4);
13776 ID = gen_const_xmlChar_ptr(n_ID, 5);
13777 lst = gen_xmlNodePtr_ptr(n_lst, 6);
13778
William M. Brackf13f77f2004-11-12 16:03:48 +000013779 ret_val = xmlParseExternalEntity(doc, sax, user_data, depth, (const xmlChar *)URL, (const xmlChar *)ID, lst);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013780 desret_int(ret_val);
13781 call_tests++;
13782 des_xmlDocPtr(n_doc, doc, 0);
13783 des_xmlSAXHandlerPtr(n_sax, sax, 1);
13784 des_userdata(n_user_data, user_data, 2);
13785 des_int(n_depth, depth, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000013786 des_const_xmlChar_ptr(n_URL, (const xmlChar *)URL, 4);
13787 des_const_xmlChar_ptr(n_ID, (const xmlChar *)ID, 5);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013788 des_xmlNodePtr_ptr(n_lst, lst, 6);
13789 xmlResetLastError();
13790 if (mem_base != xmlMemBlocks()) {
13791 printf("Leak of %d blocks found in xmlParseExternalEntity",
13792 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013793 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013794 printf(" %d", n_doc);
13795 printf(" %d", n_sax);
13796 printf(" %d", n_user_data);
13797 printf(" %d", n_depth);
13798 printf(" %d", n_URL);
13799 printf(" %d", n_ID);
13800 printf(" %d", n_lst);
13801 printf("\n");
13802 }
13803 }
13804 }
13805 }
13806 }
13807 }
13808 }
13809 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013810 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013811#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013812#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000013813
Daniel Veillard42595322004-11-08 10:52:06 +000013814 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013815}
13816
13817
13818static int
13819test_xmlParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013820 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013821
William M. Brack21e4ef22005-01-02 09:53:13 +000013822#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013823#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000013824 int mem_base;
13825 xmlDocPtr ret_val;
13826 const char * filename; /* the filename */
13827 int n_filename;
13828
13829 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
13830 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013831 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013832
13833 ret_val = xmlParseFile(filename);
13834 desret_xmlDocPtr(ret_val);
13835 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013836 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013837 xmlResetLastError();
13838 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013839 printf("Leak of %d blocks found in xmlParseFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013840 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013841 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013842 printf(" %d", n_filename);
13843 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013844 }
13845 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013846 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013847#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013848#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000013849
Daniel Veillard42595322004-11-08 10:52:06 +000013850 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013851}
13852
13853
13854static int
13855test_xmlParseInNodeContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013856 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013857
Daniel Veillard57b25162004-11-06 14:50:18 +000013858 int mem_base;
13859 xmlParserErrors ret_val;
13860 xmlNodePtr node; /* the context node */
13861 int n_node;
13862 char * data; /* the input string */
13863 int n_data;
13864 int datalen; /* the input string length in bytes */
13865 int n_datalen;
13866 int options; /* a combination of xmlParserOption */
13867 int n_options;
13868 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13869 int n_lst;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013870
Daniel Veillard57b25162004-11-06 14:50:18 +000013871 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
13872 for (n_data = 0;n_data < gen_nb_const_char_ptr;n_data++) {
13873 for (n_datalen = 0;n_datalen < gen_nb_int;n_datalen++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000013874 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillard57b25162004-11-06 14:50:18 +000013875 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13876 mem_base = xmlMemBlocks();
13877 node = gen_xmlNodePtr(n_node, 0);
13878 data = gen_const_char_ptr(n_data, 1);
13879 datalen = gen_int(n_datalen, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000013880 options = gen_parseroptions(n_options, 3);
Daniel Veillard57b25162004-11-06 14:50:18 +000013881 lst = gen_xmlNodePtr_ptr(n_lst, 4);
13882
William M. Brackf13f77f2004-11-12 16:03:48 +000013883 ret_val = xmlParseInNodeContext(node, (const char *)data, datalen, options, lst);
Daniel Veillard57b25162004-11-06 14:50:18 +000013884 desret_xmlParserErrors(ret_val);
13885 call_tests++;
13886 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000013887 des_const_char_ptr(n_data, (const char *)data, 1);
Daniel Veillard57b25162004-11-06 14:50:18 +000013888 des_int(n_datalen, datalen, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000013889 des_parseroptions(n_options, options, 3);
Daniel Veillard57b25162004-11-06 14:50:18 +000013890 des_xmlNodePtr_ptr(n_lst, lst, 4);
13891 xmlResetLastError();
13892 if (mem_base != xmlMemBlocks()) {
13893 printf("Leak of %d blocks found in xmlParseInNodeContext",
13894 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013895 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000013896 printf(" %d", n_node);
13897 printf(" %d", n_data);
13898 printf(" %d", n_datalen);
13899 printf(" %d", n_options);
13900 printf(" %d", n_lst);
13901 printf("\n");
13902 }
13903 }
13904 }
13905 }
13906 }
13907 }
Daniel Veillard57b25162004-11-06 14:50:18 +000013908 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013909
Daniel Veillard42595322004-11-08 10:52:06 +000013910 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013911}
13912
13913
13914static int
13915test_xmlParseMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013916 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013917
William M. Brack21e4ef22005-01-02 09:53:13 +000013918#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013919#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000013920 int mem_base;
13921 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013922 char * buffer; /* an pointer to a char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000013923 int n_buffer;
13924 int size; /* the size of the array */
13925 int n_size;
13926
13927 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
13928 for (n_size = 0;n_size < gen_nb_int;n_size++) {
13929 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013930 buffer = gen_const_char_ptr(n_buffer, 0);
13931 size = gen_int(n_size, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013932
William M. Brackf13f77f2004-11-12 16:03:48 +000013933 ret_val = xmlParseMemory((const char *)buffer, size);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013934 desret_xmlDocPtr(ret_val);
13935 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000013936 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000013937 des_int(n_size, size, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013938 xmlResetLastError();
13939 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013940 printf("Leak of %d blocks found in xmlParseMemory",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013941 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013942 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013943 printf(" %d", n_buffer);
13944 printf(" %d", n_size);
13945 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013946 }
13947 }
13948 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013949 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013950#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013951#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000013952
Daniel Veillard42595322004-11-08 10:52:06 +000013953 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013954}
13955
13956
Daniel Veillardce682bc2004-11-05 17:22:25 +000013957#define gen_nb_const_xmlParserNodeInfoPtr 1
13958static xmlParserNodeInfoPtr gen_const_xmlParserNodeInfoPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
13959 return(NULL);
13960}
13961static void des_const_xmlParserNodeInfoPtr(int no ATTRIBUTE_UNUSED, const xmlParserNodeInfoPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
13962}
13963
Daniel Veillardd93f6252004-11-02 15:53:51 +000013964static int
13965test_xmlParserAddNodeInfo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013966 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013967
Daniel Veillardce682bc2004-11-05 17:22:25 +000013968 int mem_base;
13969 xmlParserCtxtPtr ctxt; /* an XML parser context */
13970 int n_ctxt;
13971 xmlParserNodeInfoPtr info; /* a node info sequence pointer */
13972 int n_info;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013973
Daniel Veillardce682bc2004-11-05 17:22:25 +000013974 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13975 for (n_info = 0;n_info < gen_nb_const_xmlParserNodeInfoPtr;n_info++) {
13976 mem_base = xmlMemBlocks();
13977 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
13978 info = gen_const_xmlParserNodeInfoPtr(n_info, 1);
13979
William M. Brackf13f77f2004-11-12 16:03:48 +000013980 xmlParserAddNodeInfo(ctxt, (const xmlParserNodeInfoPtr)info);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013981 call_tests++;
13982 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000013983 des_const_xmlParserNodeInfoPtr(n_info, (const xmlParserNodeInfoPtr)info, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013984 xmlResetLastError();
13985 if (mem_base != xmlMemBlocks()) {
13986 printf("Leak of %d blocks found in xmlParserAddNodeInfo",
13987 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013988 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013989 printf(" %d", n_ctxt);
13990 printf(" %d", n_info);
13991 printf("\n");
13992 }
13993 }
13994 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000013995 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013996
Daniel Veillard42595322004-11-08 10:52:06 +000013997 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013998}
13999
14000
Daniel Veillardce682bc2004-11-05 17:22:25 +000014001#define gen_nb_const_xmlParserCtxtPtr 1
14002static xmlParserCtxtPtr gen_const_xmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14003 return(NULL);
14004}
14005static void des_const_xmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, const xmlParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14006}
14007
Daniel Veillarda521d282004-11-09 14:59:59 +000014008#define gen_nb_const_xmlNodePtr 1
14009static xmlNodePtr gen_const_xmlNodePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14010 return(NULL);
14011}
14012static void des_const_xmlNodePtr(int no ATTRIBUTE_UNUSED, const xmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14013}
14014
Daniel Veillardd93f6252004-11-02 15:53:51 +000014015static int
14016test_xmlParserFindNodeInfo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014017 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014018
William M. Brack094dd862004-11-14 14:28:34 +000014019 int mem_base;
14020 const xmlParserNodeInfo * ret_val;
14021 xmlParserCtxtPtr ctx; /* an XML parser context */
14022 int n_ctx;
14023 xmlNodePtr node; /* an XML node within the tree */
14024 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014025
William M. Brack094dd862004-11-14 14:28:34 +000014026 for (n_ctx = 0;n_ctx < gen_nb_const_xmlParserCtxtPtr;n_ctx++) {
14027 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
14028 mem_base = xmlMemBlocks();
14029 ctx = gen_const_xmlParserCtxtPtr(n_ctx, 0);
14030 node = gen_const_xmlNodePtr(n_node, 1);
14031
14032 ret_val = xmlParserFindNodeInfo((const xmlParserCtxtPtr)ctx, (const xmlNodePtr)node);
14033 desret_const_xmlParserNodeInfo_ptr(ret_val);
14034 call_tests++;
14035 des_const_xmlParserCtxtPtr(n_ctx, (const xmlParserCtxtPtr)ctx, 0);
14036 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 1);
14037 xmlResetLastError();
14038 if (mem_base != xmlMemBlocks()) {
14039 printf("Leak of %d blocks found in xmlParserFindNodeInfo",
14040 xmlMemBlocks() - mem_base);
14041 test_ret++;
14042 printf(" %d", n_ctx);
14043 printf(" %d", n_node);
14044 printf("\n");
14045 }
14046 }
14047 }
14048 function_tests++;
14049
Daniel Veillard42595322004-11-08 10:52:06 +000014050 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014051}
14052
14053
Daniel Veillardce682bc2004-11-05 17:22:25 +000014054#define gen_nb_const_xmlParserNodeInfoSeqPtr 1
14055static xmlParserNodeInfoSeqPtr gen_const_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14056 return(NULL);
14057}
14058static void des_const_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, const xmlParserNodeInfoSeqPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14059}
14060
Daniel Veillardd93f6252004-11-02 15:53:51 +000014061static int
14062test_xmlParserFindNodeInfoIndex(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014063 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014064
William M. Brack094dd862004-11-14 14:28:34 +000014065 int mem_base;
14066 unsigned long ret_val;
14067 xmlParserNodeInfoSeqPtr seq; /* a node info sequence pointer */
14068 int n_seq;
14069 xmlNodePtr node; /* an XML node pointer */
14070 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014071
William M. Brack094dd862004-11-14 14:28:34 +000014072 for (n_seq = 0;n_seq < gen_nb_const_xmlParserNodeInfoSeqPtr;n_seq++) {
14073 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
14074 mem_base = xmlMemBlocks();
14075 seq = gen_const_xmlParserNodeInfoSeqPtr(n_seq, 0);
14076 node = gen_const_xmlNodePtr(n_node, 1);
14077
14078 ret_val = xmlParserFindNodeInfoIndex((const xmlParserNodeInfoSeqPtr)seq, (const xmlNodePtr)node);
14079 desret_unsigned_long(ret_val);
14080 call_tests++;
14081 des_const_xmlParserNodeInfoSeqPtr(n_seq, (const xmlParserNodeInfoSeqPtr)seq, 0);
14082 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 1);
14083 xmlResetLastError();
14084 if (mem_base != xmlMemBlocks()) {
14085 printf("Leak of %d blocks found in xmlParserFindNodeInfoIndex",
14086 xmlMemBlocks() - mem_base);
14087 test_ret++;
14088 printf(" %d", n_seq);
14089 printf(" %d", n_node);
14090 printf("\n");
14091 }
14092 }
14093 }
14094 function_tests++;
14095
Daniel Veillard42595322004-11-08 10:52:06 +000014096 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014097}
14098
14099
Daniel Veillardce682bc2004-11-05 17:22:25 +000014100#define gen_nb_xmlParserInputPtr 1
14101static xmlParserInputPtr gen_xmlParserInputPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14102 return(NULL);
14103}
14104static void des_xmlParserInputPtr(int no ATTRIBUTE_UNUSED, xmlParserInputPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14105}
14106
Daniel Veillardd93f6252004-11-02 15:53:51 +000014107static int
14108test_xmlParserInputGrow(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014109 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014110
Daniel Veillardce682bc2004-11-05 17:22:25 +000014111 int mem_base;
14112 int ret_val;
14113 xmlParserInputPtr in; /* an XML parser input */
14114 int n_in;
14115 int len; /* an indicative size for the lookahead */
14116 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014117
Daniel Veillardce682bc2004-11-05 17:22:25 +000014118 for (n_in = 0;n_in < gen_nb_xmlParserInputPtr;n_in++) {
14119 for (n_len = 0;n_len < gen_nb_int;n_len++) {
14120 mem_base = xmlMemBlocks();
14121 in = gen_xmlParserInputPtr(n_in, 0);
14122 len = gen_int(n_len, 1);
14123
14124 ret_val = xmlParserInputGrow(in, len);
14125 desret_int(ret_val);
14126 call_tests++;
14127 des_xmlParserInputPtr(n_in, in, 0);
14128 des_int(n_len, len, 1);
14129 xmlResetLastError();
14130 if (mem_base != xmlMemBlocks()) {
14131 printf("Leak of %d blocks found in xmlParserInputGrow",
14132 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014133 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014134 printf(" %d", n_in);
14135 printf(" %d", n_len);
14136 printf("\n");
14137 }
14138 }
14139 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000014140 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014141
Daniel Veillard42595322004-11-08 10:52:06 +000014142 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014143}
14144
14145
14146static int
14147test_xmlParserInputRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014148 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014149
Daniel Veillardce682bc2004-11-05 17:22:25 +000014150 int mem_base;
14151 int ret_val;
14152 xmlParserInputPtr in; /* an XML parser input */
14153 int n_in;
14154 int len; /* an indicative size for the lookahead */
14155 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014156
Daniel Veillardce682bc2004-11-05 17:22:25 +000014157 for (n_in = 0;n_in < gen_nb_xmlParserInputPtr;n_in++) {
14158 for (n_len = 0;n_len < gen_nb_int;n_len++) {
14159 mem_base = xmlMemBlocks();
14160 in = gen_xmlParserInputPtr(n_in, 0);
14161 len = gen_int(n_len, 1);
14162
14163 ret_val = xmlParserInputRead(in, len);
14164 desret_int(ret_val);
14165 call_tests++;
14166 des_xmlParserInputPtr(n_in, in, 0);
14167 des_int(n_len, len, 1);
14168 xmlResetLastError();
14169 if (mem_base != xmlMemBlocks()) {
14170 printf("Leak of %d blocks found in xmlParserInputRead",
14171 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014172 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014173 printf(" %d", n_in);
14174 printf(" %d", n_len);
14175 printf("\n");
14176 }
14177 }
14178 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000014179 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014180
Daniel Veillard42595322004-11-08 10:52:06 +000014181 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014182}
14183
14184
14185static int
14186test_xmlPedanticParserDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014187 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014188
14189 int mem_base;
14190 int ret_val;
14191 int val; /* int 0 or 1 */
14192 int n_val;
14193
14194 for (n_val = 0;n_val < gen_nb_int;n_val++) {
14195 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014196 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014197
14198 ret_val = xmlPedanticParserDefault(val);
14199 desret_int(ret_val);
14200 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014201 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014202 xmlResetLastError();
14203 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014204 printf("Leak of %d blocks found in xmlPedanticParserDefault",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014205 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014206 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014207 printf(" %d", n_val);
14208 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014209 }
14210 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000014211 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014212
Daniel Veillard42595322004-11-08 10:52:06 +000014213 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014214}
14215
14216
14217static int
14218test_xmlReadDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014219 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014220
14221 int mem_base;
14222 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014223 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014224 int n_cur;
14225 const char * URL; /* the base URL to use for the document */
14226 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014227 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014228 int n_encoding;
14229 int options; /* a combination of xmlParserOption */
14230 int n_options;
14231
14232 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
14233 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
14234 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000014235 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000014236 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014237 cur = gen_const_xmlChar_ptr(n_cur, 0);
14238 URL = gen_filepath(n_URL, 1);
14239 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000014240 options = gen_parseroptions(n_options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014241
William M. Brackf13f77f2004-11-12 16:03:48 +000014242 ret_val = xmlReadDoc((const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014243 desret_xmlDocPtr(ret_val);
14244 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000014245 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000014246 des_filepath(n_URL, URL, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000014247 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000014248 des_parseroptions(n_options, options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014249 xmlResetLastError();
14250 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014251 printf("Leak of %d blocks found in xmlReadDoc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014252 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014253 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014254 printf(" %d", n_cur);
14255 printf(" %d", n_URL);
14256 printf(" %d", n_encoding);
14257 printf(" %d", n_options);
14258 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014259 }
14260 }
14261 }
14262 }
14263 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000014264 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014265
Daniel Veillard42595322004-11-08 10:52:06 +000014266 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014267}
14268
14269
14270static int
14271test_xmlReadFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014272 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014273
14274 int mem_base;
14275 xmlDocPtr ret_val;
14276 const char * filename; /* a file or URL */
14277 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014278 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014279 int n_encoding;
14280 int options; /* a combination of xmlParserOption */
14281 int n_options;
14282
14283 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14284 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000014285 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000014286 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014287 filename = gen_filepath(n_filename, 0);
14288 encoding = gen_const_char_ptr(n_encoding, 1);
Daniel Veillard6128c012004-11-08 17:16:15 +000014289 options = gen_parseroptions(n_options, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014290
William M. Brackf13f77f2004-11-12 16:03:48 +000014291 ret_val = xmlReadFile(filename, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014292 desret_xmlDocPtr(ret_val);
14293 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014294 des_filepath(n_filename, filename, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000014295 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillard6128c012004-11-08 17:16:15 +000014296 des_parseroptions(n_options, options, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014297 xmlResetLastError();
14298 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014299 printf("Leak of %d blocks found in xmlReadFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014300 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014301 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014302 printf(" %d", n_filename);
14303 printf(" %d", n_encoding);
14304 printf(" %d", n_options);
14305 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014306 }
14307 }
14308 }
14309 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000014310 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014311
Daniel Veillard42595322004-11-08 10:52:06 +000014312 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014313}
14314
14315
14316static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000014317test_xmlReadMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014318 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014319
14320 int mem_base;
14321 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014322 char * buffer; /* a pointer to a char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014323 int n_buffer;
14324 int size; /* the size of the array */
14325 int n_size;
14326 const char * URL; /* the base URL to use for the document */
14327 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014328 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014329 int n_encoding;
14330 int options; /* a combination of xmlParserOption */
14331 int n_options;
14332
14333 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14334 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14335 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
14336 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000014337 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000014338 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014339 buffer = gen_const_char_ptr(n_buffer, 0);
14340 size = gen_int(n_size, 1);
14341 URL = gen_filepath(n_URL, 2);
14342 encoding = gen_const_char_ptr(n_encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000014343 options = gen_parseroptions(n_options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014344
William M. Brackf13f77f2004-11-12 16:03:48 +000014345 ret_val = xmlReadMemory((const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014346 desret_xmlDocPtr(ret_val);
14347 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000014348 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000014349 des_int(n_size, size, 1);
14350 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000014351 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000014352 des_parseroptions(n_options, options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014353 xmlResetLastError();
14354 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014355 printf("Leak of %d blocks found in xmlReadMemory",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014356 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014357 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014358 printf(" %d", n_buffer);
14359 printf(" %d", n_size);
14360 printf(" %d", n_URL);
14361 printf(" %d", n_encoding);
14362 printf(" %d", n_options);
14363 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014364 }
14365 }
14366 }
14367 }
14368 }
14369 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000014370 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014371
Daniel Veillard42595322004-11-08 10:52:06 +000014372 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014373}
14374
14375
14376static int
14377test_xmlRecoverDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014378 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014379
William M. Brack21e4ef22005-01-02 09:53:13 +000014380#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014381#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014382 int mem_base;
14383 xmlDocPtr ret_val;
14384 xmlChar * cur; /* a pointer to an array of xmlChar */
14385 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014386
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014387 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
14388 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014389 cur = gen_xmlChar_ptr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014390
14391 ret_val = xmlRecoverDoc(cur);
14392 desret_xmlDocPtr(ret_val);
14393 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014394 des_xmlChar_ptr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014395 xmlResetLastError();
14396 if (mem_base != xmlMemBlocks()) {
14397 printf("Leak of %d blocks found in xmlRecoverDoc",
14398 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014399 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014400 printf(" %d", n_cur);
14401 printf("\n");
14402 }
14403 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014404 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014405#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014406#endif
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014407
Daniel Veillard42595322004-11-08 10:52:06 +000014408 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014409}
14410
14411
14412static int
14413test_xmlRecoverFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014414 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014415
William M. Brack21e4ef22005-01-02 09:53:13 +000014416#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014417#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000014418 int mem_base;
14419 xmlDocPtr ret_val;
14420 const char * filename; /* the filename */
14421 int n_filename;
14422
14423 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14424 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014425 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014426
14427 ret_val = xmlRecoverFile(filename);
14428 desret_xmlDocPtr(ret_val);
14429 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014430 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014431 xmlResetLastError();
14432 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014433 printf("Leak of %d blocks found in xmlRecoverFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014434 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014435 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014436 printf(" %d", n_filename);
14437 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014438 }
14439 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014440 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014441#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014442#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000014443
Daniel Veillard42595322004-11-08 10:52:06 +000014444 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014445}
14446
14447
14448static int
14449test_xmlRecoverMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014450 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014451
William M. Brack21e4ef22005-01-02 09:53:13 +000014452#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014453#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000014454 int mem_base;
14455 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014456 char * buffer; /* an pointer to a char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014457 int n_buffer;
14458 int size; /* the size of the array */
14459 int n_size;
14460
14461 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14462 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14463 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014464 buffer = gen_const_char_ptr(n_buffer, 0);
14465 size = gen_int(n_size, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014466
William M. Brackf13f77f2004-11-12 16:03:48 +000014467 ret_val = xmlRecoverMemory((const char *)buffer, size);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014468 desret_xmlDocPtr(ret_val);
14469 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000014470 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000014471 des_int(n_size, size, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014472 xmlResetLastError();
14473 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014474 printf("Leak of %d blocks found in xmlRecoverMemory",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014475 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014476 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014477 printf(" %d", n_buffer);
14478 printf(" %d", n_size);
14479 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014480 }
14481 }
14482 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014483 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014484#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014485#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000014486
Daniel Veillard42595322004-11-08 10:52:06 +000014487 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014488}
14489
14490
14491static int
14492test_xmlSAXParseDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014493 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014494
William M. Brack21e4ef22005-01-02 09:53:13 +000014495#if defined(LIBXML_VALID_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014496#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014497 int mem_base;
14498 xmlDtdPtr ret_val;
14499 xmlSAXHandlerPtr sax; /* the SAX handler block */
14500 int n_sax;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014501 xmlChar * ExternalID; /* a NAME* containing the External ID of the DTD */
Daniel Veillard34099b42004-11-04 17:34:35 +000014502 int n_ExternalID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014503 xmlChar * SystemID; /* a NAME* containing the URL to the DTD */
Daniel Veillard34099b42004-11-04 17:34:35 +000014504 int n_SystemID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014505
Daniel Veillard34099b42004-11-04 17:34:35 +000014506 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14507 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
14508 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
14509 mem_base = xmlMemBlocks();
14510 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14511 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 1);
14512 SystemID = gen_const_xmlChar_ptr(n_SystemID, 2);
14513
William M. Brackf13f77f2004-11-12 16:03:48 +000014514 ret_val = xmlSAXParseDTD(sax, (const xmlChar *)ExternalID, (const xmlChar *)SystemID);
Daniel Veillard34099b42004-11-04 17:34:35 +000014515 desret_xmlDtdPtr(ret_val);
14516 call_tests++;
14517 des_xmlSAXHandlerPtr(n_sax, sax, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000014518 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 1);
14519 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 2);
Daniel Veillard34099b42004-11-04 17:34:35 +000014520 xmlResetLastError();
14521 if (mem_base != xmlMemBlocks()) {
14522 printf("Leak of %d blocks found in xmlSAXParseDTD",
14523 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014524 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014525 printf(" %d", n_sax);
14526 printf(" %d", n_ExternalID);
14527 printf(" %d", n_SystemID);
14528 printf("\n");
14529 }
14530 }
14531 }
14532 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014533 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014534#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014535#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014536
Daniel Veillard42595322004-11-08 10:52:06 +000014537 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014538}
14539
14540
14541static int
14542test_xmlSAXParseDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014543 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014544
William M. Brack21e4ef22005-01-02 09:53:13 +000014545#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014546#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014547 int mem_base;
14548 xmlDocPtr ret_val;
14549 xmlSAXHandlerPtr sax; /* the SAX handler block */
14550 int n_sax;
14551 xmlChar * cur; /* a pointer to an array of xmlChar */
14552 int n_cur;
14553 int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */
14554 int n_recovery;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014555
Daniel Veillard34099b42004-11-04 17:34:35 +000014556 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14557 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
14558 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14559 mem_base = xmlMemBlocks();
14560 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14561 cur = gen_xmlChar_ptr(n_cur, 1);
14562 recovery = gen_int(n_recovery, 2);
14563
14564 ret_val = xmlSAXParseDoc(sax, cur, recovery);
14565 desret_xmlDocPtr(ret_val);
14566 call_tests++;
14567 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14568 des_xmlChar_ptr(n_cur, cur, 1);
14569 des_int(n_recovery, recovery, 2);
14570 xmlResetLastError();
14571 if (mem_base != xmlMemBlocks()) {
14572 printf("Leak of %d blocks found in xmlSAXParseDoc",
14573 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014574 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014575 printf(" %d", n_sax);
14576 printf(" %d", n_cur);
14577 printf(" %d", n_recovery);
14578 printf("\n");
14579 }
14580 }
14581 }
14582 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014583 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014584#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014585#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014586
Daniel Veillard42595322004-11-08 10:52:06 +000014587 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014588}
14589
14590
14591static int
14592test_xmlSAXParseEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014593 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014594
William M. Brack21e4ef22005-01-02 09:53:13 +000014595#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014596#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014597 int mem_base;
14598 xmlDocPtr ret_val;
14599 xmlSAXHandlerPtr sax; /* the SAX handler block */
14600 int n_sax;
14601 const char * filename; /* the filename */
14602 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014603
Daniel Veillard34099b42004-11-04 17:34:35 +000014604 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14605 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14606 mem_base = xmlMemBlocks();
14607 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14608 filename = gen_filepath(n_filename, 1);
14609
14610 ret_val = xmlSAXParseEntity(sax, filename);
14611 desret_xmlDocPtr(ret_val);
14612 call_tests++;
14613 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14614 des_filepath(n_filename, filename, 1);
14615 xmlResetLastError();
14616 if (mem_base != xmlMemBlocks()) {
14617 printf("Leak of %d blocks found in xmlSAXParseEntity",
14618 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014619 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014620 printf(" %d", n_sax);
14621 printf(" %d", n_filename);
14622 printf("\n");
14623 }
14624 }
14625 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014626 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014627#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014628#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014629
Daniel Veillard42595322004-11-08 10:52:06 +000014630 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014631}
14632
14633
14634static int
14635test_xmlSAXParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014636 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014637
William M. Brack21e4ef22005-01-02 09:53:13 +000014638#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014639#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014640 int mem_base;
14641 xmlDocPtr ret_val;
14642 xmlSAXHandlerPtr sax; /* the SAX handler block */
14643 int n_sax;
14644 const char * filename; /* the filename */
14645 int n_filename;
14646 int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */
14647 int n_recovery;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014648
Daniel Veillard34099b42004-11-04 17:34:35 +000014649 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14650 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14651 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14652 mem_base = xmlMemBlocks();
14653 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14654 filename = gen_filepath(n_filename, 1);
14655 recovery = gen_int(n_recovery, 2);
14656
14657 ret_val = xmlSAXParseFile(sax, filename, recovery);
14658 desret_xmlDocPtr(ret_val);
14659 call_tests++;
14660 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14661 des_filepath(n_filename, filename, 1);
14662 des_int(n_recovery, recovery, 2);
14663 xmlResetLastError();
14664 if (mem_base != xmlMemBlocks()) {
14665 printf("Leak of %d blocks found in xmlSAXParseFile",
14666 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014667 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014668 printf(" %d", n_sax);
14669 printf(" %d", n_filename);
14670 printf(" %d", n_recovery);
14671 printf("\n");
14672 }
14673 }
14674 }
14675 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014676 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014677#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014678#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014679
Daniel Veillard42595322004-11-08 10:52:06 +000014680 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014681}
14682
14683
14684static int
14685test_xmlSAXParseFileWithData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014686 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014687
William M. Brack21e4ef22005-01-02 09:53:13 +000014688#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014689#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014690 int mem_base;
14691 xmlDocPtr ret_val;
14692 xmlSAXHandlerPtr sax; /* the SAX handler block */
14693 int n_sax;
14694 const char * filename; /* the filename */
14695 int n_filename;
14696 int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */
14697 int n_recovery;
14698 void * data; /* the userdata */
14699 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014700
Daniel Veillard34099b42004-11-04 17:34:35 +000014701 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14702 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14703 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14704 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
14705 mem_base = xmlMemBlocks();
14706 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14707 filename = gen_filepath(n_filename, 1);
14708 recovery = gen_int(n_recovery, 2);
14709 data = gen_userdata(n_data, 3);
14710
14711 ret_val = xmlSAXParseFileWithData(sax, filename, recovery, data);
14712 desret_xmlDocPtr(ret_val);
14713 call_tests++;
14714 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14715 des_filepath(n_filename, filename, 1);
14716 des_int(n_recovery, recovery, 2);
14717 des_userdata(n_data, data, 3);
14718 xmlResetLastError();
14719 if (mem_base != xmlMemBlocks()) {
14720 printf("Leak of %d blocks found in xmlSAXParseFileWithData",
14721 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014722 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014723 printf(" %d", n_sax);
14724 printf(" %d", n_filename);
14725 printf(" %d", n_recovery);
14726 printf(" %d", n_data);
14727 printf("\n");
14728 }
14729 }
14730 }
14731 }
14732 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014733 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014734#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014735#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014736
Daniel Veillard42595322004-11-08 10:52:06 +000014737 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014738}
14739
14740
14741static int
14742test_xmlSAXParseMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014743 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014744
William M. Brack21e4ef22005-01-02 09:53:13 +000014745#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014746#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014747 int mem_base;
14748 xmlDocPtr ret_val;
14749 xmlSAXHandlerPtr sax; /* the SAX handler block */
14750 int n_sax;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014751 char * buffer; /* an pointer to a char array */
Daniel Veillard34099b42004-11-04 17:34:35 +000014752 int n_buffer;
14753 int size; /* the size of the array */
14754 int n_size;
14755 int recovery; /* work in recovery mode, i.e. tries to read not Well Formed documents */
14756 int n_recovery;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014757
Daniel Veillard34099b42004-11-04 17:34:35 +000014758 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14759 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14760 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14761 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14762 mem_base = xmlMemBlocks();
14763 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14764 buffer = gen_const_char_ptr(n_buffer, 1);
14765 size = gen_int(n_size, 2);
14766 recovery = gen_int(n_recovery, 3);
14767
William M. Brackf13f77f2004-11-12 16:03:48 +000014768 ret_val = xmlSAXParseMemory(sax, (const char *)buffer, size, recovery);
Daniel Veillard34099b42004-11-04 17:34:35 +000014769 desret_xmlDocPtr(ret_val);
14770 call_tests++;
14771 des_xmlSAXHandlerPtr(n_sax, sax, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000014772 des_const_char_ptr(n_buffer, (const char *)buffer, 1);
Daniel Veillard34099b42004-11-04 17:34:35 +000014773 des_int(n_size, size, 2);
14774 des_int(n_recovery, recovery, 3);
14775 xmlResetLastError();
14776 if (mem_base != xmlMemBlocks()) {
14777 printf("Leak of %d blocks found in xmlSAXParseMemory",
14778 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014779 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014780 printf(" %d", n_sax);
14781 printf(" %d", n_buffer);
14782 printf(" %d", n_size);
14783 printf(" %d", n_recovery);
14784 printf("\n");
14785 }
14786 }
14787 }
14788 }
14789 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014790 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014791#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014792#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014793
Daniel Veillard42595322004-11-08 10:52:06 +000014794 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014795}
14796
14797
14798static int
14799test_xmlSAXParseMemoryWithData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014800 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014801
William M. Brack21e4ef22005-01-02 09:53:13 +000014802#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014803#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014804 int mem_base;
14805 xmlDocPtr ret_val;
14806 xmlSAXHandlerPtr sax; /* the SAX handler block */
14807 int n_sax;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014808 char * buffer; /* an pointer to a char array */
Daniel Veillard34099b42004-11-04 17:34:35 +000014809 int n_buffer;
14810 int size; /* the size of the array */
14811 int n_size;
14812 int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */
14813 int n_recovery;
14814 void * data; /* the userdata */
14815 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014816
Daniel Veillard34099b42004-11-04 17:34:35 +000014817 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14818 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14819 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14820 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14821 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
14822 mem_base = xmlMemBlocks();
14823 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14824 buffer = gen_const_char_ptr(n_buffer, 1);
14825 size = gen_int(n_size, 2);
14826 recovery = gen_int(n_recovery, 3);
14827 data = gen_userdata(n_data, 4);
14828
William M. Brackf13f77f2004-11-12 16:03:48 +000014829 ret_val = xmlSAXParseMemoryWithData(sax, (const char *)buffer, size, recovery, data);
Daniel Veillard34099b42004-11-04 17:34:35 +000014830 desret_xmlDocPtr(ret_val);
14831 call_tests++;
14832 des_xmlSAXHandlerPtr(n_sax, sax, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000014833 des_const_char_ptr(n_buffer, (const char *)buffer, 1);
Daniel Veillard34099b42004-11-04 17:34:35 +000014834 des_int(n_size, size, 2);
14835 des_int(n_recovery, recovery, 3);
14836 des_userdata(n_data, data, 4);
14837 xmlResetLastError();
14838 if (mem_base != xmlMemBlocks()) {
14839 printf("Leak of %d blocks found in xmlSAXParseMemoryWithData",
14840 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014841 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014842 printf(" %d", n_sax);
14843 printf(" %d", n_buffer);
14844 printf(" %d", n_size);
14845 printf(" %d", n_recovery);
14846 printf(" %d", n_data);
14847 printf("\n");
14848 }
14849 }
14850 }
14851 }
14852 }
14853 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014854 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014855#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014856#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014857
Daniel Veillard42595322004-11-08 10:52:06 +000014858 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014859}
14860
14861
14862static int
14863test_xmlSAXUserParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014864 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014865
William M. Brack21e4ef22005-01-02 09:53:13 +000014866#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014867#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014868 int mem_base;
14869 int ret_val;
14870 xmlSAXHandlerPtr sax; /* a SAX handler */
14871 int n_sax;
14872 void * user_data; /* The user data returned on SAX callbacks */
14873 int n_user_data;
14874 const char * filename; /* a file name */
14875 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014876
Daniel Veillard34099b42004-11-04 17:34:35 +000014877 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14878 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
14879 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14880 mem_base = xmlMemBlocks();
14881 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14882 user_data = gen_userdata(n_user_data, 1);
14883 filename = gen_filepath(n_filename, 2);
Daniel Veillarda521d282004-11-09 14:59:59 +000014884
14885#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce244ad2004-11-05 10:03:46 +000014886 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
Daniel Veillarda521d282004-11-09 14:59:59 +000014887#endif
14888
Daniel Veillard34099b42004-11-04 17:34:35 +000014889
14890 ret_val = xmlSAXUserParseFile(sax, user_data, filename);
14891 desret_int(ret_val);
14892 call_tests++;
14893 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14894 des_userdata(n_user_data, user_data, 1);
14895 des_filepath(n_filename, filename, 2);
14896 xmlResetLastError();
14897 if (mem_base != xmlMemBlocks()) {
14898 printf("Leak of %d blocks found in xmlSAXUserParseFile",
14899 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014900 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014901 printf(" %d", n_sax);
14902 printf(" %d", n_user_data);
14903 printf(" %d", n_filename);
14904 printf("\n");
14905 }
14906 }
14907 }
14908 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014909 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014910#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014911#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014912
Daniel Veillard42595322004-11-08 10:52:06 +000014913 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014914}
14915
14916
14917static int
14918test_xmlSAXUserParseMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014919 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014920
William M. Brack21e4ef22005-01-02 09:53:13 +000014921#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014922#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014923 int mem_base;
14924 int ret_val;
14925 xmlSAXHandlerPtr sax; /* a SAX handler */
14926 int n_sax;
14927 void * user_data; /* The user data returned on SAX callbacks */
14928 int n_user_data;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014929 char * buffer; /* an in-memory XML document input */
Daniel Veillard34099b42004-11-04 17:34:35 +000014930 int n_buffer;
14931 int size; /* the length of the XML document in bytes */
14932 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014933
Daniel Veillard34099b42004-11-04 17:34:35 +000014934 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14935 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
14936 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14937 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14938 mem_base = xmlMemBlocks();
14939 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14940 user_data = gen_userdata(n_user_data, 1);
14941 buffer = gen_const_char_ptr(n_buffer, 2);
14942 size = gen_int(n_size, 3);
Daniel Veillarda521d282004-11-09 14:59:59 +000014943
14944#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce244ad2004-11-05 10:03:46 +000014945 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
Daniel Veillarda521d282004-11-09 14:59:59 +000014946#endif
14947
Daniel Veillard34099b42004-11-04 17:34:35 +000014948
William M. Brackf13f77f2004-11-12 16:03:48 +000014949 ret_val = xmlSAXUserParseMemory(sax, user_data, (const char *)buffer, size);
Daniel Veillard34099b42004-11-04 17:34:35 +000014950 desret_int(ret_val);
14951 call_tests++;
14952 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14953 des_userdata(n_user_data, user_data, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000014954 des_const_char_ptr(n_buffer, (const char *)buffer, 2);
Daniel Veillard34099b42004-11-04 17:34:35 +000014955 des_int(n_size, size, 3);
14956 xmlResetLastError();
14957 if (mem_base != xmlMemBlocks()) {
14958 printf("Leak of %d blocks found in xmlSAXUserParseMemory",
14959 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014960 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014961 printf(" %d", n_sax);
14962 printf(" %d", n_user_data);
14963 printf(" %d", n_buffer);
14964 printf(" %d", n_size);
14965 printf("\n");
14966 }
14967 }
14968 }
14969 }
14970 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014971 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014972#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014973#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014974
Daniel Veillard42595322004-11-08 10:52:06 +000014975 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014976}
14977
14978
14979static int
14980test_xmlSetExternalEntityLoader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014981 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014982
14983
14984 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000014985 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014986}
14987
14988
14989static int
14990test_xmlSetFeature(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014991 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014992
William M. Brack21e4ef22005-01-02 09:53:13 +000014993#if defined(LIBXML_LEGACY_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014994#ifdef LIBXML_LEGACY_ENABLED
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000014995 int mem_base;
14996 int ret_val;
14997 xmlParserCtxtPtr ctxt; /* an XML/HTML parser context */
14998 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014999 char * name; /* the feature name */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015000 int n_name;
15001 void * value; /* pointer to the location of the new value */
15002 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015003
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015004 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15005 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
15006 for (n_value = 0;n_value < gen_nb_void_ptr;n_value++) {
15007 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000015008 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15009 name = gen_const_char_ptr(n_name, 1);
15010 value = gen_void_ptr(n_value, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015011
William M. Brackf13f77f2004-11-12 16:03:48 +000015012 ret_val = xmlSetFeature(ctxt, (const char *)name, value);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015013 desret_int(ret_val);
15014 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015015 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000015016 des_const_char_ptr(n_name, (const char *)name, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000015017 des_void_ptr(n_value, value, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015018 xmlResetLastError();
15019 if (mem_base != xmlMemBlocks()) {
15020 printf("Leak of %d blocks found in xmlSetFeature",
15021 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015022 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015023 printf(" %d", n_ctxt);
15024 printf(" %d", n_name);
15025 printf(" %d", n_value);
15026 printf("\n");
15027 }
15028 }
15029 }
15030 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015031 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000015032#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000015033#endif
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015034
Daniel Veillard42595322004-11-08 10:52:06 +000015035 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015036}
15037
15038
15039static int
15040test_xmlSetupParserForBuffer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015041 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015042
William M. Brack21e4ef22005-01-02 09:53:13 +000015043#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000015044#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000015045 int mem_base;
15046 xmlParserCtxtPtr ctxt; /* an XML parser context */
15047 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000015048 xmlChar * buffer; /* a xmlChar * buffer */
Daniel Veillardd93f6252004-11-02 15:53:51 +000015049 int n_buffer;
15050 const char * filename; /* a file name */
15051 int n_filename;
15052
15053 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15054 for (n_buffer = 0;n_buffer < gen_nb_const_xmlChar_ptr;n_buffer++) {
15055 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
15056 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000015057 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15058 buffer = gen_const_xmlChar_ptr(n_buffer, 1);
15059 filename = gen_filepath(n_filename, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015060
William M. Brackf13f77f2004-11-12 16:03:48 +000015061 xmlSetupParserForBuffer(ctxt, (const xmlChar *)buffer, filename);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015062 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015063 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000015064 des_const_xmlChar_ptr(n_buffer, (const xmlChar *)buffer, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000015065 des_filepath(n_filename, filename, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015066 xmlResetLastError();
15067 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000015068 printf("Leak of %d blocks found in xmlSetupParserForBuffer",
Daniel Veillardd93f6252004-11-02 15:53:51 +000015069 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015070 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000015071 printf(" %d", n_ctxt);
15072 printf(" %d", n_buffer);
15073 printf(" %d", n_filename);
15074 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000015075 }
15076 }
15077 }
15078 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015079 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000015080#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000015081#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000015082
Daniel Veillard42595322004-11-08 10:52:06 +000015083 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015084}
15085
15086
15087static int
15088test_xmlStopParser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015089 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015090
William M. Brack21e4ef22005-01-02 09:53:13 +000015091#if defined(LIBXML_PUSH_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000015092#ifdef LIBXML_PUSH_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000015093 int mem_base;
15094 xmlParserCtxtPtr ctxt; /* an XML parser context */
15095 int n_ctxt;
15096
15097 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15098 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000015099 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015100
15101 xmlStopParser(ctxt);
15102 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015103 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015104 xmlResetLastError();
15105 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000015106 printf("Leak of %d blocks found in xmlStopParser",
Daniel Veillardd93f6252004-11-02 15:53:51 +000015107 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015108 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000015109 printf(" %d", n_ctxt);
15110 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000015111 }
15112 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015113 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000015114#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000015115#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000015116
Daniel Veillard42595322004-11-08 10:52:06 +000015117 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015118}
15119
15120
15121static int
15122test_xmlSubstituteEntitiesDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015123 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015124
15125 int mem_base;
15126 int ret_val;
15127 int val; /* int 0 or 1 */
15128 int n_val;
15129
15130 for (n_val = 0;n_val < gen_nb_int;n_val++) {
15131 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000015132 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015133
15134 ret_val = xmlSubstituteEntitiesDefault(val);
15135 desret_int(ret_val);
15136 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015137 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015138 xmlResetLastError();
15139 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000015140 printf("Leak of %d blocks found in xmlSubstituteEntitiesDefault",
Daniel Veillardd93f6252004-11-02 15:53:51 +000015141 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015142 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000015143 printf(" %d", n_val);
15144 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000015145 }
15146 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000015147 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015148
Daniel Veillard42595322004-11-08 10:52:06 +000015149 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015150}
15151
15152static int
15153test_parser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015154 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015155
William M. Brack094dd862004-11-14 14:28:34 +000015156 if (quiet == 0) printf("Testing parser : 60 of 69 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000015157 test_ret += test_xmlByteConsumed();
15158 test_ret += test_xmlClearNodeInfoSeq();
15159 test_ret += test_xmlClearParserCtxt();
15160 test_ret += test_xmlCreateDocParserCtxt();
15161 test_ret += test_xmlCreatePushParserCtxt();
15162 test_ret += test_xmlCtxtReadDoc();
15163 test_ret += test_xmlCtxtReadFile();
15164 test_ret += test_xmlCtxtReadMemory();
15165 test_ret += test_xmlCtxtReset();
15166 test_ret += test_xmlCtxtResetPush();
15167 test_ret += test_xmlCtxtUseOptions();
15168 test_ret += test_xmlGetExternalEntityLoader();
15169 test_ret += test_xmlGetFeature();
15170 test_ret += test_xmlGetFeaturesList();
15171 test_ret += test_xmlIOParseDTD();
15172 test_ret += test_xmlInitNodeInfoSeq();
15173 test_ret += test_xmlInitParser();
15174 test_ret += test_xmlInitParserCtxt();
15175 test_ret += test_xmlKeepBlanksDefault();
15176 test_ret += test_xmlLineNumbersDefault();
15177 test_ret += test_xmlLoadExternalEntity();
15178 test_ret += test_xmlNewIOInputStream();
15179 test_ret += test_xmlNewParserCtxt();
15180 test_ret += test_xmlParseBalancedChunkMemory();
15181 test_ret += test_xmlParseBalancedChunkMemoryRecover();
15182 test_ret += test_xmlParseChunk();
15183 test_ret += test_xmlParseCtxtExternalEntity();
15184 test_ret += test_xmlParseDTD();
15185 test_ret += test_xmlParseDoc();
15186 test_ret += test_xmlParseDocument();
15187 test_ret += test_xmlParseEntity();
15188 test_ret += test_xmlParseExtParsedEnt();
15189 test_ret += test_xmlParseExternalEntity();
15190 test_ret += test_xmlParseFile();
15191 test_ret += test_xmlParseInNodeContext();
15192 test_ret += test_xmlParseMemory();
15193 test_ret += test_xmlParserAddNodeInfo();
15194 test_ret += test_xmlParserFindNodeInfo();
15195 test_ret += test_xmlParserFindNodeInfoIndex();
15196 test_ret += test_xmlParserInputGrow();
15197 test_ret += test_xmlParserInputRead();
15198 test_ret += test_xmlPedanticParserDefault();
15199 test_ret += test_xmlReadDoc();
15200 test_ret += test_xmlReadFile();
15201 test_ret += test_xmlReadMemory();
15202 test_ret += test_xmlRecoverDoc();
15203 test_ret += test_xmlRecoverFile();
15204 test_ret += test_xmlRecoverMemory();
15205 test_ret += test_xmlSAXParseDTD();
15206 test_ret += test_xmlSAXParseDoc();
15207 test_ret += test_xmlSAXParseEntity();
15208 test_ret += test_xmlSAXParseFile();
15209 test_ret += test_xmlSAXParseFileWithData();
15210 test_ret += test_xmlSAXParseMemory();
15211 test_ret += test_xmlSAXParseMemoryWithData();
15212 test_ret += test_xmlSAXUserParseFile();
15213 test_ret += test_xmlSAXUserParseMemory();
15214 test_ret += test_xmlSetExternalEntityLoader();
15215 test_ret += test_xmlSetFeature();
15216 test_ret += test_xmlSetupParserForBuffer();
15217 test_ret += test_xmlStopParser();
15218 test_ret += test_xmlSubstituteEntitiesDefault();
Daniel Veillardd93f6252004-11-02 15:53:51 +000015219
Daniel Veillard42595322004-11-08 10:52:06 +000015220 if (test_ret != 0)
15221 printf("Module parser: %d errors\n", test_ret);
15222 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015223}
15224
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015225static int
15226test_htmlCreateFileParserCtxt(void) {
15227 int test_ret = 0;
15228
William M. Brack21e4ef22005-01-02 09:53:13 +000015229#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015230 int mem_base;
15231 htmlParserCtxtPtr ret_val;
15232 const char * filename; /* the filename */
15233 int n_filename;
15234 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
15235 int n_encoding;
15236
15237 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
15238 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
15239 mem_base = xmlMemBlocks();
15240 filename = gen_fileoutput(n_filename, 0);
15241 encoding = gen_const_char_ptr(n_encoding, 1);
15242
William M. Brackf13f77f2004-11-12 16:03:48 +000015243 ret_val = htmlCreateFileParserCtxt(filename, (const char *)encoding);
Daniel Veillarda521d282004-11-09 14:59:59 +000015244 desret_htmlParserCtxtPtr(ret_val);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015245 call_tests++;
15246 des_fileoutput(n_filename, filename, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000015247 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015248 xmlResetLastError();
15249 if (mem_base != xmlMemBlocks()) {
15250 printf("Leak of %d blocks found in htmlCreateFileParserCtxt",
15251 xmlMemBlocks() - mem_base);
15252 test_ret++;
15253 printf(" %d", n_filename);
15254 printf(" %d", n_encoding);
15255 printf("\n");
15256 }
15257 }
15258 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015259 function_tests++;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015260#endif
15261
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015262 return(test_ret);
15263}
15264
15265
15266static int
15267test_htmlInitAutoClose(void) {
15268 int test_ret = 0;
15269
William M. Brack21e4ef22005-01-02 09:53:13 +000015270#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015271 int mem_base;
15272
15273 mem_base = xmlMemBlocks();
15274
15275 htmlInitAutoClose();
15276 call_tests++;
15277 xmlResetLastError();
15278 if (mem_base != xmlMemBlocks()) {
15279 printf("Leak of %d blocks found in htmlInitAutoClose",
15280 xmlMemBlocks() - mem_base);
15281 test_ret++;
15282 printf("\n");
15283 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015284 function_tests++;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015285#endif
15286
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015287 return(test_ret);
15288}
15289
15290
15291static int
15292test_inputPop(void) {
15293 int test_ret = 0;
15294
15295 int mem_base;
15296 xmlParserInputPtr ret_val;
15297 xmlParserCtxtPtr ctxt; /* an XML parser context */
15298 int n_ctxt;
15299
15300 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15301 mem_base = xmlMemBlocks();
15302 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15303
15304 ret_val = inputPop(ctxt);
15305 desret_xmlParserInputPtr(ret_val);
15306 call_tests++;
15307 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15308 xmlResetLastError();
15309 if (mem_base != xmlMemBlocks()) {
15310 printf("Leak of %d blocks found in inputPop",
15311 xmlMemBlocks() - mem_base);
15312 test_ret++;
15313 printf(" %d", n_ctxt);
15314 printf("\n");
15315 }
15316 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015317 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015318
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015319 return(test_ret);
15320}
15321
15322
15323static int
15324test_inputPush(void) {
15325 int test_ret = 0;
15326
15327 int mem_base;
15328 int ret_val;
15329 xmlParserCtxtPtr ctxt; /* an XML parser context */
15330 int n_ctxt;
15331 xmlParserInputPtr value; /* the parser input */
15332 int n_value;
15333
15334 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15335 for (n_value = 0;n_value < gen_nb_xmlParserInputPtr;n_value++) {
15336 mem_base = xmlMemBlocks();
15337 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15338 value = gen_xmlParserInputPtr(n_value, 1);
15339
15340 ret_val = inputPush(ctxt, value);
15341 desret_int(ret_val);
15342 call_tests++;
15343 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15344 des_xmlParserInputPtr(n_value, value, 1);
15345 xmlResetLastError();
15346 if (mem_base != xmlMemBlocks()) {
15347 printf("Leak of %d blocks found in inputPush",
15348 xmlMemBlocks() - mem_base);
15349 test_ret++;
15350 printf(" %d", n_ctxt);
15351 printf(" %d", n_value);
15352 printf("\n");
15353 }
15354 }
15355 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015356 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015357
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015358 return(test_ret);
15359}
15360
15361
15362static int
15363test_namePop(void) {
15364 int test_ret = 0;
15365
15366 int mem_base;
15367 const xmlChar * ret_val;
15368 xmlParserCtxtPtr ctxt; /* an XML parser context */
15369 int n_ctxt;
15370
15371 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15372 mem_base = xmlMemBlocks();
15373 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15374
15375 ret_val = namePop(ctxt);
15376 desret_const_xmlChar_ptr(ret_val);
15377 call_tests++;
15378 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15379 xmlResetLastError();
15380 if (mem_base != xmlMemBlocks()) {
15381 printf("Leak of %d blocks found in namePop",
15382 xmlMemBlocks() - mem_base);
15383 test_ret++;
15384 printf(" %d", n_ctxt);
15385 printf("\n");
15386 }
15387 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015388 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015389
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015390 return(test_ret);
15391}
15392
15393
15394static int
15395test_namePush(void) {
15396 int test_ret = 0;
15397
15398 int mem_base;
15399 int ret_val;
15400 xmlParserCtxtPtr ctxt; /* an XML parser context */
15401 int n_ctxt;
15402 xmlChar * value; /* the element name */
15403 int n_value;
15404
15405 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15406 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
15407 mem_base = xmlMemBlocks();
15408 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15409 value = gen_const_xmlChar_ptr(n_value, 1);
15410
William M. Brackf13f77f2004-11-12 16:03:48 +000015411 ret_val = namePush(ctxt, (const xmlChar *)value);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015412 desret_int(ret_val);
15413 call_tests++;
15414 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000015415 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015416 xmlResetLastError();
15417 if (mem_base != xmlMemBlocks()) {
15418 printf("Leak of %d blocks found in namePush",
15419 xmlMemBlocks() - mem_base);
15420 test_ret++;
15421 printf(" %d", n_ctxt);
15422 printf(" %d", n_value);
15423 printf("\n");
15424 }
15425 }
15426 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015427 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015428
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015429 return(test_ret);
15430}
15431
15432
15433static int
15434test_nodePop(void) {
15435 int test_ret = 0;
15436
15437 int mem_base;
15438 xmlNodePtr ret_val;
15439 xmlParserCtxtPtr ctxt; /* an XML parser context */
15440 int n_ctxt;
15441
15442 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15443 mem_base = xmlMemBlocks();
15444 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15445
15446 ret_val = nodePop(ctxt);
15447 desret_xmlNodePtr(ret_val);
15448 call_tests++;
15449 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15450 xmlResetLastError();
15451 if (mem_base != xmlMemBlocks()) {
15452 printf("Leak of %d blocks found in nodePop",
15453 xmlMemBlocks() - mem_base);
15454 test_ret++;
15455 printf(" %d", n_ctxt);
15456 printf("\n");
15457 }
15458 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015459 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015460
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015461 return(test_ret);
15462}
15463
15464
15465static int
15466test_nodePush(void) {
15467 int test_ret = 0;
15468
15469 int mem_base;
15470 int ret_val;
15471 xmlParserCtxtPtr ctxt; /* an XML parser context */
15472 int n_ctxt;
15473 xmlNodePtr value; /* the element node */
15474 int n_value;
15475
15476 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15477 for (n_value = 0;n_value < gen_nb_xmlNodePtr;n_value++) {
15478 mem_base = xmlMemBlocks();
15479 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15480 value = gen_xmlNodePtr(n_value, 1);
15481
15482 ret_val = nodePush(ctxt, value);
15483 desret_int(ret_val);
15484 call_tests++;
15485 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15486 des_xmlNodePtr(n_value, value, 1);
15487 xmlResetLastError();
15488 if (mem_base != xmlMemBlocks()) {
15489 printf("Leak of %d blocks found in nodePush",
15490 xmlMemBlocks() - mem_base);
15491 test_ret++;
15492 printf(" %d", n_ctxt);
15493 printf(" %d", n_value);
15494 printf("\n");
15495 }
15496 }
15497 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015498 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015499
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015500 return(test_ret);
15501}
15502
15503
15504static int
15505test_xmlCheckLanguageID(void) {
15506 int test_ret = 0;
15507
15508 int mem_base;
15509 int ret_val;
15510 xmlChar * lang; /* pointer to the string value */
15511 int n_lang;
15512
15513 for (n_lang = 0;n_lang < gen_nb_const_xmlChar_ptr;n_lang++) {
15514 mem_base = xmlMemBlocks();
15515 lang = gen_const_xmlChar_ptr(n_lang, 0);
15516
William M. Brackf13f77f2004-11-12 16:03:48 +000015517 ret_val = xmlCheckLanguageID((const xmlChar *)lang);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015518 desret_int(ret_val);
15519 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000015520 des_const_xmlChar_ptr(n_lang, (const xmlChar *)lang, 0);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015521 xmlResetLastError();
15522 if (mem_base != xmlMemBlocks()) {
15523 printf("Leak of %d blocks found in xmlCheckLanguageID",
15524 xmlMemBlocks() - mem_base);
15525 test_ret++;
15526 printf(" %d", n_lang);
15527 printf("\n");
15528 }
15529 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015530 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015531
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015532 return(test_ret);
15533}
15534
15535
15536static int
15537test_xmlCopyChar(void) {
15538 int test_ret = 0;
15539
15540 int mem_base;
15541 int ret_val;
15542 int len; /* Ignored, compatibility */
15543 int n_len;
15544 xmlChar * out; /* pointer to an array of xmlChar */
15545 int n_out;
15546 int val; /* the char value */
15547 int n_val;
15548
15549 for (n_len = 0;n_len < gen_nb_int;n_len++) {
15550 for (n_out = 0;n_out < gen_nb_xmlChar_ptr;n_out++) {
15551 for (n_val = 0;n_val < gen_nb_int;n_val++) {
15552 mem_base = xmlMemBlocks();
15553 len = gen_int(n_len, 0);
15554 out = gen_xmlChar_ptr(n_out, 1);
15555 val = gen_int(n_val, 2);
15556
15557 ret_val = xmlCopyChar(len, out, val);
15558 desret_int(ret_val);
15559 call_tests++;
15560 des_int(n_len, len, 0);
15561 des_xmlChar_ptr(n_out, out, 1);
15562 des_int(n_val, val, 2);
15563 xmlResetLastError();
15564 if (mem_base != xmlMemBlocks()) {
15565 printf("Leak of %d blocks found in xmlCopyChar",
15566 xmlMemBlocks() - mem_base);
15567 test_ret++;
15568 printf(" %d", n_len);
15569 printf(" %d", n_out);
15570 printf(" %d", n_val);
15571 printf("\n");
15572 }
15573 }
15574 }
15575 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015576 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015577
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015578 return(test_ret);
15579}
15580
15581
15582static int
15583test_xmlCopyCharMultiByte(void) {
15584 int test_ret = 0;
15585
15586 int mem_base;
15587 int ret_val;
15588 xmlChar * out; /* pointer to an array of xmlChar */
15589 int n_out;
15590 int val; /* the char value */
15591 int n_val;
15592
15593 for (n_out = 0;n_out < gen_nb_xmlChar_ptr;n_out++) {
15594 for (n_val = 0;n_val < gen_nb_int;n_val++) {
15595 mem_base = xmlMemBlocks();
15596 out = gen_xmlChar_ptr(n_out, 0);
15597 val = gen_int(n_val, 1);
15598
15599 ret_val = xmlCopyCharMultiByte(out, val);
15600 desret_int(ret_val);
15601 call_tests++;
15602 des_xmlChar_ptr(n_out, out, 0);
15603 des_int(n_val, val, 1);
15604 xmlResetLastError();
15605 if (mem_base != xmlMemBlocks()) {
15606 printf("Leak of %d blocks found in xmlCopyCharMultiByte",
15607 xmlMemBlocks() - mem_base);
15608 test_ret++;
15609 printf(" %d", n_out);
15610 printf(" %d", n_val);
15611 printf("\n");
15612 }
15613 }
15614 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015615 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015616
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015617 return(test_ret);
15618}
15619
15620
15621static int
15622test_xmlCreateEntityParserCtxt(void) {
15623 int test_ret = 0;
15624
15625 int mem_base;
15626 xmlParserCtxtPtr ret_val;
15627 xmlChar * URL; /* the entity URL */
15628 int n_URL;
15629 xmlChar * ID; /* the entity PUBLIC ID */
15630 int n_ID;
15631 xmlChar * base; /* a possible base for the target URI */
15632 int n_base;
15633
15634 for (n_URL = 0;n_URL < gen_nb_const_xmlChar_ptr;n_URL++) {
15635 for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) {
15636 for (n_base = 0;n_base < gen_nb_const_xmlChar_ptr;n_base++) {
15637 mem_base = xmlMemBlocks();
15638 URL = gen_const_xmlChar_ptr(n_URL, 0);
15639 ID = gen_const_xmlChar_ptr(n_ID, 1);
15640 base = gen_const_xmlChar_ptr(n_base, 2);
15641
William M. Brackf13f77f2004-11-12 16:03:48 +000015642 ret_val = xmlCreateEntityParserCtxt((const xmlChar *)URL, (const xmlChar *)ID, (const xmlChar *)base);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015643 desret_xmlParserCtxtPtr(ret_val);
15644 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000015645 des_const_xmlChar_ptr(n_URL, (const xmlChar *)URL, 0);
15646 des_const_xmlChar_ptr(n_ID, (const xmlChar *)ID, 1);
15647 des_const_xmlChar_ptr(n_base, (const xmlChar *)base, 2);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015648 xmlResetLastError();
15649 if (mem_base != xmlMemBlocks()) {
15650 printf("Leak of %d blocks found in xmlCreateEntityParserCtxt",
15651 xmlMemBlocks() - mem_base);
15652 test_ret++;
15653 printf(" %d", n_URL);
15654 printf(" %d", n_ID);
15655 printf(" %d", n_base);
15656 printf("\n");
15657 }
15658 }
15659 }
15660 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015661 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015662
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015663 return(test_ret);
15664}
15665
15666
15667static int
15668test_xmlCreateFileParserCtxt(void) {
15669 int test_ret = 0;
15670
15671 int mem_base;
15672 xmlParserCtxtPtr ret_val;
15673 const char * filename; /* the filename */
15674 int n_filename;
15675
15676 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
15677 mem_base = xmlMemBlocks();
15678 filename = gen_fileoutput(n_filename, 0);
15679
15680 ret_val = xmlCreateFileParserCtxt(filename);
15681 desret_xmlParserCtxtPtr(ret_val);
15682 call_tests++;
15683 des_fileoutput(n_filename, filename, 0);
15684 xmlResetLastError();
15685 if (mem_base != xmlMemBlocks()) {
15686 printf("Leak of %d blocks found in xmlCreateFileParserCtxt",
15687 xmlMemBlocks() - mem_base);
15688 test_ret++;
15689 printf(" %d", n_filename);
15690 printf("\n");
15691 }
15692 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015693 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015694
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015695 return(test_ret);
15696}
15697
15698
15699static int
15700test_xmlCreateMemoryParserCtxt(void) {
15701 int test_ret = 0;
15702
15703 int mem_base;
15704 xmlParserCtxtPtr ret_val;
15705 char * buffer; /* a pointer to a char array */
15706 int n_buffer;
15707 int size; /* the size of the array */
15708 int n_size;
15709
15710 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
15711 for (n_size = 0;n_size < gen_nb_int;n_size++) {
15712 mem_base = xmlMemBlocks();
15713 buffer = gen_const_char_ptr(n_buffer, 0);
15714 size = gen_int(n_size, 1);
15715
William M. Brackf13f77f2004-11-12 16:03:48 +000015716 ret_val = xmlCreateMemoryParserCtxt((const char *)buffer, size);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015717 desret_xmlParserCtxtPtr(ret_val);
15718 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000015719 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015720 des_int(n_size, size, 1);
15721 xmlResetLastError();
15722 if (mem_base != xmlMemBlocks()) {
15723 printf("Leak of %d blocks found in xmlCreateMemoryParserCtxt",
15724 xmlMemBlocks() - mem_base);
15725 test_ret++;
15726 printf(" %d", n_buffer);
15727 printf(" %d", n_size);
15728 printf("\n");
15729 }
15730 }
15731 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015732 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015733
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015734 return(test_ret);
15735}
15736
15737
15738static int
15739test_xmlCreateURLParserCtxt(void) {
15740 int test_ret = 0;
15741
15742 int mem_base;
15743 xmlParserCtxtPtr ret_val;
15744 const char * filename; /* the filename or URL */
15745 int n_filename;
15746 int options; /* a combination of xmlParserOption */
15747 int n_options;
15748
15749 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
15750 for (n_options = 0;n_options < gen_nb_int;n_options++) {
15751 mem_base = xmlMemBlocks();
15752 filename = gen_fileoutput(n_filename, 0);
15753 options = gen_int(n_options, 1);
15754
15755 ret_val = xmlCreateURLParserCtxt(filename, options);
15756 desret_xmlParserCtxtPtr(ret_val);
15757 call_tests++;
15758 des_fileoutput(n_filename, filename, 0);
15759 des_int(n_options, options, 1);
15760 xmlResetLastError();
15761 if (mem_base != xmlMemBlocks()) {
15762 printf("Leak of %d blocks found in xmlCreateURLParserCtxt",
15763 xmlMemBlocks() - mem_base);
15764 test_ret++;
15765 printf(" %d", n_filename);
15766 printf(" %d", n_options);
15767 printf("\n");
15768 }
15769 }
15770 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015771 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015772
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015773 return(test_ret);
15774}
15775
15776
15777static int
15778test_xmlCurrentChar(void) {
15779 int test_ret = 0;
15780
15781 int mem_base;
15782 int ret_val;
15783 xmlParserCtxtPtr ctxt; /* the XML parser context */
15784 int n_ctxt;
15785 int * len; /* pointer to the length of the char read */
15786 int n_len;
15787
15788 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15789 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
15790 mem_base = xmlMemBlocks();
15791 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15792 len = gen_int_ptr(n_len, 1);
15793
15794 ret_val = xmlCurrentChar(ctxt, len);
15795 desret_int(ret_val);
15796 call_tests++;
15797 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15798 des_int_ptr(n_len, len, 1);
15799 xmlResetLastError();
15800 if (mem_base != xmlMemBlocks()) {
15801 printf("Leak of %d blocks found in xmlCurrentChar",
15802 xmlMemBlocks() - mem_base);
15803 test_ret++;
15804 printf(" %d", n_ctxt);
15805 printf(" %d", n_len);
15806 printf("\n");
15807 }
15808 }
15809 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015810 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015811
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015812 return(test_ret);
15813}
15814
15815
15816static int
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015817test_xmlErrMemory(void) {
15818 int test_ret = 0;
15819
15820 int mem_base;
15821 xmlParserCtxtPtr ctxt; /* an XML parser context */
15822 int n_ctxt;
15823 char * extra; /* extra informations */
15824 int n_extra;
15825
15826 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15827 for (n_extra = 0;n_extra < gen_nb_const_char_ptr;n_extra++) {
15828 mem_base = xmlMemBlocks();
15829 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15830 extra = gen_const_char_ptr(n_extra, 1);
15831
William M. Brackf13f77f2004-11-12 16:03:48 +000015832 xmlErrMemory(ctxt, (const char *)extra);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015833 call_tests++;
15834 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000015835 des_const_char_ptr(n_extra, (const char *)extra, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015836 xmlResetLastError();
15837 if (mem_base != xmlMemBlocks()) {
15838 printf("Leak of %d blocks found in xmlErrMemory",
15839 xmlMemBlocks() - mem_base);
15840 test_ret++;
15841 printf(" %d", n_ctxt);
15842 printf(" %d", n_extra);
15843 printf("\n");
15844 }
15845 }
15846 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015847 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015848
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015849 return(test_ret);
15850}
15851
15852
15853static int
15854test_xmlIsLetter(void) {
15855 int test_ret = 0;
15856
15857 int mem_base;
15858 int ret_val;
15859 int c; /* an unicode character (int) */
15860 int n_c;
15861
15862 for (n_c = 0;n_c < gen_nb_int;n_c++) {
15863 mem_base = xmlMemBlocks();
15864 c = gen_int(n_c, 0);
15865
15866 ret_val = xmlIsLetter(c);
15867 desret_int(ret_val);
15868 call_tests++;
15869 des_int(n_c, c, 0);
15870 xmlResetLastError();
15871 if (mem_base != xmlMemBlocks()) {
15872 printf("Leak of %d blocks found in xmlIsLetter",
15873 xmlMemBlocks() - mem_base);
15874 test_ret++;
15875 printf(" %d", n_c);
15876 printf("\n");
15877 }
15878 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015879 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015880
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015881 return(test_ret);
15882}
15883
15884
15885static int
15886test_xmlNewEntityInputStream(void) {
15887 int test_ret = 0;
15888
15889 int mem_base;
15890 xmlParserInputPtr ret_val;
15891 xmlParserCtxtPtr ctxt; /* an XML parser context */
15892 int n_ctxt;
15893 xmlEntityPtr entity; /* an Entity pointer */
15894 int n_entity;
15895
15896 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15897 for (n_entity = 0;n_entity < gen_nb_xmlEntityPtr;n_entity++) {
15898 mem_base = xmlMemBlocks();
15899 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15900 entity = gen_xmlEntityPtr(n_entity, 1);
15901
15902 ret_val = xmlNewEntityInputStream(ctxt, entity);
15903 desret_xmlParserInputPtr(ret_val);
15904 call_tests++;
15905 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15906 des_xmlEntityPtr(n_entity, entity, 1);
15907 xmlResetLastError();
15908 if (mem_base != xmlMemBlocks()) {
15909 printf("Leak of %d blocks found in xmlNewEntityInputStream",
15910 xmlMemBlocks() - mem_base);
15911 test_ret++;
15912 printf(" %d", n_ctxt);
15913 printf(" %d", n_entity);
15914 printf("\n");
15915 }
15916 }
15917 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015918 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015919
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015920 return(test_ret);
15921}
15922
15923
15924static int
15925test_xmlNewInputFromFile(void) {
15926 int test_ret = 0;
15927
15928 int mem_base;
15929 xmlParserInputPtr ret_val;
15930 xmlParserCtxtPtr ctxt; /* an XML parser context */
15931 int n_ctxt;
15932 const char * filename; /* the filename to use as entity */
15933 int n_filename;
15934
15935 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15936 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
15937 mem_base = xmlMemBlocks();
15938 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15939 filename = gen_filepath(n_filename, 1);
15940
15941 ret_val = xmlNewInputFromFile(ctxt, filename);
15942 desret_xmlParserInputPtr(ret_val);
15943 call_tests++;
15944 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15945 des_filepath(n_filename, filename, 1);
15946 xmlResetLastError();
15947 if (mem_base != xmlMemBlocks()) {
15948 printf("Leak of %d blocks found in xmlNewInputFromFile",
15949 xmlMemBlocks() - mem_base);
15950 test_ret++;
15951 printf(" %d", n_ctxt);
15952 printf(" %d", n_filename);
15953 printf("\n");
15954 }
15955 }
15956 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015957 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015958
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015959 return(test_ret);
15960}
15961
15962
15963static int
15964test_xmlNewInputStream(void) {
15965 int test_ret = 0;
15966
15967 int mem_base;
15968 xmlParserInputPtr ret_val;
15969 xmlParserCtxtPtr ctxt; /* an XML parser context */
15970 int n_ctxt;
15971
15972 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15973 mem_base = xmlMemBlocks();
15974 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15975
15976 ret_val = xmlNewInputStream(ctxt);
15977 desret_xmlParserInputPtr(ret_val);
15978 call_tests++;
15979 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15980 xmlResetLastError();
15981 if (mem_base != xmlMemBlocks()) {
15982 printf("Leak of %d blocks found in xmlNewInputStream",
15983 xmlMemBlocks() - mem_base);
15984 test_ret++;
15985 printf(" %d", n_ctxt);
15986 printf("\n");
15987 }
15988 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015989 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015990
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015991 return(test_ret);
15992}
15993
15994
15995static int
15996test_xmlNewStringInputStream(void) {
15997 int test_ret = 0;
15998
15999 int mem_base;
16000 xmlParserInputPtr ret_val;
16001 xmlParserCtxtPtr ctxt; /* an XML parser context */
16002 int n_ctxt;
16003 xmlChar * buffer; /* an memory buffer */
16004 int n_buffer;
16005
16006 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16007 for (n_buffer = 0;n_buffer < gen_nb_const_xmlChar_ptr;n_buffer++) {
16008 mem_base = xmlMemBlocks();
16009 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16010 buffer = gen_const_xmlChar_ptr(n_buffer, 1);
16011
William M. Brackf13f77f2004-11-12 16:03:48 +000016012 ret_val = xmlNewStringInputStream(ctxt, (const xmlChar *)buffer);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016013 desret_xmlParserInputPtr(ret_val);
16014 call_tests++;
16015 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000016016 des_const_xmlChar_ptr(n_buffer, (const xmlChar *)buffer, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016017 xmlResetLastError();
16018 if (mem_base != xmlMemBlocks()) {
16019 printf("Leak of %d blocks found in xmlNewStringInputStream",
16020 xmlMemBlocks() - mem_base);
16021 test_ret++;
16022 printf(" %d", n_ctxt);
16023 printf(" %d", n_buffer);
16024 printf("\n");
16025 }
16026 }
16027 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016028 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016029
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016030 return(test_ret);
16031}
16032
16033
16034static int
16035test_xmlNextChar(void) {
16036 int test_ret = 0;
16037
16038 int mem_base;
16039 xmlParserCtxtPtr ctxt; /* the XML parser context */
16040 int n_ctxt;
16041
16042 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16043 mem_base = xmlMemBlocks();
16044 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16045
16046 xmlNextChar(ctxt);
16047 call_tests++;
16048 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16049 xmlResetLastError();
16050 if (mem_base != xmlMemBlocks()) {
16051 printf("Leak of %d blocks found in xmlNextChar",
16052 xmlMemBlocks() - mem_base);
16053 test_ret++;
16054 printf(" %d", n_ctxt);
16055 printf("\n");
16056 }
16057 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016058 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016059
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016060 return(test_ret);
16061}
16062
16063
16064static int
16065test_xmlParserInputShrink(void) {
16066 int test_ret = 0;
16067
16068 int mem_base;
16069 xmlParserInputPtr in; /* an XML parser input */
16070 int n_in;
16071
16072 for (n_in = 0;n_in < gen_nb_xmlParserInputPtr;n_in++) {
16073 mem_base = xmlMemBlocks();
16074 in = gen_xmlParserInputPtr(n_in, 0);
16075
16076 xmlParserInputShrink(in);
16077 call_tests++;
16078 des_xmlParserInputPtr(n_in, in, 0);
16079 xmlResetLastError();
16080 if (mem_base != xmlMemBlocks()) {
16081 printf("Leak of %d blocks found in xmlParserInputShrink",
16082 xmlMemBlocks() - mem_base);
16083 test_ret++;
16084 printf(" %d", n_in);
16085 printf("\n");
16086 }
16087 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016088 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016089
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016090 return(test_ret);
16091}
16092
16093
16094static int
16095test_xmlPopInput(void) {
16096 int test_ret = 0;
16097
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016098 int mem_base;
16099 xmlChar ret_val;
16100 xmlParserCtxtPtr ctxt; /* an XML parser context */
16101 int n_ctxt;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016102
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016103 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16104 mem_base = xmlMemBlocks();
16105 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16106
16107 ret_val = xmlPopInput(ctxt);
16108 desret_xmlChar(ret_val);
16109 call_tests++;
16110 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16111 xmlResetLastError();
16112 if (mem_base != xmlMemBlocks()) {
16113 printf("Leak of %d blocks found in xmlPopInput",
16114 xmlMemBlocks() - mem_base);
16115 test_ret++;
16116 printf(" %d", n_ctxt);
16117 printf("\n");
16118 }
16119 }
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016120 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016121
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016122 return(test_ret);
16123}
16124
16125
16126static int
16127test_xmlPushInput(void) {
16128 int test_ret = 0;
16129
16130 int mem_base;
16131 xmlParserCtxtPtr ctxt; /* an XML parser context */
16132 int n_ctxt;
16133 xmlParserInputPtr input; /* an XML parser input fragment (entity, XML fragment ...). */
16134 int n_input;
16135
16136 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16137 for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) {
16138 mem_base = xmlMemBlocks();
16139 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16140 input = gen_xmlParserInputPtr(n_input, 1);
16141
16142 xmlPushInput(ctxt, input);
16143 call_tests++;
16144 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16145 des_xmlParserInputPtr(n_input, input, 1);
16146 xmlResetLastError();
16147 if (mem_base != xmlMemBlocks()) {
16148 printf("Leak of %d blocks found in xmlPushInput",
16149 xmlMemBlocks() - mem_base);
16150 test_ret++;
16151 printf(" %d", n_ctxt);
16152 printf(" %d", n_input);
16153 printf("\n");
16154 }
16155 }
16156 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016157 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016158
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016159 return(test_ret);
16160}
16161
16162
16163static int
16164test_xmlSetEntityReferenceFunc(void) {
16165 int test_ret = 0;
16166
16167
16168 /* missing type support */
16169 return(test_ret);
16170}
16171
16172
16173static int
16174test_xmlSplitQName(void) {
16175 int test_ret = 0;
16176
16177 int mem_base;
16178 xmlChar * ret_val;
16179 xmlParserCtxtPtr ctxt; /* an XML parser context */
16180 int n_ctxt;
16181 xmlChar * name; /* an XML parser context */
16182 int n_name;
16183 xmlChar ** prefix; /* a xmlChar ** */
16184 int n_prefix;
16185
16186 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16187 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
16188 for (n_prefix = 0;n_prefix < gen_nb_xmlChar_ptr_ptr;n_prefix++) {
16189 mem_base = xmlMemBlocks();
16190 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16191 name = gen_const_xmlChar_ptr(n_name, 1);
16192 prefix = gen_xmlChar_ptr_ptr(n_prefix, 2);
16193
William M. Brackf13f77f2004-11-12 16:03:48 +000016194 ret_val = xmlSplitQName(ctxt, (const xmlChar *)name, prefix);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016195 desret_xmlChar_ptr(ret_val);
16196 call_tests++;
16197 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000016198 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016199 des_xmlChar_ptr_ptr(n_prefix, prefix, 2);
16200 xmlResetLastError();
16201 if (mem_base != xmlMemBlocks()) {
16202 printf("Leak of %d blocks found in xmlSplitQName",
16203 xmlMemBlocks() - mem_base);
16204 test_ret++;
16205 printf(" %d", n_ctxt);
16206 printf(" %d", n_name);
16207 printf(" %d", n_prefix);
16208 printf("\n");
16209 }
16210 }
16211 }
16212 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016213 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016214
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016215 return(test_ret);
16216}
16217
16218
16219static int
16220test_xmlStringCurrentChar(void) {
16221 int test_ret = 0;
16222
16223 int mem_base;
16224 int ret_val;
16225 xmlParserCtxtPtr ctxt; /* the XML parser context */
16226 int n_ctxt;
16227 xmlChar * cur; /* pointer to the beginning of the char */
16228 int n_cur;
16229 int * len; /* pointer to the length of the char read */
16230 int n_len;
16231
16232 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16233 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
16234 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
16235 mem_base = xmlMemBlocks();
16236 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16237 cur = gen_const_xmlChar_ptr(n_cur, 1);
16238 len = gen_int_ptr(n_len, 2);
16239
William M. Brackf13f77f2004-11-12 16:03:48 +000016240 ret_val = xmlStringCurrentChar(ctxt, (const xmlChar *)cur, len);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016241 desret_int(ret_val);
16242 call_tests++;
16243 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000016244 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016245 des_int_ptr(n_len, len, 2);
16246 xmlResetLastError();
16247 if (mem_base != xmlMemBlocks()) {
16248 printf("Leak of %d blocks found in xmlStringCurrentChar",
16249 xmlMemBlocks() - mem_base);
16250 test_ret++;
16251 printf(" %d", n_ctxt);
16252 printf(" %d", n_cur);
16253 printf(" %d", n_len);
16254 printf("\n");
16255 }
16256 }
16257 }
16258 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016259 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016260
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016261 return(test_ret);
16262}
16263
16264
16265static int
16266test_xmlStringDecodeEntities(void) {
16267 int test_ret = 0;
16268
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016269 int mem_base;
16270 xmlChar * ret_val;
16271 xmlParserCtxtPtr ctxt; /* the parser context */
16272 int n_ctxt;
16273 xmlChar * str; /* the input string */
16274 int n_str;
16275 int what; /* combination of XML_SUBSTITUTE_REF and XML_SUBSTITUTE_PEREF */
16276 int n_what;
16277 xmlChar end; /* an end marker xmlChar, 0 if none */
16278 int n_end;
16279 xmlChar end2; /* an end marker xmlChar, 0 if none */
16280 int n_end2;
16281 xmlChar end3; /* an end marker xmlChar, 0 if none */
16282 int n_end3;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016283
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016284 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16285 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
16286 for (n_what = 0;n_what < gen_nb_int;n_what++) {
16287 for (n_end = 0;n_end < gen_nb_xmlChar;n_end++) {
16288 for (n_end2 = 0;n_end2 < gen_nb_xmlChar;n_end2++) {
16289 for (n_end3 = 0;n_end3 < gen_nb_xmlChar;n_end3++) {
16290 mem_base = xmlMemBlocks();
16291 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16292 str = gen_const_xmlChar_ptr(n_str, 1);
16293 what = gen_int(n_what, 2);
16294 end = gen_xmlChar(n_end, 3);
16295 end2 = gen_xmlChar(n_end2, 4);
16296 end3 = gen_xmlChar(n_end3, 5);
16297
William M. Brackf13f77f2004-11-12 16:03:48 +000016298 ret_val = xmlStringDecodeEntities(ctxt, (const xmlChar *)str, what, end, end2, end3);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016299 desret_xmlChar_ptr(ret_val);
16300 call_tests++;
16301 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000016302 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016303 des_int(n_what, what, 2);
16304 des_xmlChar(n_end, end, 3);
16305 des_xmlChar(n_end2, end2, 4);
16306 des_xmlChar(n_end3, end3, 5);
16307 xmlResetLastError();
16308 if (mem_base != xmlMemBlocks()) {
16309 printf("Leak of %d blocks found in xmlStringDecodeEntities",
16310 xmlMemBlocks() - mem_base);
16311 test_ret++;
16312 printf(" %d", n_ctxt);
16313 printf(" %d", n_str);
16314 printf(" %d", n_what);
16315 printf(" %d", n_end);
16316 printf(" %d", n_end2);
16317 printf(" %d", n_end3);
16318 printf("\n");
16319 }
16320 }
16321 }
16322 }
16323 }
16324 }
16325 }
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016326 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016327
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016328 return(test_ret);
16329}
16330
16331
16332static int
16333test_xmlStringLenDecodeEntities(void) {
16334 int test_ret = 0;
16335
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016336 int mem_base;
16337 xmlChar * ret_val;
16338 xmlParserCtxtPtr ctxt; /* the parser context */
16339 int n_ctxt;
16340 xmlChar * str; /* the input string */
16341 int n_str;
16342 int len; /* the string length */
16343 int n_len;
16344 int what; /* combination of XML_SUBSTITUTE_REF and XML_SUBSTITUTE_PEREF */
16345 int n_what;
16346 xmlChar end; /* an end marker xmlChar, 0 if none */
16347 int n_end;
16348 xmlChar end2; /* an end marker xmlChar, 0 if none */
16349 int n_end2;
16350 xmlChar end3; /* an end marker xmlChar, 0 if none */
16351 int n_end3;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016352
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016353 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16354 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
16355 for (n_len = 0;n_len < gen_nb_int;n_len++) {
16356 for (n_what = 0;n_what < gen_nb_int;n_what++) {
16357 for (n_end = 0;n_end < gen_nb_xmlChar;n_end++) {
16358 for (n_end2 = 0;n_end2 < gen_nb_xmlChar;n_end2++) {
16359 for (n_end3 = 0;n_end3 < gen_nb_xmlChar;n_end3++) {
16360 mem_base = xmlMemBlocks();
16361 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16362 str = gen_const_xmlChar_ptr(n_str, 1);
16363 len = gen_int(n_len, 2);
16364 what = gen_int(n_what, 3);
16365 end = gen_xmlChar(n_end, 4);
16366 end2 = gen_xmlChar(n_end2, 5);
16367 end3 = gen_xmlChar(n_end3, 6);
16368
William M. Brackf13f77f2004-11-12 16:03:48 +000016369 ret_val = xmlStringLenDecodeEntities(ctxt, (const xmlChar *)str, len, what, end, end2, end3);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016370 desret_xmlChar_ptr(ret_val);
16371 call_tests++;
16372 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000016373 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016374 des_int(n_len, len, 2);
16375 des_int(n_what, what, 3);
16376 des_xmlChar(n_end, end, 4);
16377 des_xmlChar(n_end2, end2, 5);
16378 des_xmlChar(n_end3, end3, 6);
16379 xmlResetLastError();
16380 if (mem_base != xmlMemBlocks()) {
16381 printf("Leak of %d blocks found in xmlStringLenDecodeEntities",
16382 xmlMemBlocks() - mem_base);
16383 test_ret++;
16384 printf(" %d", n_ctxt);
16385 printf(" %d", n_str);
16386 printf(" %d", n_len);
16387 printf(" %d", n_what);
16388 printf(" %d", n_end);
16389 printf(" %d", n_end2);
16390 printf(" %d", n_end3);
16391 printf("\n");
16392 }
16393 }
16394 }
16395 }
16396 }
16397 }
16398 }
16399 }
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016400 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016401
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016402 return(test_ret);
16403}
16404
16405
16406static int
16407test_xmlSwitchEncoding(void) {
16408 int test_ret = 0;
16409
16410 int mem_base;
16411 int ret_val;
16412 xmlParserCtxtPtr ctxt; /* the parser context */
16413 int n_ctxt;
16414 xmlCharEncoding enc; /* the encoding value (number) */
16415 int n_enc;
16416
16417 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16418 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
16419 mem_base = xmlMemBlocks();
16420 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16421 enc = gen_xmlCharEncoding(n_enc, 1);
16422
16423 ret_val = xmlSwitchEncoding(ctxt, enc);
16424 desret_int(ret_val);
16425 call_tests++;
16426 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16427 des_xmlCharEncoding(n_enc, enc, 1);
16428 xmlResetLastError();
16429 if (mem_base != xmlMemBlocks()) {
16430 printf("Leak of %d blocks found in xmlSwitchEncoding",
16431 xmlMemBlocks() - mem_base);
16432 test_ret++;
16433 printf(" %d", n_ctxt);
16434 printf(" %d", n_enc);
16435 printf("\n");
16436 }
16437 }
16438 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016439 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016440
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016441 return(test_ret);
16442}
16443
16444
16445static int
16446test_xmlSwitchInputEncoding(void) {
16447 int test_ret = 0;
16448
16449 int mem_base;
16450 int ret_val;
16451 xmlParserCtxtPtr ctxt; /* the parser context */
16452 int n_ctxt;
16453 xmlParserInputPtr input; /* the input stream */
16454 int n_input;
16455 xmlCharEncodingHandlerPtr handler; /* the encoding handler */
16456 int n_handler;
16457
16458 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16459 for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) {
16460 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandlerPtr;n_handler++) {
16461 mem_base = xmlMemBlocks();
16462 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16463 input = gen_xmlParserInputPtr(n_input, 1);
16464 handler = gen_xmlCharEncodingHandlerPtr(n_handler, 2);
16465
16466 ret_val = xmlSwitchInputEncoding(ctxt, input, handler);
16467 desret_int(ret_val);
16468 call_tests++;
16469 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16470 des_xmlParserInputPtr(n_input, input, 1);
16471 des_xmlCharEncodingHandlerPtr(n_handler, handler, 2);
16472 xmlResetLastError();
16473 if (mem_base != xmlMemBlocks()) {
16474 printf("Leak of %d blocks found in xmlSwitchInputEncoding",
16475 xmlMemBlocks() - mem_base);
16476 test_ret++;
16477 printf(" %d", n_ctxt);
16478 printf(" %d", n_input);
16479 printf(" %d", n_handler);
16480 printf("\n");
16481 }
16482 }
16483 }
16484 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016485 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016486
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016487 return(test_ret);
16488}
16489
16490
16491static int
16492test_xmlSwitchToEncoding(void) {
16493 int test_ret = 0;
16494
16495 int mem_base;
16496 int ret_val;
16497 xmlParserCtxtPtr ctxt; /* the parser context */
16498 int n_ctxt;
16499 xmlCharEncodingHandlerPtr handler; /* the encoding handler */
16500 int n_handler;
16501
16502 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16503 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandlerPtr;n_handler++) {
16504 mem_base = xmlMemBlocks();
16505 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16506 handler = gen_xmlCharEncodingHandlerPtr(n_handler, 1);
16507
16508 ret_val = xmlSwitchToEncoding(ctxt, handler);
16509 desret_int(ret_val);
16510 call_tests++;
16511 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16512 des_xmlCharEncodingHandlerPtr(n_handler, handler, 1);
16513 xmlResetLastError();
16514 if (mem_base != xmlMemBlocks()) {
16515 printf("Leak of %d blocks found in xmlSwitchToEncoding",
16516 xmlMemBlocks() - mem_base);
16517 test_ret++;
16518 printf(" %d", n_ctxt);
16519 printf(" %d", n_handler);
16520 printf("\n");
16521 }
16522 }
16523 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016524 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016525
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016526 return(test_ret);
16527}
16528
16529static int
16530test_parserInternals(void) {
16531 int test_ret = 0;
16532
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016533 if (quiet == 0) printf("Testing parserInternals : 33 of 90 functions ...\n");
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016534 test_ret += test_htmlCreateFileParserCtxt();
16535 test_ret += test_htmlInitAutoClose();
16536 test_ret += test_inputPop();
16537 test_ret += test_inputPush();
16538 test_ret += test_namePop();
16539 test_ret += test_namePush();
16540 test_ret += test_nodePop();
16541 test_ret += test_nodePush();
16542 test_ret += test_xmlCheckLanguageID();
16543 test_ret += test_xmlCopyChar();
16544 test_ret += test_xmlCopyCharMultiByte();
16545 test_ret += test_xmlCreateEntityParserCtxt();
16546 test_ret += test_xmlCreateFileParserCtxt();
16547 test_ret += test_xmlCreateMemoryParserCtxt();
16548 test_ret += test_xmlCreateURLParserCtxt();
16549 test_ret += test_xmlCurrentChar();
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016550 test_ret += test_xmlErrMemory();
16551 test_ret += test_xmlIsLetter();
16552 test_ret += test_xmlNewEntityInputStream();
16553 test_ret += test_xmlNewInputFromFile();
16554 test_ret += test_xmlNewInputStream();
16555 test_ret += test_xmlNewStringInputStream();
16556 test_ret += test_xmlNextChar();
16557 test_ret += test_xmlParserInputShrink();
16558 test_ret += test_xmlPopInput();
16559 test_ret += test_xmlPushInput();
16560 test_ret += test_xmlSetEntityReferenceFunc();
16561 test_ret += test_xmlSplitQName();
16562 test_ret += test_xmlStringCurrentChar();
16563 test_ret += test_xmlStringDecodeEntities();
16564 test_ret += test_xmlStringLenDecodeEntities();
16565 test_ret += test_xmlSwitchEncoding();
16566 test_ret += test_xmlSwitchInputEncoding();
16567 test_ret += test_xmlSwitchToEncoding();
16568
16569 if (test_ret != 0)
16570 printf("Module parserInternals: %d errors\n", test_ret);
16571 return(test_ret);
16572}
16573
Daniel Veillardd93f6252004-11-02 15:53:51 +000016574static int
Daniel Veillardb5839c32005-02-19 18:27:14 +000016575test_xmlPatternFromRoot(void) {
16576 int test_ret = 0;
16577
16578#if defined(LIBXML_PATTERN_ENABLED)
16579 int mem_base;
16580 int ret_val;
16581 xmlPatternPtr comp; /* */
16582 int n_comp;
16583
16584 for (n_comp = 0;n_comp < gen_nb_xmlPatternPtr;n_comp++) {
16585 mem_base = xmlMemBlocks();
16586 comp = gen_xmlPatternPtr(n_comp, 0);
16587
16588 ret_val = xmlPatternFromRoot(comp);
16589 desret_int(ret_val);
16590 call_tests++;
16591 des_xmlPatternPtr(n_comp, comp, 0);
16592 xmlResetLastError();
16593 if (mem_base != xmlMemBlocks()) {
16594 printf("Leak of %d blocks found in xmlPatternFromRoot",
16595 xmlMemBlocks() - mem_base);
16596 test_ret++;
16597 printf(" %d", n_comp);
16598 printf("\n");
16599 }
16600 }
16601 function_tests++;
16602#endif
16603
16604 return(test_ret);
16605}
16606
16607
16608static int
Daniel Veillarde92bf5d2005-02-04 17:28:19 +000016609test_xmlPatternGetStreamCtxt(void) {
16610 int test_ret = 0;
16611
16612
16613 /* missing type support */
16614 return(test_ret);
16615}
16616
16617
16618static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000016619test_xmlPatternMatch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016620 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016621
William M. Brack21e4ef22005-01-02 09:53:13 +000016622#if defined(LIBXML_PATTERN_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000016623 int mem_base;
16624 int ret_val;
Daniel Veillardb5839c32005-02-19 18:27:14 +000016625 xmlPatternPtr comp; /* */
Daniel Veillardce682bc2004-11-05 17:22:25 +000016626 int n_comp;
Daniel Veillardb5839c32005-02-19 18:27:14 +000016627 xmlNodePtr node; /* */
Daniel Veillardce682bc2004-11-05 17:22:25 +000016628 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016629
Daniel Veillardce682bc2004-11-05 17:22:25 +000016630 for (n_comp = 0;n_comp < gen_nb_xmlPatternPtr;n_comp++) {
16631 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
16632 mem_base = xmlMemBlocks();
16633 comp = gen_xmlPatternPtr(n_comp, 0);
16634 node = gen_xmlNodePtr(n_node, 1);
16635
16636 ret_val = xmlPatternMatch(comp, node);
16637 desret_int(ret_val);
16638 call_tests++;
16639 des_xmlPatternPtr(n_comp, comp, 0);
16640 des_xmlNodePtr(n_node, node, 1);
16641 xmlResetLastError();
16642 if (mem_base != xmlMemBlocks()) {
16643 printf("Leak of %d blocks found in xmlPatternMatch",
16644 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016645 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016646 printf(" %d", n_comp);
16647 printf(" %d", n_node);
16648 printf("\n");
16649 }
16650 }
16651 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016652 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016653#endif
16654
Daniel Veillard42595322004-11-08 10:52:06 +000016655 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016656}
16657
16658
16659static int
Daniel Veillardb5839c32005-02-19 18:27:14 +000016660test_xmlPatternMaxDepth(void) {
16661 int test_ret = 0;
16662
16663#if defined(LIBXML_PATTERN_ENABLED)
16664 int mem_base;
16665 int ret_val;
16666 xmlPatternPtr comp; /* */
16667 int n_comp;
16668
16669 for (n_comp = 0;n_comp < gen_nb_xmlPatternPtr;n_comp++) {
16670 mem_base = xmlMemBlocks();
16671 comp = gen_xmlPatternPtr(n_comp, 0);
16672
16673 ret_val = xmlPatternMaxDepth(comp);
16674 desret_int(ret_val);
16675 call_tests++;
16676 des_xmlPatternPtr(n_comp, comp, 0);
16677 xmlResetLastError();
16678 if (mem_base != xmlMemBlocks()) {
16679 printf("Leak of %d blocks found in xmlPatternMaxDepth",
16680 xmlMemBlocks() - mem_base);
16681 test_ret++;
16682 printf(" %d", n_comp);
16683 printf("\n");
16684 }
16685 }
16686 function_tests++;
16687#endif
16688
16689 return(test_ret);
16690}
16691
16692
16693static int
16694test_xmlPatternStreamable(void) {
16695 int test_ret = 0;
16696
16697#if defined(LIBXML_PATTERN_ENABLED)
16698 int mem_base;
16699 int ret_val;
16700 xmlPatternPtr comp; /* */
16701 int n_comp;
16702
16703 for (n_comp = 0;n_comp < gen_nb_xmlPatternPtr;n_comp++) {
16704 mem_base = xmlMemBlocks();
16705 comp = gen_xmlPatternPtr(n_comp, 0);
16706
16707 ret_val = xmlPatternStreamable(comp);
16708 desret_int(ret_val);
16709 call_tests++;
16710 des_xmlPatternPtr(n_comp, comp, 0);
16711 xmlResetLastError();
16712 if (mem_base != xmlMemBlocks()) {
16713 printf("Leak of %d blocks found in xmlPatternStreamable",
16714 xmlMemBlocks() - mem_base);
16715 test_ret++;
16716 printf(" %d", n_comp);
16717 printf("\n");
16718 }
16719 }
16720 function_tests++;
16721#endif
16722
16723 return(test_ret);
16724}
16725
16726
16727static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000016728test_xmlPatterncompile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016729 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016730
16731
16732 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000016733 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016734}
16735
Daniel Veillarde92bf5d2005-02-04 17:28:19 +000016736
16737#define gen_nb_xmlStreamCtxtPtr 1
16738static xmlStreamCtxtPtr gen_xmlStreamCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16739 return(NULL);
16740}
16741static void des_xmlStreamCtxtPtr(int no ATTRIBUTE_UNUSED, xmlStreamCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16742}
16743
16744static int
16745test_xmlStreamPop(void) {
16746 int test_ret = 0;
16747
16748#if defined(LIBXML_PATTERN_ENABLED)
16749 int mem_base;
16750 int ret_val;
Daniel Veillardb5839c32005-02-19 18:27:14 +000016751 xmlStreamCtxtPtr stream; /* */
Daniel Veillarde92bf5d2005-02-04 17:28:19 +000016752 int n_stream;
16753
16754 for (n_stream = 0;n_stream < gen_nb_xmlStreamCtxtPtr;n_stream++) {
16755 mem_base = xmlMemBlocks();
16756 stream = gen_xmlStreamCtxtPtr(n_stream, 0);
16757
16758 ret_val = xmlStreamPop(stream);
16759 desret_int(ret_val);
16760 call_tests++;
16761 des_xmlStreamCtxtPtr(n_stream, stream, 0);
16762 xmlResetLastError();
16763 if (mem_base != xmlMemBlocks()) {
16764 printf("Leak of %d blocks found in xmlStreamPop",
16765 xmlMemBlocks() - mem_base);
16766 test_ret++;
16767 printf(" %d", n_stream);
16768 printf("\n");
16769 }
16770 }
16771 function_tests++;
16772#endif
16773
16774 return(test_ret);
16775}
16776
16777
16778static int
16779test_xmlStreamPush(void) {
16780 int test_ret = 0;
16781
16782#if defined(LIBXML_PATTERN_ENABLED)
16783 int mem_base;
16784 int ret_val;
Daniel Veillardb5839c32005-02-19 18:27:14 +000016785 xmlStreamCtxtPtr stream; /* */
Daniel Veillarde92bf5d2005-02-04 17:28:19 +000016786 int n_stream;
Daniel Veillardb5839c32005-02-19 18:27:14 +000016787 xmlChar * name; /* */
Daniel Veillarde92bf5d2005-02-04 17:28:19 +000016788 int n_name;
Daniel Veillardb5839c32005-02-19 18:27:14 +000016789 xmlChar * ns; /* */
Daniel Veillarde92bf5d2005-02-04 17:28:19 +000016790 int n_ns;
16791
16792 for (n_stream = 0;n_stream < gen_nb_xmlStreamCtxtPtr;n_stream++) {
16793 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
16794 for (n_ns = 0;n_ns < gen_nb_const_xmlChar_ptr;n_ns++) {
16795 mem_base = xmlMemBlocks();
16796 stream = gen_xmlStreamCtxtPtr(n_stream, 0);
16797 name = gen_const_xmlChar_ptr(n_name, 1);
16798 ns = gen_const_xmlChar_ptr(n_ns, 2);
16799
16800 ret_val = xmlStreamPush(stream, (const xmlChar *)name, (const xmlChar *)ns);
16801 desret_int(ret_val);
16802 call_tests++;
16803 des_xmlStreamCtxtPtr(n_stream, stream, 0);
16804 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
16805 des_const_xmlChar_ptr(n_ns, (const xmlChar *)ns, 2);
16806 xmlResetLastError();
16807 if (mem_base != xmlMemBlocks()) {
16808 printf("Leak of %d blocks found in xmlStreamPush",
16809 xmlMemBlocks() - mem_base);
16810 test_ret++;
16811 printf(" %d", n_stream);
16812 printf(" %d", n_name);
16813 printf(" %d", n_ns);
16814 printf("\n");
16815 }
16816 }
16817 }
16818 }
16819 function_tests++;
16820#endif
16821
16822 return(test_ret);
16823}
16824
Daniel Veillardb5839c32005-02-19 18:27:14 +000016825
16826static int
16827test_xmlStreamPushAttr(void) {
16828 int test_ret = 0;
16829
16830#if defined(LIBXML_PATTERN_ENABLED)
16831 int mem_base;
16832 int ret_val;
16833 xmlStreamCtxtPtr stream; /* */
16834 int n_stream;
16835 xmlChar * name; /* */
16836 int n_name;
16837 xmlChar * ns; /* */
16838 int n_ns;
16839
16840 for (n_stream = 0;n_stream < gen_nb_xmlStreamCtxtPtr;n_stream++) {
16841 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
16842 for (n_ns = 0;n_ns < gen_nb_const_xmlChar_ptr;n_ns++) {
16843 mem_base = xmlMemBlocks();
16844 stream = gen_xmlStreamCtxtPtr(n_stream, 0);
16845 name = gen_const_xmlChar_ptr(n_name, 1);
16846 ns = gen_const_xmlChar_ptr(n_ns, 2);
16847
16848 ret_val = xmlStreamPushAttr(stream, (const xmlChar *)name, (const xmlChar *)ns);
16849 desret_int(ret_val);
16850 call_tests++;
16851 des_xmlStreamCtxtPtr(n_stream, stream, 0);
16852 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
16853 des_const_xmlChar_ptr(n_ns, (const xmlChar *)ns, 2);
16854 xmlResetLastError();
16855 if (mem_base != xmlMemBlocks()) {
16856 printf("Leak of %d blocks found in xmlStreamPushAttr",
16857 xmlMemBlocks() - mem_base);
16858 test_ret++;
16859 printf(" %d", n_stream);
16860 printf(" %d", n_name);
16861 printf(" %d", n_ns);
16862 printf("\n");
16863 }
16864 }
16865 }
16866 }
16867 function_tests++;
16868#endif
16869
16870 return(test_ret);
16871}
16872
Daniel Veillardd93f6252004-11-02 15:53:51 +000016873static int
16874test_pattern(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016875 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016876
Daniel Veillardb5839c32005-02-19 18:27:14 +000016877 if (quiet == 0) printf("Testing pattern : 7 of 12 functions ...\n");
16878 test_ret += test_xmlPatternFromRoot();
Daniel Veillarde92bf5d2005-02-04 17:28:19 +000016879 test_ret += test_xmlPatternGetStreamCtxt();
Daniel Veillard42595322004-11-08 10:52:06 +000016880 test_ret += test_xmlPatternMatch();
Daniel Veillardb5839c32005-02-19 18:27:14 +000016881 test_ret += test_xmlPatternMaxDepth();
16882 test_ret += test_xmlPatternStreamable();
Daniel Veillard42595322004-11-08 10:52:06 +000016883 test_ret += test_xmlPatterncompile();
Daniel Veillarde92bf5d2005-02-04 17:28:19 +000016884 test_ret += test_xmlStreamPop();
16885 test_ret += test_xmlStreamPush();
Daniel Veillardb5839c32005-02-19 18:27:14 +000016886 test_ret += test_xmlStreamPushAttr();
Daniel Veillardd93f6252004-11-02 15:53:51 +000016887
Daniel Veillard42595322004-11-08 10:52:06 +000016888 if (test_ret != 0)
16889 printf("Module pattern: %d errors\n", test_ret);
16890 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016891}
Daniel Veillarda521d282004-11-09 14:59:59 +000016892#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000016893
Daniel Veillardce682bc2004-11-05 17:22:25 +000016894#define gen_nb_xmlRelaxNGPtr 1
16895static xmlRelaxNGPtr gen_xmlRelaxNGPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16896 return(NULL);
16897}
16898static void des_xmlRelaxNGPtr(int no ATTRIBUTE_UNUSED, xmlRelaxNGPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16899}
Daniel Veillarda521d282004-11-09 14:59:59 +000016900#endif
16901
Daniel Veillardce682bc2004-11-05 17:22:25 +000016902
Daniel Veillardd93f6252004-11-02 15:53:51 +000016903static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000016904test_xmlRelaxNGDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016905 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016906
William M. Brack21e4ef22005-01-02 09:53:13 +000016907#if defined(LIBXML_SCHEMAS_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000016908 int mem_base;
16909 FILE * output; /* the file output */
16910 int n_output;
16911 xmlRelaxNGPtr schema; /* a schema structure */
16912 int n_schema;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016913
Daniel Veillardce682bc2004-11-05 17:22:25 +000016914 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
16915 for (n_schema = 0;n_schema < gen_nb_xmlRelaxNGPtr;n_schema++) {
16916 mem_base = xmlMemBlocks();
16917 output = gen_FILE_ptr(n_output, 0);
16918 schema = gen_xmlRelaxNGPtr(n_schema, 1);
16919
16920 xmlRelaxNGDump(output, schema);
16921 call_tests++;
16922 des_FILE_ptr(n_output, output, 0);
16923 des_xmlRelaxNGPtr(n_schema, schema, 1);
16924 xmlResetLastError();
16925 if (mem_base != xmlMemBlocks()) {
16926 printf("Leak of %d blocks found in xmlRelaxNGDump",
16927 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016928 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016929 printf(" %d", n_output);
16930 printf(" %d", n_schema);
16931 printf("\n");
16932 }
16933 }
16934 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016935 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016936#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000016937
Daniel Veillard42595322004-11-08 10:52:06 +000016938 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016939}
16940
16941
16942static int
16943test_xmlRelaxNGDumpTree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016944 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016945
William M. Brack21e4ef22005-01-02 09:53:13 +000016946#if defined(LIBXML_SCHEMAS_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000016947 int mem_base;
16948 FILE * output; /* the file output */
16949 int n_output;
16950 xmlRelaxNGPtr schema; /* a schema structure */
16951 int n_schema;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016952
Daniel Veillardce682bc2004-11-05 17:22:25 +000016953 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
16954 for (n_schema = 0;n_schema < gen_nb_xmlRelaxNGPtr;n_schema++) {
16955 mem_base = xmlMemBlocks();
16956 output = gen_FILE_ptr(n_output, 0);
16957 schema = gen_xmlRelaxNGPtr(n_schema, 1);
16958
16959 xmlRelaxNGDumpTree(output, schema);
16960 call_tests++;
16961 des_FILE_ptr(n_output, output, 0);
16962 des_xmlRelaxNGPtr(n_schema, schema, 1);
16963 xmlResetLastError();
16964 if (mem_base != xmlMemBlocks()) {
16965 printf("Leak of %d blocks found in xmlRelaxNGDumpTree",
16966 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016967 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016968 printf(" %d", n_output);
16969 printf(" %d", n_schema);
16970 printf("\n");
16971 }
16972 }
16973 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016974 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016975#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000016976
Daniel Veillard42595322004-11-08 10:52:06 +000016977 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016978}
16979
Daniel Veillarda521d282004-11-09 14:59:59 +000016980#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000016981
Daniel Veillardce682bc2004-11-05 17:22:25 +000016982#define gen_nb_xmlRelaxNGParserCtxtPtr 1
16983static xmlRelaxNGParserCtxtPtr gen_xmlRelaxNGParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16984 return(NULL);
16985}
16986static void des_xmlRelaxNGParserCtxtPtr(int no ATTRIBUTE_UNUSED, xmlRelaxNGParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16987}
Daniel Veillarda521d282004-11-09 14:59:59 +000016988#endif
16989
16990#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000016991
16992#define gen_nb_xmlRelaxNGValidityErrorFunc_ptr 1
16993static xmlRelaxNGValidityErrorFunc * gen_xmlRelaxNGValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16994 return(NULL);
16995}
16996static void des_xmlRelaxNGValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlRelaxNGValidityErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16997}
Daniel Veillarda521d282004-11-09 14:59:59 +000016998#endif
16999
17000#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000017001
17002#define gen_nb_xmlRelaxNGValidityWarningFunc_ptr 1
17003static xmlRelaxNGValidityWarningFunc * gen_xmlRelaxNGValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17004 return(NULL);
17005}
17006static void des_xmlRelaxNGValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, xmlRelaxNGValidityWarningFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17007}
Daniel Veillarda521d282004-11-09 14:59:59 +000017008#endif
17009
17010#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000017011
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017012#define gen_nb_void_ptr_ptr 1
17013static void ** gen_void_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17014 return(NULL);
17015}
17016static void des_void_ptr_ptr(int no ATTRIBUTE_UNUSED, void ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17017}
Daniel Veillarda521d282004-11-09 14:59:59 +000017018#endif
17019
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017020
Daniel Veillardd93f6252004-11-02 15:53:51 +000017021static int
17022test_xmlRelaxNGGetParserErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017023 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017024
William M. Brack21e4ef22005-01-02 09:53:13 +000017025#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017026 int mem_base;
17027 int ret_val;
17028 xmlRelaxNGParserCtxtPtr ctxt; /* a Relax-NG validation context */
17029 int n_ctxt;
17030 xmlRelaxNGValidityErrorFunc * err; /* the error callback result */
17031 int n_err;
17032 xmlRelaxNGValidityWarningFunc * warn; /* the warning callback result */
17033 int n_warn;
17034 void ** ctx; /* contextual data for the callbacks result */
17035 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017036
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017037 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGParserCtxtPtr;n_ctxt++) {
17038 for (n_err = 0;n_err < gen_nb_xmlRelaxNGValidityErrorFunc_ptr;n_err++) {
17039 for (n_warn = 0;n_warn < gen_nb_xmlRelaxNGValidityWarningFunc_ptr;n_warn++) {
17040 for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
17041 mem_base = xmlMemBlocks();
17042 ctxt = gen_xmlRelaxNGParserCtxtPtr(n_ctxt, 0);
17043 err = gen_xmlRelaxNGValidityErrorFunc_ptr(n_err, 1);
17044 warn = gen_xmlRelaxNGValidityWarningFunc_ptr(n_warn, 2);
17045 ctx = gen_void_ptr_ptr(n_ctx, 3);
17046
17047 ret_val = xmlRelaxNGGetParserErrors(ctxt, err, warn, ctx);
17048 desret_int(ret_val);
17049 call_tests++;
17050 des_xmlRelaxNGParserCtxtPtr(n_ctxt, ctxt, 0);
17051 des_xmlRelaxNGValidityErrorFunc_ptr(n_err, err, 1);
17052 des_xmlRelaxNGValidityWarningFunc_ptr(n_warn, warn, 2);
17053 des_void_ptr_ptr(n_ctx, ctx, 3);
17054 xmlResetLastError();
17055 if (mem_base != xmlMemBlocks()) {
17056 printf("Leak of %d blocks found in xmlRelaxNGGetParserErrors",
17057 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017058 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017059 printf(" %d", n_ctxt);
17060 printf(" %d", n_err);
17061 printf(" %d", n_warn);
17062 printf(" %d", n_ctx);
17063 printf("\n");
17064 }
17065 }
17066 }
17067 }
17068 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017069 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017070#endif
17071
Daniel Veillard42595322004-11-08 10:52:06 +000017072 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017073}
17074
Daniel Veillarda521d282004-11-09 14:59:59 +000017075#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000017076
Daniel Veillardce682bc2004-11-05 17:22:25 +000017077#define gen_nb_xmlRelaxNGValidCtxtPtr 1
17078static xmlRelaxNGValidCtxtPtr gen_xmlRelaxNGValidCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17079 return(NULL);
17080}
17081static void des_xmlRelaxNGValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlRelaxNGValidCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17082}
Daniel Veillarda521d282004-11-09 14:59:59 +000017083#endif
17084
Daniel Veillardce682bc2004-11-05 17:22:25 +000017085
Daniel Veillardd93f6252004-11-02 15:53:51 +000017086static int
17087test_xmlRelaxNGGetValidErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017088 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017089
William M. Brack21e4ef22005-01-02 09:53:13 +000017090#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017091 int mem_base;
17092 int ret_val;
17093 xmlRelaxNGValidCtxtPtr ctxt; /* a Relax-NG validation context */
17094 int n_ctxt;
17095 xmlRelaxNGValidityErrorFunc * err; /* the error function result */
17096 int n_err;
17097 xmlRelaxNGValidityWarningFunc * warn; /* the warning function result */
17098 int n_warn;
17099 void ** ctx; /* the functions context result */
17100 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017101
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017102 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17103 for (n_err = 0;n_err < gen_nb_xmlRelaxNGValidityErrorFunc_ptr;n_err++) {
17104 for (n_warn = 0;n_warn < gen_nb_xmlRelaxNGValidityWarningFunc_ptr;n_warn++) {
17105 for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
17106 mem_base = xmlMemBlocks();
17107 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17108 err = gen_xmlRelaxNGValidityErrorFunc_ptr(n_err, 1);
17109 warn = gen_xmlRelaxNGValidityWarningFunc_ptr(n_warn, 2);
17110 ctx = gen_void_ptr_ptr(n_ctx, 3);
17111
17112 ret_val = xmlRelaxNGGetValidErrors(ctxt, err, warn, ctx);
17113 desret_int(ret_val);
17114 call_tests++;
17115 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17116 des_xmlRelaxNGValidityErrorFunc_ptr(n_err, err, 1);
17117 des_xmlRelaxNGValidityWarningFunc_ptr(n_warn, warn, 2);
17118 des_void_ptr_ptr(n_ctx, ctx, 3);
17119 xmlResetLastError();
17120 if (mem_base != xmlMemBlocks()) {
17121 printf("Leak of %d blocks found in xmlRelaxNGGetValidErrors",
17122 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017123 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017124 printf(" %d", n_ctxt);
17125 printf(" %d", n_err);
17126 printf(" %d", n_warn);
17127 printf(" %d", n_ctx);
17128 printf("\n");
17129 }
17130 }
17131 }
17132 }
17133 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017134 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000017135#endif
17136
Daniel Veillard42595322004-11-08 10:52:06 +000017137 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017138}
17139
17140
17141static int
Daniel Veillard34099b42004-11-04 17:34:35 +000017142test_xmlRelaxNGInitTypes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017143 int test_ret = 0;
Daniel Veillard34099b42004-11-04 17:34:35 +000017144
William M. Brack21e4ef22005-01-02 09:53:13 +000017145#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard34099b42004-11-04 17:34:35 +000017146 int mem_base;
17147 int ret_val;
17148
17149 mem_base = xmlMemBlocks();
17150
17151 ret_val = xmlRelaxNGInitTypes();
17152 desret_int(ret_val);
17153 call_tests++;
17154 xmlResetLastError();
17155 if (mem_base != xmlMemBlocks()) {
17156 printf("Leak of %d blocks found in xmlRelaxNGInitTypes",
17157 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017158 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000017159 printf("\n");
17160 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017161 function_tests++;
Daniel Veillard34099b42004-11-04 17:34:35 +000017162#endif
17163
Daniel Veillard42595322004-11-08 10:52:06 +000017164 return(test_ret);
Daniel Veillard34099b42004-11-04 17:34:35 +000017165}
17166
17167
17168static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000017169test_xmlRelaxNGNewDocParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017170 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017171
William M. Brack21e4ef22005-01-02 09:53:13 +000017172#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000017173 int mem_base;
17174 xmlRelaxNGParserCtxtPtr ret_val;
17175 xmlDocPtr doc; /* a preparsed document tree */
17176 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017177
Daniel Veillard42595322004-11-08 10:52:06 +000017178 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17179 mem_base = xmlMemBlocks();
17180 doc = gen_xmlDocPtr(n_doc, 0);
17181
17182 ret_val = xmlRelaxNGNewDocParserCtxt(doc);
17183 desret_xmlRelaxNGParserCtxtPtr(ret_val);
17184 call_tests++;
17185 des_xmlDocPtr(n_doc, doc, 0);
17186 xmlResetLastError();
17187 if (mem_base != xmlMemBlocks()) {
17188 printf("Leak of %d blocks found in xmlRelaxNGNewDocParserCtxt",
17189 xmlMemBlocks() - mem_base);
17190 test_ret++;
17191 printf(" %d", n_doc);
17192 printf("\n");
17193 }
17194 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017195 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017196#endif
17197
Daniel Veillard42595322004-11-08 10:52:06 +000017198 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017199}
17200
17201
17202static int
17203test_xmlRelaxNGNewMemParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017204 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017205
William M. Brack21e4ef22005-01-02 09:53:13 +000017206#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000017207 int mem_base;
17208 xmlRelaxNGParserCtxtPtr ret_val;
17209 char * buffer; /* a pointer to a char array containing the schemas */
17210 int n_buffer;
17211 int size; /* the size of the array */
17212 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017213
Daniel Veillard42595322004-11-08 10:52:06 +000017214 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
17215 for (n_size = 0;n_size < gen_nb_int;n_size++) {
17216 mem_base = xmlMemBlocks();
17217 buffer = gen_const_char_ptr(n_buffer, 0);
17218 size = gen_int(n_size, 1);
17219
William M. Brackf13f77f2004-11-12 16:03:48 +000017220 ret_val = xmlRelaxNGNewMemParserCtxt((const char *)buffer, size);
Daniel Veillard42595322004-11-08 10:52:06 +000017221 desret_xmlRelaxNGParserCtxtPtr(ret_val);
17222 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000017223 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard42595322004-11-08 10:52:06 +000017224 des_int(n_size, size, 1);
17225 xmlResetLastError();
17226 if (mem_base != xmlMemBlocks()) {
17227 printf("Leak of %d blocks found in xmlRelaxNGNewMemParserCtxt",
17228 xmlMemBlocks() - mem_base);
17229 test_ret++;
17230 printf(" %d", n_buffer);
17231 printf(" %d", n_size);
17232 printf("\n");
17233 }
17234 }
17235 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017236 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017237#endif
17238
Daniel Veillard42595322004-11-08 10:52:06 +000017239 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017240}
17241
17242
17243static int
17244test_xmlRelaxNGNewParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017245 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017246
William M. Brack21e4ef22005-01-02 09:53:13 +000017247#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000017248 int mem_base;
17249 xmlRelaxNGParserCtxtPtr ret_val;
17250 char * URL; /* the location of the schema */
17251 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017252
Daniel Veillard42595322004-11-08 10:52:06 +000017253 for (n_URL = 0;n_URL < gen_nb_const_char_ptr;n_URL++) {
17254 mem_base = xmlMemBlocks();
17255 URL = gen_const_char_ptr(n_URL, 0);
17256
William M. Brackf13f77f2004-11-12 16:03:48 +000017257 ret_val = xmlRelaxNGNewParserCtxt((const char *)URL);
Daniel Veillard42595322004-11-08 10:52:06 +000017258 desret_xmlRelaxNGParserCtxtPtr(ret_val);
17259 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000017260 des_const_char_ptr(n_URL, (const char *)URL, 0);
Daniel Veillard42595322004-11-08 10:52:06 +000017261 xmlResetLastError();
17262 if (mem_base != xmlMemBlocks()) {
17263 printf("Leak of %d blocks found in xmlRelaxNGNewParserCtxt",
17264 xmlMemBlocks() - mem_base);
17265 test_ret++;
17266 printf(" %d", n_URL);
17267 printf("\n");
17268 }
17269 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017270 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017271#endif
17272
Daniel Veillard42595322004-11-08 10:52:06 +000017273 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017274}
17275
17276
17277static int
17278test_xmlRelaxNGNewValidCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017279 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017280
17281
17282 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017283 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017284}
17285
17286
17287static int
17288test_xmlRelaxNGParse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017289 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017290
17291
17292 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017293 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017294}
17295
17296
17297static int
17298test_xmlRelaxNGSetParserErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017299 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017300
17301
17302 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017303 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017304}
17305
17306
17307static int
17308test_xmlRelaxNGSetValidErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017309 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017310
17311
17312 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017313 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017314}
17315
17316
17317static int
17318test_xmlRelaxNGValidateDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017319 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017320
William M. Brack21e4ef22005-01-02 09:53:13 +000017321#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000017322 int mem_base;
17323 int ret_val;
17324 xmlRelaxNGValidCtxtPtr ctxt; /* a Relax-NG validation context */
17325 int n_ctxt;
17326 xmlDocPtr doc; /* a parsed document tree */
17327 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017328
Daniel Veillardce682bc2004-11-05 17:22:25 +000017329 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17330 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17331 mem_base = xmlMemBlocks();
17332 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17333 doc = gen_xmlDocPtr(n_doc, 1);
17334
17335 ret_val = xmlRelaxNGValidateDoc(ctxt, doc);
17336 desret_int(ret_val);
17337 call_tests++;
17338 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17339 des_xmlDocPtr(n_doc, doc, 1);
17340 xmlResetLastError();
17341 if (mem_base != xmlMemBlocks()) {
17342 printf("Leak of %d blocks found in xmlRelaxNGValidateDoc",
17343 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017344 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017345 printf(" %d", n_ctxt);
17346 printf(" %d", n_doc);
17347 printf("\n");
17348 }
17349 }
17350 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017351 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017352#endif
17353
Daniel Veillard42595322004-11-08 10:52:06 +000017354 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017355}
17356
17357
17358static int
17359test_xmlRelaxNGValidateFullElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017360 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017361
William M. Brack21e4ef22005-01-02 09:53:13 +000017362#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000017363 int mem_base;
17364 int ret_val;
17365 xmlRelaxNGValidCtxtPtr ctxt; /* the validation context */
17366 int n_ctxt;
17367 xmlDocPtr doc; /* a document instance */
17368 int n_doc;
17369 xmlNodePtr elem; /* an element instance */
17370 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017371
Daniel Veillardce682bc2004-11-05 17:22:25 +000017372 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17373 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17374 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
17375 mem_base = xmlMemBlocks();
17376 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17377 doc = gen_xmlDocPtr(n_doc, 1);
17378 elem = gen_xmlNodePtr(n_elem, 2);
17379
17380 ret_val = xmlRelaxNGValidateFullElement(ctxt, doc, elem);
17381 desret_int(ret_val);
17382 call_tests++;
17383 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17384 des_xmlDocPtr(n_doc, doc, 1);
17385 des_xmlNodePtr(n_elem, elem, 2);
17386 xmlResetLastError();
17387 if (mem_base != xmlMemBlocks()) {
17388 printf("Leak of %d blocks found in xmlRelaxNGValidateFullElement",
17389 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017390 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017391 printf(" %d", n_ctxt);
17392 printf(" %d", n_doc);
17393 printf(" %d", n_elem);
17394 printf("\n");
17395 }
17396 }
17397 }
17398 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017399 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017400#endif
17401
Daniel Veillard42595322004-11-08 10:52:06 +000017402 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017403}
17404
17405
17406static int
17407test_xmlRelaxNGValidatePopElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017408 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017409
William M. Brack21e4ef22005-01-02 09:53:13 +000017410#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000017411 int mem_base;
17412 int ret_val;
17413 xmlRelaxNGValidCtxtPtr ctxt; /* the RelaxNG validation context */
17414 int n_ctxt;
17415 xmlDocPtr doc; /* a document instance */
17416 int n_doc;
17417 xmlNodePtr elem; /* an element instance */
17418 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017419
Daniel Veillardce682bc2004-11-05 17:22:25 +000017420 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17421 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17422 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
17423 mem_base = xmlMemBlocks();
17424 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17425 doc = gen_xmlDocPtr(n_doc, 1);
17426 elem = gen_xmlNodePtr(n_elem, 2);
17427
17428 ret_val = xmlRelaxNGValidatePopElement(ctxt, doc, elem);
17429 desret_int(ret_val);
17430 call_tests++;
17431 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17432 des_xmlDocPtr(n_doc, doc, 1);
17433 des_xmlNodePtr(n_elem, elem, 2);
17434 xmlResetLastError();
17435 if (mem_base != xmlMemBlocks()) {
17436 printf("Leak of %d blocks found in xmlRelaxNGValidatePopElement",
17437 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017438 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017439 printf(" %d", n_ctxt);
17440 printf(" %d", n_doc);
17441 printf(" %d", n_elem);
17442 printf("\n");
17443 }
17444 }
17445 }
17446 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017447 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017448#endif
17449
Daniel Veillard42595322004-11-08 10:52:06 +000017450 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017451}
17452
17453
17454static int
17455test_xmlRelaxNGValidatePushCData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017456 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017457
William M. Brack21e4ef22005-01-02 09:53:13 +000017458#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000017459 int mem_base;
17460 int ret_val;
17461 xmlRelaxNGValidCtxtPtr ctxt; /* the RelaxNG validation context */
17462 int n_ctxt;
17463 xmlChar * data; /* some character data read */
17464 int n_data;
17465 int len; /* the lenght of the data */
17466 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017467
Daniel Veillardce682bc2004-11-05 17:22:25 +000017468 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17469 for (n_data = 0;n_data < gen_nb_const_xmlChar_ptr;n_data++) {
17470 for (n_len = 0;n_len < gen_nb_int;n_len++) {
17471 mem_base = xmlMemBlocks();
17472 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17473 data = gen_const_xmlChar_ptr(n_data, 1);
17474 len = gen_int(n_len, 2);
17475
William M. Brackf13f77f2004-11-12 16:03:48 +000017476 ret_val = xmlRelaxNGValidatePushCData(ctxt, (const xmlChar *)data, len);
Daniel Veillardce682bc2004-11-05 17:22:25 +000017477 desret_int(ret_val);
17478 call_tests++;
17479 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000017480 des_const_xmlChar_ptr(n_data, (const xmlChar *)data, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000017481 des_int(n_len, len, 2);
17482 xmlResetLastError();
17483 if (mem_base != xmlMemBlocks()) {
17484 printf("Leak of %d blocks found in xmlRelaxNGValidatePushCData",
17485 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017486 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017487 printf(" %d", n_ctxt);
17488 printf(" %d", n_data);
17489 printf(" %d", n_len);
17490 printf("\n");
17491 }
17492 }
17493 }
17494 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017495 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017496#endif
17497
Daniel Veillard42595322004-11-08 10:52:06 +000017498 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017499}
17500
17501
17502static int
17503test_xmlRelaxNGValidatePushElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017504 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017505
William M. Brack21e4ef22005-01-02 09:53:13 +000017506#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000017507 int mem_base;
17508 int ret_val;
17509 xmlRelaxNGValidCtxtPtr ctxt; /* the validation context */
17510 int n_ctxt;
17511 xmlDocPtr doc; /* a document instance */
17512 int n_doc;
17513 xmlNodePtr elem; /* an element instance */
17514 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017515
Daniel Veillardce682bc2004-11-05 17:22:25 +000017516 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17517 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17518 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
17519 mem_base = xmlMemBlocks();
17520 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17521 doc = gen_xmlDocPtr(n_doc, 1);
17522 elem = gen_xmlNodePtr(n_elem, 2);
17523
17524 ret_val = xmlRelaxNGValidatePushElement(ctxt, doc, elem);
17525 desret_int(ret_val);
17526 call_tests++;
17527 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17528 des_xmlDocPtr(n_doc, doc, 1);
17529 des_xmlNodePtr(n_elem, elem, 2);
17530 xmlResetLastError();
17531 if (mem_base != xmlMemBlocks()) {
17532 printf("Leak of %d blocks found in xmlRelaxNGValidatePushElement",
17533 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017534 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017535 printf(" %d", n_ctxt);
17536 printf(" %d", n_doc);
17537 printf(" %d", n_elem);
17538 printf("\n");
17539 }
17540 }
17541 }
17542 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017543 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017544#endif
17545
Daniel Veillard42595322004-11-08 10:52:06 +000017546 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017547}
17548
17549
17550static int
17551test_xmlRelaxParserSetFlag(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017552 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017553
William M. Brack21e4ef22005-01-02 09:53:13 +000017554#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000017555 int mem_base;
17556 int ret_val;
17557 xmlRelaxNGParserCtxtPtr ctxt; /* a RelaxNG parser context */
17558 int n_ctxt;
17559 int flags; /* a set of flags values */
17560 int n_flags;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017561
Daniel Veillardce682bc2004-11-05 17:22:25 +000017562 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGParserCtxtPtr;n_ctxt++) {
17563 for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
17564 mem_base = xmlMemBlocks();
17565 ctxt = gen_xmlRelaxNGParserCtxtPtr(n_ctxt, 0);
17566 flags = gen_int(n_flags, 1);
17567
17568 ret_val = xmlRelaxParserSetFlag(ctxt, flags);
17569 desret_int(ret_val);
17570 call_tests++;
17571 des_xmlRelaxNGParserCtxtPtr(n_ctxt, ctxt, 0);
17572 des_int(n_flags, flags, 1);
17573 xmlResetLastError();
17574 if (mem_base != xmlMemBlocks()) {
17575 printf("Leak of %d blocks found in xmlRelaxParserSetFlag",
17576 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017577 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017578 printf(" %d", n_ctxt);
17579 printf(" %d", n_flags);
17580 printf("\n");
17581 }
17582 }
17583 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017584 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017585#endif
17586
Daniel Veillard42595322004-11-08 10:52:06 +000017587 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017588}
17589
17590static int
17591test_relaxng(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017592 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017593
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017594 if (quiet == 0) printf("Testing relaxng : 14 of 22 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000017595 test_ret += test_xmlRelaxNGDump();
17596 test_ret += test_xmlRelaxNGDumpTree();
17597 test_ret += test_xmlRelaxNGGetParserErrors();
17598 test_ret += test_xmlRelaxNGGetValidErrors();
17599 test_ret += test_xmlRelaxNGInitTypes();
17600 test_ret += test_xmlRelaxNGNewDocParserCtxt();
17601 test_ret += test_xmlRelaxNGNewMemParserCtxt();
17602 test_ret += test_xmlRelaxNGNewParserCtxt();
17603 test_ret += test_xmlRelaxNGNewValidCtxt();
17604 test_ret += test_xmlRelaxNGParse();
17605 test_ret += test_xmlRelaxNGSetParserErrors();
17606 test_ret += test_xmlRelaxNGSetValidErrors();
17607 test_ret += test_xmlRelaxNGValidateDoc();
17608 test_ret += test_xmlRelaxNGValidateFullElement();
17609 test_ret += test_xmlRelaxNGValidatePopElement();
17610 test_ret += test_xmlRelaxNGValidatePushCData();
17611 test_ret += test_xmlRelaxNGValidatePushElement();
17612 test_ret += test_xmlRelaxParserSetFlag();
Daniel Veillardd93f6252004-11-02 15:53:51 +000017613
Daniel Veillard42595322004-11-08 10:52:06 +000017614 if (test_ret != 0)
17615 printf("Module relaxng: %d errors\n", test_ret);
17616 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017617}
17618static int
17619test_schemasInternals(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017620 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017621
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017622 if (quiet == 0) printf("Testing schemasInternals : 0 of 2 functions ...\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017623
Daniel Veillard42595322004-11-08 10:52:06 +000017624 if (test_ret != 0)
17625 printf("Module schemasInternals: %d errors\n", test_ret);
17626 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017627}
17628
17629static int
17630test_xmlAddChild(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017631 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017632
17633 int mem_base;
17634 xmlNodePtr ret_val;
17635 xmlNodePtr parent; /* the parent node */
17636 int n_parent;
17637 xmlNodePtr cur; /* the child node */
17638 int n_cur;
17639
Daniel Veillarda03e3652004-11-02 18:45:30 +000017640 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017641 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr_in;n_cur++) {
17642 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017643 parent = gen_xmlNodePtr(n_parent, 0);
17644 cur = gen_xmlNodePtr_in(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017645
17646 ret_val = xmlAddChild(parent, cur);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017647 if (ret_val == NULL) { xmlFreeNode(cur) ; cur = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017648 desret_xmlNodePtr(ret_val);
17649 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017650 des_xmlNodePtr(n_parent, parent, 0);
17651 des_xmlNodePtr_in(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017652 xmlResetLastError();
17653 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017654 printf("Leak of %d blocks found in xmlAddChild",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017655 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017656 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017657 printf(" %d", n_parent);
17658 printf(" %d", n_cur);
17659 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017660 }
17661 }
17662 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017663 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017664
Daniel Veillard42595322004-11-08 10:52:06 +000017665 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017666}
17667
17668
17669static int
17670test_xmlAddChildList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017671 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017672
17673 int mem_base;
17674 xmlNodePtr ret_val;
17675 xmlNodePtr parent; /* the parent node */
17676 int n_parent;
17677 xmlNodePtr cur; /* the first node in the list */
17678 int n_cur;
17679
Daniel Veillarda03e3652004-11-02 18:45:30 +000017680 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017681 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr_in;n_cur++) {
17682 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017683 parent = gen_xmlNodePtr(n_parent, 0);
17684 cur = gen_xmlNodePtr_in(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017685
17686 ret_val = xmlAddChildList(parent, cur);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017687 if (ret_val == NULL) { xmlFreeNodeList(cur) ; cur = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017688 desret_xmlNodePtr(ret_val);
17689 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017690 des_xmlNodePtr(n_parent, parent, 0);
17691 des_xmlNodePtr_in(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017692 xmlResetLastError();
17693 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017694 printf("Leak of %d blocks found in xmlAddChildList",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017695 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017696 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017697 printf(" %d", n_parent);
17698 printf(" %d", n_cur);
17699 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017700 }
17701 }
17702 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017703 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017704
Daniel Veillard42595322004-11-08 10:52:06 +000017705 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017706}
17707
17708
17709static int
17710test_xmlAddNextSibling(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017711 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017712
17713 int mem_base;
17714 xmlNodePtr ret_val;
17715 xmlNodePtr cur; /* the child node */
17716 int n_cur;
17717 xmlNodePtr elem; /* the new node */
17718 int n_elem;
17719
17720 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017721 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr_in;n_elem++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017722 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017723 cur = gen_xmlNodePtr(n_cur, 0);
17724 elem = gen_xmlNodePtr_in(n_elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017725
17726 ret_val = xmlAddNextSibling(cur, elem);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017727 if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017728 desret_xmlNodePtr(ret_val);
17729 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017730 des_xmlNodePtr(n_cur, cur, 0);
17731 des_xmlNodePtr_in(n_elem, elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017732 xmlResetLastError();
17733 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017734 printf("Leak of %d blocks found in xmlAddNextSibling",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017735 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017736 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017737 printf(" %d", n_cur);
17738 printf(" %d", n_elem);
17739 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017740 }
17741 }
17742 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017743 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017744
Daniel Veillard42595322004-11-08 10:52:06 +000017745 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017746}
17747
17748
17749static int
17750test_xmlAddPrevSibling(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017751 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017752
William M. Brack21e4ef22005-01-02 09:53:13 +000017753#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000017754 int mem_base;
17755 xmlNodePtr ret_val;
17756 xmlNodePtr cur; /* the child node */
17757 int n_cur;
17758 xmlNodePtr elem; /* the new node */
17759 int n_elem;
17760
17761 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017762 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr_in;n_elem++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017763 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017764 cur = gen_xmlNodePtr(n_cur, 0);
17765 elem = gen_xmlNodePtr_in(n_elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017766
17767 ret_val = xmlAddPrevSibling(cur, elem);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017768 if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017769 desret_xmlNodePtr(ret_val);
17770 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017771 des_xmlNodePtr(n_cur, cur, 0);
17772 des_xmlNodePtr_in(n_elem, elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017773 xmlResetLastError();
17774 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017775 printf("Leak of %d blocks found in xmlAddPrevSibling",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017776 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017777 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017778 printf(" %d", n_cur);
17779 printf(" %d", n_elem);
17780 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017781 }
17782 }
17783 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017784 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017785#endif
17786
Daniel Veillard42595322004-11-08 10:52:06 +000017787 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017788}
17789
17790
17791static int
17792test_xmlAddSibling(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017793 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017794
17795 int mem_base;
17796 xmlNodePtr ret_val;
17797 xmlNodePtr cur; /* the child node */
17798 int n_cur;
17799 xmlNodePtr elem; /* the new node */
17800 int n_elem;
17801
17802 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017803 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr_in;n_elem++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017804 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017805 cur = gen_xmlNodePtr(n_cur, 0);
17806 elem = gen_xmlNodePtr_in(n_elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017807
17808 ret_val = xmlAddSibling(cur, elem);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017809 if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017810 desret_xmlNodePtr(ret_val);
17811 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017812 des_xmlNodePtr(n_cur, cur, 0);
17813 des_xmlNodePtr_in(n_elem, elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017814 xmlResetLastError();
17815 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017816 printf("Leak of %d blocks found in xmlAddSibling",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017817 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017818 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017819 printf(" %d", n_cur);
17820 printf(" %d", n_elem);
17821 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017822 }
17823 }
17824 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017825 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017826
Daniel Veillard42595322004-11-08 10:52:06 +000017827 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017828}
17829
17830
17831static int
17832test_xmlAttrSerializeTxtContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017833 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017834
William M. Brack21e4ef22005-01-02 09:53:13 +000017835#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000017836#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillardce244ad2004-11-05 10:03:46 +000017837 int mem_base;
17838 xmlBufferPtr buf; /* the XML buffer output */
17839 int n_buf;
17840 xmlDocPtr doc; /* the document */
17841 int n_doc;
17842 xmlAttrPtr attr; /* the attribute node */
17843 int n_attr;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017844 xmlChar * string; /* the text content */
Daniel Veillardce244ad2004-11-05 10:03:46 +000017845 int n_string;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017846
Daniel Veillardce244ad2004-11-05 10:03:46 +000017847 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17848 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17849 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
17850 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
17851 mem_base = xmlMemBlocks();
17852 buf = gen_xmlBufferPtr(n_buf, 0);
17853 doc = gen_xmlDocPtr(n_doc, 1);
17854 attr = gen_xmlAttrPtr(n_attr, 2);
17855 string = gen_const_xmlChar_ptr(n_string, 3);
17856
William M. Brackf13f77f2004-11-12 16:03:48 +000017857 xmlAttrSerializeTxtContent(buf, doc, attr, (const xmlChar *)string);
Daniel Veillardce244ad2004-11-05 10:03:46 +000017858 call_tests++;
17859 des_xmlBufferPtr(n_buf, buf, 0);
17860 des_xmlDocPtr(n_doc, doc, 1);
17861 des_xmlAttrPtr(n_attr, attr, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000017862 des_const_xmlChar_ptr(n_string, (const xmlChar *)string, 3);
Daniel Veillardce244ad2004-11-05 10:03:46 +000017863 xmlResetLastError();
17864 if (mem_base != xmlMemBlocks()) {
17865 printf("Leak of %d blocks found in xmlAttrSerializeTxtContent",
17866 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017867 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000017868 printf(" %d", n_buf);
17869 printf(" %d", n_doc);
17870 printf(" %d", n_attr);
17871 printf(" %d", n_string);
17872 printf("\n");
17873 }
17874 }
17875 }
17876 }
17877 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017878 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000017879#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000017880#endif
Daniel Veillardce244ad2004-11-05 10:03:46 +000017881
Daniel Veillard42595322004-11-08 10:52:06 +000017882 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017883}
17884
17885
17886static int
17887test_xmlBufferAdd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017888 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017889
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017890 int mem_base;
17891 int ret_val;
17892 xmlBufferPtr buf; /* the buffer to dump */
17893 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017894 xmlChar * str; /* the #xmlChar string */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017895 int n_str;
17896 int len; /* the number of #xmlChar to add */
17897 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017898
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017899 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17900 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
17901 for (n_len = 0;n_len < gen_nb_int;n_len++) {
17902 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017903 buf = gen_xmlBufferPtr(n_buf, 0);
17904 str = gen_const_xmlChar_ptr(n_str, 1);
17905 len = gen_int(n_len, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017906
William M. Brackf13f77f2004-11-12 16:03:48 +000017907 ret_val = xmlBufferAdd(buf, (const xmlChar *)str, len);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017908 desret_int(ret_val);
17909 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017910 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000017911 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000017912 des_int(n_len, len, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017913 xmlResetLastError();
17914 if (mem_base != xmlMemBlocks()) {
17915 printf("Leak of %d blocks found in xmlBufferAdd",
17916 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017917 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017918 printf(" %d", n_buf);
17919 printf(" %d", n_str);
17920 printf(" %d", n_len);
17921 printf("\n");
17922 }
17923 }
17924 }
17925 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017926 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017927
Daniel Veillard42595322004-11-08 10:52:06 +000017928 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017929}
17930
17931
17932static int
17933test_xmlBufferAddHead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017934 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017935
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017936 int mem_base;
17937 int ret_val;
17938 xmlBufferPtr buf; /* the buffer */
17939 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017940 xmlChar * str; /* the #xmlChar string */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017941 int n_str;
17942 int len; /* the number of #xmlChar to add */
17943 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017944
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017945 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17946 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
17947 for (n_len = 0;n_len < gen_nb_int;n_len++) {
17948 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017949 buf = gen_xmlBufferPtr(n_buf, 0);
17950 str = gen_const_xmlChar_ptr(n_str, 1);
17951 len = gen_int(n_len, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017952
William M. Brackf13f77f2004-11-12 16:03:48 +000017953 ret_val = xmlBufferAddHead(buf, (const xmlChar *)str, len);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017954 desret_int(ret_val);
17955 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017956 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000017957 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000017958 des_int(n_len, len, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017959 xmlResetLastError();
17960 if (mem_base != xmlMemBlocks()) {
17961 printf("Leak of %d blocks found in xmlBufferAddHead",
17962 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017963 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017964 printf(" %d", n_buf);
17965 printf(" %d", n_str);
17966 printf(" %d", n_len);
17967 printf("\n");
17968 }
17969 }
17970 }
17971 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017972 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017973
Daniel Veillard42595322004-11-08 10:52:06 +000017974 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017975}
17976
17977
17978static int
17979test_xmlBufferCCat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017980 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017981
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017982 int mem_base;
17983 int ret_val;
17984 xmlBufferPtr buf; /* the buffer to dump */
17985 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017986 char * str; /* the C char string */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017987 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017988
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017989 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17990 for (n_str = 0;n_str < gen_nb_const_char_ptr;n_str++) {
17991 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017992 buf = gen_xmlBufferPtr(n_buf, 0);
17993 str = gen_const_char_ptr(n_str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017994
William M. Brackf13f77f2004-11-12 16:03:48 +000017995 ret_val = xmlBufferCCat(buf, (const char *)str);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017996 desret_int(ret_val);
17997 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017998 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000017999 des_const_char_ptr(n_str, (const char *)str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018000 xmlResetLastError();
18001 if (mem_base != xmlMemBlocks()) {
18002 printf("Leak of %d blocks found in xmlBufferCCat",
18003 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018004 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018005 printf(" %d", n_buf);
18006 printf(" %d", n_str);
18007 printf("\n");
18008 }
18009 }
18010 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018011 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018012
Daniel Veillard42595322004-11-08 10:52:06 +000018013 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018014}
18015
18016
18017static int
18018test_xmlBufferCat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018019 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018020
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018021 int mem_base;
18022 int ret_val;
18023 xmlBufferPtr buf; /* the buffer to add to */
18024 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018025 xmlChar * str; /* the #xmlChar string */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018026 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018027
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018028 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18029 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
18030 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018031 buf = gen_xmlBufferPtr(n_buf, 0);
18032 str = gen_const_xmlChar_ptr(n_str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018033
William M. Brackf13f77f2004-11-12 16:03:48 +000018034 ret_val = xmlBufferCat(buf, (const xmlChar *)str);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018035 desret_int(ret_val);
18036 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018037 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000018038 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018039 xmlResetLastError();
18040 if (mem_base != xmlMemBlocks()) {
18041 printf("Leak of %d blocks found in xmlBufferCat",
18042 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018043 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018044 printf(" %d", n_buf);
18045 printf(" %d", n_str);
18046 printf("\n");
18047 }
18048 }
18049 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018050 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018051
Daniel Veillard42595322004-11-08 10:52:06 +000018052 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018053}
18054
18055
Daniel Veillardce682bc2004-11-05 17:22:25 +000018056#define gen_nb_const_xmlBufferPtr 1
18057static xmlBufferPtr gen_const_xmlBufferPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
18058 return(NULL);
18059}
18060static void des_const_xmlBufferPtr(int no ATTRIBUTE_UNUSED, const xmlBufferPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
18061}
18062
Daniel Veillardd93f6252004-11-02 15:53:51 +000018063static int
18064test_xmlBufferContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018065 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018066
Daniel Veillardce682bc2004-11-05 17:22:25 +000018067 int mem_base;
18068 const xmlChar * ret_val;
18069 xmlBufferPtr buf; /* the buffer */
18070 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018071
Daniel Veillardce682bc2004-11-05 17:22:25 +000018072 for (n_buf = 0;n_buf < gen_nb_const_xmlBufferPtr;n_buf++) {
18073 mem_base = xmlMemBlocks();
18074 buf = gen_const_xmlBufferPtr(n_buf, 0);
18075
William M. Brackf13f77f2004-11-12 16:03:48 +000018076 ret_val = xmlBufferContent((const xmlBufferPtr)buf);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018077 desret_const_xmlChar_ptr(ret_val);
18078 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000018079 des_const_xmlBufferPtr(n_buf, (const xmlBufferPtr)buf, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018080 xmlResetLastError();
18081 if (mem_base != xmlMemBlocks()) {
18082 printf("Leak of %d blocks found in xmlBufferContent",
18083 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018084 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018085 printf(" %d", n_buf);
18086 printf("\n");
18087 }
18088 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000018089 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018090
Daniel Veillard42595322004-11-08 10:52:06 +000018091 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018092}
18093
18094
18095static int
18096test_xmlBufferCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018097 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018098
Daniel Veillard3d95c732004-11-06 22:25:14 +000018099 int mem_base;
18100 xmlBufferPtr ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018101
Daniel Veillard3d95c732004-11-06 22:25:14 +000018102 mem_base = xmlMemBlocks();
18103
18104 ret_val = xmlBufferCreate();
18105 desret_xmlBufferPtr(ret_val);
18106 call_tests++;
18107 xmlResetLastError();
18108 if (mem_base != xmlMemBlocks()) {
18109 printf("Leak of %d blocks found in xmlBufferCreate",
18110 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018111 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000018112 printf("\n");
18113 }
Daniel Veillard3d95c732004-11-06 22:25:14 +000018114 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018115
Daniel Veillard42595322004-11-08 10:52:06 +000018116 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018117}
18118
18119
18120static int
18121test_xmlBufferCreateSize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018122 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018123
18124
18125 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000018126 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018127}
18128
18129
18130static int
18131test_xmlBufferCreateStatic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018132 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018133
18134
18135 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000018136 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018137}
18138
18139
18140static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000018141test_xmlBufferEmpty(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018142 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018143
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018144 int mem_base;
18145 xmlBufferPtr buf; /* the buffer */
18146 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018147
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018148 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18149 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018150 buf = gen_xmlBufferPtr(n_buf, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018151
18152 xmlBufferEmpty(buf);
18153 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018154 des_xmlBufferPtr(n_buf, buf, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018155 xmlResetLastError();
18156 if (mem_base != xmlMemBlocks()) {
18157 printf("Leak of %d blocks found in xmlBufferEmpty",
18158 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018159 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018160 printf(" %d", n_buf);
18161 printf("\n");
18162 }
18163 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018164 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018165
Daniel Veillard42595322004-11-08 10:52:06 +000018166 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018167}
18168
18169
18170static int
18171test_xmlBufferGrow(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018172 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018173
Daniel Veillard3d97e662004-11-04 10:49:00 +000018174 int mem_base;
18175 int ret_val;
18176 xmlBufferPtr buf; /* the buffer */
18177 int n_buf;
18178 unsigned int len; /* the minimum free size to allocate */
18179 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018180
Daniel Veillard3d97e662004-11-04 10:49:00 +000018181 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18182 for (n_len = 0;n_len < gen_nb_unsigned_int;n_len++) {
18183 mem_base = xmlMemBlocks();
18184 buf = gen_xmlBufferPtr(n_buf, 0);
18185 len = gen_unsigned_int(n_len, 1);
18186
18187 ret_val = xmlBufferGrow(buf, len);
18188 desret_int(ret_val);
18189 call_tests++;
18190 des_xmlBufferPtr(n_buf, buf, 0);
18191 des_unsigned_int(n_len, len, 1);
18192 xmlResetLastError();
18193 if (mem_base != xmlMemBlocks()) {
18194 printf("Leak of %d blocks found in xmlBufferGrow",
18195 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018196 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018197 printf(" %d", n_buf);
18198 printf(" %d", n_len);
18199 printf("\n");
18200 }
18201 }
18202 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018203 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018204
Daniel Veillard42595322004-11-08 10:52:06 +000018205 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018206}
18207
18208
18209static int
18210test_xmlBufferLength(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018211 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018212
Daniel Veillardce682bc2004-11-05 17:22:25 +000018213 int mem_base;
18214 int ret_val;
18215 xmlBufferPtr buf; /* the buffer */
18216 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018217
Daniel Veillardce682bc2004-11-05 17:22:25 +000018218 for (n_buf = 0;n_buf < gen_nb_const_xmlBufferPtr;n_buf++) {
18219 mem_base = xmlMemBlocks();
18220 buf = gen_const_xmlBufferPtr(n_buf, 0);
18221
William M. Brackf13f77f2004-11-12 16:03:48 +000018222 ret_val = xmlBufferLength((const xmlBufferPtr)buf);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018223 desret_int(ret_val);
18224 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000018225 des_const_xmlBufferPtr(n_buf, (const xmlBufferPtr)buf, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018226 xmlResetLastError();
18227 if (mem_base != xmlMemBlocks()) {
18228 printf("Leak of %d blocks found in xmlBufferLength",
18229 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018230 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018231 printf(" %d", n_buf);
18232 printf("\n");
18233 }
18234 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000018235 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018236
Daniel Veillard42595322004-11-08 10:52:06 +000018237 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018238}
18239
18240
18241static int
18242test_xmlBufferResize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018243 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018244
Daniel Veillard3d97e662004-11-04 10:49:00 +000018245 int mem_base;
18246 int ret_val;
18247 xmlBufferPtr buf; /* the buffer to resize */
18248 int n_buf;
18249 unsigned int size; /* the desired size */
18250 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018251
Daniel Veillard3d97e662004-11-04 10:49:00 +000018252 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18253 for (n_size = 0;n_size < gen_nb_unsigned_int;n_size++) {
18254 mem_base = xmlMemBlocks();
18255 buf = gen_xmlBufferPtr(n_buf, 0);
18256 size = gen_unsigned_int(n_size, 1);
18257
18258 ret_val = xmlBufferResize(buf, size);
18259 desret_int(ret_val);
18260 call_tests++;
18261 des_xmlBufferPtr(n_buf, buf, 0);
18262 des_unsigned_int(n_size, size, 1);
18263 xmlResetLastError();
18264 if (mem_base != xmlMemBlocks()) {
18265 printf("Leak of %d blocks found in xmlBufferResize",
18266 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018267 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018268 printf(" %d", n_buf);
18269 printf(" %d", n_size);
18270 printf("\n");
18271 }
18272 }
18273 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018274 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018275
Daniel Veillard42595322004-11-08 10:52:06 +000018276 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018277}
18278
18279
18280static int
18281test_xmlBufferSetAllocationScheme(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018282 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018283
Daniel Veillard57b25162004-11-06 14:50:18 +000018284 int mem_base;
18285 xmlBufferPtr buf; /* the buffer to tune */
18286 int n_buf;
18287 xmlBufferAllocationScheme scheme; /* allocation scheme to use */
18288 int n_scheme;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018289
Daniel Veillard57b25162004-11-06 14:50:18 +000018290 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18291 for (n_scheme = 0;n_scheme < gen_nb_xmlBufferAllocationScheme;n_scheme++) {
18292 mem_base = xmlMemBlocks();
18293 buf = gen_xmlBufferPtr(n_buf, 0);
18294 scheme = gen_xmlBufferAllocationScheme(n_scheme, 1);
18295
18296 xmlBufferSetAllocationScheme(buf, scheme);
18297 call_tests++;
18298 des_xmlBufferPtr(n_buf, buf, 0);
18299 des_xmlBufferAllocationScheme(n_scheme, scheme, 1);
18300 xmlResetLastError();
18301 if (mem_base != xmlMemBlocks()) {
18302 printf("Leak of %d blocks found in xmlBufferSetAllocationScheme",
18303 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018304 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000018305 printf(" %d", n_buf);
18306 printf(" %d", n_scheme);
18307 printf("\n");
18308 }
18309 }
18310 }
Daniel Veillard57b25162004-11-06 14:50:18 +000018311 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018312
Daniel Veillard42595322004-11-08 10:52:06 +000018313 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018314}
18315
18316
18317static int
18318test_xmlBufferShrink(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018319 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018320
Daniel Veillard3d97e662004-11-04 10:49:00 +000018321 int mem_base;
18322 int ret_val;
18323 xmlBufferPtr buf; /* the buffer to dump */
18324 int n_buf;
18325 unsigned int len; /* the number of xmlChar to remove */
18326 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018327
Daniel Veillard3d97e662004-11-04 10:49:00 +000018328 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18329 for (n_len = 0;n_len < gen_nb_unsigned_int;n_len++) {
18330 mem_base = xmlMemBlocks();
18331 buf = gen_xmlBufferPtr(n_buf, 0);
18332 len = gen_unsigned_int(n_len, 1);
18333
18334 ret_val = xmlBufferShrink(buf, len);
18335 desret_int(ret_val);
18336 call_tests++;
18337 des_xmlBufferPtr(n_buf, buf, 0);
18338 des_unsigned_int(n_len, len, 1);
18339 xmlResetLastError();
18340 if (mem_base != xmlMemBlocks()) {
18341 printf("Leak of %d blocks found in xmlBufferShrink",
18342 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018343 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018344 printf(" %d", n_buf);
18345 printf(" %d", n_len);
18346 printf("\n");
18347 }
18348 }
18349 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018350 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018351
Daniel Veillard42595322004-11-08 10:52:06 +000018352 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018353}
18354
18355
18356static int
18357test_xmlBufferWriteCHAR(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018358 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018359
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018360 int mem_base;
18361 xmlBufferPtr buf; /* the XML buffer */
18362 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018363 xmlChar * string; /* the string to add */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018364 int n_string;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018365
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018366 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18367 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
18368 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018369 buf = gen_xmlBufferPtr(n_buf, 0);
18370 string = gen_const_xmlChar_ptr(n_string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018371
William M. Brackf13f77f2004-11-12 16:03:48 +000018372 xmlBufferWriteCHAR(buf, (const xmlChar *)string);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018373 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018374 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000018375 des_const_xmlChar_ptr(n_string, (const xmlChar *)string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018376 xmlResetLastError();
18377 if (mem_base != xmlMemBlocks()) {
18378 printf("Leak of %d blocks found in xmlBufferWriteCHAR",
18379 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018380 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018381 printf(" %d", n_buf);
18382 printf(" %d", n_string);
18383 printf("\n");
18384 }
18385 }
18386 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018387 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018388
Daniel Veillard42595322004-11-08 10:52:06 +000018389 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018390}
18391
18392
18393static int
18394test_xmlBufferWriteChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018395 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018396
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018397 int mem_base;
18398 xmlBufferPtr buf; /* the XML buffer output */
18399 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018400 char * string; /* the string to add */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018401 int n_string;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018402
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018403 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18404 for (n_string = 0;n_string < gen_nb_const_char_ptr;n_string++) {
18405 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018406 buf = gen_xmlBufferPtr(n_buf, 0);
18407 string = gen_const_char_ptr(n_string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018408
William M. Brackf13f77f2004-11-12 16:03:48 +000018409 xmlBufferWriteChar(buf, (const char *)string);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018410 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018411 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000018412 des_const_char_ptr(n_string, (const char *)string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018413 xmlResetLastError();
18414 if (mem_base != xmlMemBlocks()) {
18415 printf("Leak of %d blocks found in xmlBufferWriteChar",
18416 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018417 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018418 printf(" %d", n_buf);
18419 printf(" %d", n_string);
18420 printf("\n");
18421 }
18422 }
18423 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018424 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018425
Daniel Veillard42595322004-11-08 10:52:06 +000018426 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018427}
18428
18429
18430static int
18431test_xmlBufferWriteQuotedString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018432 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018433
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018434 int mem_base;
18435 xmlBufferPtr buf; /* the XML buffer output */
18436 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018437 xmlChar * string; /* the string to add */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018438 int n_string;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018439
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018440 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18441 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
18442 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018443 buf = gen_xmlBufferPtr(n_buf, 0);
18444 string = gen_const_xmlChar_ptr(n_string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018445
William M. Brackf13f77f2004-11-12 16:03:48 +000018446 xmlBufferWriteQuotedString(buf, (const xmlChar *)string);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018447 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018448 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000018449 des_const_xmlChar_ptr(n_string, (const xmlChar *)string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018450 xmlResetLastError();
18451 if (mem_base != xmlMemBlocks()) {
18452 printf("Leak of %d blocks found in xmlBufferWriteQuotedString",
18453 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018454 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018455 printf(" %d", n_buf);
18456 printf(" %d", n_string);
18457 printf("\n");
18458 }
18459 }
18460 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018461 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018462
Daniel Veillard42595322004-11-08 10:52:06 +000018463 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018464}
18465
18466
18467static int
18468test_xmlBuildQName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018469 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018470
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018471 int mem_base;
18472 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018473 xmlChar * ncname; /* the Name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018474 int n_ncname;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018475 xmlChar * prefix; /* the prefix */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018476 int n_prefix;
18477 xmlChar * memory; /* preallocated memory */
18478 int n_memory;
18479 int len; /* preallocated memory length */
18480 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018481
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018482 for (n_ncname = 0;n_ncname < gen_nb_const_xmlChar_ptr;n_ncname++) {
18483 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
18484 for (n_memory = 0;n_memory < gen_nb_xmlChar_ptr;n_memory++) {
18485 for (n_len = 0;n_len < gen_nb_int;n_len++) {
18486 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018487 ncname = gen_const_xmlChar_ptr(n_ncname, 0);
18488 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
18489 memory = gen_xmlChar_ptr(n_memory, 2);
18490 len = gen_int(n_len, 3);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018491
William M. Brackf13f77f2004-11-12 16:03:48 +000018492 ret_val = xmlBuildQName((const xmlChar *)ncname, (const xmlChar *)prefix, memory, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018493 if ((ret_val != NULL) && (ret_val != ncname) &&
18494 (ret_val != prefix) && (ret_val != memory))
18495 xmlFree(ret_val);
18496 ret_val = NULL;
18497 desret_xmlChar_ptr(ret_val);
18498 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000018499 des_const_xmlChar_ptr(n_ncname, (const xmlChar *)ncname, 0);
18500 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000018501 des_xmlChar_ptr(n_memory, memory, 2);
18502 des_int(n_len, len, 3);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018503 xmlResetLastError();
18504 if (mem_base != xmlMemBlocks()) {
18505 printf("Leak of %d blocks found in xmlBuildQName",
18506 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018507 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018508 printf(" %d", n_ncname);
18509 printf(" %d", n_prefix);
18510 printf(" %d", n_memory);
18511 printf(" %d", n_len);
18512 printf("\n");
18513 }
18514 }
18515 }
18516 }
18517 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018518 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018519
Daniel Veillard42595322004-11-08 10:52:06 +000018520 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018521}
18522
18523
18524static int
18525test_xmlCopyDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018526 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018527
William M. Brack21e4ef22005-01-02 09:53:13 +000018528#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000018529 int mem_base;
18530 xmlDocPtr ret_val;
18531 xmlDocPtr doc; /* the document */
18532 int n_doc;
18533 int recursive; /* if not zero do a recursive copy. */
18534 int n_recursive;
18535
18536 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
18537 for (n_recursive = 0;n_recursive < gen_nb_int;n_recursive++) {
18538 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018539 doc = gen_xmlDocPtr(n_doc, 0);
18540 recursive = gen_int(n_recursive, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018541
18542 ret_val = xmlCopyDoc(doc, recursive);
18543 desret_xmlDocPtr(ret_val);
18544 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018545 des_xmlDocPtr(n_doc, doc, 0);
18546 des_int(n_recursive, recursive, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018547 xmlResetLastError();
18548 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000018549 printf("Leak of %d blocks found in xmlCopyDoc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000018550 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018551 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000018552 printf(" %d", n_doc);
18553 printf(" %d", n_recursive);
18554 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000018555 }
18556 }
18557 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018558 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018559#endif
18560
Daniel Veillard42595322004-11-08 10:52:06 +000018561 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018562}
18563
18564
18565static int
18566test_xmlCopyDtd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018567 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018568
William M. Brack21e4ef22005-01-02 09:53:13 +000018569#if defined(LIBXML_TREE_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000018570 int mem_base;
18571 xmlDtdPtr ret_val;
18572 xmlDtdPtr dtd; /* the dtd */
18573 int n_dtd;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018574
Daniel Veillard27f20102004-11-05 11:50:11 +000018575 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
18576 mem_base = xmlMemBlocks();
18577 dtd = gen_xmlDtdPtr(n_dtd, 0);
18578
18579 ret_val = xmlCopyDtd(dtd);
18580 desret_xmlDtdPtr(ret_val);
18581 call_tests++;
18582 des_xmlDtdPtr(n_dtd, dtd, 0);
18583 xmlResetLastError();
18584 if (mem_base != xmlMemBlocks()) {
18585 printf("Leak of %d blocks found in xmlCopyDtd",
18586 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018587 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000018588 printf(" %d", n_dtd);
18589 printf("\n");
18590 }
18591 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018592 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000018593#endif
18594
Daniel Veillard42595322004-11-08 10:52:06 +000018595 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018596}
18597
18598
18599static int
18600test_xmlCopyNamespace(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018601 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018602
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018603 int mem_base;
18604 xmlNsPtr ret_val;
18605 xmlNsPtr cur; /* the namespace */
18606 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018607
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018608 for (n_cur = 0;n_cur < gen_nb_xmlNsPtr;n_cur++) {
18609 mem_base = xmlMemBlocks();
18610 cur = gen_xmlNsPtr(n_cur, 0);
18611
18612 ret_val = xmlCopyNamespace(cur);
18613 if (ret_val != NULL) xmlFreeNs(ret_val);
18614 desret_xmlNsPtr(ret_val);
18615 call_tests++;
18616 des_xmlNsPtr(n_cur, cur, 0);
18617 xmlResetLastError();
18618 if (mem_base != xmlMemBlocks()) {
18619 printf("Leak of %d blocks found in xmlCopyNamespace",
18620 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018621 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018622 printf(" %d", n_cur);
18623 printf("\n");
18624 }
18625 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018626 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018627
Daniel Veillard42595322004-11-08 10:52:06 +000018628 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018629}
18630
18631
18632static int
18633test_xmlCopyNamespaceList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018634 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018635
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018636 int mem_base;
18637 xmlNsPtr ret_val;
18638 xmlNsPtr cur; /* the first namespace */
18639 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018640
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018641 for (n_cur = 0;n_cur < gen_nb_xmlNsPtr;n_cur++) {
18642 mem_base = xmlMemBlocks();
18643 cur = gen_xmlNsPtr(n_cur, 0);
18644
18645 ret_val = xmlCopyNamespaceList(cur);
18646 if (ret_val != NULL) xmlFreeNsList(ret_val);
18647 desret_xmlNsPtr(ret_val);
18648 call_tests++;
18649 des_xmlNsPtr(n_cur, cur, 0);
18650 xmlResetLastError();
18651 if (mem_base != xmlMemBlocks()) {
18652 printf("Leak of %d blocks found in xmlCopyNamespaceList",
18653 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018654 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018655 printf(" %d", n_cur);
18656 printf("\n");
18657 }
18658 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018659 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018660
Daniel Veillard42595322004-11-08 10:52:06 +000018661 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018662}
18663
18664
18665static int
18666test_xmlCopyNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018667 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018668
Daniel Veillardce682bc2004-11-05 17:22:25 +000018669 int mem_base;
18670 xmlNodePtr ret_val;
18671 xmlNodePtr node; /* the node */
18672 int n_node;
18673 int extended; /* if 1 do a recursive copy (properties, namespaces and children when applicable) if 2 copy properties and namespaces (when applicable) */
18674 int n_extended;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018675
Daniel Veillardce682bc2004-11-05 17:22:25 +000018676 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
18677 for (n_extended = 0;n_extended < gen_nb_int;n_extended++) {
18678 mem_base = xmlMemBlocks();
18679 node = gen_const_xmlNodePtr(n_node, 0);
18680 extended = gen_int(n_extended, 1);
18681
William M. Brackf13f77f2004-11-12 16:03:48 +000018682 ret_val = xmlCopyNode((const xmlNodePtr)node, extended);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018683 desret_xmlNodePtr(ret_val);
18684 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000018685 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018686 des_int(n_extended, extended, 1);
18687 xmlResetLastError();
18688 if (mem_base != xmlMemBlocks()) {
18689 printf("Leak of %d blocks found in xmlCopyNode",
18690 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018691 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018692 printf(" %d", n_node);
18693 printf(" %d", n_extended);
18694 printf("\n");
18695 }
18696 }
18697 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000018698 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018699
Daniel Veillard42595322004-11-08 10:52:06 +000018700 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018701}
18702
18703
18704static int
18705test_xmlCopyNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018706 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018707
Daniel Veillardce682bc2004-11-05 17:22:25 +000018708 int mem_base;
18709 xmlNodePtr ret_val;
18710 xmlNodePtr node; /* the first node in the list. */
18711 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018712
Daniel Veillardce682bc2004-11-05 17:22:25 +000018713 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
18714 mem_base = xmlMemBlocks();
18715 node = gen_const_xmlNodePtr(n_node, 0);
18716
William M. Brackf13f77f2004-11-12 16:03:48 +000018717 ret_val = xmlCopyNodeList((const xmlNodePtr)node);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018718 desret_xmlNodePtr(ret_val);
18719 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000018720 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018721 xmlResetLastError();
18722 if (mem_base != xmlMemBlocks()) {
18723 printf("Leak of %d blocks found in xmlCopyNodeList",
18724 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018725 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018726 printf(" %d", n_node);
18727 printf("\n");
18728 }
18729 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000018730 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018731
Daniel Veillard42595322004-11-08 10:52:06 +000018732 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018733}
18734
18735
18736static int
18737test_xmlCopyProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018738 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018739
Daniel Veillard57b25162004-11-06 14:50:18 +000018740 int mem_base;
18741 xmlAttrPtr ret_val;
18742 xmlNodePtr target; /* the element where the attribute will be grafted */
18743 int n_target;
18744 xmlAttrPtr cur; /* the attribute */
18745 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018746
Daniel Veillard57b25162004-11-06 14:50:18 +000018747 for (n_target = 0;n_target < gen_nb_xmlNodePtr;n_target++) {
18748 for (n_cur = 0;n_cur < gen_nb_xmlAttrPtr;n_cur++) {
18749 mem_base = xmlMemBlocks();
18750 target = gen_xmlNodePtr(n_target, 0);
18751 cur = gen_xmlAttrPtr(n_cur, 1);
18752
18753 ret_val = xmlCopyProp(target, cur);
18754 desret_xmlAttrPtr(ret_val);
18755 call_tests++;
18756 des_xmlNodePtr(n_target, target, 0);
18757 des_xmlAttrPtr(n_cur, cur, 1);
18758 xmlResetLastError();
18759 if (mem_base != xmlMemBlocks()) {
18760 printf("Leak of %d blocks found in xmlCopyProp",
18761 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018762 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000018763 printf(" %d", n_target);
18764 printf(" %d", n_cur);
18765 printf("\n");
18766 }
18767 }
18768 }
Daniel Veillard57b25162004-11-06 14:50:18 +000018769 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018770
Daniel Veillard42595322004-11-08 10:52:06 +000018771 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018772}
18773
18774
18775static int
18776test_xmlCopyPropList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018777 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018778
Daniel Veillard57b25162004-11-06 14:50:18 +000018779 int mem_base;
18780 xmlAttrPtr ret_val;
18781 xmlNodePtr target; /* the element where the attributes will be grafted */
18782 int n_target;
18783 xmlAttrPtr cur; /* the first attribute */
18784 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018785
Daniel Veillard57b25162004-11-06 14:50:18 +000018786 for (n_target = 0;n_target < gen_nb_xmlNodePtr;n_target++) {
18787 for (n_cur = 0;n_cur < gen_nb_xmlAttrPtr;n_cur++) {
18788 mem_base = xmlMemBlocks();
18789 target = gen_xmlNodePtr(n_target, 0);
18790 cur = gen_xmlAttrPtr(n_cur, 1);
18791
18792 ret_val = xmlCopyPropList(target, cur);
18793 desret_xmlAttrPtr(ret_val);
18794 call_tests++;
18795 des_xmlNodePtr(n_target, target, 0);
18796 des_xmlAttrPtr(n_cur, cur, 1);
18797 xmlResetLastError();
18798 if (mem_base != xmlMemBlocks()) {
18799 printf("Leak of %d blocks found in xmlCopyPropList",
18800 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018801 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000018802 printf(" %d", n_target);
18803 printf(" %d", n_cur);
18804 printf("\n");
18805 }
18806 }
18807 }
Daniel Veillard57b25162004-11-06 14:50:18 +000018808 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018809
Daniel Veillard42595322004-11-08 10:52:06 +000018810 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018811}
18812
18813
18814static int
18815test_xmlCreateIntSubset(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018816 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018817
Daniel Veillard34099b42004-11-04 17:34:35 +000018818 int mem_base;
18819 xmlDtdPtr ret_val;
18820 xmlDocPtr doc; /* the document pointer */
18821 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018822 xmlChar * name; /* the DTD name */
Daniel Veillard34099b42004-11-04 17:34:35 +000018823 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018824 xmlChar * ExternalID; /* the external (PUBLIC) ID */
Daniel Veillard34099b42004-11-04 17:34:35 +000018825 int n_ExternalID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018826 xmlChar * SystemID; /* the system ID */
Daniel Veillard34099b42004-11-04 17:34:35 +000018827 int n_SystemID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018828
Daniel Veillard34099b42004-11-04 17:34:35 +000018829 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
18830 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
18831 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
18832 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
18833 mem_base = xmlMemBlocks();
18834 doc = gen_xmlDocPtr(n_doc, 0);
18835 name = gen_const_xmlChar_ptr(n_name, 1);
18836 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2);
18837 SystemID = gen_const_xmlChar_ptr(n_SystemID, 3);
18838
William M. Brackf13f77f2004-11-12 16:03:48 +000018839 ret_val = xmlCreateIntSubset(doc, (const xmlChar *)name, (const xmlChar *)ExternalID, (const xmlChar *)SystemID);
Daniel Veillard34099b42004-11-04 17:34:35 +000018840 desret_xmlDtdPtr(ret_val);
18841 call_tests++;
18842 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000018843 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
18844 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 2);
18845 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 3);
Daniel Veillard34099b42004-11-04 17:34:35 +000018846 xmlResetLastError();
18847 if (mem_base != xmlMemBlocks()) {
18848 printf("Leak of %d blocks found in xmlCreateIntSubset",
18849 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018850 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000018851 printf(" %d", n_doc);
18852 printf(" %d", n_name);
18853 printf(" %d", n_ExternalID);
18854 printf(" %d", n_SystemID);
18855 printf("\n");
18856 }
18857 }
18858 }
18859 }
18860 }
Daniel Veillard34099b42004-11-04 17:34:35 +000018861 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018862
Daniel Veillard42595322004-11-08 10:52:06 +000018863 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018864}
18865
18866
18867static int
18868test_xmlDocCopyNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018869 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018870
Daniel Veillardce682bc2004-11-05 17:22:25 +000018871 int mem_base;
18872 xmlNodePtr ret_val;
18873 xmlNodePtr node; /* the node */
18874 int n_node;
18875 xmlDocPtr doc; /* the document */
18876 int n_doc;
18877 int extended; /* if 1 do a recursive copy (properties, namespaces and children when applicable) if 2 copy properties and namespaces (when applicable) */
18878 int n_extended;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018879
Daniel Veillardce682bc2004-11-05 17:22:25 +000018880 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
18881 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
18882 for (n_extended = 0;n_extended < gen_nb_int;n_extended++) {
18883 mem_base = xmlMemBlocks();
18884 node = gen_const_xmlNodePtr(n_node, 0);
18885 doc = gen_xmlDocPtr(n_doc, 1);
18886 extended = gen_int(n_extended, 2);
18887
William M. Brackf13f77f2004-11-12 16:03:48 +000018888 ret_val = xmlDocCopyNode((const xmlNodePtr)node, doc, extended);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018889 desret_xmlNodePtr(ret_val);
18890 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000018891 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018892 des_xmlDocPtr(n_doc, doc, 1);
18893 des_int(n_extended, extended, 2);
18894 xmlResetLastError();
18895 if (mem_base != xmlMemBlocks()) {
18896 printf("Leak of %d blocks found in xmlDocCopyNode",
18897 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018898 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018899 printf(" %d", n_node);
18900 printf(" %d", n_doc);
18901 printf(" %d", n_extended);
18902 printf("\n");
18903 }
18904 }
18905 }
18906 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000018907 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018908
Daniel Veillard42595322004-11-08 10:52:06 +000018909 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018910}
18911
18912
18913static int
18914test_xmlDocCopyNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018915 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018916
Daniel Veillardce682bc2004-11-05 17:22:25 +000018917 int mem_base;
18918 xmlNodePtr ret_val;
18919 xmlDocPtr doc; /* the target document */
18920 int n_doc;
18921 xmlNodePtr node; /* the first node in the list. */
18922 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018923
Daniel Veillardce682bc2004-11-05 17:22:25 +000018924 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
18925 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
18926 mem_base = xmlMemBlocks();
18927 doc = gen_xmlDocPtr(n_doc, 0);
18928 node = gen_const_xmlNodePtr(n_node, 1);
18929
William M. Brackf13f77f2004-11-12 16:03:48 +000018930 ret_val = xmlDocCopyNodeList(doc, (const xmlNodePtr)node);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018931 desret_xmlNodePtr(ret_val);
18932 call_tests++;
18933 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000018934 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018935 xmlResetLastError();
18936 if (mem_base != xmlMemBlocks()) {
18937 printf("Leak of %d blocks found in xmlDocCopyNodeList",
18938 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018939 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018940 printf(" %d", n_doc);
18941 printf(" %d", n_node);
18942 printf("\n");
18943 }
18944 }
18945 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000018946 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018947
Daniel Veillard42595322004-11-08 10:52:06 +000018948 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018949}
18950
18951
18952static int
18953test_xmlDocDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018954 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018955
William M. Brack21e4ef22005-01-02 09:53:13 +000018956#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000018957 int mem_base;
18958 int ret_val;
18959 FILE * f; /* the FILE* */
18960 int n_f;
18961 xmlDocPtr cur; /* the document */
18962 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018963
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000018964 for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) {
18965 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
18966 mem_base = xmlMemBlocks();
18967 f = gen_FILE_ptr(n_f, 0);
18968 cur = gen_xmlDocPtr(n_cur, 1);
18969
18970 ret_val = xmlDocDump(f, cur);
18971 desret_int(ret_val);
18972 call_tests++;
18973 des_FILE_ptr(n_f, f, 0);
18974 des_xmlDocPtr(n_cur, cur, 1);
18975 xmlResetLastError();
18976 if (mem_base != xmlMemBlocks()) {
18977 printf("Leak of %d blocks found in xmlDocDump",
18978 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018979 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000018980 printf(" %d", n_f);
18981 printf(" %d", n_cur);
18982 printf("\n");
18983 }
18984 }
18985 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018986 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000018987#endif
18988
Daniel Veillard42595322004-11-08 10:52:06 +000018989 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018990}
18991
18992
18993static int
18994test_xmlDocDumpFormatMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018995 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018996
William M. Brack21e4ef22005-01-02 09:53:13 +000018997#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018998 int mem_base;
18999 xmlDocPtr cur; /* the document */
19000 int n_cur;
19001 xmlChar ** mem; /* OUT: the memory pointer */
19002 int n_mem;
19003 int * size; /* OUT: the memory length */
19004 int n_size;
19005 int format; /* should formatting spaces been added */
19006 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019007
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019008 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
19009 for (n_mem = 0;n_mem < gen_nb_xmlChar_ptr_ptr;n_mem++) {
19010 for (n_size = 0;n_size < gen_nb_int_ptr;n_size++) {
19011 for (n_format = 0;n_format < gen_nb_int;n_format++) {
19012 mem_base = xmlMemBlocks();
19013 cur = gen_xmlDocPtr(n_cur, 0);
19014 mem = gen_xmlChar_ptr_ptr(n_mem, 1);
19015 size = gen_int_ptr(n_size, 2);
19016 format = gen_int(n_format, 3);
19017
19018 xmlDocDumpFormatMemory(cur, mem, size, format);
19019 call_tests++;
19020 des_xmlDocPtr(n_cur, cur, 0);
19021 des_xmlChar_ptr_ptr(n_mem, mem, 1);
19022 des_int_ptr(n_size, size, 2);
19023 des_int(n_format, format, 3);
19024 xmlResetLastError();
19025 if (mem_base != xmlMemBlocks()) {
19026 printf("Leak of %d blocks found in xmlDocDumpFormatMemory",
19027 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019028 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019029 printf(" %d", n_cur);
19030 printf(" %d", n_mem);
19031 printf(" %d", n_size);
19032 printf(" %d", n_format);
19033 printf("\n");
19034 }
19035 }
19036 }
19037 }
19038 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019039 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019040#endif
19041
Daniel Veillard42595322004-11-08 10:52:06 +000019042 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019043}
19044
19045
19046static int
19047test_xmlDocDumpFormatMemoryEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019048 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019049
William M. Brack21e4ef22005-01-02 09:53:13 +000019050#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019051 int mem_base;
19052 xmlDocPtr out_doc; /* Document to generate XML text from */
19053 int n_out_doc;
19054 xmlChar ** doc_txt_ptr; /* Memory pointer for allocated XML text */
19055 int n_doc_txt_ptr;
19056 int * doc_txt_len; /* Length of the generated XML text */
19057 int n_doc_txt_len;
19058 char * txt_encoding; /* Character encoding to use when generating XML text */
19059 int n_txt_encoding;
19060 int format; /* should formatting spaces been added */
19061 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019062
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019063 for (n_out_doc = 0;n_out_doc < gen_nb_xmlDocPtr;n_out_doc++) {
19064 for (n_doc_txt_ptr = 0;n_doc_txt_ptr < gen_nb_xmlChar_ptr_ptr;n_doc_txt_ptr++) {
19065 for (n_doc_txt_len = 0;n_doc_txt_len < gen_nb_int_ptr;n_doc_txt_len++) {
19066 for (n_txt_encoding = 0;n_txt_encoding < gen_nb_const_char_ptr;n_txt_encoding++) {
19067 for (n_format = 0;n_format < gen_nb_int;n_format++) {
19068 mem_base = xmlMemBlocks();
19069 out_doc = gen_xmlDocPtr(n_out_doc, 0);
19070 doc_txt_ptr = gen_xmlChar_ptr_ptr(n_doc_txt_ptr, 1);
19071 doc_txt_len = gen_int_ptr(n_doc_txt_len, 2);
19072 txt_encoding = gen_const_char_ptr(n_txt_encoding, 3);
19073 format = gen_int(n_format, 4);
19074
William M. Brackf13f77f2004-11-12 16:03:48 +000019075 xmlDocDumpFormatMemoryEnc(out_doc, doc_txt_ptr, doc_txt_len, (const char *)txt_encoding, format);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019076 call_tests++;
19077 des_xmlDocPtr(n_out_doc, out_doc, 0);
19078 des_xmlChar_ptr_ptr(n_doc_txt_ptr, doc_txt_ptr, 1);
19079 des_int_ptr(n_doc_txt_len, doc_txt_len, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000019080 des_const_char_ptr(n_txt_encoding, (const char *)txt_encoding, 3);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019081 des_int(n_format, format, 4);
19082 xmlResetLastError();
19083 if (mem_base != xmlMemBlocks()) {
19084 printf("Leak of %d blocks found in xmlDocDumpFormatMemoryEnc",
19085 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019086 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019087 printf(" %d", n_out_doc);
19088 printf(" %d", n_doc_txt_ptr);
19089 printf(" %d", n_doc_txt_len);
19090 printf(" %d", n_txt_encoding);
19091 printf(" %d", n_format);
19092 printf("\n");
19093 }
19094 }
19095 }
19096 }
19097 }
19098 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019099 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019100#endif
19101
Daniel Veillard42595322004-11-08 10:52:06 +000019102 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019103}
19104
19105
19106static int
19107test_xmlDocDumpMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019108 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019109
William M. Brack21e4ef22005-01-02 09:53:13 +000019110#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019111 int mem_base;
19112 xmlDocPtr cur; /* the document */
19113 int n_cur;
19114 xmlChar ** mem; /* OUT: the memory pointer */
19115 int n_mem;
19116 int * size; /* OUT: the memory length */
19117 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019118
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019119 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
19120 for (n_mem = 0;n_mem < gen_nb_xmlChar_ptr_ptr;n_mem++) {
19121 for (n_size = 0;n_size < gen_nb_int_ptr;n_size++) {
19122 mem_base = xmlMemBlocks();
19123 cur = gen_xmlDocPtr(n_cur, 0);
19124 mem = gen_xmlChar_ptr_ptr(n_mem, 1);
19125 size = gen_int_ptr(n_size, 2);
19126
19127 xmlDocDumpMemory(cur, mem, size);
19128 call_tests++;
19129 des_xmlDocPtr(n_cur, cur, 0);
19130 des_xmlChar_ptr_ptr(n_mem, mem, 1);
19131 des_int_ptr(n_size, size, 2);
19132 xmlResetLastError();
19133 if (mem_base != xmlMemBlocks()) {
19134 printf("Leak of %d blocks found in xmlDocDumpMemory",
19135 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019136 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019137 printf(" %d", n_cur);
19138 printf(" %d", n_mem);
19139 printf(" %d", n_size);
19140 printf("\n");
19141 }
19142 }
19143 }
19144 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019145 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019146#endif
19147
Daniel Veillard42595322004-11-08 10:52:06 +000019148 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019149}
19150
19151
19152static int
19153test_xmlDocDumpMemoryEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019154 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019155
William M. Brack21e4ef22005-01-02 09:53:13 +000019156#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019157 int mem_base;
19158 xmlDocPtr out_doc; /* Document to generate XML text from */
19159 int n_out_doc;
19160 xmlChar ** doc_txt_ptr; /* Memory pointer for allocated XML text */
19161 int n_doc_txt_ptr;
19162 int * doc_txt_len; /* Length of the generated XML text */
19163 int n_doc_txt_len;
19164 char * txt_encoding; /* Character encoding to use when generating XML text */
19165 int n_txt_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019166
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019167 for (n_out_doc = 0;n_out_doc < gen_nb_xmlDocPtr;n_out_doc++) {
19168 for (n_doc_txt_ptr = 0;n_doc_txt_ptr < gen_nb_xmlChar_ptr_ptr;n_doc_txt_ptr++) {
19169 for (n_doc_txt_len = 0;n_doc_txt_len < gen_nb_int_ptr;n_doc_txt_len++) {
19170 for (n_txt_encoding = 0;n_txt_encoding < gen_nb_const_char_ptr;n_txt_encoding++) {
19171 mem_base = xmlMemBlocks();
19172 out_doc = gen_xmlDocPtr(n_out_doc, 0);
19173 doc_txt_ptr = gen_xmlChar_ptr_ptr(n_doc_txt_ptr, 1);
19174 doc_txt_len = gen_int_ptr(n_doc_txt_len, 2);
19175 txt_encoding = gen_const_char_ptr(n_txt_encoding, 3);
19176
William M. Brackf13f77f2004-11-12 16:03:48 +000019177 xmlDocDumpMemoryEnc(out_doc, doc_txt_ptr, doc_txt_len, (const char *)txt_encoding);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019178 call_tests++;
19179 des_xmlDocPtr(n_out_doc, out_doc, 0);
19180 des_xmlChar_ptr_ptr(n_doc_txt_ptr, doc_txt_ptr, 1);
19181 des_int_ptr(n_doc_txt_len, doc_txt_len, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000019182 des_const_char_ptr(n_txt_encoding, (const char *)txt_encoding, 3);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019183 xmlResetLastError();
19184 if (mem_base != xmlMemBlocks()) {
19185 printf("Leak of %d blocks found in xmlDocDumpMemoryEnc",
19186 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019187 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019188 printf(" %d", n_out_doc);
19189 printf(" %d", n_doc_txt_ptr);
19190 printf(" %d", n_doc_txt_len);
19191 printf(" %d", n_txt_encoding);
19192 printf("\n");
19193 }
19194 }
19195 }
19196 }
19197 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019198 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019199#endif
19200
Daniel Veillard42595322004-11-08 10:52:06 +000019201 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019202}
19203
19204
19205static int
19206test_xmlDocFormatDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019207 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019208
William M. Brack21e4ef22005-01-02 09:53:13 +000019209#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019210 int mem_base;
19211 int ret_val;
19212 FILE * f; /* the FILE* */
19213 int n_f;
19214 xmlDocPtr cur; /* the document */
19215 int n_cur;
19216 int format; /* should formatting spaces been added */
19217 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019218
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019219 for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) {
19220 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
19221 for (n_format = 0;n_format < gen_nb_int;n_format++) {
19222 mem_base = xmlMemBlocks();
19223 f = gen_FILE_ptr(n_f, 0);
19224 cur = gen_xmlDocPtr(n_cur, 1);
19225 format = gen_int(n_format, 2);
19226
19227 ret_val = xmlDocFormatDump(f, cur, format);
19228 desret_int(ret_val);
19229 call_tests++;
19230 des_FILE_ptr(n_f, f, 0);
19231 des_xmlDocPtr(n_cur, cur, 1);
19232 des_int(n_format, format, 2);
19233 xmlResetLastError();
19234 if (mem_base != xmlMemBlocks()) {
19235 printf("Leak of %d blocks found in xmlDocFormatDump",
19236 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019237 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019238 printf(" %d", n_f);
19239 printf(" %d", n_cur);
19240 printf(" %d", n_format);
19241 printf("\n");
19242 }
19243 }
19244 }
19245 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019246 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019247#endif
19248
Daniel Veillard42595322004-11-08 10:52:06 +000019249 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019250}
19251
19252
19253static int
19254test_xmlDocGetRootElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019255 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019256
19257 int mem_base;
19258 xmlNodePtr ret_val;
19259 xmlDocPtr doc; /* the document */
19260 int n_doc;
19261
19262 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19263 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019264 doc = gen_xmlDocPtr(n_doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019265
19266 ret_val = xmlDocGetRootElement(doc);
19267 desret_xmlNodePtr(ret_val);
19268 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019269 des_xmlDocPtr(n_doc, doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019270 xmlResetLastError();
19271 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019272 printf("Leak of %d blocks found in xmlDocGetRootElement",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019273 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019274 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019275 printf(" %d", n_doc);
19276 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019277 }
19278 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019279 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019280
Daniel Veillard42595322004-11-08 10:52:06 +000019281 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019282}
19283
19284
19285static int
19286test_xmlDocSetRootElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019287 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019288
William M. Brack21e4ef22005-01-02 09:53:13 +000019289#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000019290 int mem_base;
19291 xmlNodePtr ret_val;
19292 xmlDocPtr doc; /* the document */
19293 int n_doc;
19294 xmlNodePtr root; /* the new document root element */
19295 int n_root;
19296
19297 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019298 for (n_root = 0;n_root < gen_nb_xmlNodePtr_in;n_root++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000019299 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019300 doc = gen_xmlDocPtr(n_doc, 0);
19301 root = gen_xmlNodePtr_in(n_root, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019302
19303 ret_val = xmlDocSetRootElement(doc, root);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019304 if (doc == NULL) { xmlFreeNode(root) ; root = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000019305 desret_xmlNodePtr(ret_val);
19306 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019307 des_xmlDocPtr(n_doc, doc, 0);
19308 des_xmlNodePtr_in(n_root, root, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019309 xmlResetLastError();
19310 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019311 printf("Leak of %d blocks found in xmlDocSetRootElement",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019312 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019313 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019314 printf(" %d", n_doc);
19315 printf(" %d", n_root);
19316 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019317 }
19318 }
19319 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019320 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019321#endif
19322
Daniel Veillard42595322004-11-08 10:52:06 +000019323 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019324}
19325
19326
19327static int
19328test_xmlElemDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019329 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019330
William M. Brack21e4ef22005-01-02 09:53:13 +000019331#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019332 int mem_base;
19333 FILE * f; /* the FILE * for the output */
19334 int n_f;
19335 xmlDocPtr doc; /* the document */
19336 int n_doc;
19337 xmlNodePtr cur; /* the current node */
19338 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019339
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019340 for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) {
19341 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19342 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
19343 mem_base = xmlMemBlocks();
19344 f = gen_FILE_ptr(n_f, 0);
19345 doc = gen_xmlDocPtr(n_doc, 1);
19346 cur = gen_xmlNodePtr(n_cur, 2);
19347
19348 xmlElemDump(f, doc, cur);
19349 call_tests++;
19350 des_FILE_ptr(n_f, f, 0);
19351 des_xmlDocPtr(n_doc, doc, 1);
19352 des_xmlNodePtr(n_cur, cur, 2);
19353 xmlResetLastError();
19354 if (mem_base != xmlMemBlocks()) {
19355 printf("Leak of %d blocks found in xmlElemDump",
19356 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019357 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019358 printf(" %d", n_f);
19359 printf(" %d", n_doc);
19360 printf(" %d", n_cur);
19361 printf("\n");
19362 }
19363 }
19364 }
19365 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019366 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019367#endif
19368
Daniel Veillard42595322004-11-08 10:52:06 +000019369 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019370}
19371
19372
19373static int
19374test_xmlGetBufferAllocationScheme(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019375 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019376
Daniel Veillard57b25162004-11-06 14:50:18 +000019377 int mem_base;
19378 xmlBufferAllocationScheme ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019379
Daniel Veillard57b25162004-11-06 14:50:18 +000019380 mem_base = xmlMemBlocks();
19381
19382 ret_val = xmlGetBufferAllocationScheme();
19383 desret_xmlBufferAllocationScheme(ret_val);
19384 call_tests++;
19385 xmlResetLastError();
19386 if (mem_base != xmlMemBlocks()) {
19387 printf("Leak of %d blocks found in xmlGetBufferAllocationScheme",
19388 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019389 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000019390 printf("\n");
19391 }
Daniel Veillard57b25162004-11-06 14:50:18 +000019392 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019393
Daniel Veillard42595322004-11-08 10:52:06 +000019394 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019395}
19396
19397
19398static int
19399test_xmlGetCompressMode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019400 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019401
19402 int mem_base;
19403 int ret_val;
19404
19405 mem_base = xmlMemBlocks();
19406
19407 ret_val = xmlGetCompressMode();
19408 desret_int(ret_val);
19409 call_tests++;
19410 xmlResetLastError();
19411 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019412 printf("Leak of %d blocks found in xmlGetCompressMode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019413 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019414 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019415 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019416 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019417 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019418
Daniel Veillard42595322004-11-08 10:52:06 +000019419 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019420}
19421
19422
19423static int
19424test_xmlGetDocCompressMode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019425 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019426
19427 int mem_base;
19428 int ret_val;
19429 xmlDocPtr doc; /* the document */
19430 int n_doc;
19431
19432 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19433 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019434 doc = gen_xmlDocPtr(n_doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019435
19436 ret_val = xmlGetDocCompressMode(doc);
19437 desret_int(ret_val);
19438 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019439 des_xmlDocPtr(n_doc, doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019440 xmlResetLastError();
19441 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019442 printf("Leak of %d blocks found in xmlGetDocCompressMode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019443 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019444 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019445 printf(" %d", n_doc);
19446 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019447 }
19448 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019449 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019450
Daniel Veillard42595322004-11-08 10:52:06 +000019451 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019452}
19453
19454
19455static int
19456test_xmlGetIntSubset(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019457 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019458
Daniel Veillard34099b42004-11-04 17:34:35 +000019459 int mem_base;
19460 xmlDtdPtr ret_val;
19461 xmlDocPtr doc; /* the document pointer */
19462 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019463
Daniel Veillard34099b42004-11-04 17:34:35 +000019464 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19465 mem_base = xmlMemBlocks();
19466 doc = gen_xmlDocPtr(n_doc, 0);
19467
19468 ret_val = xmlGetIntSubset(doc);
19469 desret_xmlDtdPtr(ret_val);
19470 call_tests++;
19471 des_xmlDocPtr(n_doc, doc, 0);
19472 xmlResetLastError();
19473 if (mem_base != xmlMemBlocks()) {
19474 printf("Leak of %d blocks found in xmlGetIntSubset",
19475 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019476 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000019477 printf(" %d", n_doc);
19478 printf("\n");
19479 }
19480 }
Daniel Veillard34099b42004-11-04 17:34:35 +000019481 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019482
Daniel Veillard42595322004-11-08 10:52:06 +000019483 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019484}
19485
19486
19487static int
19488test_xmlGetLastChild(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019489 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019490
19491 int mem_base;
19492 xmlNodePtr ret_val;
19493 xmlNodePtr parent; /* the parent node */
19494 int n_parent;
19495
19496 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
19497 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019498 parent = gen_xmlNodePtr(n_parent, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019499
19500 ret_val = xmlGetLastChild(parent);
19501 desret_xmlNodePtr(ret_val);
19502 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019503 des_xmlNodePtr(n_parent, parent, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019504 xmlResetLastError();
19505 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019506 printf("Leak of %d blocks found in xmlGetLastChild",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019507 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019508 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019509 printf(" %d", n_parent);
19510 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019511 }
19512 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019513 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019514
Daniel Veillard42595322004-11-08 10:52:06 +000019515 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019516}
19517
19518
19519static int
19520test_xmlGetLineNo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019521 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019522
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019523 int mem_base;
19524 long ret_val;
19525 xmlNodePtr node; /* valid node */
19526 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019527
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019528 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19529 mem_base = xmlMemBlocks();
19530 node = gen_xmlNodePtr(n_node, 0);
19531
19532 ret_val = xmlGetLineNo(node);
19533 desret_long(ret_val);
19534 call_tests++;
19535 des_xmlNodePtr(n_node, node, 0);
19536 xmlResetLastError();
19537 if (mem_base != xmlMemBlocks()) {
19538 printf("Leak of %d blocks found in xmlGetLineNo",
19539 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019540 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019541 printf(" %d", n_node);
19542 printf("\n");
19543 }
19544 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019545 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019546
Daniel Veillard42595322004-11-08 10:52:06 +000019547 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019548}
19549
19550
19551static int
19552test_xmlGetNoNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019553 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019554
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019555 int mem_base;
19556 xmlChar * ret_val;
19557 xmlNodePtr node; /* the node */
19558 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019559 xmlChar * name; /* the attribute name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019560 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019561
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019562 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19563 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19564 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019565 node = gen_xmlNodePtr(n_node, 0);
19566 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019567
William M. Brackf13f77f2004-11-12 16:03:48 +000019568 ret_val = xmlGetNoNsProp(node, (const xmlChar *)name);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019569 desret_xmlChar_ptr(ret_val);
19570 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019571 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019572 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019573 xmlResetLastError();
19574 if (mem_base != xmlMemBlocks()) {
19575 printf("Leak of %d blocks found in xmlGetNoNsProp",
19576 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019577 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019578 printf(" %d", n_node);
19579 printf(" %d", n_name);
19580 printf("\n");
19581 }
19582 }
19583 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019584 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019585
Daniel Veillard42595322004-11-08 10:52:06 +000019586 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019587}
19588
19589
19590static int
19591test_xmlGetNodePath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019592 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019593
William M. Brack21e4ef22005-01-02 09:53:13 +000019594#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_DEBUG_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019595 int mem_base;
19596 xmlChar * ret_val;
19597 xmlNodePtr node; /* a node */
19598 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019599
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019600 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19601 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019602 node = gen_xmlNodePtr(n_node, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019603
19604 ret_val = xmlGetNodePath(node);
19605 desret_xmlChar_ptr(ret_val);
19606 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019607 des_xmlNodePtr(n_node, node, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019608 xmlResetLastError();
19609 if (mem_base != xmlMemBlocks()) {
19610 printf("Leak of %d blocks found in xmlGetNodePath",
19611 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019612 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019613 printf(" %d", n_node);
19614 printf("\n");
19615 }
19616 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019617 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019618#endif
19619
Daniel Veillard42595322004-11-08 10:52:06 +000019620 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019621}
19622
19623
19624static int
19625test_xmlGetNsList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019626 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019627
19628
19629 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000019630 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019631}
19632
19633
19634static int
19635test_xmlGetNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019636 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019637
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019638 int mem_base;
19639 xmlChar * ret_val;
19640 xmlNodePtr node; /* the node */
19641 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019642 xmlChar * name; /* the attribute name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019643 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019644 xmlChar * nameSpace; /* the URI of the namespace */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019645 int n_nameSpace;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019646
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019647 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19648 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19649 for (n_nameSpace = 0;n_nameSpace < gen_nb_const_xmlChar_ptr;n_nameSpace++) {
19650 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019651 node = gen_xmlNodePtr(n_node, 0);
19652 name = gen_const_xmlChar_ptr(n_name, 1);
19653 nameSpace = gen_const_xmlChar_ptr(n_nameSpace, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019654
William M. Brackf13f77f2004-11-12 16:03:48 +000019655 ret_val = xmlGetNsProp(node, (const xmlChar *)name, (const xmlChar *)nameSpace);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019656 desret_xmlChar_ptr(ret_val);
19657 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019658 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019659 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
19660 des_const_xmlChar_ptr(n_nameSpace, (const xmlChar *)nameSpace, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019661 xmlResetLastError();
19662 if (mem_base != xmlMemBlocks()) {
19663 printf("Leak of %d blocks found in xmlGetNsProp",
19664 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019665 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019666 printf(" %d", n_node);
19667 printf(" %d", n_name);
19668 printf(" %d", n_nameSpace);
19669 printf("\n");
19670 }
19671 }
19672 }
19673 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019674 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019675
Daniel Veillard42595322004-11-08 10:52:06 +000019676 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019677}
19678
19679
19680static int
19681test_xmlGetProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019682 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019683
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019684 int mem_base;
19685 xmlChar * ret_val;
19686 xmlNodePtr node; /* the node */
19687 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019688 xmlChar * name; /* the attribute name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019689 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019690
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019691 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19692 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19693 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019694 node = gen_xmlNodePtr(n_node, 0);
19695 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019696
William M. Brackf13f77f2004-11-12 16:03:48 +000019697 ret_val = xmlGetProp(node, (const xmlChar *)name);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019698 desret_xmlChar_ptr(ret_val);
19699 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019700 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019701 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019702 xmlResetLastError();
19703 if (mem_base != xmlMemBlocks()) {
19704 printf("Leak of %d blocks found in xmlGetProp",
19705 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019706 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019707 printf(" %d", n_node);
19708 printf(" %d", n_name);
19709 printf("\n");
19710 }
19711 }
19712 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019713 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019714
Daniel Veillard42595322004-11-08 10:52:06 +000019715 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019716}
19717
19718
19719static int
19720test_xmlHasNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019721 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019722
Daniel Veillard57b25162004-11-06 14:50:18 +000019723 int mem_base;
19724 xmlAttrPtr ret_val;
19725 xmlNodePtr node; /* the node */
19726 int n_node;
19727 xmlChar * name; /* the attribute name */
19728 int n_name;
19729 xmlChar * nameSpace; /* the URI of the namespace */
19730 int n_nameSpace;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019731
Daniel Veillard57b25162004-11-06 14:50:18 +000019732 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19733 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19734 for (n_nameSpace = 0;n_nameSpace < gen_nb_const_xmlChar_ptr;n_nameSpace++) {
19735 mem_base = xmlMemBlocks();
19736 node = gen_xmlNodePtr(n_node, 0);
19737 name = gen_const_xmlChar_ptr(n_name, 1);
19738 nameSpace = gen_const_xmlChar_ptr(n_nameSpace, 2);
19739
William M. Brackf13f77f2004-11-12 16:03:48 +000019740 ret_val = xmlHasNsProp(node, (const xmlChar *)name, (const xmlChar *)nameSpace);
Daniel Veillard57b25162004-11-06 14:50:18 +000019741 desret_xmlAttrPtr(ret_val);
19742 call_tests++;
19743 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019744 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
19745 des_const_xmlChar_ptr(n_nameSpace, (const xmlChar *)nameSpace, 2);
Daniel Veillard57b25162004-11-06 14:50:18 +000019746 xmlResetLastError();
19747 if (mem_base != xmlMemBlocks()) {
19748 printf("Leak of %d blocks found in xmlHasNsProp",
19749 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019750 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000019751 printf(" %d", n_node);
19752 printf(" %d", n_name);
19753 printf(" %d", n_nameSpace);
19754 printf("\n");
19755 }
19756 }
19757 }
19758 }
Daniel Veillard57b25162004-11-06 14:50:18 +000019759 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019760
Daniel Veillard42595322004-11-08 10:52:06 +000019761 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019762}
19763
19764
19765static int
19766test_xmlHasProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019767 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019768
Daniel Veillard57b25162004-11-06 14:50:18 +000019769 int mem_base;
19770 xmlAttrPtr ret_val;
19771 xmlNodePtr node; /* the node */
19772 int n_node;
19773 xmlChar * name; /* the attribute name */
19774 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019775
Daniel Veillard57b25162004-11-06 14:50:18 +000019776 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19777 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19778 mem_base = xmlMemBlocks();
19779 node = gen_xmlNodePtr(n_node, 0);
19780 name = gen_const_xmlChar_ptr(n_name, 1);
19781
William M. Brackf13f77f2004-11-12 16:03:48 +000019782 ret_val = xmlHasProp(node, (const xmlChar *)name);
Daniel Veillard57b25162004-11-06 14:50:18 +000019783 desret_xmlAttrPtr(ret_val);
19784 call_tests++;
19785 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019786 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard57b25162004-11-06 14:50:18 +000019787 xmlResetLastError();
19788 if (mem_base != xmlMemBlocks()) {
19789 printf("Leak of %d blocks found in xmlHasProp",
19790 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019791 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000019792 printf(" %d", n_node);
19793 printf(" %d", n_name);
19794 printf("\n");
19795 }
19796 }
19797 }
Daniel Veillard57b25162004-11-06 14:50:18 +000019798 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019799
Daniel Veillard42595322004-11-08 10:52:06 +000019800 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019801}
19802
19803
19804static int
19805test_xmlIsBlankNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019806 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019807
19808 int mem_base;
19809 int ret_val;
19810 xmlNodePtr node; /* the node */
19811 int n_node;
19812
19813 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19814 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019815 node = gen_xmlNodePtr(n_node, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019816
19817 ret_val = xmlIsBlankNode(node);
19818 desret_int(ret_val);
19819 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019820 des_xmlNodePtr(n_node, node, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019821 xmlResetLastError();
19822 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019823 printf("Leak of %d blocks found in xmlIsBlankNode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019824 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019825 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019826 printf(" %d", n_node);
19827 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019828 }
19829 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019830 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019831
Daniel Veillard42595322004-11-08 10:52:06 +000019832 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019833}
19834
19835
19836static int
19837test_xmlIsXHTML(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019838 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019839
19840 int mem_base;
19841 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019842 xmlChar * systemID; /* the system identifier */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019843 int n_systemID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019844 xmlChar * publicID; /* the public identifier */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019845 int n_publicID;
19846
19847 for (n_systemID = 0;n_systemID < gen_nb_const_xmlChar_ptr;n_systemID++) {
19848 for (n_publicID = 0;n_publicID < gen_nb_const_xmlChar_ptr;n_publicID++) {
19849 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019850 systemID = gen_const_xmlChar_ptr(n_systemID, 0);
19851 publicID = gen_const_xmlChar_ptr(n_publicID, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019852
William M. Brackf13f77f2004-11-12 16:03:48 +000019853 ret_val = xmlIsXHTML((const xmlChar *)systemID, (const xmlChar *)publicID);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019854 desret_int(ret_val);
19855 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000019856 des_const_xmlChar_ptr(n_systemID, (const xmlChar *)systemID, 0);
19857 des_const_xmlChar_ptr(n_publicID, (const xmlChar *)publicID, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019858 xmlResetLastError();
19859 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019860 printf("Leak of %d blocks found in xmlIsXHTML",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019861 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019862 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019863 printf(" %d", n_systemID);
19864 printf(" %d", n_publicID);
19865 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019866 }
19867 }
19868 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019869 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019870
Daniel Veillard42595322004-11-08 10:52:06 +000019871 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019872}
19873
19874
19875static int
19876test_xmlNewCDataBlock(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019877 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019878
19879 int mem_base;
19880 xmlNodePtr ret_val;
19881 xmlDocPtr doc; /* the document */
19882 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019883 xmlChar * content; /* the CDATA block content content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019884 int n_content;
19885 int len; /* the length of the block */
19886 int n_len;
19887
19888 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19889 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
19890 for (n_len = 0;n_len < gen_nb_int;n_len++) {
19891 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019892 doc = gen_xmlDocPtr(n_doc, 0);
19893 content = gen_const_xmlChar_ptr(n_content, 1);
19894 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019895
William M. Brackf13f77f2004-11-12 16:03:48 +000019896 ret_val = xmlNewCDataBlock(doc, (const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019897 desret_xmlNodePtr(ret_val);
19898 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019899 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019900 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000019901 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019902 xmlResetLastError();
19903 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019904 printf("Leak of %d blocks found in xmlNewCDataBlock",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019905 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019906 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019907 printf(" %d", n_doc);
19908 printf(" %d", n_content);
19909 printf(" %d", n_len);
19910 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019911 }
19912 }
19913 }
19914 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019915 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019916
Daniel Veillard42595322004-11-08 10:52:06 +000019917 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019918}
19919
19920
19921static int
19922test_xmlNewCharRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019923 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019924
19925 int mem_base;
19926 xmlNodePtr ret_val;
19927 xmlDocPtr doc; /* the document */
19928 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019929 xmlChar * name; /* the char ref string, starting with # or "&# ... ;" */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019930 int n_name;
19931
19932 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19933 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19934 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019935 doc = gen_xmlDocPtr(n_doc, 0);
19936 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019937
William M. Brackf13f77f2004-11-12 16:03:48 +000019938 ret_val = xmlNewCharRef(doc, (const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019939 desret_xmlNodePtr(ret_val);
19940 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019941 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019942 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019943 xmlResetLastError();
19944 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019945 printf("Leak of %d blocks found in xmlNewCharRef",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019946 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019947 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019948 printf(" %d", n_doc);
19949 printf(" %d", n_name);
19950 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019951 }
19952 }
19953 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019954 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019955
Daniel Veillard42595322004-11-08 10:52:06 +000019956 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019957}
19958
19959
19960static int
19961test_xmlNewChild(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019962 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019963
William M. Brack21e4ef22005-01-02 09:53:13 +000019964#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000019965#ifdef LIBXML_TREE_ENABLED
Daniel Veillard27f20102004-11-05 11:50:11 +000019966 int mem_base;
19967 xmlNodePtr ret_val;
19968 xmlNodePtr parent; /* the parent node */
19969 int n_parent;
19970 xmlNsPtr ns; /* a namespace if any */
19971 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019972 xmlChar * name; /* the name of the child */
Daniel Veillard27f20102004-11-05 11:50:11 +000019973 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019974 xmlChar * content; /* the XML content of the child if any. */
Daniel Veillard27f20102004-11-05 11:50:11 +000019975 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019976
Daniel Veillard27f20102004-11-05 11:50:11 +000019977 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
19978 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
19979 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19980 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
19981 mem_base = xmlMemBlocks();
19982 parent = gen_xmlNodePtr(n_parent, 0);
19983 ns = gen_xmlNsPtr(n_ns, 1);
19984 name = gen_const_xmlChar_ptr(n_name, 2);
19985 content = gen_const_xmlChar_ptr(n_content, 3);
19986
William M. Brackf13f77f2004-11-12 16:03:48 +000019987 ret_val = xmlNewChild(parent, ns, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillard27f20102004-11-05 11:50:11 +000019988 desret_xmlNodePtr(ret_val);
19989 call_tests++;
19990 des_xmlNodePtr(n_parent, parent, 0);
19991 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000019992 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
19993 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000019994 xmlResetLastError();
19995 if (mem_base != xmlMemBlocks()) {
19996 printf("Leak of %d blocks found in xmlNewChild",
19997 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019998 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000019999 printf(" %d", n_parent);
20000 printf(" %d", n_ns);
20001 printf(" %d", n_name);
20002 printf(" %d", n_content);
20003 printf("\n");
20004 }
20005 }
20006 }
20007 }
20008 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020009 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000020010#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000020011#endif
Daniel Veillard27f20102004-11-05 11:50:11 +000020012
Daniel Veillard42595322004-11-08 10:52:06 +000020013 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020014}
20015
20016
20017static int
20018test_xmlNewComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020019 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020020
20021 int mem_base;
20022 xmlNodePtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020023 xmlChar * content; /* the comment content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020024 int n_content;
20025
20026 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20027 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020028 content = gen_const_xmlChar_ptr(n_content, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020029
William M. Brackf13f77f2004-11-12 16:03:48 +000020030 ret_val = xmlNewComment((const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020031 desret_xmlNodePtr(ret_val);
20032 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000020033 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020034 xmlResetLastError();
20035 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020036 printf("Leak of %d blocks found in xmlNewComment",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020037 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020038 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020039 printf(" %d", n_content);
20040 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020041 }
20042 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020043 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020044
Daniel Veillard42595322004-11-08 10:52:06 +000020045 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020046}
20047
20048
20049static int
20050test_xmlNewDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020051 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020052
20053 int mem_base;
20054 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020055 xmlChar * version; /* xmlChar string giving the version of XML "1.0" */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020056 int n_version;
20057
20058 for (n_version = 0;n_version < gen_nb_const_xmlChar_ptr;n_version++) {
20059 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020060 version = gen_const_xmlChar_ptr(n_version, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020061
William M. Brackf13f77f2004-11-12 16:03:48 +000020062 ret_val = xmlNewDoc((const xmlChar *)version);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020063 desret_xmlDocPtr(ret_val);
20064 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000020065 des_const_xmlChar_ptr(n_version, (const xmlChar *)version, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020066 xmlResetLastError();
20067 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020068 printf("Leak of %d blocks found in xmlNewDoc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020069 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020070 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020071 printf(" %d", n_version);
20072 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020073 }
20074 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020075 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020076
Daniel Veillard42595322004-11-08 10:52:06 +000020077 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020078}
20079
20080
20081static int
20082test_xmlNewDocComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020083 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020084
20085 int mem_base;
20086 xmlNodePtr ret_val;
20087 xmlDocPtr doc; /* the document */
20088 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020089 xmlChar * content; /* the comment content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020090 int n_content;
20091
20092 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20093 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20094 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020095 doc = gen_xmlDocPtr(n_doc, 0);
20096 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020097
William M. Brackf13f77f2004-11-12 16:03:48 +000020098 ret_val = xmlNewDocComment(doc, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020099 desret_xmlNodePtr(ret_val);
20100 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020101 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020102 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020103 xmlResetLastError();
20104 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020105 printf("Leak of %d blocks found in xmlNewDocComment",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020106 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020107 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020108 printf(" %d", n_doc);
20109 printf(" %d", n_content);
20110 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020111 }
20112 }
20113 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020114 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020115
Daniel Veillard42595322004-11-08 10:52:06 +000020116 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020117}
20118
20119
20120static int
20121test_xmlNewDocFragment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020122 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020123
William M. Brack21e4ef22005-01-02 09:53:13 +000020124#if defined(LIBXML_TREE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000020125 int mem_base;
20126 xmlNodePtr ret_val;
20127 xmlDocPtr doc; /* the document owning the fragment */
20128 int n_doc;
20129
20130 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20131 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020132 doc = gen_xmlDocPtr(n_doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020133
20134 ret_val = xmlNewDocFragment(doc);
20135 desret_xmlNodePtr(ret_val);
20136 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020137 des_xmlDocPtr(n_doc, doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020138 xmlResetLastError();
20139 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020140 printf("Leak of %d blocks found in xmlNewDocFragment",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020141 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020142 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020143 printf(" %d", n_doc);
20144 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020145 }
20146 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020147 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020148#endif
20149
Daniel Veillard42595322004-11-08 10:52:06 +000020150 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020151}
20152
20153
20154static int
20155test_xmlNewDocNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020156 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020157
Daniel Veillard27f20102004-11-05 11:50:11 +000020158 int mem_base;
20159 xmlNodePtr ret_val;
20160 xmlDocPtr doc; /* the document */
20161 int n_doc;
20162 xmlNsPtr ns; /* namespace if any */
20163 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020164 xmlChar * name; /* the node name */
Daniel Veillard27f20102004-11-05 11:50:11 +000020165 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020166 xmlChar * content; /* the XML text content if any */
Daniel Veillard27f20102004-11-05 11:50:11 +000020167 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020168
Daniel Veillard27f20102004-11-05 11:50:11 +000020169 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20170 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20171 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20172 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20173 mem_base = xmlMemBlocks();
20174 doc = gen_xmlDocPtr(n_doc, 0);
20175 ns = gen_xmlNsPtr(n_ns, 1);
20176 name = gen_const_xmlChar_ptr(n_name, 2);
20177 content = gen_const_xmlChar_ptr(n_content, 3);
20178
William M. Brackf13f77f2004-11-12 16:03:48 +000020179 ret_val = xmlNewDocNode(doc, ns, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillard27f20102004-11-05 11:50:11 +000020180 desret_xmlNodePtr(ret_val);
20181 call_tests++;
20182 des_xmlDocPtr(n_doc, doc, 0);
20183 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000020184 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
20185 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000020186 xmlResetLastError();
20187 if (mem_base != xmlMemBlocks()) {
20188 printf("Leak of %d blocks found in xmlNewDocNode",
20189 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020190 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020191 printf(" %d", n_doc);
20192 printf(" %d", n_ns);
20193 printf(" %d", n_name);
20194 printf(" %d", n_content);
20195 printf("\n");
20196 }
20197 }
20198 }
20199 }
20200 }
Daniel Veillard27f20102004-11-05 11:50:11 +000020201 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020202
Daniel Veillard42595322004-11-08 10:52:06 +000020203 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020204}
20205
20206
20207static int
20208test_xmlNewDocNodeEatName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020209 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020210
Daniel Veillard27f20102004-11-05 11:50:11 +000020211 int mem_base;
20212 xmlNodePtr ret_val;
20213 xmlDocPtr doc; /* the document */
20214 int n_doc;
20215 xmlNsPtr ns; /* namespace if any */
20216 int n_ns;
20217 xmlChar * name; /* the node name */
20218 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020219 xmlChar * content; /* the XML text content if any */
Daniel Veillard27f20102004-11-05 11:50:11 +000020220 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020221
Daniel Veillard27f20102004-11-05 11:50:11 +000020222 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20223 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20224 for (n_name = 0;n_name < gen_nb_eaten_name;n_name++) {
20225 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20226 mem_base = xmlMemBlocks();
20227 doc = gen_xmlDocPtr(n_doc, 0);
20228 ns = gen_xmlNsPtr(n_ns, 1);
20229 name = gen_eaten_name(n_name, 2);
20230 content = gen_const_xmlChar_ptr(n_content, 3);
20231
William M. Brackf13f77f2004-11-12 16:03:48 +000020232 ret_val = xmlNewDocNodeEatName(doc, ns, name, (const xmlChar *)content);
Daniel Veillard27f20102004-11-05 11:50:11 +000020233 desret_xmlNodePtr(ret_val);
20234 call_tests++;
20235 des_xmlDocPtr(n_doc, doc, 0);
20236 des_xmlNsPtr(n_ns, ns, 1);
20237 des_eaten_name(n_name, name, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000020238 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000020239 xmlResetLastError();
20240 if (mem_base != xmlMemBlocks()) {
20241 printf("Leak of %d blocks found in xmlNewDocNodeEatName",
20242 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020243 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020244 printf(" %d", n_doc);
20245 printf(" %d", n_ns);
20246 printf(" %d", n_name);
20247 printf(" %d", n_content);
20248 printf("\n");
20249 }
20250 }
20251 }
20252 }
20253 }
Daniel Veillard27f20102004-11-05 11:50:11 +000020254 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020255
Daniel Veillard42595322004-11-08 10:52:06 +000020256 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020257}
20258
20259
20260static int
20261test_xmlNewDocPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020262 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020263
20264 int mem_base;
20265 xmlNodePtr ret_val;
20266 xmlDocPtr doc; /* the target document */
20267 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020268 xmlChar * name; /* the processing instruction name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020269 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020270 xmlChar * content; /* the PI content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020271 int n_content;
20272
20273 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20274 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20275 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20276 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020277 doc = gen_xmlDocPtr(n_doc, 0);
20278 name = gen_const_xmlChar_ptr(n_name, 1);
20279 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020280
William M. Brackf13f77f2004-11-12 16:03:48 +000020281 ret_val = xmlNewDocPI(doc, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020282 desret_xmlNodePtr(ret_val);
20283 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020284 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020285 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
20286 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020287 xmlResetLastError();
20288 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020289 printf("Leak of %d blocks found in xmlNewDocPI",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020290 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020291 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020292 printf(" %d", n_doc);
20293 printf(" %d", n_name);
20294 printf(" %d", n_content);
20295 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020296 }
20297 }
20298 }
20299 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020300 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020301
Daniel Veillard42595322004-11-08 10:52:06 +000020302 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020303}
20304
20305
20306static int
20307test_xmlNewDocProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020308 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020309
Daniel Veillard57b25162004-11-06 14:50:18 +000020310 int mem_base;
20311 xmlAttrPtr ret_val;
20312 xmlDocPtr doc; /* the document */
20313 int n_doc;
20314 xmlChar * name; /* the name of the attribute */
20315 int n_name;
20316 xmlChar * value; /* the value of the attribute */
20317 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020318
Daniel Veillard57b25162004-11-06 14:50:18 +000020319 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20320 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20321 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
20322 mem_base = xmlMemBlocks();
20323 doc = gen_xmlDocPtr(n_doc, 0);
20324 name = gen_const_xmlChar_ptr(n_name, 1);
20325 value = gen_const_xmlChar_ptr(n_value, 2);
20326
William M. Brackf13f77f2004-11-12 16:03:48 +000020327 ret_val = xmlNewDocProp(doc, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000020328 desret_xmlAttrPtr(ret_val);
20329 call_tests++;
20330 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020331 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
20332 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 2);
Daniel Veillard57b25162004-11-06 14:50:18 +000020333 xmlResetLastError();
20334 if (mem_base != xmlMemBlocks()) {
20335 printf("Leak of %d blocks found in xmlNewDocProp",
20336 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020337 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000020338 printf(" %d", n_doc);
20339 printf(" %d", n_name);
20340 printf(" %d", n_value);
20341 printf("\n");
20342 }
20343 }
20344 }
20345 }
Daniel Veillard57b25162004-11-06 14:50:18 +000020346 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020347
Daniel Veillard42595322004-11-08 10:52:06 +000020348 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020349}
20350
20351
20352static int
20353test_xmlNewDocRawNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020354 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020355
William M. Brack21e4ef22005-01-02 09:53:13 +000020356#if defined(LIBXML_TREE_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000020357#ifdef LIBXML_TREE_ENABLED
Daniel Veillard27f20102004-11-05 11:50:11 +000020358 int mem_base;
20359 xmlNodePtr ret_val;
20360 xmlDocPtr doc; /* the document */
20361 int n_doc;
20362 xmlNsPtr ns; /* namespace if any */
20363 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020364 xmlChar * name; /* the node name */
Daniel Veillard27f20102004-11-05 11:50:11 +000020365 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020366 xmlChar * content; /* the text content if any */
Daniel Veillard27f20102004-11-05 11:50:11 +000020367 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020368
Daniel Veillard27f20102004-11-05 11:50:11 +000020369 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20370 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20371 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20372 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20373 mem_base = xmlMemBlocks();
20374 doc = gen_xmlDocPtr(n_doc, 0);
20375 ns = gen_xmlNsPtr(n_ns, 1);
20376 name = gen_const_xmlChar_ptr(n_name, 2);
20377 content = gen_const_xmlChar_ptr(n_content, 3);
20378
William M. Brackf13f77f2004-11-12 16:03:48 +000020379 ret_val = xmlNewDocRawNode(doc, ns, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillard27f20102004-11-05 11:50:11 +000020380 desret_xmlNodePtr(ret_val);
20381 call_tests++;
20382 des_xmlDocPtr(n_doc, doc, 0);
20383 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000020384 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
20385 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000020386 xmlResetLastError();
20387 if (mem_base != xmlMemBlocks()) {
20388 printf("Leak of %d blocks found in xmlNewDocRawNode",
20389 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020390 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020391 printf(" %d", n_doc);
20392 printf(" %d", n_ns);
20393 printf(" %d", n_name);
20394 printf(" %d", n_content);
20395 printf("\n");
20396 }
20397 }
20398 }
20399 }
20400 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020401 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000020402#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000020403#endif
Daniel Veillard27f20102004-11-05 11:50:11 +000020404
Daniel Veillard42595322004-11-08 10:52:06 +000020405 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020406}
20407
20408
20409static int
20410test_xmlNewDocText(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020411 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020412
20413 int mem_base;
20414 xmlNodePtr ret_val;
20415 xmlDocPtr doc; /* the document */
20416 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020417 xmlChar * content; /* the text content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020418 int n_content;
20419
20420 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20421 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20422 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020423 doc = gen_xmlDocPtr(n_doc, 0);
20424 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020425
William M. Brackf13f77f2004-11-12 16:03:48 +000020426 ret_val = xmlNewDocText(doc, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020427 desret_xmlNodePtr(ret_val);
20428 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020429 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020430 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020431 xmlResetLastError();
20432 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020433 printf("Leak of %d blocks found in xmlNewDocText",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020434 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020435 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020436 printf(" %d", n_doc);
20437 printf(" %d", n_content);
20438 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020439 }
20440 }
20441 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020442 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020443
Daniel Veillard42595322004-11-08 10:52:06 +000020444 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020445}
20446
20447
20448static int
20449test_xmlNewDocTextLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020450 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020451
20452 int mem_base;
20453 xmlNodePtr ret_val;
20454 xmlDocPtr doc; /* the document */
20455 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020456 xmlChar * content; /* the text content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020457 int n_content;
20458 int len; /* the text len. */
20459 int n_len;
20460
20461 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20462 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20463 for (n_len = 0;n_len < gen_nb_int;n_len++) {
20464 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020465 doc = gen_xmlDocPtr(n_doc, 0);
20466 content = gen_const_xmlChar_ptr(n_content, 1);
20467 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020468
William M. Brackf13f77f2004-11-12 16:03:48 +000020469 ret_val = xmlNewDocTextLen(doc, (const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020470 desret_xmlNodePtr(ret_val);
20471 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020472 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020473 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000020474 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020475 xmlResetLastError();
20476 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020477 printf("Leak of %d blocks found in xmlNewDocTextLen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020478 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020479 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020480 printf(" %d", n_doc);
20481 printf(" %d", n_content);
20482 printf(" %d", n_len);
20483 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020484 }
20485 }
20486 }
20487 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020488 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020489
Daniel Veillard42595322004-11-08 10:52:06 +000020490 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020491}
20492
20493
20494static int
20495test_xmlNewDtd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020496 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020497
Daniel Veillard34099b42004-11-04 17:34:35 +000020498 int mem_base;
20499 xmlDtdPtr ret_val;
20500 xmlDocPtr doc; /* the document pointer */
20501 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020502 xmlChar * name; /* the DTD name */
Daniel Veillard34099b42004-11-04 17:34:35 +000020503 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020504 xmlChar * ExternalID; /* the external ID */
Daniel Veillard34099b42004-11-04 17:34:35 +000020505 int n_ExternalID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020506 xmlChar * SystemID; /* the system ID */
Daniel Veillard34099b42004-11-04 17:34:35 +000020507 int n_SystemID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020508
Daniel Veillard34099b42004-11-04 17:34:35 +000020509 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20510 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20511 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
20512 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
20513 mem_base = xmlMemBlocks();
20514 doc = gen_xmlDocPtr(n_doc, 0);
20515 name = gen_const_xmlChar_ptr(n_name, 1);
20516 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2);
20517 SystemID = gen_const_xmlChar_ptr(n_SystemID, 3);
20518
William M. Brackf13f77f2004-11-12 16:03:48 +000020519 ret_val = xmlNewDtd(doc, (const xmlChar *)name, (const xmlChar *)ExternalID, (const xmlChar *)SystemID);
Daniel Veillard34099b42004-11-04 17:34:35 +000020520 desret_xmlDtdPtr(ret_val);
20521 call_tests++;
20522 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020523 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
20524 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 2);
20525 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 3);
Daniel Veillard34099b42004-11-04 17:34:35 +000020526 xmlResetLastError();
20527 if (mem_base != xmlMemBlocks()) {
20528 printf("Leak of %d blocks found in xmlNewDtd",
20529 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020530 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000020531 printf(" %d", n_doc);
20532 printf(" %d", n_name);
20533 printf(" %d", n_ExternalID);
20534 printf(" %d", n_SystemID);
20535 printf("\n");
20536 }
20537 }
20538 }
20539 }
20540 }
Daniel Veillard34099b42004-11-04 17:34:35 +000020541 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020542
Daniel Veillard42595322004-11-08 10:52:06 +000020543 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020544}
20545
20546
20547static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000020548test_xmlNewNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020549 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020550
Daniel Veillard27f20102004-11-05 11:50:11 +000020551 int mem_base;
20552 xmlNodePtr ret_val;
20553 xmlNsPtr ns; /* namespace if any */
20554 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020555 xmlChar * name; /* the node name */
Daniel Veillard27f20102004-11-05 11:50:11 +000020556 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020557
Daniel Veillard27f20102004-11-05 11:50:11 +000020558 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20559 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20560 mem_base = xmlMemBlocks();
20561 ns = gen_xmlNsPtr(n_ns, 0);
20562 name = gen_const_xmlChar_ptr(n_name, 1);
20563
William M. Brackf13f77f2004-11-12 16:03:48 +000020564 ret_val = xmlNewNode(ns, (const xmlChar *)name);
Daniel Veillard27f20102004-11-05 11:50:11 +000020565 desret_xmlNodePtr(ret_val);
20566 call_tests++;
20567 des_xmlNsPtr(n_ns, ns, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020568 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard27f20102004-11-05 11:50:11 +000020569 xmlResetLastError();
20570 if (mem_base != xmlMemBlocks()) {
20571 printf("Leak of %d blocks found in xmlNewNode",
20572 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020573 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020574 printf(" %d", n_ns);
20575 printf(" %d", n_name);
20576 printf("\n");
20577 }
20578 }
20579 }
Daniel Veillard27f20102004-11-05 11:50:11 +000020580 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020581
Daniel Veillard42595322004-11-08 10:52:06 +000020582 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020583}
20584
20585
20586static int
20587test_xmlNewNodeEatName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020588 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020589
Daniel Veillard27f20102004-11-05 11:50:11 +000020590 int mem_base;
20591 xmlNodePtr ret_val;
20592 xmlNsPtr ns; /* namespace if any */
20593 int n_ns;
20594 xmlChar * name; /* the node name */
20595 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020596
Daniel Veillard27f20102004-11-05 11:50:11 +000020597 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20598 for (n_name = 0;n_name < gen_nb_eaten_name;n_name++) {
20599 mem_base = xmlMemBlocks();
20600 ns = gen_xmlNsPtr(n_ns, 0);
20601 name = gen_eaten_name(n_name, 1);
20602
20603 ret_val = xmlNewNodeEatName(ns, name);
20604 desret_xmlNodePtr(ret_val);
20605 call_tests++;
20606 des_xmlNsPtr(n_ns, ns, 0);
20607 des_eaten_name(n_name, name, 1);
20608 xmlResetLastError();
20609 if (mem_base != xmlMemBlocks()) {
20610 printf("Leak of %d blocks found in xmlNewNodeEatName",
20611 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020612 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020613 printf(" %d", n_ns);
20614 printf(" %d", n_name);
20615 printf("\n");
20616 }
20617 }
20618 }
Daniel Veillard27f20102004-11-05 11:50:11 +000020619 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020620
Daniel Veillard42595322004-11-08 10:52:06 +000020621 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020622}
20623
20624
20625static int
20626test_xmlNewNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020627 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020628
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020629 int mem_base;
20630 xmlNsPtr ret_val;
20631 xmlNodePtr node; /* the element carrying the namespace */
20632 int n_node;
20633 xmlChar * href; /* the URI associated */
20634 int n_href;
20635 xmlChar * prefix; /* the prefix for the namespace */
20636 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020637
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020638 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
20639 for (n_href = 0;n_href < gen_nb_const_xmlChar_ptr;n_href++) {
20640 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
20641 mem_base = xmlMemBlocks();
20642 node = gen_xmlNodePtr(n_node, 0);
20643 href = gen_const_xmlChar_ptr(n_href, 1);
20644 prefix = gen_const_xmlChar_ptr(n_prefix, 2);
20645
William M. Brackf13f77f2004-11-12 16:03:48 +000020646 ret_val = xmlNewNs(node, (const xmlChar *)href, (const xmlChar *)prefix);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020647 if ((node == NULL) && (ret_val != NULL)) xmlFreeNs(ret_val);
20648 desret_xmlNsPtr(ret_val);
20649 call_tests++;
20650 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020651 des_const_xmlChar_ptr(n_href, (const xmlChar *)href, 1);
20652 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020653 xmlResetLastError();
20654 if (mem_base != xmlMemBlocks()) {
20655 printf("Leak of %d blocks found in xmlNewNs",
20656 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020657 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020658 printf(" %d", n_node);
20659 printf(" %d", n_href);
20660 printf(" %d", n_prefix);
20661 printf("\n");
20662 }
20663 }
20664 }
20665 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020666 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020667
Daniel Veillard42595322004-11-08 10:52:06 +000020668 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020669}
20670
20671
20672static int
20673test_xmlNewNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020674 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020675
Daniel Veillard57b25162004-11-06 14:50:18 +000020676 int mem_base;
20677 xmlAttrPtr ret_val;
20678 xmlNodePtr node; /* the holding node */
20679 int n_node;
20680 xmlNsPtr ns; /* the namespace */
20681 int n_ns;
20682 xmlChar * name; /* the name of the attribute */
20683 int n_name;
20684 xmlChar * value; /* the value of the attribute */
20685 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020686
Daniel Veillard57b25162004-11-06 14:50:18 +000020687 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
20688 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20689 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20690 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
20691 mem_base = xmlMemBlocks();
20692 node = gen_xmlNodePtr(n_node, 0);
20693 ns = gen_xmlNsPtr(n_ns, 1);
20694 name = gen_const_xmlChar_ptr(n_name, 2);
20695 value = gen_const_xmlChar_ptr(n_value, 3);
20696
William M. Brackf13f77f2004-11-12 16:03:48 +000020697 ret_val = xmlNewNsProp(node, ns, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000020698 desret_xmlAttrPtr(ret_val);
20699 call_tests++;
20700 des_xmlNodePtr(n_node, node, 0);
20701 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000020702 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
20703 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 3);
Daniel Veillard57b25162004-11-06 14:50:18 +000020704 xmlResetLastError();
20705 if (mem_base != xmlMemBlocks()) {
20706 printf("Leak of %d blocks found in xmlNewNsProp",
20707 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020708 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000020709 printf(" %d", n_node);
20710 printf(" %d", n_ns);
20711 printf(" %d", n_name);
20712 printf(" %d", n_value);
20713 printf("\n");
20714 }
20715 }
20716 }
20717 }
20718 }
Daniel Veillard57b25162004-11-06 14:50:18 +000020719 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020720
Daniel Veillard42595322004-11-08 10:52:06 +000020721 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020722}
20723
20724
20725static int
20726test_xmlNewNsPropEatName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020727 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020728
Daniel Veillard57b25162004-11-06 14:50:18 +000020729 int mem_base;
20730 xmlAttrPtr ret_val;
20731 xmlNodePtr node; /* the holding node */
20732 int n_node;
20733 xmlNsPtr ns; /* the namespace */
20734 int n_ns;
20735 xmlChar * name; /* the name of the attribute */
20736 int n_name;
20737 xmlChar * value; /* the value of the attribute */
20738 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020739
Daniel Veillard57b25162004-11-06 14:50:18 +000020740 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
20741 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20742 for (n_name = 0;n_name < gen_nb_eaten_name;n_name++) {
20743 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
20744 mem_base = xmlMemBlocks();
20745 node = gen_xmlNodePtr(n_node, 0);
20746 ns = gen_xmlNsPtr(n_ns, 1);
20747 name = gen_eaten_name(n_name, 2);
20748 value = gen_const_xmlChar_ptr(n_value, 3);
20749
William M. Brackf13f77f2004-11-12 16:03:48 +000020750 ret_val = xmlNewNsPropEatName(node, ns, name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000020751 desret_xmlAttrPtr(ret_val);
20752 call_tests++;
20753 des_xmlNodePtr(n_node, node, 0);
20754 des_xmlNsPtr(n_ns, ns, 1);
20755 des_eaten_name(n_name, name, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000020756 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 3);
Daniel Veillard57b25162004-11-06 14:50:18 +000020757 xmlResetLastError();
20758 if (mem_base != xmlMemBlocks()) {
20759 printf("Leak of %d blocks found in xmlNewNsPropEatName",
20760 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020761 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000020762 printf(" %d", n_node);
20763 printf(" %d", n_ns);
20764 printf(" %d", n_name);
20765 printf(" %d", n_value);
20766 printf("\n");
20767 }
20768 }
20769 }
20770 }
20771 }
Daniel Veillard57b25162004-11-06 14:50:18 +000020772 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020773
Daniel Veillard42595322004-11-08 10:52:06 +000020774 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020775}
20776
20777
20778static int
20779test_xmlNewPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020780 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020781
20782 int mem_base;
20783 xmlNodePtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020784 xmlChar * name; /* the processing instruction name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020785 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020786 xmlChar * content; /* the PI content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020787 int n_content;
20788
20789 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20790 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20791 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020792 name = gen_const_xmlChar_ptr(n_name, 0);
20793 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020794
William M. Brackf13f77f2004-11-12 16:03:48 +000020795 ret_val = xmlNewPI((const xmlChar *)name, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020796 desret_xmlNodePtr(ret_val);
20797 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000020798 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
20799 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020800 xmlResetLastError();
20801 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020802 printf("Leak of %d blocks found in xmlNewPI",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020803 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020804 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020805 printf(" %d", n_name);
20806 printf(" %d", n_content);
20807 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020808 }
20809 }
20810 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020811 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020812
Daniel Veillard42595322004-11-08 10:52:06 +000020813 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020814}
20815
20816
20817static int
20818test_xmlNewProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020819 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020820
William M. Brack21e4ef22005-01-02 09:53:13 +000020821#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000020822#ifdef LIBXML_TREE_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +000020823 int mem_base;
20824 xmlAttrPtr ret_val;
20825 xmlNodePtr node; /* the holding node */
20826 int n_node;
20827 xmlChar * name; /* the name of the attribute */
20828 int n_name;
20829 xmlChar * value; /* the value of the attribute */
20830 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020831
Daniel Veillard57b25162004-11-06 14:50:18 +000020832 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
20833 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20834 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
20835 mem_base = xmlMemBlocks();
20836 node = gen_xmlNodePtr(n_node, 0);
20837 name = gen_const_xmlChar_ptr(n_name, 1);
20838 value = gen_const_xmlChar_ptr(n_value, 2);
20839
William M. Brackf13f77f2004-11-12 16:03:48 +000020840 ret_val = xmlNewProp(node, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000020841 desret_xmlAttrPtr(ret_val);
20842 call_tests++;
20843 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020844 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
20845 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 2);
Daniel Veillard57b25162004-11-06 14:50:18 +000020846 xmlResetLastError();
20847 if (mem_base != xmlMemBlocks()) {
20848 printf("Leak of %d blocks found in xmlNewProp",
20849 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020850 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000020851 printf(" %d", n_node);
20852 printf(" %d", n_name);
20853 printf(" %d", n_value);
20854 printf("\n");
20855 }
20856 }
20857 }
20858 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020859 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000020860#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000020861#endif
Daniel Veillard57b25162004-11-06 14:50:18 +000020862
Daniel Veillard42595322004-11-08 10:52:06 +000020863 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020864}
20865
20866
20867static int
20868test_xmlNewReference(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020869 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020870
20871 int mem_base;
20872 xmlNodePtr ret_val;
20873 xmlDocPtr doc; /* the document */
20874 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020875 xmlChar * name; /* the reference name, or the reference string with & and ; */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020876 int n_name;
20877
20878 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20879 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20880 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020881 doc = gen_xmlDocPtr(n_doc, 0);
20882 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020883
William M. Brackf13f77f2004-11-12 16:03:48 +000020884 ret_val = xmlNewReference(doc, (const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020885 desret_xmlNodePtr(ret_val);
20886 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020887 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020888 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020889 xmlResetLastError();
20890 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020891 printf("Leak of %d blocks found in xmlNewReference",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020892 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020893 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020894 printf(" %d", n_doc);
20895 printf(" %d", n_name);
20896 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020897 }
20898 }
20899 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020900 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020901
Daniel Veillard42595322004-11-08 10:52:06 +000020902 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020903}
20904
20905
20906static int
20907test_xmlNewText(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020908 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020909
20910 int mem_base;
20911 xmlNodePtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020912 xmlChar * content; /* the text content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020913 int n_content;
20914
20915 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20916 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020917 content = gen_const_xmlChar_ptr(n_content, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020918
William M. Brackf13f77f2004-11-12 16:03:48 +000020919 ret_val = xmlNewText((const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020920 desret_xmlNodePtr(ret_val);
20921 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000020922 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020923 xmlResetLastError();
20924 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020925 printf("Leak of %d blocks found in xmlNewText",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020926 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020927 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020928 printf(" %d", n_content);
20929 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020930 }
20931 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020932 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020933
Daniel Veillard42595322004-11-08 10:52:06 +000020934 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020935}
20936
20937
20938static int
20939test_xmlNewTextChild(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020940 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020941
William M. Brack21e4ef22005-01-02 09:53:13 +000020942#if defined(LIBXML_TREE_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000020943#ifdef LIBXML_TREE_ENABLED
Daniel Veillard27f20102004-11-05 11:50:11 +000020944 int mem_base;
20945 xmlNodePtr ret_val;
20946 xmlNodePtr parent; /* the parent node */
20947 int n_parent;
20948 xmlNsPtr ns; /* a namespace if any */
20949 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020950 xmlChar * name; /* the name of the child */
Daniel Veillard27f20102004-11-05 11:50:11 +000020951 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020952 xmlChar * content; /* the text content of the child if any. */
Daniel Veillard27f20102004-11-05 11:50:11 +000020953 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020954
Daniel Veillard27f20102004-11-05 11:50:11 +000020955 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
20956 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20957 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20958 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20959 mem_base = xmlMemBlocks();
20960 parent = gen_xmlNodePtr(n_parent, 0);
20961 ns = gen_xmlNsPtr(n_ns, 1);
20962 name = gen_const_xmlChar_ptr(n_name, 2);
20963 content = gen_const_xmlChar_ptr(n_content, 3);
20964
William M. Brackf13f77f2004-11-12 16:03:48 +000020965 ret_val = xmlNewTextChild(parent, ns, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillard27f20102004-11-05 11:50:11 +000020966 desret_xmlNodePtr(ret_val);
20967 call_tests++;
20968 des_xmlNodePtr(n_parent, parent, 0);
20969 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000020970 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
20971 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000020972 xmlResetLastError();
20973 if (mem_base != xmlMemBlocks()) {
20974 printf("Leak of %d blocks found in xmlNewTextChild",
20975 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020976 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020977 printf(" %d", n_parent);
20978 printf(" %d", n_ns);
20979 printf(" %d", n_name);
20980 printf(" %d", n_content);
20981 printf("\n");
20982 }
20983 }
20984 }
20985 }
20986 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020987 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000020988#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000020989#endif
Daniel Veillard27f20102004-11-05 11:50:11 +000020990
Daniel Veillard42595322004-11-08 10:52:06 +000020991 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020992}
20993
20994
20995static int
20996test_xmlNewTextLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020997 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020998
20999 int mem_base;
21000 xmlNodePtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021001 xmlChar * content; /* the text content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021002 int n_content;
21003 int len; /* the text len. */
21004 int n_len;
21005
21006 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
21007 for (n_len = 0;n_len < gen_nb_int;n_len++) {
21008 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021009 content = gen_const_xmlChar_ptr(n_content, 0);
21010 len = gen_int(n_len, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021011
William M. Brackf13f77f2004-11-12 16:03:48 +000021012 ret_val = xmlNewTextLen((const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021013 desret_xmlNodePtr(ret_val);
21014 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000021015 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000021016 des_int(n_len, len, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021017 xmlResetLastError();
21018 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021019 printf("Leak of %d blocks found in xmlNewTextLen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021020 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021021 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021022 printf(" %d", n_content);
21023 printf(" %d", n_len);
21024 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021025 }
21026 }
21027 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021028 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021029
Daniel Veillard42595322004-11-08 10:52:06 +000021030 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021031}
21032
21033
21034static int
21035test_xmlNodeAddContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021036 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021037
21038 int mem_base;
21039 xmlNodePtr cur; /* the node being modified */
21040 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021041 xmlChar * content; /* extra content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021042 int n_content;
21043
21044 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21045 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
21046 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021047 cur = gen_xmlNodePtr(n_cur, 0);
21048 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021049
William M. Brackf13f77f2004-11-12 16:03:48 +000021050 xmlNodeAddContent(cur, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021051 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021052 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021053 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021054 xmlResetLastError();
21055 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021056 printf("Leak of %d blocks found in xmlNodeAddContent",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021057 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021058 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021059 printf(" %d", n_cur);
21060 printf(" %d", n_content);
21061 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021062 }
21063 }
21064 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021065 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021066
Daniel Veillard42595322004-11-08 10:52:06 +000021067 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021068}
21069
21070
21071static int
21072test_xmlNodeAddContentLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021073 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021074
21075 int mem_base;
21076 xmlNodePtr cur; /* the node being modified */
21077 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021078 xmlChar * content; /* extra content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021079 int n_content;
21080 int len; /* the size of @content */
21081 int n_len;
21082
21083 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21084 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
21085 for (n_len = 0;n_len < gen_nb_int;n_len++) {
21086 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021087 cur = gen_xmlNodePtr(n_cur, 0);
21088 content = gen_const_xmlChar_ptr(n_content, 1);
21089 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021090
William M. Brackf13f77f2004-11-12 16:03:48 +000021091 xmlNodeAddContentLen(cur, (const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021092 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021093 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021094 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000021095 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021096 xmlResetLastError();
21097 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021098 printf("Leak of %d blocks found in xmlNodeAddContentLen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021099 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021100 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021101 printf(" %d", n_cur);
21102 printf(" %d", n_content);
21103 printf(" %d", n_len);
21104 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021105 }
21106 }
21107 }
21108 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021109 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021110
Daniel Veillard42595322004-11-08 10:52:06 +000021111 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021112}
21113
21114
21115static int
21116test_xmlNodeBufGetContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021117 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021118
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021119 int mem_base;
21120 int ret_val;
21121 xmlBufferPtr buffer; /* a buffer */
21122 int n_buffer;
21123 xmlNodePtr cur; /* the node being read */
21124 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021125
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021126 for (n_buffer = 0;n_buffer < gen_nb_xmlBufferPtr;n_buffer++) {
21127 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21128 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021129 buffer = gen_xmlBufferPtr(n_buffer, 0);
21130 cur = gen_xmlNodePtr(n_cur, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021131
21132 ret_val = xmlNodeBufGetContent(buffer, cur);
21133 desret_int(ret_val);
21134 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021135 des_xmlBufferPtr(n_buffer, buffer, 0);
21136 des_xmlNodePtr(n_cur, cur, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021137 xmlResetLastError();
21138 if (mem_base != xmlMemBlocks()) {
21139 printf("Leak of %d blocks found in xmlNodeBufGetContent",
21140 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021141 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021142 printf(" %d", n_buffer);
21143 printf(" %d", n_cur);
21144 printf("\n");
21145 }
21146 }
21147 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021148 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021149
Daniel Veillard42595322004-11-08 10:52:06 +000021150 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021151}
21152
21153
21154static int
21155test_xmlNodeDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021156 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021157
William M. Brack21e4ef22005-01-02 09:53:13 +000021158#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021159 int mem_base;
21160 int ret_val;
21161 xmlBufferPtr buf; /* the XML buffer output */
21162 int n_buf;
21163 xmlDocPtr doc; /* the document */
21164 int n_doc;
21165 xmlNodePtr cur; /* the current node */
21166 int n_cur;
21167 int level; /* the imbrication level for indenting */
21168 int n_level;
21169 int format; /* is formatting allowed */
21170 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021171
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021172 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
21173 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21174 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21175 for (n_level = 0;n_level < gen_nb_int;n_level++) {
21176 for (n_format = 0;n_format < gen_nb_int;n_format++) {
21177 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021178 buf = gen_xmlBufferPtr(n_buf, 0);
21179 doc = gen_xmlDocPtr(n_doc, 1);
21180 cur = gen_xmlNodePtr(n_cur, 2);
21181 level = gen_int(n_level, 3);
21182 format = gen_int(n_format, 4);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021183
21184 ret_val = xmlNodeDump(buf, doc, cur, level, format);
21185 desret_int(ret_val);
21186 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021187 des_xmlBufferPtr(n_buf, buf, 0);
21188 des_xmlDocPtr(n_doc, doc, 1);
21189 des_xmlNodePtr(n_cur, cur, 2);
21190 des_int(n_level, level, 3);
21191 des_int(n_format, format, 4);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021192 xmlResetLastError();
21193 if (mem_base != xmlMemBlocks()) {
21194 printf("Leak of %d blocks found in xmlNodeDump",
21195 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021196 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021197 printf(" %d", n_buf);
21198 printf(" %d", n_doc);
21199 printf(" %d", n_cur);
21200 printf(" %d", n_level);
21201 printf(" %d", n_format);
21202 printf("\n");
21203 }
21204 }
21205 }
21206 }
21207 }
21208 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021209 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021210#endif
21211
Daniel Veillard42595322004-11-08 10:52:06 +000021212 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021213}
21214
21215
21216static int
21217test_xmlNodeDumpOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021218 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021219
William M. Brack21e4ef22005-01-02 09:53:13 +000021220#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000021221 int mem_base;
21222 xmlOutputBufferPtr buf; /* the XML buffer output */
21223 int n_buf;
21224 xmlDocPtr doc; /* the document */
21225 int n_doc;
21226 xmlNodePtr cur; /* the current node */
21227 int n_cur;
21228 int level; /* the imbrication level for indenting */
21229 int n_level;
21230 int format; /* is formatting allowed */
21231 int n_format;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021232 char * encoding; /* an optional encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +000021233 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021234
Daniel Veillard3d97e662004-11-04 10:49:00 +000021235 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
21236 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21237 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21238 for (n_level = 0;n_level < gen_nb_int;n_level++) {
21239 for (n_format = 0;n_format < gen_nb_int;n_format++) {
21240 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
21241 mem_base = xmlMemBlocks();
21242 buf = gen_xmlOutputBufferPtr(n_buf, 0);
21243 doc = gen_xmlDocPtr(n_doc, 1);
21244 cur = gen_xmlNodePtr(n_cur, 2);
21245 level = gen_int(n_level, 3);
21246 format = gen_int(n_format, 4);
21247 encoding = gen_const_char_ptr(n_encoding, 5);
21248
William M. Brackf13f77f2004-11-12 16:03:48 +000021249 xmlNodeDumpOutput(buf, doc, cur, level, format, (const char *)encoding);
Daniel Veillard3d97e662004-11-04 10:49:00 +000021250 call_tests++;
21251 des_xmlOutputBufferPtr(n_buf, buf, 0);
21252 des_xmlDocPtr(n_doc, doc, 1);
21253 des_xmlNodePtr(n_cur, cur, 2);
21254 des_int(n_level, level, 3);
21255 des_int(n_format, format, 4);
William M. Brackf13f77f2004-11-12 16:03:48 +000021256 des_const_char_ptr(n_encoding, (const char *)encoding, 5);
Daniel Veillard3d97e662004-11-04 10:49:00 +000021257 xmlResetLastError();
21258 if (mem_base != xmlMemBlocks()) {
21259 printf("Leak of %d blocks found in xmlNodeDumpOutput",
21260 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021261 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021262 printf(" %d", n_buf);
21263 printf(" %d", n_doc);
21264 printf(" %d", n_cur);
21265 printf(" %d", n_level);
21266 printf(" %d", n_format);
21267 printf(" %d", n_encoding);
21268 printf("\n");
21269 }
21270 }
21271 }
21272 }
21273 }
21274 }
21275 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021276 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021277#endif
21278
Daniel Veillard42595322004-11-08 10:52:06 +000021279 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021280}
21281
21282
21283static int
21284test_xmlNodeGetBase(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021285 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021286
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021287 int mem_base;
21288 xmlChar * ret_val;
21289 xmlDocPtr doc; /* the document the node pertains to */
21290 int n_doc;
21291 xmlNodePtr cur; /* the node being checked */
21292 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021293
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021294 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21295 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21296 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021297 doc = gen_xmlDocPtr(n_doc, 0);
21298 cur = gen_xmlNodePtr(n_cur, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021299
21300 ret_val = xmlNodeGetBase(doc, cur);
21301 desret_xmlChar_ptr(ret_val);
21302 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021303 des_xmlDocPtr(n_doc, doc, 0);
21304 des_xmlNodePtr(n_cur, cur, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021305 xmlResetLastError();
21306 if (mem_base != xmlMemBlocks()) {
21307 printf("Leak of %d blocks found in xmlNodeGetBase",
21308 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021309 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021310 printf(" %d", n_doc);
21311 printf(" %d", n_cur);
21312 printf("\n");
21313 }
21314 }
21315 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021316 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021317
Daniel Veillard42595322004-11-08 10:52:06 +000021318 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021319}
21320
21321
21322static int
21323test_xmlNodeGetContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021324 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021325
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021326 int mem_base;
21327 xmlChar * ret_val;
21328 xmlNodePtr cur; /* the node being read */
21329 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021330
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021331 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21332 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021333 cur = gen_xmlNodePtr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021334
21335 ret_val = xmlNodeGetContent(cur);
21336 desret_xmlChar_ptr(ret_val);
21337 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021338 des_xmlNodePtr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021339 xmlResetLastError();
21340 if (mem_base != xmlMemBlocks()) {
21341 printf("Leak of %d blocks found in xmlNodeGetContent",
21342 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021343 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021344 printf(" %d", n_cur);
21345 printf("\n");
21346 }
21347 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021348 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021349
Daniel Veillard42595322004-11-08 10:52:06 +000021350 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021351}
21352
21353
21354static int
21355test_xmlNodeGetLang(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021356 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021357
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021358 int mem_base;
21359 xmlChar * ret_val;
21360 xmlNodePtr cur; /* the node being checked */
21361 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021362
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021363 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21364 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021365 cur = gen_xmlNodePtr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021366
21367 ret_val = xmlNodeGetLang(cur);
21368 desret_xmlChar_ptr(ret_val);
21369 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021370 des_xmlNodePtr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021371 xmlResetLastError();
21372 if (mem_base != xmlMemBlocks()) {
21373 printf("Leak of %d blocks found in xmlNodeGetLang",
21374 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021375 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021376 printf(" %d", n_cur);
21377 printf("\n");
21378 }
21379 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021380 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021381
Daniel Veillard42595322004-11-08 10:52:06 +000021382 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021383}
21384
21385
21386static int
21387test_xmlNodeGetSpacePreserve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021388 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021389
21390 int mem_base;
21391 int ret_val;
21392 xmlNodePtr cur; /* the node being checked */
21393 int n_cur;
21394
21395 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21396 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021397 cur = gen_xmlNodePtr(n_cur, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021398
21399 ret_val = xmlNodeGetSpacePreserve(cur);
21400 desret_int(ret_val);
21401 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021402 des_xmlNodePtr(n_cur, cur, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021403 xmlResetLastError();
21404 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021405 printf("Leak of %d blocks found in xmlNodeGetSpacePreserve",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021406 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021407 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021408 printf(" %d", n_cur);
21409 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021410 }
21411 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021412 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021413
Daniel Veillard42595322004-11-08 10:52:06 +000021414 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021415}
21416
21417
21418static int
21419test_xmlNodeIsText(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021420 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021421
21422 int mem_base;
21423 int ret_val;
21424 xmlNodePtr node; /* the node */
21425 int n_node;
21426
21427 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
21428 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021429 node = gen_xmlNodePtr(n_node, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021430
21431 ret_val = xmlNodeIsText(node);
21432 desret_int(ret_val);
21433 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021434 des_xmlNodePtr(n_node, node, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021435 xmlResetLastError();
21436 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021437 printf("Leak of %d blocks found in xmlNodeIsText",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021438 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021439 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021440 printf(" %d", n_node);
21441 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021442 }
21443 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021444 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021445
Daniel Veillard42595322004-11-08 10:52:06 +000021446 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021447}
21448
21449
21450static int
21451test_xmlNodeListGetRawString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021452 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021453
William M. Brack21e4ef22005-01-02 09:53:13 +000021454#if defined(LIBXML_TREE_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021455 int mem_base;
21456 xmlChar * ret_val;
21457 xmlDocPtr doc; /* the document */
21458 int n_doc;
21459 xmlNodePtr list; /* a Node list */
21460 int n_list;
21461 int inLine; /* should we replace entity contents or show their external form */
21462 int n_inLine;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021463
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021464 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21465 for (n_list = 0;n_list < gen_nb_xmlNodePtr;n_list++) {
21466 for (n_inLine = 0;n_inLine < gen_nb_int;n_inLine++) {
21467 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021468 doc = gen_xmlDocPtr(n_doc, 0);
21469 list = gen_xmlNodePtr(n_list, 1);
21470 inLine = gen_int(n_inLine, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021471
21472 ret_val = xmlNodeListGetRawString(doc, list, inLine);
21473 desret_xmlChar_ptr(ret_val);
21474 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021475 des_xmlDocPtr(n_doc, doc, 0);
21476 des_xmlNodePtr(n_list, list, 1);
21477 des_int(n_inLine, inLine, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021478 xmlResetLastError();
21479 if (mem_base != xmlMemBlocks()) {
21480 printf("Leak of %d blocks found in xmlNodeListGetRawString",
21481 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021482 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021483 printf(" %d", n_doc);
21484 printf(" %d", n_list);
21485 printf(" %d", n_inLine);
21486 printf("\n");
21487 }
21488 }
21489 }
21490 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021491 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021492#endif
21493
Daniel Veillard42595322004-11-08 10:52:06 +000021494 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021495}
21496
21497
21498static int
21499test_xmlNodeListGetString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021500 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021501
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021502 int mem_base;
21503 xmlChar * ret_val;
21504 xmlDocPtr doc; /* the document */
21505 int n_doc;
21506 xmlNodePtr list; /* a Node list */
21507 int n_list;
21508 int inLine; /* should we replace entity contents or show their external form */
21509 int n_inLine;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021510
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021511 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21512 for (n_list = 0;n_list < gen_nb_xmlNodePtr;n_list++) {
21513 for (n_inLine = 0;n_inLine < gen_nb_int;n_inLine++) {
21514 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021515 doc = gen_xmlDocPtr(n_doc, 0);
21516 list = gen_xmlNodePtr(n_list, 1);
21517 inLine = gen_int(n_inLine, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021518
21519 ret_val = xmlNodeListGetString(doc, list, inLine);
21520 desret_xmlChar_ptr(ret_val);
21521 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021522 des_xmlDocPtr(n_doc, doc, 0);
21523 des_xmlNodePtr(n_list, list, 1);
21524 des_int(n_inLine, inLine, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021525 xmlResetLastError();
21526 if (mem_base != xmlMemBlocks()) {
21527 printf("Leak of %d blocks found in xmlNodeListGetString",
21528 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021529 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021530 printf(" %d", n_doc);
21531 printf(" %d", n_list);
21532 printf(" %d", n_inLine);
21533 printf("\n");
21534 }
21535 }
21536 }
21537 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021538 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021539
Daniel Veillard42595322004-11-08 10:52:06 +000021540 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021541}
21542
21543
21544static int
21545test_xmlNodeSetBase(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021546 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021547
William M. Brack21e4ef22005-01-02 09:53:13 +000021548#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021549 int mem_base;
21550 xmlNodePtr cur; /* the node being changed */
21551 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021552 xmlChar * uri; /* the new base URI */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021553 int n_uri;
21554
21555 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21556 for (n_uri = 0;n_uri < gen_nb_const_xmlChar_ptr;n_uri++) {
21557 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021558 cur = gen_xmlNodePtr(n_cur, 0);
21559 uri = gen_const_xmlChar_ptr(n_uri, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021560
William M. Brackf13f77f2004-11-12 16:03:48 +000021561 xmlNodeSetBase(cur, (const xmlChar *)uri);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021562 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021563 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021564 des_const_xmlChar_ptr(n_uri, (const xmlChar *)uri, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021565 xmlResetLastError();
21566 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021567 printf("Leak of %d blocks found in xmlNodeSetBase",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021568 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021569 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021570 printf(" %d", n_cur);
21571 printf(" %d", n_uri);
21572 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021573 }
21574 }
21575 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021576 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021577#endif
21578
Daniel Veillard42595322004-11-08 10:52:06 +000021579 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021580}
21581
21582
21583static int
21584test_xmlNodeSetContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021585 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021586
21587 int mem_base;
21588 xmlNodePtr cur; /* the node being modified */
21589 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021590 xmlChar * content; /* the new value of the content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021591 int n_content;
21592
21593 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21594 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
21595 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021596 cur = gen_xmlNodePtr(n_cur, 0);
21597 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021598
William M. Brackf13f77f2004-11-12 16:03:48 +000021599 xmlNodeSetContent(cur, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021600 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021601 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021602 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021603 xmlResetLastError();
21604 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021605 printf("Leak of %d blocks found in xmlNodeSetContent",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021606 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021607 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021608 printf(" %d", n_cur);
21609 printf(" %d", n_content);
21610 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021611 }
21612 }
21613 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021614 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021615
Daniel Veillard42595322004-11-08 10:52:06 +000021616 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021617}
21618
21619
21620static int
21621test_xmlNodeSetContentLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021622 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021623
William M. Brack21e4ef22005-01-02 09:53:13 +000021624#if defined(LIBXML_TREE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021625 int mem_base;
21626 xmlNodePtr cur; /* the node being modified */
21627 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021628 xmlChar * content; /* the new value of the content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021629 int n_content;
21630 int len; /* the size of @content */
21631 int n_len;
21632
21633 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21634 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
21635 for (n_len = 0;n_len < gen_nb_int;n_len++) {
21636 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021637 cur = gen_xmlNodePtr(n_cur, 0);
21638 content = gen_const_xmlChar_ptr(n_content, 1);
21639 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021640
William M. Brackf13f77f2004-11-12 16:03:48 +000021641 xmlNodeSetContentLen(cur, (const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021642 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021643 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021644 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000021645 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021646 xmlResetLastError();
21647 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021648 printf("Leak of %d blocks found in xmlNodeSetContentLen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021649 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021650 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021651 printf(" %d", n_cur);
21652 printf(" %d", n_content);
21653 printf(" %d", n_len);
21654 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021655 }
21656 }
21657 }
21658 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021659 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021660#endif
21661
Daniel Veillard42595322004-11-08 10:52:06 +000021662 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021663}
21664
21665
21666static int
21667test_xmlNodeSetLang(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021668 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021669
William M. Brack21e4ef22005-01-02 09:53:13 +000021670#if defined(LIBXML_TREE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021671 int mem_base;
21672 xmlNodePtr cur; /* the node being changed */
21673 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021674 xmlChar * lang; /* the language description */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021675 int n_lang;
21676
21677 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21678 for (n_lang = 0;n_lang < gen_nb_const_xmlChar_ptr;n_lang++) {
21679 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021680 cur = gen_xmlNodePtr(n_cur, 0);
21681 lang = gen_const_xmlChar_ptr(n_lang, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021682
William M. Brackf13f77f2004-11-12 16:03:48 +000021683 xmlNodeSetLang(cur, (const xmlChar *)lang);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021684 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021685 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021686 des_const_xmlChar_ptr(n_lang, (const xmlChar *)lang, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021687 xmlResetLastError();
21688 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021689 printf("Leak of %d blocks found in xmlNodeSetLang",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021690 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021691 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021692 printf(" %d", n_cur);
21693 printf(" %d", n_lang);
21694 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021695 }
21696 }
21697 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021698 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021699#endif
21700
Daniel Veillard42595322004-11-08 10:52:06 +000021701 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021702}
21703
21704
21705static int
21706test_xmlNodeSetName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021707 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021708
William M. Brack21e4ef22005-01-02 09:53:13 +000021709#if defined(LIBXML_TREE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021710 int mem_base;
21711 xmlNodePtr cur; /* the node being changed */
21712 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021713 xmlChar * name; /* the new tag name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021714 int n_name;
21715
21716 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21717 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
21718 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021719 cur = gen_xmlNodePtr(n_cur, 0);
21720 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021721
William M. Brackf13f77f2004-11-12 16:03:48 +000021722 xmlNodeSetName(cur, (const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021723 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021724 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021725 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021726 xmlResetLastError();
21727 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021728 printf("Leak of %d blocks found in xmlNodeSetName",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021729 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021730 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021731 printf(" %d", n_cur);
21732 printf(" %d", n_name);
21733 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021734 }
21735 }
21736 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021737 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021738#endif
21739
Daniel Veillard42595322004-11-08 10:52:06 +000021740 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021741}
21742
21743
21744static int
21745test_xmlNodeSetSpacePreserve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021746 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021747
William M. Brack21e4ef22005-01-02 09:53:13 +000021748#if defined(LIBXML_TREE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021749 int mem_base;
21750 xmlNodePtr cur; /* the node being changed */
21751 int n_cur;
21752 int val; /* the xml:space value ("0": default, 1: "preserve") */
21753 int n_val;
21754
21755 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21756 for (n_val = 0;n_val < gen_nb_int;n_val++) {
21757 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021758 cur = gen_xmlNodePtr(n_cur, 0);
21759 val = gen_int(n_val, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021760
21761 xmlNodeSetSpacePreserve(cur, val);
21762 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021763 des_xmlNodePtr(n_cur, cur, 0);
21764 des_int(n_val, val, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021765 xmlResetLastError();
21766 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021767 printf("Leak of %d blocks found in xmlNodeSetSpacePreserve",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021768 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021769 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021770 printf(" %d", n_cur);
21771 printf(" %d", n_val);
21772 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021773 }
21774 }
21775 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021776 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021777#endif
21778
Daniel Veillard42595322004-11-08 10:52:06 +000021779 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021780}
21781
21782
21783static int
21784test_xmlReconciliateNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021785 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021786
William M. Brack21e4ef22005-01-02 09:53:13 +000021787#if defined(LIBXML_TREE_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000021788#ifdef LIBXML_TREE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000021789 int mem_base;
21790 int ret_val;
21791 xmlDocPtr doc; /* the document */
21792 int n_doc;
21793 xmlNodePtr tree; /* a node defining the subtree to reconciliate */
21794 int n_tree;
21795
21796 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21797 for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) {
21798 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021799 doc = gen_xmlDocPtr(n_doc, 0);
21800 tree = gen_xmlNodePtr(n_tree, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021801
21802 ret_val = xmlReconciliateNs(doc, tree);
21803 desret_int(ret_val);
21804 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021805 des_xmlDocPtr(n_doc, doc, 0);
21806 des_xmlNodePtr(n_tree, tree, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021807 xmlResetLastError();
21808 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021809 printf("Leak of %d blocks found in xmlReconciliateNs",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021810 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021811 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021812 printf(" %d", n_doc);
21813 printf(" %d", n_tree);
21814 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021815 }
21816 }
21817 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021818 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000021819#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000021820#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000021821
Daniel Veillard42595322004-11-08 10:52:06 +000021822 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021823}
21824
21825
21826static int
21827test_xmlRemoveProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021828 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021829
William M. Brack21e4ef22005-01-02 09:53:13 +000021830#if defined(LIBXML_TREE_ENABLED)
Daniel Veillardce244ad2004-11-05 10:03:46 +000021831 int mem_base;
21832 int ret_val;
21833 xmlAttrPtr cur; /* an attribute */
21834 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021835
Daniel Veillardce244ad2004-11-05 10:03:46 +000021836 for (n_cur = 0;n_cur < gen_nb_xmlAttrPtr;n_cur++) {
21837 mem_base = xmlMemBlocks();
21838 cur = gen_xmlAttrPtr(n_cur, 0);
21839
21840 ret_val = xmlRemoveProp(cur);
21841 cur = NULL;
21842 desret_int(ret_val);
21843 call_tests++;
21844 des_xmlAttrPtr(n_cur, cur, 0);
21845 xmlResetLastError();
21846 if (mem_base != xmlMemBlocks()) {
21847 printf("Leak of %d blocks found in xmlRemoveProp",
21848 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021849 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000021850 printf(" %d", n_cur);
21851 printf("\n");
21852 }
21853 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021854 function_tests++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000021855#endif
21856
Daniel Veillard42595322004-11-08 10:52:06 +000021857 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021858}
21859
21860
21861static int
21862test_xmlReplaceNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021863 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021864
William M. Brack21e4ef22005-01-02 09:53:13 +000021865#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021866 int mem_base;
21867 xmlNodePtr ret_val;
21868 xmlNodePtr old; /* the old node */
21869 int n_old;
21870 xmlNodePtr cur; /* the node */
21871 int n_cur;
21872
21873 for (n_old = 0;n_old < gen_nb_xmlNodePtr;n_old++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021874 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr_in;n_cur++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000021875 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021876 old = gen_xmlNodePtr(n_old, 0);
21877 cur = gen_xmlNodePtr_in(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021878
21879 ret_val = xmlReplaceNode(old, cur);
Daniel Veillardce244ad2004-11-05 10:03:46 +000021880 if (cur != NULL) {
21881 xmlUnlinkNode(cur);
Daniel Veillarda03e3652004-11-02 18:45:30 +000021882 xmlFreeNode(cur) ; cur = NULL ; }
Daniel Veillardce244ad2004-11-05 10:03:46 +000021883 if (old != NULL) {
21884 xmlUnlinkNode(old);
21885 xmlFreeNode(old) ; old = NULL ; }
21886 ret_val = NULL;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021887 desret_xmlNodePtr(ret_val);
21888 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021889 des_xmlNodePtr(n_old, old, 0);
21890 des_xmlNodePtr_in(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021891 xmlResetLastError();
21892 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021893 printf("Leak of %d blocks found in xmlReplaceNode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021894 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021895 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021896 printf(" %d", n_old);
21897 printf(" %d", n_cur);
21898 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021899 }
21900 }
21901 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021902 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021903#endif
21904
Daniel Veillard42595322004-11-08 10:52:06 +000021905 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021906}
21907
21908
21909static int
21910test_xmlSaveFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021911 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021912
William M. Brack21e4ef22005-01-02 09:53:13 +000021913#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021914 int mem_base;
21915 int ret_val;
21916 const char * filename; /* the filename (or URL) */
21917 int n_filename;
21918 xmlDocPtr cur; /* the document */
21919 int n_cur;
21920
21921 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
21922 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
21923 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021924 filename = gen_fileoutput(n_filename, 0);
21925 cur = gen_xmlDocPtr(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021926
21927 ret_val = xmlSaveFile(filename, cur);
21928 desret_int(ret_val);
21929 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021930 des_fileoutput(n_filename, filename, 0);
21931 des_xmlDocPtr(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021932 xmlResetLastError();
21933 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021934 printf("Leak of %d blocks found in xmlSaveFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021935 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021936 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021937 printf(" %d", n_filename);
21938 printf(" %d", n_cur);
21939 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021940 }
21941 }
21942 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021943 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021944#endif
21945
Daniel Veillard42595322004-11-08 10:52:06 +000021946 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021947}
21948
21949
21950static int
21951test_xmlSaveFileEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021952 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021953
William M. Brack21e4ef22005-01-02 09:53:13 +000021954#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021955 int mem_base;
21956 int ret_val;
21957 const char * filename; /* the filename (or URL) */
21958 int n_filename;
21959 xmlDocPtr cur; /* the document */
21960 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021961 char * encoding; /* the name of an encoding (or NULL) */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021962 int n_encoding;
21963
21964 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
21965 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
21966 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
21967 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021968 filename = gen_fileoutput(n_filename, 0);
21969 cur = gen_xmlDocPtr(n_cur, 1);
21970 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021971
William M. Brackf13f77f2004-11-12 16:03:48 +000021972 ret_val = xmlSaveFileEnc(filename, cur, (const char *)encoding);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021973 desret_int(ret_val);
21974 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021975 des_fileoutput(n_filename, filename, 0);
21976 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000021977 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021978 xmlResetLastError();
21979 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021980 printf("Leak of %d blocks found in xmlSaveFileEnc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021981 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021982 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021983 printf(" %d", n_filename);
21984 printf(" %d", n_cur);
21985 printf(" %d", n_encoding);
21986 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021987 }
21988 }
21989 }
21990 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021991 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021992#endif
21993
Daniel Veillard42595322004-11-08 10:52:06 +000021994 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021995}
21996
21997
21998static int
21999test_xmlSaveFileTo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022000 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022001
William M. Brack21e4ef22005-01-02 09:53:13 +000022002#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000022003 int mem_base;
22004 int ret_val;
22005 xmlOutputBufferPtr buf; /* an output I/O buffer */
22006 int n_buf;
22007 xmlDocPtr cur; /* the document */
22008 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022009 char * encoding; /* the encoding if any assuming the I/O layer handles the trancoding */
Daniel Veillard3d97e662004-11-04 10:49:00 +000022010 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022011
Daniel Veillard3d97e662004-11-04 10:49:00 +000022012 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
22013 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
22014 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
22015 mem_base = xmlMemBlocks();
22016 buf = gen_xmlOutputBufferPtr(n_buf, 0);
22017 cur = gen_xmlDocPtr(n_cur, 1);
22018 encoding = gen_const_char_ptr(n_encoding, 2);
22019
William M. Brackf13f77f2004-11-12 16:03:48 +000022020 ret_val = xmlSaveFileTo(buf, cur, (const char *)encoding);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022021 buf = NULL;
22022 desret_int(ret_val);
22023 call_tests++;
22024 des_xmlOutputBufferPtr(n_buf, buf, 0);
22025 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022026 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022027 xmlResetLastError();
22028 if (mem_base != xmlMemBlocks()) {
22029 printf("Leak of %d blocks found in xmlSaveFileTo",
22030 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022031 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022032 printf(" %d", n_buf);
22033 printf(" %d", n_cur);
22034 printf(" %d", n_encoding);
22035 printf("\n");
22036 }
22037 }
22038 }
22039 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022040 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022041#endif
22042
Daniel Veillard42595322004-11-08 10:52:06 +000022043 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022044}
22045
22046
22047static int
22048test_xmlSaveFormatFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022049 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022050
William M. Brack21e4ef22005-01-02 09:53:13 +000022051#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000022052 int mem_base;
22053 int ret_val;
22054 const char * filename; /* the filename (or URL) */
22055 int n_filename;
22056 xmlDocPtr cur; /* the document */
22057 int n_cur;
22058 int format; /* should formatting spaces been added */
22059 int n_format;
22060
22061 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
22062 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
22063 for (n_format = 0;n_format < gen_nb_int;n_format++) {
22064 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022065 filename = gen_fileoutput(n_filename, 0);
22066 cur = gen_xmlDocPtr(n_cur, 1);
22067 format = gen_int(n_format, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022068
22069 ret_val = xmlSaveFormatFile(filename, cur, format);
22070 desret_int(ret_val);
22071 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022072 des_fileoutput(n_filename, filename, 0);
22073 des_xmlDocPtr(n_cur, cur, 1);
22074 des_int(n_format, format, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022075 xmlResetLastError();
22076 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022077 printf("Leak of %d blocks found in xmlSaveFormatFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022078 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022079 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022080 printf(" %d", n_filename);
22081 printf(" %d", n_cur);
22082 printf(" %d", n_format);
22083 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022084 }
22085 }
22086 }
22087 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022088 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022089#endif
22090
Daniel Veillard42595322004-11-08 10:52:06 +000022091 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022092}
22093
22094
22095static int
22096test_xmlSaveFormatFileEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022097 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022098
William M. Brack21e4ef22005-01-02 09:53:13 +000022099#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000022100 int mem_base;
22101 int ret_val;
22102 const char * filename; /* the filename or URL to output */
22103 int n_filename;
22104 xmlDocPtr cur; /* the document being saved */
22105 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022106 char * encoding; /* the name of the encoding to use or NULL. */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022107 int n_encoding;
22108 int format; /* should formatting spaces be added. */
22109 int n_format;
22110
22111 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
22112 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
22113 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
22114 for (n_format = 0;n_format < gen_nb_int;n_format++) {
22115 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022116 filename = gen_fileoutput(n_filename, 0);
22117 cur = gen_xmlDocPtr(n_cur, 1);
22118 encoding = gen_const_char_ptr(n_encoding, 2);
22119 format = gen_int(n_format, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022120
William M. Brackf13f77f2004-11-12 16:03:48 +000022121 ret_val = xmlSaveFormatFileEnc(filename, cur, (const char *)encoding, format);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022122 desret_int(ret_val);
22123 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022124 des_fileoutput(n_filename, filename, 0);
22125 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022126 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022127 des_int(n_format, format, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022128 xmlResetLastError();
22129 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022130 printf("Leak of %d blocks found in xmlSaveFormatFileEnc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022131 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022132 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022133 printf(" %d", n_filename);
22134 printf(" %d", n_cur);
22135 printf(" %d", n_encoding);
22136 printf(" %d", n_format);
22137 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022138 }
22139 }
22140 }
22141 }
22142 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022143 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022144#endif
22145
Daniel Veillard42595322004-11-08 10:52:06 +000022146 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022147}
22148
22149
22150static int
22151test_xmlSaveFormatFileTo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022152 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022153
William M. Brack21e4ef22005-01-02 09:53:13 +000022154#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000022155 int mem_base;
22156 int ret_val;
22157 xmlOutputBufferPtr buf; /* an output I/O buffer */
22158 int n_buf;
22159 xmlDocPtr cur; /* the document */
22160 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022161 char * encoding; /* the encoding if any assuming the I/O layer handles the trancoding */
Daniel Veillard3d97e662004-11-04 10:49:00 +000022162 int n_encoding;
22163 int format; /* should formatting spaces been added */
22164 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022165
Daniel Veillard3d97e662004-11-04 10:49:00 +000022166 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
22167 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
22168 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
22169 for (n_format = 0;n_format < gen_nb_int;n_format++) {
22170 mem_base = xmlMemBlocks();
22171 buf = gen_xmlOutputBufferPtr(n_buf, 0);
22172 cur = gen_xmlDocPtr(n_cur, 1);
22173 encoding = gen_const_char_ptr(n_encoding, 2);
22174 format = gen_int(n_format, 3);
22175
William M. Brackf13f77f2004-11-12 16:03:48 +000022176 ret_val = xmlSaveFormatFileTo(buf, cur, (const char *)encoding, format);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022177 buf = NULL;
22178 desret_int(ret_val);
22179 call_tests++;
22180 des_xmlOutputBufferPtr(n_buf, buf, 0);
22181 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022182 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022183 des_int(n_format, format, 3);
22184 xmlResetLastError();
22185 if (mem_base != xmlMemBlocks()) {
22186 printf("Leak of %d blocks found in xmlSaveFormatFileTo",
22187 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022188 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022189 printf(" %d", n_buf);
22190 printf(" %d", n_cur);
22191 printf(" %d", n_encoding);
22192 printf(" %d", n_format);
22193 printf("\n");
22194 }
22195 }
22196 }
22197 }
22198 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022199 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022200#endif
22201
Daniel Veillard42595322004-11-08 10:52:06 +000022202 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022203}
22204
22205
22206static int
22207test_xmlSearchNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022208 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022209
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022210 int mem_base;
22211 xmlNsPtr ret_val;
22212 xmlDocPtr doc; /* the document */
22213 int n_doc;
22214 xmlNodePtr node; /* the current node */
22215 int n_node;
22216 xmlChar * nameSpace; /* the namespace prefix */
22217 int n_nameSpace;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022218
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022219 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22220 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22221 for (n_nameSpace = 0;n_nameSpace < gen_nb_const_xmlChar_ptr;n_nameSpace++) {
22222 mem_base = xmlMemBlocks();
22223 doc = gen_xmlDocPtr(n_doc, 0);
22224 node = gen_xmlNodePtr(n_node, 1);
22225 nameSpace = gen_const_xmlChar_ptr(n_nameSpace, 2);
22226
William M. Brackf13f77f2004-11-12 16:03:48 +000022227 ret_val = xmlSearchNs(doc, node, (const xmlChar *)nameSpace);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022228 desret_xmlNsPtr(ret_val);
22229 call_tests++;
22230 des_xmlDocPtr(n_doc, doc, 0);
22231 des_xmlNodePtr(n_node, node, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022232 des_const_xmlChar_ptr(n_nameSpace, (const xmlChar *)nameSpace, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022233 xmlResetLastError();
22234 if (mem_base != xmlMemBlocks()) {
22235 printf("Leak of %d blocks found in xmlSearchNs",
22236 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022237 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022238 printf(" %d", n_doc);
22239 printf(" %d", n_node);
22240 printf(" %d", n_nameSpace);
22241 printf("\n");
22242 }
22243 }
22244 }
22245 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022246 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022247
Daniel Veillard42595322004-11-08 10:52:06 +000022248 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022249}
22250
22251
22252static int
22253test_xmlSearchNsByHref(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022254 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022255
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022256 int mem_base;
22257 xmlNsPtr ret_val;
22258 xmlDocPtr doc; /* the document */
22259 int n_doc;
22260 xmlNodePtr node; /* the current node */
22261 int n_node;
22262 xmlChar * href; /* the namespace value */
22263 int n_href;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022264
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022265 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22266 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22267 for (n_href = 0;n_href < gen_nb_const_xmlChar_ptr;n_href++) {
22268 mem_base = xmlMemBlocks();
22269 doc = gen_xmlDocPtr(n_doc, 0);
22270 node = gen_xmlNodePtr(n_node, 1);
22271 href = gen_const_xmlChar_ptr(n_href, 2);
22272
William M. Brackf13f77f2004-11-12 16:03:48 +000022273 ret_val = xmlSearchNsByHref(doc, node, (const xmlChar *)href);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022274 desret_xmlNsPtr(ret_val);
22275 call_tests++;
22276 des_xmlDocPtr(n_doc, doc, 0);
22277 des_xmlNodePtr(n_node, node, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022278 des_const_xmlChar_ptr(n_href, (const xmlChar *)href, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022279 xmlResetLastError();
22280 if (mem_base != xmlMemBlocks()) {
22281 printf("Leak of %d blocks found in xmlSearchNsByHref",
22282 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022283 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022284 printf(" %d", n_doc);
22285 printf(" %d", n_node);
22286 printf(" %d", n_href);
22287 printf("\n");
22288 }
22289 }
22290 }
22291 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022292 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022293
Daniel Veillard42595322004-11-08 10:52:06 +000022294 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022295}
22296
22297
22298static int
22299test_xmlSetBufferAllocationScheme(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022300 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022301
Daniel Veillard57b25162004-11-06 14:50:18 +000022302 int mem_base;
22303 xmlBufferAllocationScheme scheme; /* allocation method to use */
22304 int n_scheme;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022305
Daniel Veillard57b25162004-11-06 14:50:18 +000022306 for (n_scheme = 0;n_scheme < gen_nb_xmlBufferAllocationScheme;n_scheme++) {
22307 mem_base = xmlMemBlocks();
22308 scheme = gen_xmlBufferAllocationScheme(n_scheme, 0);
22309
22310 xmlSetBufferAllocationScheme(scheme);
22311 call_tests++;
22312 des_xmlBufferAllocationScheme(n_scheme, scheme, 0);
22313 xmlResetLastError();
22314 if (mem_base != xmlMemBlocks()) {
22315 printf("Leak of %d blocks found in xmlSetBufferAllocationScheme",
22316 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022317 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000022318 printf(" %d", n_scheme);
22319 printf("\n");
22320 }
22321 }
Daniel Veillard57b25162004-11-06 14:50:18 +000022322 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022323
Daniel Veillard42595322004-11-08 10:52:06 +000022324 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022325}
22326
22327
22328static int
22329test_xmlSetCompressMode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022330 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022331
22332 int mem_base;
22333 int mode; /* the compression ratio */
22334 int n_mode;
22335
22336 for (n_mode = 0;n_mode < gen_nb_int;n_mode++) {
22337 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022338 mode = gen_int(n_mode, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022339
22340 xmlSetCompressMode(mode);
22341 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022342 des_int(n_mode, mode, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022343 xmlResetLastError();
22344 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022345 printf("Leak of %d blocks found in xmlSetCompressMode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022346 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022347 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022348 printf(" %d", n_mode);
22349 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022350 }
22351 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022352 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022353
Daniel Veillard42595322004-11-08 10:52:06 +000022354 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022355}
22356
22357
22358static int
22359test_xmlSetDocCompressMode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022360 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022361
22362 int mem_base;
22363 xmlDocPtr doc; /* the document */
22364 int n_doc;
22365 int mode; /* the compression ratio */
22366 int n_mode;
22367
22368 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22369 for (n_mode = 0;n_mode < gen_nb_int;n_mode++) {
22370 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022371 doc = gen_xmlDocPtr(n_doc, 0);
22372 mode = gen_int(n_mode, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022373
22374 xmlSetDocCompressMode(doc, mode);
22375 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022376 des_xmlDocPtr(n_doc, doc, 0);
22377 des_int(n_mode, mode, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022378 xmlResetLastError();
22379 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022380 printf("Leak of %d blocks found in xmlSetDocCompressMode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022381 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022382 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022383 printf(" %d", n_doc);
22384 printf(" %d", n_mode);
22385 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022386 }
22387 }
22388 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022389 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022390
Daniel Veillard42595322004-11-08 10:52:06 +000022391 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022392}
22393
22394
22395static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000022396test_xmlSetNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022397 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022398
Daniel Veillard27f20102004-11-05 11:50:11 +000022399 int mem_base;
22400 xmlNodePtr node; /* a node in the document */
22401 int n_node;
22402 xmlNsPtr ns; /* a namespace pointer */
22403 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022404
Daniel Veillard27f20102004-11-05 11:50:11 +000022405 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22406 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
22407 mem_base = xmlMemBlocks();
22408 node = gen_xmlNodePtr(n_node, 0);
22409 ns = gen_xmlNsPtr(n_ns, 1);
22410
22411 xmlSetNs(node, ns);
22412 call_tests++;
22413 des_xmlNodePtr(n_node, node, 0);
22414 des_xmlNsPtr(n_ns, ns, 1);
22415 xmlResetLastError();
22416 if (mem_base != xmlMemBlocks()) {
22417 printf("Leak of %d blocks found in xmlSetNs",
22418 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022419 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000022420 printf(" %d", n_node);
22421 printf(" %d", n_ns);
22422 printf("\n");
22423 }
22424 }
22425 }
Daniel Veillard27f20102004-11-05 11:50:11 +000022426 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022427
Daniel Veillard42595322004-11-08 10:52:06 +000022428 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022429}
22430
22431
22432static int
22433test_xmlSetNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022434 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022435
William M. Brack21e4ef22005-01-02 09:53:13 +000022436#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +000022437 int mem_base;
22438 xmlAttrPtr ret_val;
22439 xmlNodePtr node; /* the node */
22440 int n_node;
22441 xmlNsPtr ns; /* the namespace definition */
22442 int n_ns;
22443 xmlChar * name; /* the attribute name */
22444 int n_name;
22445 xmlChar * value; /* the attribute value */
22446 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022447
Daniel Veillard57b25162004-11-06 14:50:18 +000022448 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22449 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
22450 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22451 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22452 mem_base = xmlMemBlocks();
22453 node = gen_xmlNodePtr(n_node, 0);
22454 ns = gen_xmlNsPtr(n_ns, 1);
22455 name = gen_const_xmlChar_ptr(n_name, 2);
22456 value = gen_const_xmlChar_ptr(n_value, 3);
22457
William M. Brackf13f77f2004-11-12 16:03:48 +000022458 ret_val = xmlSetNsProp(node, ns, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000022459 desret_xmlAttrPtr(ret_val);
22460 call_tests++;
22461 des_xmlNodePtr(n_node, node, 0);
22462 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022463 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
22464 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 3);
Daniel Veillard57b25162004-11-06 14:50:18 +000022465 xmlResetLastError();
22466 if (mem_base != xmlMemBlocks()) {
22467 printf("Leak of %d blocks found in xmlSetNsProp",
22468 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022469 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000022470 printf(" %d", n_node);
22471 printf(" %d", n_ns);
22472 printf(" %d", n_name);
22473 printf(" %d", n_value);
22474 printf("\n");
22475 }
22476 }
22477 }
22478 }
22479 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022480 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +000022481#endif
22482
Daniel Veillard42595322004-11-08 10:52:06 +000022483 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022484}
22485
22486
22487static int
22488test_xmlSetProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022489 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022490
William M. Brack21e4ef22005-01-02 09:53:13 +000022491#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +000022492 int mem_base;
22493 xmlAttrPtr ret_val;
22494 xmlNodePtr node; /* the node */
22495 int n_node;
22496 xmlChar * name; /* the attribute name */
22497 int n_name;
22498 xmlChar * value; /* the attribute value */
22499 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022500
Daniel Veillard57b25162004-11-06 14:50:18 +000022501 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22502 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22503 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22504 mem_base = xmlMemBlocks();
22505 node = gen_xmlNodePtr(n_node, 0);
22506 name = gen_const_xmlChar_ptr(n_name, 1);
22507 value = gen_const_xmlChar_ptr(n_value, 2);
22508
William M. Brackf13f77f2004-11-12 16:03:48 +000022509 ret_val = xmlSetProp(node, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000022510 desret_xmlAttrPtr(ret_val);
22511 call_tests++;
22512 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000022513 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
22514 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 2);
Daniel Veillard57b25162004-11-06 14:50:18 +000022515 xmlResetLastError();
22516 if (mem_base != xmlMemBlocks()) {
22517 printf("Leak of %d blocks found in xmlSetProp",
22518 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022519 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000022520 printf(" %d", n_node);
22521 printf(" %d", n_name);
22522 printf(" %d", n_value);
22523 printf("\n");
22524 }
22525 }
22526 }
22527 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022528 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +000022529#endif
22530
Daniel Veillard42595322004-11-08 10:52:06 +000022531 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022532}
22533
22534
22535static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000022536test_xmlSplitQName2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022537 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022538
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022539 int mem_base;
22540 xmlChar * ret_val;
22541 xmlChar * name; /* the full QName */
22542 int n_name;
22543 xmlChar ** prefix; /* a xmlChar ** */
22544 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022545
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022546 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22547 for (n_prefix = 0;n_prefix < gen_nb_xmlChar_ptr_ptr;n_prefix++) {
22548 mem_base = xmlMemBlocks();
22549 name = gen_const_xmlChar_ptr(n_name, 0);
22550 prefix = gen_xmlChar_ptr_ptr(n_prefix, 1);
22551
William M. Brackf13f77f2004-11-12 16:03:48 +000022552 ret_val = xmlSplitQName2((const xmlChar *)name, prefix);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022553 desret_xmlChar_ptr(ret_val);
22554 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000022555 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022556 des_xmlChar_ptr_ptr(n_prefix, prefix, 1);
22557 xmlResetLastError();
22558 if (mem_base != xmlMemBlocks()) {
22559 printf("Leak of %d blocks found in xmlSplitQName2",
22560 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022561 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022562 printf(" %d", n_name);
22563 printf(" %d", n_prefix);
22564 printf("\n");
22565 }
22566 }
22567 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022568 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022569
Daniel Veillard42595322004-11-08 10:52:06 +000022570 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022571}
22572
22573
22574static int
22575test_xmlSplitQName3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022576 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022577
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022578 int mem_base;
22579 const xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022580 xmlChar * name; /* the full QName */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022581 int n_name;
22582 int * len; /* an int * */
22583 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022584
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022585 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22586 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
22587 mem_base = xmlMemBlocks();
22588 name = gen_const_xmlChar_ptr(n_name, 0);
22589 len = gen_int_ptr(n_len, 1);
22590
William M. Brackf13f77f2004-11-12 16:03:48 +000022591 ret_val = xmlSplitQName3((const xmlChar *)name, len);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022592 desret_const_xmlChar_ptr(ret_val);
22593 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000022594 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022595 des_int_ptr(n_len, len, 1);
22596 xmlResetLastError();
22597 if (mem_base != xmlMemBlocks()) {
22598 printf("Leak of %d blocks found in xmlSplitQName3",
22599 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022600 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022601 printf(" %d", n_name);
22602 printf(" %d", n_len);
22603 printf("\n");
22604 }
22605 }
22606 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022607 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022608
Daniel Veillard42595322004-11-08 10:52:06 +000022609 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022610}
22611
22612
22613static int
22614test_xmlStringGetNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022615 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022616
22617 int mem_base;
22618 xmlNodePtr ret_val;
22619 xmlDocPtr doc; /* the document */
22620 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022621 xmlChar * value; /* the value of the attribute */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022622 int n_value;
22623
22624 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22625 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22626 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022627 doc = gen_xmlDocPtr(n_doc, 0);
22628 value = gen_const_xmlChar_ptr(n_value, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022629
William M. Brackf13f77f2004-11-12 16:03:48 +000022630 ret_val = xmlStringGetNodeList(doc, (const xmlChar *)value);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022631 desret_xmlNodePtr(ret_val);
22632 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022633 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000022634 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022635 xmlResetLastError();
22636 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022637 printf("Leak of %d blocks found in xmlStringGetNodeList",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022638 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022639 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022640 printf(" %d", n_doc);
22641 printf(" %d", n_value);
22642 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022643 }
22644 }
22645 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022646 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022647
Daniel Veillard42595322004-11-08 10:52:06 +000022648 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022649}
22650
22651
22652static int
22653test_xmlStringLenGetNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022654 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022655
22656 int mem_base;
22657 xmlNodePtr ret_val;
22658 xmlDocPtr doc; /* the document */
22659 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022660 xmlChar * value; /* the value of the text */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022661 int n_value;
22662 int len; /* the length of the string value */
22663 int n_len;
22664
22665 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22666 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22667 for (n_len = 0;n_len < gen_nb_int;n_len++) {
22668 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022669 doc = gen_xmlDocPtr(n_doc, 0);
22670 value = gen_const_xmlChar_ptr(n_value, 1);
22671 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022672
William M. Brackf13f77f2004-11-12 16:03:48 +000022673 ret_val = xmlStringLenGetNodeList(doc, (const xmlChar *)value, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022674 desret_xmlNodePtr(ret_val);
22675 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022676 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000022677 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022678 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022679 xmlResetLastError();
22680 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022681 printf("Leak of %d blocks found in xmlStringLenGetNodeList",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022682 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022683 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022684 printf(" %d", n_doc);
22685 printf(" %d", n_value);
22686 printf(" %d", n_len);
22687 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022688 }
22689 }
22690 }
22691 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022692 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022693
Daniel Veillard42595322004-11-08 10:52:06 +000022694 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022695}
22696
22697
22698static int
22699test_xmlTextConcat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022700 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022701
22702 int mem_base;
22703 int ret_val;
22704 xmlNodePtr node; /* the node */
22705 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022706 xmlChar * content; /* the content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022707 int n_content;
22708 int len; /* @content length */
22709 int n_len;
22710
22711 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22712 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
22713 for (n_len = 0;n_len < gen_nb_int;n_len++) {
22714 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022715 node = gen_xmlNodePtr(n_node, 0);
22716 content = gen_const_xmlChar_ptr(n_content, 1);
22717 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022718
William M. Brackf13f77f2004-11-12 16:03:48 +000022719 ret_val = xmlTextConcat(node, (const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022720 desret_int(ret_val);
22721 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022722 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000022723 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022724 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022725 xmlResetLastError();
22726 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022727 printf("Leak of %d blocks found in xmlTextConcat",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022728 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022729 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022730 printf(" %d", n_node);
22731 printf(" %d", n_content);
22732 printf(" %d", n_len);
22733 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022734 }
22735 }
22736 }
22737 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022738 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022739
Daniel Veillard42595322004-11-08 10:52:06 +000022740 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022741}
22742
22743
22744static int
22745test_xmlTextMerge(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022746 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022747
22748 int mem_base;
22749 xmlNodePtr ret_val;
22750 xmlNodePtr first; /* the first text node */
22751 int n_first;
22752 xmlNodePtr second; /* the second text node being merged */
22753 int n_second;
22754
Daniel Veillarda03e3652004-11-02 18:45:30 +000022755 for (n_first = 0;n_first < gen_nb_xmlNodePtr_in;n_first++) {
22756 for (n_second = 0;n_second < gen_nb_xmlNodePtr_in;n_second++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000022757 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022758 first = gen_xmlNodePtr_in(n_first, 0);
22759 second = gen_xmlNodePtr_in(n_second, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022760
22761 ret_val = xmlTextMerge(first, second);
Daniel Veillarda03e3652004-11-02 18:45:30 +000022762 if ((first != NULL) && (first->type != XML_TEXT_NODE)) {
Daniel Veillardce244ad2004-11-05 10:03:46 +000022763 xmlUnlinkNode(second);
Daniel Veillarda03e3652004-11-02 18:45:30 +000022764 xmlFreeNode(second) ; second = NULL ; }
Daniel Veillard8a32fe42004-11-02 22:10:16 +000022765 desret_xmlNodePtr(ret_val);
22766 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022767 des_xmlNodePtr_in(n_first, first, 0);
22768 des_xmlNodePtr_in(n_second, second, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022769 xmlResetLastError();
22770 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022771 printf("Leak of %d blocks found in xmlTextMerge",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022772 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022773 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022774 printf(" %d", n_first);
22775 printf(" %d", n_second);
22776 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022777 }
22778 }
22779 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022780 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022781
Daniel Veillard42595322004-11-08 10:52:06 +000022782 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022783}
22784
22785
22786static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000022787test_xmlUnsetNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022788 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022789
William M. Brack21e4ef22005-01-02 09:53:13 +000022790#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000022791 int mem_base;
22792 int ret_val;
22793 xmlNodePtr node; /* the node */
22794 int n_node;
22795 xmlNsPtr ns; /* the namespace definition */
22796 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022797 xmlChar * name; /* the attribute name */
Daniel Veillard27f20102004-11-05 11:50:11 +000022798 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022799
Daniel Veillard27f20102004-11-05 11:50:11 +000022800 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22801 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
22802 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22803 mem_base = xmlMemBlocks();
22804 node = gen_xmlNodePtr(n_node, 0);
22805 ns = gen_xmlNsPtr(n_ns, 1);
22806 name = gen_const_xmlChar_ptr(n_name, 2);
22807
William M. Brackf13f77f2004-11-12 16:03:48 +000022808 ret_val = xmlUnsetNsProp(node, ns, (const xmlChar *)name);
Daniel Veillard27f20102004-11-05 11:50:11 +000022809 desret_int(ret_val);
22810 call_tests++;
22811 des_xmlNodePtr(n_node, node, 0);
22812 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022813 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillard27f20102004-11-05 11:50:11 +000022814 xmlResetLastError();
22815 if (mem_base != xmlMemBlocks()) {
22816 printf("Leak of %d blocks found in xmlUnsetNsProp",
22817 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022818 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000022819 printf(" %d", n_node);
22820 printf(" %d", n_ns);
22821 printf(" %d", n_name);
22822 printf("\n");
22823 }
22824 }
22825 }
22826 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022827 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000022828#endif
22829
Daniel Veillard42595322004-11-08 10:52:06 +000022830 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022831}
22832
22833
22834static int
22835test_xmlUnsetProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022836 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022837
William M. Brack21e4ef22005-01-02 09:53:13 +000022838#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000022839 int mem_base;
22840 int ret_val;
22841 xmlNodePtr node; /* the node */
22842 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022843 xmlChar * name; /* the attribute name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022844 int n_name;
22845
22846 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22847 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22848 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022849 node = gen_xmlNodePtr(n_node, 0);
22850 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022851
William M. Brackf13f77f2004-11-12 16:03:48 +000022852 ret_val = xmlUnsetProp(node, (const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022853 desret_int(ret_val);
22854 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022855 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000022856 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022857 xmlResetLastError();
22858 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022859 printf("Leak of %d blocks found in xmlUnsetProp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022860 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022861 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022862 printf(" %d", n_node);
22863 printf(" %d", n_name);
22864 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022865 }
22866 }
22867 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022868 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022869#endif
22870
Daniel Veillard42595322004-11-08 10:52:06 +000022871 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022872}
22873
22874
22875static int
22876test_xmlValidateNCName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022877 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022878
William M. Brack21e4ef22005-01-02 09:53:13 +000022879#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000022880#ifdef LIBXML_TREE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000022881 int mem_base;
22882 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022883 xmlChar * value; /* the value to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022884 int n_value;
22885 int space; /* allow spaces in front and end of the string */
22886 int n_space;
22887
22888 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22889 for (n_space = 0;n_space < gen_nb_int;n_space++) {
22890 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022891 value = gen_const_xmlChar_ptr(n_value, 0);
22892 space = gen_int(n_space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022893
William M. Brackf13f77f2004-11-12 16:03:48 +000022894 ret_val = xmlValidateNCName((const xmlChar *)value, space);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022895 desret_int(ret_val);
22896 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000022897 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022898 des_int(n_space, space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022899 xmlResetLastError();
22900 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022901 printf("Leak of %d blocks found in xmlValidateNCName",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022902 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022903 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022904 printf(" %d", n_value);
22905 printf(" %d", n_space);
22906 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022907 }
22908 }
22909 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022910 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000022911#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000022912#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000022913
Daniel Veillard42595322004-11-08 10:52:06 +000022914 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022915}
22916
22917
22918static int
22919test_xmlValidateNMToken(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022920 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022921
William M. Brack21e4ef22005-01-02 09:53:13 +000022922#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000022923#ifdef LIBXML_TREE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000022924 int mem_base;
22925 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022926 xmlChar * value; /* the value to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022927 int n_value;
22928 int space; /* allow spaces in front and end of the string */
22929 int n_space;
22930
22931 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22932 for (n_space = 0;n_space < gen_nb_int;n_space++) {
22933 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022934 value = gen_const_xmlChar_ptr(n_value, 0);
22935 space = gen_int(n_space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022936
William M. Brackf13f77f2004-11-12 16:03:48 +000022937 ret_val = xmlValidateNMToken((const xmlChar *)value, space);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022938 desret_int(ret_val);
22939 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000022940 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022941 des_int(n_space, space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022942 xmlResetLastError();
22943 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022944 printf("Leak of %d blocks found in xmlValidateNMToken",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022945 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022946 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022947 printf(" %d", n_value);
22948 printf(" %d", n_space);
22949 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022950 }
22951 }
22952 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022953 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000022954#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000022955#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000022956
Daniel Veillard42595322004-11-08 10:52:06 +000022957 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022958}
22959
22960
22961static int
22962test_xmlValidateName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022963 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022964
William M. Brack21e4ef22005-01-02 09:53:13 +000022965#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000022966#ifdef LIBXML_TREE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000022967 int mem_base;
22968 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022969 xmlChar * value; /* the value to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022970 int n_value;
22971 int space; /* allow spaces in front and end of the string */
22972 int n_space;
22973
22974 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22975 for (n_space = 0;n_space < gen_nb_int;n_space++) {
22976 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022977 value = gen_const_xmlChar_ptr(n_value, 0);
22978 space = gen_int(n_space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022979
William M. Brackf13f77f2004-11-12 16:03:48 +000022980 ret_val = xmlValidateName((const xmlChar *)value, space);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022981 desret_int(ret_val);
22982 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000022983 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022984 des_int(n_space, space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022985 xmlResetLastError();
22986 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022987 printf("Leak of %d blocks found in xmlValidateName",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022988 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022989 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022990 printf(" %d", n_value);
22991 printf(" %d", n_space);
22992 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022993 }
22994 }
22995 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022996 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000022997#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000022998#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000022999
Daniel Veillard42595322004-11-08 10:52:06 +000023000 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023001}
23002
23003
23004static int
23005test_xmlValidateQName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023006 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023007
William M. Brack21e4ef22005-01-02 09:53:13 +000023008#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000023009#ifdef LIBXML_TREE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000023010 int mem_base;
23011 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023012 xmlChar * value; /* the value to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000023013 int n_value;
23014 int space; /* allow spaces in front and end of the string */
23015 int n_space;
23016
23017 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
23018 for (n_space = 0;n_space < gen_nb_int;n_space++) {
23019 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023020 value = gen_const_xmlChar_ptr(n_value, 0);
23021 space = gen_int(n_space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023022
William M. Brackf13f77f2004-11-12 16:03:48 +000023023 ret_val = xmlValidateQName((const xmlChar *)value, space);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023024 desret_int(ret_val);
23025 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000023026 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000023027 des_int(n_space, space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023028 xmlResetLastError();
23029 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000023030 printf("Leak of %d blocks found in xmlValidateQName",
Daniel Veillardd93f6252004-11-02 15:53:51 +000023031 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023032 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000023033 printf(" %d", n_value);
23034 printf(" %d", n_space);
23035 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000023036 }
23037 }
23038 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023039 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000023040#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000023041#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000023042
Daniel Veillard42595322004-11-08 10:52:06 +000023043 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023044}
23045
23046static int
23047test_tree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023048 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023049
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023050 if (quiet == 0) printf("Testing tree : 129 of 146 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000023051 test_ret += test_xmlAddChild();
23052 test_ret += test_xmlAddChildList();
23053 test_ret += test_xmlAddNextSibling();
23054 test_ret += test_xmlAddPrevSibling();
23055 test_ret += test_xmlAddSibling();
23056 test_ret += test_xmlAttrSerializeTxtContent();
23057 test_ret += test_xmlBufferAdd();
23058 test_ret += test_xmlBufferAddHead();
23059 test_ret += test_xmlBufferCCat();
23060 test_ret += test_xmlBufferCat();
23061 test_ret += test_xmlBufferContent();
23062 test_ret += test_xmlBufferCreate();
23063 test_ret += test_xmlBufferCreateSize();
23064 test_ret += test_xmlBufferCreateStatic();
23065 test_ret += test_xmlBufferEmpty();
23066 test_ret += test_xmlBufferGrow();
23067 test_ret += test_xmlBufferLength();
23068 test_ret += test_xmlBufferResize();
23069 test_ret += test_xmlBufferSetAllocationScheme();
23070 test_ret += test_xmlBufferShrink();
23071 test_ret += test_xmlBufferWriteCHAR();
23072 test_ret += test_xmlBufferWriteChar();
23073 test_ret += test_xmlBufferWriteQuotedString();
23074 test_ret += test_xmlBuildQName();
23075 test_ret += test_xmlCopyDoc();
23076 test_ret += test_xmlCopyDtd();
23077 test_ret += test_xmlCopyNamespace();
23078 test_ret += test_xmlCopyNamespaceList();
23079 test_ret += test_xmlCopyNode();
23080 test_ret += test_xmlCopyNodeList();
23081 test_ret += test_xmlCopyProp();
23082 test_ret += test_xmlCopyPropList();
23083 test_ret += test_xmlCreateIntSubset();
23084 test_ret += test_xmlDocCopyNode();
23085 test_ret += test_xmlDocCopyNodeList();
23086 test_ret += test_xmlDocDump();
23087 test_ret += test_xmlDocDumpFormatMemory();
23088 test_ret += test_xmlDocDumpFormatMemoryEnc();
23089 test_ret += test_xmlDocDumpMemory();
23090 test_ret += test_xmlDocDumpMemoryEnc();
23091 test_ret += test_xmlDocFormatDump();
23092 test_ret += test_xmlDocGetRootElement();
23093 test_ret += test_xmlDocSetRootElement();
23094 test_ret += test_xmlElemDump();
23095 test_ret += test_xmlGetBufferAllocationScheme();
23096 test_ret += test_xmlGetCompressMode();
23097 test_ret += test_xmlGetDocCompressMode();
23098 test_ret += test_xmlGetIntSubset();
23099 test_ret += test_xmlGetLastChild();
23100 test_ret += test_xmlGetLineNo();
23101 test_ret += test_xmlGetNoNsProp();
23102 test_ret += test_xmlGetNodePath();
23103 test_ret += test_xmlGetNsList();
23104 test_ret += test_xmlGetNsProp();
23105 test_ret += test_xmlGetProp();
23106 test_ret += test_xmlHasNsProp();
23107 test_ret += test_xmlHasProp();
23108 test_ret += test_xmlIsBlankNode();
23109 test_ret += test_xmlIsXHTML();
23110 test_ret += test_xmlNewCDataBlock();
23111 test_ret += test_xmlNewCharRef();
23112 test_ret += test_xmlNewChild();
23113 test_ret += test_xmlNewComment();
23114 test_ret += test_xmlNewDoc();
23115 test_ret += test_xmlNewDocComment();
23116 test_ret += test_xmlNewDocFragment();
23117 test_ret += test_xmlNewDocNode();
23118 test_ret += test_xmlNewDocNodeEatName();
23119 test_ret += test_xmlNewDocPI();
23120 test_ret += test_xmlNewDocProp();
23121 test_ret += test_xmlNewDocRawNode();
23122 test_ret += test_xmlNewDocText();
23123 test_ret += test_xmlNewDocTextLen();
23124 test_ret += test_xmlNewDtd();
23125 test_ret += test_xmlNewNode();
23126 test_ret += test_xmlNewNodeEatName();
23127 test_ret += test_xmlNewNs();
23128 test_ret += test_xmlNewNsProp();
23129 test_ret += test_xmlNewNsPropEatName();
23130 test_ret += test_xmlNewPI();
23131 test_ret += test_xmlNewProp();
23132 test_ret += test_xmlNewReference();
23133 test_ret += test_xmlNewText();
23134 test_ret += test_xmlNewTextChild();
23135 test_ret += test_xmlNewTextLen();
23136 test_ret += test_xmlNodeAddContent();
23137 test_ret += test_xmlNodeAddContentLen();
23138 test_ret += test_xmlNodeBufGetContent();
23139 test_ret += test_xmlNodeDump();
23140 test_ret += test_xmlNodeDumpOutput();
23141 test_ret += test_xmlNodeGetBase();
23142 test_ret += test_xmlNodeGetContent();
23143 test_ret += test_xmlNodeGetLang();
23144 test_ret += test_xmlNodeGetSpacePreserve();
23145 test_ret += test_xmlNodeIsText();
23146 test_ret += test_xmlNodeListGetRawString();
23147 test_ret += test_xmlNodeListGetString();
23148 test_ret += test_xmlNodeSetBase();
23149 test_ret += test_xmlNodeSetContent();
23150 test_ret += test_xmlNodeSetContentLen();
23151 test_ret += test_xmlNodeSetLang();
23152 test_ret += test_xmlNodeSetName();
23153 test_ret += test_xmlNodeSetSpacePreserve();
23154 test_ret += test_xmlReconciliateNs();
23155 test_ret += test_xmlRemoveProp();
23156 test_ret += test_xmlReplaceNode();
23157 test_ret += test_xmlSaveFile();
23158 test_ret += test_xmlSaveFileEnc();
23159 test_ret += test_xmlSaveFileTo();
23160 test_ret += test_xmlSaveFormatFile();
23161 test_ret += test_xmlSaveFormatFileEnc();
23162 test_ret += test_xmlSaveFormatFileTo();
23163 test_ret += test_xmlSearchNs();
23164 test_ret += test_xmlSearchNsByHref();
23165 test_ret += test_xmlSetBufferAllocationScheme();
23166 test_ret += test_xmlSetCompressMode();
23167 test_ret += test_xmlSetDocCompressMode();
23168 test_ret += test_xmlSetNs();
23169 test_ret += test_xmlSetNsProp();
23170 test_ret += test_xmlSetProp();
23171 test_ret += test_xmlSplitQName2();
23172 test_ret += test_xmlSplitQName3();
23173 test_ret += test_xmlStringGetNodeList();
23174 test_ret += test_xmlStringLenGetNodeList();
23175 test_ret += test_xmlTextConcat();
23176 test_ret += test_xmlTextMerge();
23177 test_ret += test_xmlUnsetNsProp();
23178 test_ret += test_xmlUnsetProp();
23179 test_ret += test_xmlValidateNCName();
23180 test_ret += test_xmlValidateNMToken();
23181 test_ret += test_xmlValidateName();
23182 test_ret += test_xmlValidateQName();
Daniel Veillardd93f6252004-11-02 15:53:51 +000023183
Daniel Veillard42595322004-11-08 10:52:06 +000023184 if (test_ret != 0)
23185 printf("Module tree: %d errors\n", test_ret);
23186 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023187}
23188
23189static int
23190test_xmlBuildRelativeURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023191 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023192
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023193 int mem_base;
23194 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023195 xmlChar * URI; /* the URI reference under consideration */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023196 int n_URI;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023197 xmlChar * base; /* the base value */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023198 int n_base;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023199
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023200 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
23201 for (n_base = 0;n_base < gen_nb_const_xmlChar_ptr;n_base++) {
23202 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023203 URI = gen_const_xmlChar_ptr(n_URI, 0);
23204 base = gen_const_xmlChar_ptr(n_base, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023205
William M. Brackf13f77f2004-11-12 16:03:48 +000023206 ret_val = xmlBuildRelativeURI((const xmlChar *)URI, (const xmlChar *)base);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023207 desret_xmlChar_ptr(ret_val);
23208 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000023209 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0);
23210 des_const_xmlChar_ptr(n_base, (const xmlChar *)base, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023211 xmlResetLastError();
23212 if (mem_base != xmlMemBlocks()) {
23213 printf("Leak of %d blocks found in xmlBuildRelativeURI",
23214 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023215 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023216 printf(" %d", n_URI);
23217 printf(" %d", n_base);
23218 printf("\n");
23219 }
23220 }
23221 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000023222 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023223
Daniel Veillard42595322004-11-08 10:52:06 +000023224 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023225}
23226
23227
23228static int
23229test_xmlBuildURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023230 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023231
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023232 int mem_base;
23233 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023234 xmlChar * URI; /* the URI instance found in the document */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023235 int n_URI;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023236 xmlChar * base; /* the base value */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023237 int n_base;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023238
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023239 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
23240 for (n_base = 0;n_base < gen_nb_const_xmlChar_ptr;n_base++) {
23241 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023242 URI = gen_const_xmlChar_ptr(n_URI, 0);
23243 base = gen_const_xmlChar_ptr(n_base, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023244
William M. Brackf13f77f2004-11-12 16:03:48 +000023245 ret_val = xmlBuildURI((const xmlChar *)URI, (const xmlChar *)base);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023246 desret_xmlChar_ptr(ret_val);
23247 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000023248 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0);
23249 des_const_xmlChar_ptr(n_base, (const xmlChar *)base, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023250 xmlResetLastError();
23251 if (mem_base != xmlMemBlocks()) {
23252 printf("Leak of %d blocks found in xmlBuildURI",
23253 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023254 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023255 printf(" %d", n_URI);
23256 printf(" %d", n_base);
23257 printf("\n");
23258 }
23259 }
23260 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000023261 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023262
Daniel Veillard42595322004-11-08 10:52:06 +000023263 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023264}
23265
23266
23267static int
23268test_xmlCanonicPath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023269 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023270
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023271 int mem_base;
23272 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023273 xmlChar * path; /* the resource locator in a filesystem notation */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023274 int n_path;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023275
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023276 for (n_path = 0;n_path < gen_nb_const_xmlChar_ptr;n_path++) {
23277 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023278 path = gen_const_xmlChar_ptr(n_path, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023279
William M. Brackf13f77f2004-11-12 16:03:48 +000023280 ret_val = xmlCanonicPath((const xmlChar *)path);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023281 desret_xmlChar_ptr(ret_val);
23282 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000023283 des_const_xmlChar_ptr(n_path, (const xmlChar *)path, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023284 xmlResetLastError();
23285 if (mem_base != xmlMemBlocks()) {
23286 printf("Leak of %d blocks found in xmlCanonicPath",
23287 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023288 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023289 printf(" %d", n_path);
23290 printf("\n");
23291 }
23292 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000023293 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023294
Daniel Veillard42595322004-11-08 10:52:06 +000023295 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023296}
23297
23298
23299static int
23300test_xmlCreateURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023301 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023302
23303
23304 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023305 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023306}
23307
23308
23309static int
23310test_xmlNormalizeURIPath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023311 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023312
Daniel Veillardce682bc2004-11-05 17:22:25 +000023313 int mem_base;
23314 int ret_val;
23315 char * path; /* pointer to the path string */
23316 int n_path;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023317
Daniel Veillardce682bc2004-11-05 17:22:25 +000023318 for (n_path = 0;n_path < gen_nb_char_ptr;n_path++) {
23319 mem_base = xmlMemBlocks();
23320 path = gen_char_ptr(n_path, 0);
23321
23322 ret_val = xmlNormalizeURIPath(path);
23323 desret_int(ret_val);
23324 call_tests++;
23325 des_char_ptr(n_path, path, 0);
23326 xmlResetLastError();
23327 if (mem_base != xmlMemBlocks()) {
23328 printf("Leak of %d blocks found in xmlNormalizeURIPath",
23329 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023330 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023331 printf(" %d", n_path);
23332 printf("\n");
23333 }
23334 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000023335 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023336
Daniel Veillard42595322004-11-08 10:52:06 +000023337 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023338}
23339
23340
23341static int
23342test_xmlParseURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023343 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023344
23345
23346 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023347 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023348}
23349
23350
Daniel Veillardce682bc2004-11-05 17:22:25 +000023351#define gen_nb_xmlURIPtr 1
23352static xmlURIPtr gen_xmlURIPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23353 return(NULL);
23354}
23355static void des_xmlURIPtr(int no ATTRIBUTE_UNUSED, xmlURIPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23356}
23357
Daniel Veillardd93f6252004-11-02 15:53:51 +000023358static int
23359test_xmlParseURIReference(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023360 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023361
Daniel Veillardce682bc2004-11-05 17:22:25 +000023362 int mem_base;
23363 int ret_val;
23364 xmlURIPtr uri; /* pointer to an URI structure */
23365 int n_uri;
23366 char * str; /* the string to analyze */
23367 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023368
Daniel Veillardce682bc2004-11-05 17:22:25 +000023369 for (n_uri = 0;n_uri < gen_nb_xmlURIPtr;n_uri++) {
23370 for (n_str = 0;n_str < gen_nb_const_char_ptr;n_str++) {
23371 mem_base = xmlMemBlocks();
23372 uri = gen_xmlURIPtr(n_uri, 0);
23373 str = gen_const_char_ptr(n_str, 1);
23374
William M. Brackf13f77f2004-11-12 16:03:48 +000023375 ret_val = xmlParseURIReference(uri, (const char *)str);
Daniel Veillardce682bc2004-11-05 17:22:25 +000023376 desret_int(ret_val);
23377 call_tests++;
23378 des_xmlURIPtr(n_uri, uri, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000023379 des_const_char_ptr(n_str, (const char *)str, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000023380 xmlResetLastError();
23381 if (mem_base != xmlMemBlocks()) {
23382 printf("Leak of %d blocks found in xmlParseURIReference",
23383 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023384 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023385 printf(" %d", n_uri);
23386 printf(" %d", n_str);
23387 printf("\n");
23388 }
23389 }
23390 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000023391 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023392
Daniel Veillard42595322004-11-08 10:52:06 +000023393 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023394}
23395
23396
23397static int
23398test_xmlPrintURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023399 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023400
Daniel Veillardce682bc2004-11-05 17:22:25 +000023401 int mem_base;
23402 FILE * stream; /* a FILE* for the output */
23403 int n_stream;
23404 xmlURIPtr uri; /* pointer to an xmlURI */
23405 int n_uri;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023406
Daniel Veillardce682bc2004-11-05 17:22:25 +000023407 for (n_stream = 0;n_stream < gen_nb_FILE_ptr;n_stream++) {
23408 for (n_uri = 0;n_uri < gen_nb_xmlURIPtr;n_uri++) {
23409 mem_base = xmlMemBlocks();
23410 stream = gen_FILE_ptr(n_stream, 0);
23411 uri = gen_xmlURIPtr(n_uri, 1);
23412
23413 xmlPrintURI(stream, uri);
23414 call_tests++;
23415 des_FILE_ptr(n_stream, stream, 0);
23416 des_xmlURIPtr(n_uri, uri, 1);
23417 xmlResetLastError();
23418 if (mem_base != xmlMemBlocks()) {
23419 printf("Leak of %d blocks found in xmlPrintURI",
23420 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023421 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023422 printf(" %d", n_stream);
23423 printf(" %d", n_uri);
23424 printf("\n");
23425 }
23426 }
23427 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000023428 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023429
Daniel Veillard42595322004-11-08 10:52:06 +000023430 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023431}
23432
23433
23434static int
23435test_xmlSaveUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023436 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023437
Daniel Veillardce682bc2004-11-05 17:22:25 +000023438 int mem_base;
23439 xmlChar * ret_val;
23440 xmlURIPtr uri; /* pointer to an xmlURI */
23441 int n_uri;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023442
Daniel Veillardce682bc2004-11-05 17:22:25 +000023443 for (n_uri = 0;n_uri < gen_nb_xmlURIPtr;n_uri++) {
23444 mem_base = xmlMemBlocks();
23445 uri = gen_xmlURIPtr(n_uri, 0);
23446
23447 ret_val = xmlSaveUri(uri);
23448 desret_xmlChar_ptr(ret_val);
23449 call_tests++;
23450 des_xmlURIPtr(n_uri, uri, 0);
23451 xmlResetLastError();
23452 if (mem_base != xmlMemBlocks()) {
23453 printf("Leak of %d blocks found in xmlSaveUri",
23454 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023455 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023456 printf(" %d", n_uri);
23457 printf("\n");
23458 }
23459 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000023460 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023461
Daniel Veillard42595322004-11-08 10:52:06 +000023462 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023463}
23464
23465
23466static int
23467test_xmlURIEscape(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023468 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023469
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023470 int mem_base;
23471 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023472 xmlChar * str; /* the string of the URI to escape */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023473 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023474
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023475 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
23476 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023477 str = gen_const_xmlChar_ptr(n_str, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023478
William M. Brackf13f77f2004-11-12 16:03:48 +000023479 ret_val = xmlURIEscape((const xmlChar *)str);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023480 desret_xmlChar_ptr(ret_val);
23481 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000023482 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023483 xmlResetLastError();
23484 if (mem_base != xmlMemBlocks()) {
23485 printf("Leak of %d blocks found in xmlURIEscape",
23486 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023487 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023488 printf(" %d", n_str);
23489 printf("\n");
23490 }
23491 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000023492 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023493
Daniel Veillard42595322004-11-08 10:52:06 +000023494 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023495}
23496
23497
23498static int
23499test_xmlURIEscapeStr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023500 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023501
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023502 int mem_base;
23503 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023504 xmlChar * str; /* string to escape */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023505 int n_str;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023506 xmlChar * list; /* exception list string of chars not to escape */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023507 int n_list;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023508
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023509 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
23510 for (n_list = 0;n_list < gen_nb_const_xmlChar_ptr;n_list++) {
23511 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023512 str = gen_const_xmlChar_ptr(n_str, 0);
23513 list = gen_const_xmlChar_ptr(n_list, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023514
William M. Brackf13f77f2004-11-12 16:03:48 +000023515 ret_val = xmlURIEscapeStr((const xmlChar *)str, (const xmlChar *)list);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023516 desret_xmlChar_ptr(ret_val);
23517 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000023518 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
23519 des_const_xmlChar_ptr(n_list, (const xmlChar *)list, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023520 xmlResetLastError();
23521 if (mem_base != xmlMemBlocks()) {
23522 printf("Leak of %d blocks found in xmlURIEscapeStr",
23523 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023524 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023525 printf(" %d", n_str);
23526 printf(" %d", n_list);
23527 printf("\n");
23528 }
23529 }
23530 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000023531 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023532
Daniel Veillard42595322004-11-08 10:52:06 +000023533 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023534}
23535
23536
23537static int
23538test_xmlURIUnescapeString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023539 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023540
23541
23542 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023543 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023544}
23545
23546static int
23547test_uri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023548 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023549
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023550 if (quiet == 0) printf("Testing uri : 9 of 13 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000023551 test_ret += test_xmlBuildRelativeURI();
23552 test_ret += test_xmlBuildURI();
23553 test_ret += test_xmlCanonicPath();
23554 test_ret += test_xmlCreateURI();
23555 test_ret += test_xmlNormalizeURIPath();
23556 test_ret += test_xmlParseURI();
23557 test_ret += test_xmlParseURIReference();
23558 test_ret += test_xmlPrintURI();
23559 test_ret += test_xmlSaveUri();
23560 test_ret += test_xmlURIEscape();
23561 test_ret += test_xmlURIEscapeStr();
23562 test_ret += test_xmlURIUnescapeString();
Daniel Veillardd93f6252004-11-02 15:53:51 +000023563
Daniel Veillard42595322004-11-08 10:52:06 +000023564 if (test_ret != 0)
23565 printf("Module uri: %d errors\n", test_ret);
23566 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023567}
23568
23569static int
23570test_xmlAddAttributeDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023571 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023572
Daniel Veillard42595322004-11-08 10:52:06 +000023573 int mem_base;
23574 xmlAttributePtr ret_val;
23575 xmlValidCtxtPtr ctxt; /* the validation context */
23576 int n_ctxt;
23577 xmlDtdPtr dtd; /* pointer to the DTD */
23578 int n_dtd;
23579 xmlChar * elem; /* the element name */
23580 int n_elem;
23581 xmlChar * name; /* the attribute name */
23582 int n_name;
23583 xmlChar * ns; /* the attribute namespace prefix */
23584 int n_ns;
23585 xmlAttributeType type; /* the attribute type */
23586 int n_type;
23587 xmlAttributeDefault def; /* the attribute default type */
23588 int n_def;
23589 xmlChar * defaultValue; /* the attribute default value */
23590 int n_defaultValue;
23591 xmlEnumerationPtr tree; /* if it's an enumeration, the associated list */
23592 int n_tree;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023593
Daniel Veillard42595322004-11-08 10:52:06 +000023594 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
23595 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
23596 for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) {
23597 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
23598 for (n_ns = 0;n_ns < gen_nb_const_xmlChar_ptr;n_ns++) {
23599 for (n_type = 0;n_type < gen_nb_xmlAttributeType;n_type++) {
23600 for (n_def = 0;n_def < gen_nb_xmlAttributeDefault;n_def++) {
23601 for (n_defaultValue = 0;n_defaultValue < gen_nb_const_xmlChar_ptr;n_defaultValue++) {
23602 for (n_tree = 0;n_tree < gen_nb_xmlEnumerationPtr;n_tree++) {
23603 mem_base = xmlMemBlocks();
23604 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
23605 dtd = gen_xmlDtdPtr(n_dtd, 1);
23606 elem = gen_const_xmlChar_ptr(n_elem, 2);
23607 name = gen_const_xmlChar_ptr(n_name, 3);
23608 ns = gen_const_xmlChar_ptr(n_ns, 4);
23609 type = gen_xmlAttributeType(n_type, 5);
23610 def = gen_xmlAttributeDefault(n_def, 6);
23611 defaultValue = gen_const_xmlChar_ptr(n_defaultValue, 7);
23612 tree = gen_xmlEnumerationPtr(n_tree, 8);
23613
William M. Brackf13f77f2004-11-12 16:03:48 +000023614 ret_val = xmlAddAttributeDecl(ctxt, dtd, (const xmlChar *)elem, (const xmlChar *)name, (const xmlChar *)ns, type, def, (const xmlChar *)defaultValue, tree);
Daniel Veillard42595322004-11-08 10:52:06 +000023615 desret_xmlAttributePtr(ret_val);
23616 call_tests++;
23617 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
23618 des_xmlDtdPtr(n_dtd, dtd, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000023619 des_const_xmlChar_ptr(n_elem, (const xmlChar *)elem, 2);
23620 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 3);
23621 des_const_xmlChar_ptr(n_ns, (const xmlChar *)ns, 4);
Daniel Veillard42595322004-11-08 10:52:06 +000023622 des_xmlAttributeType(n_type, type, 5);
23623 des_xmlAttributeDefault(n_def, def, 6);
William M. Brackf13f77f2004-11-12 16:03:48 +000023624 des_const_xmlChar_ptr(n_defaultValue, (const xmlChar *)defaultValue, 7);
Daniel Veillard42595322004-11-08 10:52:06 +000023625 des_xmlEnumerationPtr(n_tree, tree, 8);
23626 xmlResetLastError();
23627 if (mem_base != xmlMemBlocks()) {
23628 printf("Leak of %d blocks found in xmlAddAttributeDecl",
23629 xmlMemBlocks() - mem_base);
23630 test_ret++;
23631 printf(" %d", n_ctxt);
23632 printf(" %d", n_dtd);
23633 printf(" %d", n_elem);
23634 printf(" %d", n_name);
23635 printf(" %d", n_ns);
23636 printf(" %d", n_type);
23637 printf(" %d", n_def);
23638 printf(" %d", n_defaultValue);
23639 printf(" %d", n_tree);
23640 printf("\n");
23641 }
23642 }
23643 }
23644 }
23645 }
23646 }
23647 }
23648 }
23649 }
23650 }
Daniel Veillard42595322004-11-08 10:52:06 +000023651 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023652
Daniel Veillard42595322004-11-08 10:52:06 +000023653 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023654}
23655
23656
23657static int
23658test_xmlAddElementDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023659 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023660
Daniel Veillard42595322004-11-08 10:52:06 +000023661 int mem_base;
23662 xmlElementPtr ret_val;
23663 xmlValidCtxtPtr ctxt; /* the validation context */
23664 int n_ctxt;
23665 xmlDtdPtr dtd; /* pointer to the DTD */
23666 int n_dtd;
23667 xmlChar * name; /* the entity name */
23668 int n_name;
23669 xmlElementTypeVal type; /* the element type */
23670 int n_type;
23671 xmlElementContentPtr content; /* the element content tree or NULL */
23672 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023673
Daniel Veillard42595322004-11-08 10:52:06 +000023674 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
23675 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
23676 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
23677 for (n_type = 0;n_type < gen_nb_xmlElementTypeVal;n_type++) {
23678 for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) {
23679 mem_base = xmlMemBlocks();
23680 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
23681 dtd = gen_xmlDtdPtr(n_dtd, 1);
23682 name = gen_const_xmlChar_ptr(n_name, 2);
23683 type = gen_xmlElementTypeVal(n_type, 3);
23684 content = gen_xmlElementContentPtr(n_content, 4);
23685
William M. Brackf13f77f2004-11-12 16:03:48 +000023686 ret_val = xmlAddElementDecl(ctxt, dtd, (const xmlChar *)name, type, content);
Daniel Veillard42595322004-11-08 10:52:06 +000023687 desret_xmlElementPtr(ret_val);
23688 call_tests++;
23689 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
23690 des_xmlDtdPtr(n_dtd, dtd, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000023691 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillard42595322004-11-08 10:52:06 +000023692 des_xmlElementTypeVal(n_type, type, 3);
23693 des_xmlElementContentPtr(n_content, content, 4);
23694 xmlResetLastError();
23695 if (mem_base != xmlMemBlocks()) {
23696 printf("Leak of %d blocks found in xmlAddElementDecl",
23697 xmlMemBlocks() - mem_base);
23698 test_ret++;
23699 printf(" %d", n_ctxt);
23700 printf(" %d", n_dtd);
23701 printf(" %d", n_name);
23702 printf(" %d", n_type);
23703 printf(" %d", n_content);
23704 printf("\n");
23705 }
23706 }
23707 }
23708 }
23709 }
23710 }
Daniel Veillard42595322004-11-08 10:52:06 +000023711 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023712
Daniel Veillard42595322004-11-08 10:52:06 +000023713 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023714}
23715
23716
23717static int
23718test_xmlAddID(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023719 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023720
23721
23722 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023723 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023724}
23725
23726
23727static int
23728test_xmlAddNotationDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023729 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023730
23731
23732 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023733 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023734}
23735
23736
23737static int
23738test_xmlAddRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023739 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023740
23741
23742 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023743 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023744}
23745
23746
Daniel Veillardce682bc2004-11-05 17:22:25 +000023747#define gen_nb_xmlAttributeTablePtr 1
23748static xmlAttributeTablePtr gen_xmlAttributeTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23749 return(NULL);
23750}
23751static void des_xmlAttributeTablePtr(int no ATTRIBUTE_UNUSED, xmlAttributeTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23752}
23753
Daniel Veillardd93f6252004-11-02 15:53:51 +000023754static int
23755test_xmlCopyAttributeTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023756 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023757
23758
23759 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023760 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023761}
23762
23763
23764static int
Daniel Veillard2ae13382005-01-25 23:45:06 +000023765test_xmlCopyDocElementContent(void) {
23766 int test_ret = 0;
23767
23768 int mem_base;
23769 xmlElementContentPtr ret_val;
23770 xmlDocPtr doc; /* the document owning the element declaration */
23771 int n_doc;
23772 xmlElementContentPtr cur; /* An element content pointer. */
23773 int n_cur;
23774
23775 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
23776 for (n_cur = 0;n_cur < gen_nb_xmlElementContentPtr;n_cur++) {
23777 mem_base = xmlMemBlocks();
23778 doc = gen_xmlDocPtr(n_doc, 0);
23779 cur = gen_xmlElementContentPtr(n_cur, 1);
23780
23781 ret_val = xmlCopyDocElementContent(doc, cur);
23782 desret_xmlElementContentPtr(ret_val);
23783 call_tests++;
23784 des_xmlDocPtr(n_doc, doc, 0);
23785 des_xmlElementContentPtr(n_cur, cur, 1);
23786 xmlResetLastError();
23787 if (mem_base != xmlMemBlocks()) {
23788 printf("Leak of %d blocks found in xmlCopyDocElementContent",
23789 xmlMemBlocks() - mem_base);
23790 test_ret++;
23791 printf(" %d", n_doc);
23792 printf(" %d", n_cur);
23793 printf("\n");
23794 }
23795 }
23796 }
23797 function_tests++;
23798
23799 return(test_ret);
23800}
23801
23802
23803static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000023804test_xmlCopyElementContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023805 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023806
William M. Brack094dd862004-11-14 14:28:34 +000023807 int mem_base;
23808 xmlElementContentPtr ret_val;
23809 xmlElementContentPtr cur; /* An element content pointer. */
23810 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023811
William M. Brack094dd862004-11-14 14:28:34 +000023812 for (n_cur = 0;n_cur < gen_nb_xmlElementContentPtr;n_cur++) {
23813 mem_base = xmlMemBlocks();
23814 cur = gen_xmlElementContentPtr(n_cur, 0);
23815
23816 ret_val = xmlCopyElementContent(cur);
23817 desret_xmlElementContentPtr(ret_val);
23818 call_tests++;
23819 des_xmlElementContentPtr(n_cur, cur, 0);
23820 xmlResetLastError();
23821 if (mem_base != xmlMemBlocks()) {
23822 printf("Leak of %d blocks found in xmlCopyElementContent",
23823 xmlMemBlocks() - mem_base);
23824 test_ret++;
23825 printf(" %d", n_cur);
23826 printf("\n");
23827 }
23828 }
23829 function_tests++;
23830
Daniel Veillard42595322004-11-08 10:52:06 +000023831 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023832}
23833
23834
Daniel Veillardce682bc2004-11-05 17:22:25 +000023835#define gen_nb_xmlElementTablePtr 1
23836static xmlElementTablePtr gen_xmlElementTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23837 return(NULL);
23838}
23839static void des_xmlElementTablePtr(int no ATTRIBUTE_UNUSED, xmlElementTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23840}
23841
Daniel Veillardd93f6252004-11-02 15:53:51 +000023842static int
23843test_xmlCopyElementTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023844 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023845
23846
23847 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023848 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023849}
23850
23851
23852static int
23853test_xmlCopyEnumeration(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023854 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023855
23856
23857 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023858 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023859}
23860
23861
Daniel Veillardce682bc2004-11-05 17:22:25 +000023862#define gen_nb_xmlNotationTablePtr 1
23863static xmlNotationTablePtr gen_xmlNotationTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23864 return(NULL);
23865}
23866static void des_xmlNotationTablePtr(int no ATTRIBUTE_UNUSED, xmlNotationTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23867}
23868
Daniel Veillardd93f6252004-11-02 15:53:51 +000023869static int
23870test_xmlCopyNotationTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023871 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023872
23873
23874 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023875 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023876}
23877
23878
23879static int
23880test_xmlCreateEnumeration(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023881 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023882
23883
23884 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023885 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023886}
23887
23888
Daniel Veillardce682bc2004-11-05 17:22:25 +000023889#define gen_nb_xmlAttributePtr 1
23890static xmlAttributePtr gen_xmlAttributePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23891 return(NULL);
23892}
23893static void des_xmlAttributePtr(int no ATTRIBUTE_UNUSED, xmlAttributePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23894}
23895
Daniel Veillardd93f6252004-11-02 15:53:51 +000023896static int
23897test_xmlDumpAttributeDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023898 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023899
William M. Brack21e4ef22005-01-02 09:53:13 +000023900#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000023901 int mem_base;
23902 xmlBufferPtr buf; /* the XML buffer output */
23903 int n_buf;
23904 xmlAttributePtr attr; /* An attribute declaration */
23905 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023906
Daniel Veillardce682bc2004-11-05 17:22:25 +000023907 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
23908 for (n_attr = 0;n_attr < gen_nb_xmlAttributePtr;n_attr++) {
23909 mem_base = xmlMemBlocks();
23910 buf = gen_xmlBufferPtr(n_buf, 0);
23911 attr = gen_xmlAttributePtr(n_attr, 1);
23912
23913 xmlDumpAttributeDecl(buf, attr);
23914 call_tests++;
23915 des_xmlBufferPtr(n_buf, buf, 0);
23916 des_xmlAttributePtr(n_attr, attr, 1);
23917 xmlResetLastError();
23918 if (mem_base != xmlMemBlocks()) {
23919 printf("Leak of %d blocks found in xmlDumpAttributeDecl",
23920 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023921 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023922 printf(" %d", n_buf);
23923 printf(" %d", n_attr);
23924 printf("\n");
23925 }
23926 }
23927 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023928 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023929#endif
23930
Daniel Veillard42595322004-11-08 10:52:06 +000023931 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023932}
23933
23934
23935static int
23936test_xmlDumpAttributeTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023937 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023938
William M. Brack21e4ef22005-01-02 09:53:13 +000023939#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000023940 int mem_base;
23941 xmlBufferPtr buf; /* the XML buffer output */
23942 int n_buf;
23943 xmlAttributeTablePtr table; /* An attribute table */
23944 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023945
Daniel Veillardce682bc2004-11-05 17:22:25 +000023946 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
23947 for (n_table = 0;n_table < gen_nb_xmlAttributeTablePtr;n_table++) {
23948 mem_base = xmlMemBlocks();
23949 buf = gen_xmlBufferPtr(n_buf, 0);
23950 table = gen_xmlAttributeTablePtr(n_table, 1);
23951
23952 xmlDumpAttributeTable(buf, table);
23953 call_tests++;
23954 des_xmlBufferPtr(n_buf, buf, 0);
23955 des_xmlAttributeTablePtr(n_table, table, 1);
23956 xmlResetLastError();
23957 if (mem_base != xmlMemBlocks()) {
23958 printf("Leak of %d blocks found in xmlDumpAttributeTable",
23959 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023960 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023961 printf(" %d", n_buf);
23962 printf(" %d", n_table);
23963 printf("\n");
23964 }
23965 }
23966 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023967 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023968#endif
23969
Daniel Veillard42595322004-11-08 10:52:06 +000023970 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023971}
23972
23973
Daniel Veillardce682bc2004-11-05 17:22:25 +000023974#define gen_nb_xmlElementPtr 1
23975static xmlElementPtr gen_xmlElementPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23976 return(NULL);
23977}
23978static void des_xmlElementPtr(int no ATTRIBUTE_UNUSED, xmlElementPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23979}
23980
Daniel Veillardd93f6252004-11-02 15:53:51 +000023981static int
23982test_xmlDumpElementDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023983 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023984
William M. Brack21e4ef22005-01-02 09:53:13 +000023985#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000023986 int mem_base;
23987 xmlBufferPtr buf; /* the XML buffer output */
23988 int n_buf;
23989 xmlElementPtr elem; /* An element table */
23990 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023991
Daniel Veillardce682bc2004-11-05 17:22:25 +000023992 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
23993 for (n_elem = 0;n_elem < gen_nb_xmlElementPtr;n_elem++) {
23994 mem_base = xmlMemBlocks();
23995 buf = gen_xmlBufferPtr(n_buf, 0);
23996 elem = gen_xmlElementPtr(n_elem, 1);
23997
23998 xmlDumpElementDecl(buf, elem);
23999 call_tests++;
24000 des_xmlBufferPtr(n_buf, buf, 0);
24001 des_xmlElementPtr(n_elem, elem, 1);
24002 xmlResetLastError();
24003 if (mem_base != xmlMemBlocks()) {
24004 printf("Leak of %d blocks found in xmlDumpElementDecl",
24005 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024006 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024007 printf(" %d", n_buf);
24008 printf(" %d", n_elem);
24009 printf("\n");
24010 }
24011 }
24012 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024013 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024014#endif
24015
Daniel Veillard42595322004-11-08 10:52:06 +000024016 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024017}
24018
24019
24020static int
24021test_xmlDumpElementTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024022 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024023
William M. Brack21e4ef22005-01-02 09:53:13 +000024024#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000024025 int mem_base;
24026 xmlBufferPtr buf; /* the XML buffer output */
24027 int n_buf;
24028 xmlElementTablePtr table; /* An element table */
24029 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024030
Daniel Veillardce682bc2004-11-05 17:22:25 +000024031 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
24032 for (n_table = 0;n_table < gen_nb_xmlElementTablePtr;n_table++) {
24033 mem_base = xmlMemBlocks();
24034 buf = gen_xmlBufferPtr(n_buf, 0);
24035 table = gen_xmlElementTablePtr(n_table, 1);
24036
24037 xmlDumpElementTable(buf, table);
24038 call_tests++;
24039 des_xmlBufferPtr(n_buf, buf, 0);
24040 des_xmlElementTablePtr(n_table, table, 1);
24041 xmlResetLastError();
24042 if (mem_base != xmlMemBlocks()) {
24043 printf("Leak of %d blocks found in xmlDumpElementTable",
24044 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024045 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024046 printf(" %d", n_buf);
24047 printf(" %d", n_table);
24048 printf("\n");
24049 }
24050 }
24051 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024052 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024053#endif
24054
Daniel Veillard42595322004-11-08 10:52:06 +000024055 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024056}
24057
24058
Daniel Veillardce682bc2004-11-05 17:22:25 +000024059#define gen_nb_xmlNotationPtr 1
24060static xmlNotationPtr gen_xmlNotationPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
24061 return(NULL);
24062}
24063static void des_xmlNotationPtr(int no ATTRIBUTE_UNUSED, xmlNotationPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
24064}
24065
Daniel Veillardd93f6252004-11-02 15:53:51 +000024066static int
24067test_xmlDumpNotationDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024068 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024069
William M. Brack21e4ef22005-01-02 09:53:13 +000024070#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000024071 int mem_base;
24072 xmlBufferPtr buf; /* the XML buffer output */
24073 int n_buf;
24074 xmlNotationPtr nota; /* A notation declaration */
24075 int n_nota;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024076
Daniel Veillardce682bc2004-11-05 17:22:25 +000024077 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
24078 for (n_nota = 0;n_nota < gen_nb_xmlNotationPtr;n_nota++) {
24079 mem_base = xmlMemBlocks();
24080 buf = gen_xmlBufferPtr(n_buf, 0);
24081 nota = gen_xmlNotationPtr(n_nota, 1);
24082
24083 xmlDumpNotationDecl(buf, nota);
24084 call_tests++;
24085 des_xmlBufferPtr(n_buf, buf, 0);
24086 des_xmlNotationPtr(n_nota, nota, 1);
24087 xmlResetLastError();
24088 if (mem_base != xmlMemBlocks()) {
24089 printf("Leak of %d blocks found in xmlDumpNotationDecl",
24090 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024091 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024092 printf(" %d", n_buf);
24093 printf(" %d", n_nota);
24094 printf("\n");
24095 }
24096 }
24097 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024098 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024099#endif
24100
Daniel Veillard42595322004-11-08 10:52:06 +000024101 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024102}
24103
24104
24105static int
24106test_xmlDumpNotationTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024107 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024108
William M. Brack21e4ef22005-01-02 09:53:13 +000024109#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000024110 int mem_base;
24111 xmlBufferPtr buf; /* the XML buffer output */
24112 int n_buf;
24113 xmlNotationTablePtr table; /* A notation table */
24114 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024115
Daniel Veillardce682bc2004-11-05 17:22:25 +000024116 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
24117 for (n_table = 0;n_table < gen_nb_xmlNotationTablePtr;n_table++) {
24118 mem_base = xmlMemBlocks();
24119 buf = gen_xmlBufferPtr(n_buf, 0);
24120 table = gen_xmlNotationTablePtr(n_table, 1);
24121
24122 xmlDumpNotationTable(buf, table);
24123 call_tests++;
24124 des_xmlBufferPtr(n_buf, buf, 0);
24125 des_xmlNotationTablePtr(n_table, table, 1);
24126 xmlResetLastError();
24127 if (mem_base != xmlMemBlocks()) {
24128 printf("Leak of %d blocks found in xmlDumpNotationTable",
24129 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024130 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024131 printf(" %d", n_buf);
24132 printf(" %d", n_table);
24133 printf("\n");
24134 }
24135 }
24136 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024137 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024138#endif
24139
Daniel Veillard42595322004-11-08 10:52:06 +000024140 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024141}
24142
24143
24144static int
24145test_xmlGetDtdAttrDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024146 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024147
Daniel Veillard42595322004-11-08 10:52:06 +000024148 int mem_base;
24149 xmlAttributePtr ret_val;
24150 xmlDtdPtr dtd; /* a pointer to the DtD to search */
24151 int n_dtd;
24152 xmlChar * elem; /* the element name */
24153 int n_elem;
24154 xmlChar * name; /* the attribute name */
24155 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024156
Daniel Veillard42595322004-11-08 10:52:06 +000024157 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
24158 for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) {
24159 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24160 mem_base = xmlMemBlocks();
24161 dtd = gen_xmlDtdPtr(n_dtd, 0);
24162 elem = gen_const_xmlChar_ptr(n_elem, 1);
24163 name = gen_const_xmlChar_ptr(n_name, 2);
24164
William M. Brackf13f77f2004-11-12 16:03:48 +000024165 ret_val = xmlGetDtdAttrDesc(dtd, (const xmlChar *)elem, (const xmlChar *)name);
Daniel Veillard42595322004-11-08 10:52:06 +000024166 desret_xmlAttributePtr(ret_val);
24167 call_tests++;
24168 des_xmlDtdPtr(n_dtd, dtd, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024169 des_const_xmlChar_ptr(n_elem, (const xmlChar *)elem, 1);
24170 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillard42595322004-11-08 10:52:06 +000024171 xmlResetLastError();
24172 if (mem_base != xmlMemBlocks()) {
24173 printf("Leak of %d blocks found in xmlGetDtdAttrDesc",
24174 xmlMemBlocks() - mem_base);
24175 test_ret++;
24176 printf(" %d", n_dtd);
24177 printf(" %d", n_elem);
24178 printf(" %d", n_name);
24179 printf("\n");
24180 }
24181 }
24182 }
24183 }
Daniel Veillard42595322004-11-08 10:52:06 +000024184 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024185
Daniel Veillard42595322004-11-08 10:52:06 +000024186 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024187}
24188
24189
24190static int
24191test_xmlGetDtdElementDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024192 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024193
Daniel Veillard42595322004-11-08 10:52:06 +000024194 int mem_base;
24195 xmlElementPtr ret_val;
24196 xmlDtdPtr dtd; /* a pointer to the DtD to search */
24197 int n_dtd;
24198 xmlChar * name; /* the element name */
24199 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024200
Daniel Veillard42595322004-11-08 10:52:06 +000024201 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
24202 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24203 mem_base = xmlMemBlocks();
24204 dtd = gen_xmlDtdPtr(n_dtd, 0);
24205 name = gen_const_xmlChar_ptr(n_name, 1);
24206
William M. Brackf13f77f2004-11-12 16:03:48 +000024207 ret_val = xmlGetDtdElementDesc(dtd, (const xmlChar *)name);
Daniel Veillard42595322004-11-08 10:52:06 +000024208 desret_xmlElementPtr(ret_val);
24209 call_tests++;
24210 des_xmlDtdPtr(n_dtd, dtd, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024211 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard42595322004-11-08 10:52:06 +000024212 xmlResetLastError();
24213 if (mem_base != xmlMemBlocks()) {
24214 printf("Leak of %d blocks found in xmlGetDtdElementDesc",
24215 xmlMemBlocks() - mem_base);
24216 test_ret++;
24217 printf(" %d", n_dtd);
24218 printf(" %d", n_name);
24219 printf("\n");
24220 }
24221 }
24222 }
Daniel Veillard42595322004-11-08 10:52:06 +000024223 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024224
Daniel Veillard42595322004-11-08 10:52:06 +000024225 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024226}
24227
24228
24229static int
24230test_xmlGetDtdNotationDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024231 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024232
24233
24234 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000024235 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024236}
24237
24238
24239static int
24240test_xmlGetDtdQAttrDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024241 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024242
Daniel Veillard42595322004-11-08 10:52:06 +000024243 int mem_base;
24244 xmlAttributePtr ret_val;
24245 xmlDtdPtr dtd; /* a pointer to the DtD to search */
24246 int n_dtd;
24247 xmlChar * elem; /* the element name */
24248 int n_elem;
24249 xmlChar * name; /* the attribute name */
24250 int n_name;
24251 xmlChar * prefix; /* the attribute namespace prefix */
24252 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024253
Daniel Veillard42595322004-11-08 10:52:06 +000024254 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
24255 for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) {
24256 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24257 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
24258 mem_base = xmlMemBlocks();
24259 dtd = gen_xmlDtdPtr(n_dtd, 0);
24260 elem = gen_const_xmlChar_ptr(n_elem, 1);
24261 name = gen_const_xmlChar_ptr(n_name, 2);
24262 prefix = gen_const_xmlChar_ptr(n_prefix, 3);
24263
William M. Brackf13f77f2004-11-12 16:03:48 +000024264 ret_val = xmlGetDtdQAttrDesc(dtd, (const xmlChar *)elem, (const xmlChar *)name, (const xmlChar *)prefix);
Daniel Veillard42595322004-11-08 10:52:06 +000024265 desret_xmlAttributePtr(ret_val);
24266 call_tests++;
24267 des_xmlDtdPtr(n_dtd, dtd, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024268 des_const_xmlChar_ptr(n_elem, (const xmlChar *)elem, 1);
24269 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
24270 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 3);
Daniel Veillard42595322004-11-08 10:52:06 +000024271 xmlResetLastError();
24272 if (mem_base != xmlMemBlocks()) {
24273 printf("Leak of %d blocks found in xmlGetDtdQAttrDesc",
24274 xmlMemBlocks() - mem_base);
24275 test_ret++;
24276 printf(" %d", n_dtd);
24277 printf(" %d", n_elem);
24278 printf(" %d", n_name);
24279 printf(" %d", n_prefix);
24280 printf("\n");
24281 }
24282 }
24283 }
24284 }
24285 }
Daniel Veillard42595322004-11-08 10:52:06 +000024286 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024287
Daniel Veillard42595322004-11-08 10:52:06 +000024288 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024289}
24290
24291
24292static int
24293test_xmlGetDtdQElementDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024294 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024295
Daniel Veillard42595322004-11-08 10:52:06 +000024296 int mem_base;
24297 xmlElementPtr ret_val;
24298 xmlDtdPtr dtd; /* a pointer to the DtD to search */
24299 int n_dtd;
24300 xmlChar * name; /* the element name */
24301 int n_name;
24302 xmlChar * prefix; /* the element namespace prefix */
24303 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024304
Daniel Veillard42595322004-11-08 10:52:06 +000024305 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
24306 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24307 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
24308 mem_base = xmlMemBlocks();
24309 dtd = gen_xmlDtdPtr(n_dtd, 0);
24310 name = gen_const_xmlChar_ptr(n_name, 1);
24311 prefix = gen_const_xmlChar_ptr(n_prefix, 2);
24312
William M. Brackf13f77f2004-11-12 16:03:48 +000024313 ret_val = xmlGetDtdQElementDesc(dtd, (const xmlChar *)name, (const xmlChar *)prefix);
Daniel Veillard42595322004-11-08 10:52:06 +000024314 desret_xmlElementPtr(ret_val);
24315 call_tests++;
24316 des_xmlDtdPtr(n_dtd, dtd, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024317 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
24318 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 2);
Daniel Veillard42595322004-11-08 10:52:06 +000024319 xmlResetLastError();
24320 if (mem_base != xmlMemBlocks()) {
24321 printf("Leak of %d blocks found in xmlGetDtdQElementDesc",
24322 xmlMemBlocks() - mem_base);
24323 test_ret++;
24324 printf(" %d", n_dtd);
24325 printf(" %d", n_name);
24326 printf(" %d", n_prefix);
24327 printf("\n");
24328 }
24329 }
24330 }
24331 }
Daniel Veillard42595322004-11-08 10:52:06 +000024332 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024333
Daniel Veillard42595322004-11-08 10:52:06 +000024334 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024335}
24336
24337
24338static int
24339test_xmlGetID(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024340 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024341
Daniel Veillard57b25162004-11-06 14:50:18 +000024342 int mem_base;
24343 xmlAttrPtr ret_val;
24344 xmlDocPtr doc; /* pointer to the document */
24345 int n_doc;
24346 xmlChar * ID; /* the ID value */
24347 int n_ID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024348
Daniel Veillard57b25162004-11-06 14:50:18 +000024349 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24350 for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) {
24351 mem_base = xmlMemBlocks();
24352 doc = gen_xmlDocPtr(n_doc, 0);
24353 ID = gen_const_xmlChar_ptr(n_ID, 1);
24354
William M. Brackf13f77f2004-11-12 16:03:48 +000024355 ret_val = xmlGetID(doc, (const xmlChar *)ID);
Daniel Veillard57b25162004-11-06 14:50:18 +000024356 desret_xmlAttrPtr(ret_val);
24357 call_tests++;
24358 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024359 des_const_xmlChar_ptr(n_ID, (const xmlChar *)ID, 1);
Daniel Veillard57b25162004-11-06 14:50:18 +000024360 xmlResetLastError();
24361 if (mem_base != xmlMemBlocks()) {
24362 printf("Leak of %d blocks found in xmlGetID",
24363 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024364 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000024365 printf(" %d", n_doc);
24366 printf(" %d", n_ID);
24367 printf("\n");
24368 }
24369 }
24370 }
Daniel Veillard57b25162004-11-06 14:50:18 +000024371 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024372
Daniel Veillard42595322004-11-08 10:52:06 +000024373 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024374}
24375
24376
24377static int
24378test_xmlGetRefs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024379 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024380
24381
24382 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000024383 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024384}
24385
24386
24387static int
24388test_xmlIsID(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024389 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024390
Daniel Veillardce244ad2004-11-05 10:03:46 +000024391 int mem_base;
24392 int ret_val;
24393 xmlDocPtr doc; /* the document */
24394 int n_doc;
24395 xmlNodePtr elem; /* the element carrying the attribute */
24396 int n_elem;
24397 xmlAttrPtr attr; /* the attribute */
24398 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024399
Daniel Veillardce244ad2004-11-05 10:03:46 +000024400 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24401 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
24402 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
24403 mem_base = xmlMemBlocks();
24404 doc = gen_xmlDocPtr(n_doc, 0);
24405 elem = gen_xmlNodePtr(n_elem, 1);
24406 attr = gen_xmlAttrPtr(n_attr, 2);
24407
24408 ret_val = xmlIsID(doc, elem, attr);
24409 desret_int(ret_val);
24410 call_tests++;
24411 des_xmlDocPtr(n_doc, doc, 0);
24412 des_xmlNodePtr(n_elem, elem, 1);
24413 des_xmlAttrPtr(n_attr, attr, 2);
24414 xmlResetLastError();
24415 if (mem_base != xmlMemBlocks()) {
24416 printf("Leak of %d blocks found in xmlIsID",
24417 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024418 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000024419 printf(" %d", n_doc);
24420 printf(" %d", n_elem);
24421 printf(" %d", n_attr);
24422 printf("\n");
24423 }
24424 }
24425 }
24426 }
Daniel Veillardce244ad2004-11-05 10:03:46 +000024427 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024428
Daniel Veillard42595322004-11-08 10:52:06 +000024429 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024430}
24431
24432
24433static int
24434test_xmlIsMixedElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024435 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024436
24437 int mem_base;
24438 int ret_val;
24439 xmlDocPtr doc; /* the document */
24440 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024441 xmlChar * name; /* the element name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000024442 int n_name;
24443
24444 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24445 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24446 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024447 doc = gen_xmlDocPtr(n_doc, 0);
24448 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024449
William M. Brackf13f77f2004-11-12 16:03:48 +000024450 ret_val = xmlIsMixedElement(doc, (const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024451 desret_int(ret_val);
24452 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024453 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024454 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024455 xmlResetLastError();
24456 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000024457 printf("Leak of %d blocks found in xmlIsMixedElement",
Daniel Veillardd93f6252004-11-02 15:53:51 +000024458 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024459 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000024460 printf(" %d", n_doc);
24461 printf(" %d", n_name);
24462 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000024463 }
24464 }
24465 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000024466 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024467
Daniel Veillard42595322004-11-08 10:52:06 +000024468 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024469}
24470
24471
24472static int
24473test_xmlIsRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024474 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024475
Daniel Veillardce244ad2004-11-05 10:03:46 +000024476 int mem_base;
24477 int ret_val;
24478 xmlDocPtr doc; /* the document */
24479 int n_doc;
24480 xmlNodePtr elem; /* the element carrying the attribute */
24481 int n_elem;
24482 xmlAttrPtr attr; /* the attribute */
24483 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024484
Daniel Veillardce244ad2004-11-05 10:03:46 +000024485 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24486 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
24487 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
24488 mem_base = xmlMemBlocks();
24489 doc = gen_xmlDocPtr(n_doc, 0);
24490 elem = gen_xmlNodePtr(n_elem, 1);
24491 attr = gen_xmlAttrPtr(n_attr, 2);
24492
24493 ret_val = xmlIsRef(doc, elem, attr);
24494 desret_int(ret_val);
24495 call_tests++;
24496 des_xmlDocPtr(n_doc, doc, 0);
24497 des_xmlNodePtr(n_elem, elem, 1);
24498 des_xmlAttrPtr(n_attr, attr, 2);
24499 xmlResetLastError();
24500 if (mem_base != xmlMemBlocks()) {
24501 printf("Leak of %d blocks found in xmlIsRef",
24502 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024503 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000024504 printf(" %d", n_doc);
24505 printf(" %d", n_elem);
24506 printf(" %d", n_attr);
24507 printf("\n");
24508 }
24509 }
24510 }
24511 }
Daniel Veillardce244ad2004-11-05 10:03:46 +000024512 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024513
Daniel Veillard42595322004-11-08 10:52:06 +000024514 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024515}
24516
24517
24518static int
Daniel Veillard2ae13382005-01-25 23:45:06 +000024519test_xmlNewDocElementContent(void) {
24520 int test_ret = 0;
24521
24522 int mem_base;
24523 xmlElementContentPtr ret_val;
24524 xmlDocPtr doc; /* the document */
24525 int n_doc;
24526 xmlChar * name; /* the subelement name or NULL */
24527 int n_name;
24528 xmlElementContentType type; /* the type of element content decl */
24529 int n_type;
24530
24531 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24532 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24533 for (n_type = 0;n_type < gen_nb_xmlElementContentType;n_type++) {
24534 mem_base = xmlMemBlocks();
24535 doc = gen_xmlDocPtr(n_doc, 0);
24536 name = gen_const_xmlChar_ptr(n_name, 1);
24537 type = gen_xmlElementContentType(n_type, 2);
24538
24539 ret_val = xmlNewDocElementContent(doc, (const xmlChar *)name, type);
Daniel Veillardc394f732005-01-26 00:04:52 +000024540 xmlFreeDocElementContent(doc, ret_val); ret_val = NULL;
Daniel Veillard2ae13382005-01-25 23:45:06 +000024541 desret_xmlElementContentPtr(ret_val);
24542 call_tests++;
24543 des_xmlDocPtr(n_doc, doc, 0);
24544 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
24545 des_xmlElementContentType(n_type, type, 2);
24546 xmlResetLastError();
24547 if (mem_base != xmlMemBlocks()) {
24548 printf("Leak of %d blocks found in xmlNewDocElementContent",
24549 xmlMemBlocks() - mem_base);
24550 test_ret++;
24551 printf(" %d", n_doc);
24552 printf(" %d", n_name);
24553 printf(" %d", n_type);
24554 printf("\n");
24555 }
24556 }
24557 }
24558 }
24559 function_tests++;
24560
24561 return(test_ret);
24562}
24563
24564
24565static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000024566test_xmlNewElementContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024567 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024568
William M. Brack094dd862004-11-14 14:28:34 +000024569 int mem_base;
24570 xmlElementContentPtr ret_val;
24571 xmlChar * name; /* the subelement name or NULL */
24572 int n_name;
24573 xmlElementContentType type; /* the type of element content decl */
24574 int n_type;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024575
William M. Brack094dd862004-11-14 14:28:34 +000024576 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24577 for (n_type = 0;n_type < gen_nb_xmlElementContentType;n_type++) {
24578 mem_base = xmlMemBlocks();
24579 name = gen_const_xmlChar_ptr(n_name, 0);
24580 type = gen_xmlElementContentType(n_type, 1);
24581
24582 ret_val = xmlNewElementContent((const xmlChar *)name, type);
24583 desret_xmlElementContentPtr(ret_val);
24584 call_tests++;
24585 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
24586 des_xmlElementContentType(n_type, type, 1);
24587 xmlResetLastError();
24588 if (mem_base != xmlMemBlocks()) {
24589 printf("Leak of %d blocks found in xmlNewElementContent",
24590 xmlMemBlocks() - mem_base);
24591 test_ret++;
24592 printf(" %d", n_name);
24593 printf(" %d", n_type);
24594 printf("\n");
24595 }
24596 }
24597 }
24598 function_tests++;
24599
Daniel Veillard42595322004-11-08 10:52:06 +000024600 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024601}
24602
24603
24604static int
24605test_xmlNewValidCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024606 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024607
24608
24609 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000024610 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024611}
24612
24613
24614static int
24615test_xmlRemoveID(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024616 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024617
Daniel Veillardce244ad2004-11-05 10:03:46 +000024618 int mem_base;
24619 int ret_val;
24620 xmlDocPtr doc; /* the document */
24621 int n_doc;
24622 xmlAttrPtr attr; /* the attribute */
24623 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024624
Daniel Veillardce244ad2004-11-05 10:03:46 +000024625 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24626 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
24627 mem_base = xmlMemBlocks();
24628 doc = gen_xmlDocPtr(n_doc, 0);
24629 attr = gen_xmlAttrPtr(n_attr, 1);
24630
24631 ret_val = xmlRemoveID(doc, attr);
24632 desret_int(ret_val);
24633 call_tests++;
24634 des_xmlDocPtr(n_doc, doc, 0);
24635 des_xmlAttrPtr(n_attr, attr, 1);
24636 xmlResetLastError();
24637 if (mem_base != xmlMemBlocks()) {
24638 printf("Leak of %d blocks found in xmlRemoveID",
24639 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024640 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000024641 printf(" %d", n_doc);
24642 printf(" %d", n_attr);
24643 printf("\n");
24644 }
24645 }
24646 }
Daniel Veillardce244ad2004-11-05 10:03:46 +000024647 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024648
Daniel Veillard42595322004-11-08 10:52:06 +000024649 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024650}
24651
24652
24653static int
24654test_xmlRemoveRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024655 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024656
Daniel Veillardce244ad2004-11-05 10:03:46 +000024657 int mem_base;
24658 int ret_val;
24659 xmlDocPtr doc; /* the document */
24660 int n_doc;
24661 xmlAttrPtr attr; /* the attribute */
24662 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024663
Daniel Veillardce244ad2004-11-05 10:03:46 +000024664 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24665 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
24666 mem_base = xmlMemBlocks();
24667 doc = gen_xmlDocPtr(n_doc, 0);
24668 attr = gen_xmlAttrPtr(n_attr, 1);
24669
24670 ret_val = xmlRemoveRef(doc, attr);
24671 desret_int(ret_val);
24672 call_tests++;
24673 des_xmlDocPtr(n_doc, doc, 0);
24674 des_xmlAttrPtr(n_attr, attr, 1);
24675 xmlResetLastError();
24676 if (mem_base != xmlMemBlocks()) {
24677 printf("Leak of %d blocks found in xmlRemoveRef",
24678 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024679 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000024680 printf(" %d", n_doc);
24681 printf(" %d", n_attr);
24682 printf("\n");
24683 }
24684 }
24685 }
Daniel Veillardce244ad2004-11-05 10:03:46 +000024686 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024687
Daniel Veillard42595322004-11-08 10:52:06 +000024688 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024689}
24690
24691
24692static int
24693test_xmlSnprintfElementContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024694 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024695
Daniel Veillardce682bc2004-11-05 17:22:25 +000024696 int mem_base;
24697 char * buf; /* an output buffer */
24698 int n_buf;
24699 int size; /* the buffer size */
24700 int n_size;
24701 xmlElementContentPtr content; /* An element table */
24702 int n_content;
24703 int glob; /* 1 if one must print the englobing parenthesis, 0 otherwise */
24704 int n_glob;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024705
Daniel Veillardce682bc2004-11-05 17:22:25 +000024706 for (n_buf = 0;n_buf < gen_nb_char_ptr;n_buf++) {
24707 for (n_size = 0;n_size < gen_nb_int;n_size++) {
24708 for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) {
24709 for (n_glob = 0;n_glob < gen_nb_int;n_glob++) {
24710 mem_base = xmlMemBlocks();
24711 buf = gen_char_ptr(n_buf, 0);
24712 size = gen_int(n_size, 1);
24713 content = gen_xmlElementContentPtr(n_content, 2);
24714 glob = gen_int(n_glob, 3);
24715
24716 xmlSnprintfElementContent(buf, size, content, glob);
24717 call_tests++;
24718 des_char_ptr(n_buf, buf, 0);
24719 des_int(n_size, size, 1);
24720 des_xmlElementContentPtr(n_content, content, 2);
24721 des_int(n_glob, glob, 3);
24722 xmlResetLastError();
24723 if (mem_base != xmlMemBlocks()) {
24724 printf("Leak of %d blocks found in xmlSnprintfElementContent",
24725 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024726 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024727 printf(" %d", n_buf);
24728 printf(" %d", n_size);
24729 printf(" %d", n_content);
24730 printf(" %d", n_glob);
24731 printf("\n");
24732 }
24733 }
24734 }
24735 }
24736 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000024737 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024738
Daniel Veillard42595322004-11-08 10:52:06 +000024739 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024740}
24741
24742
24743static int
24744test_xmlSprintfElementContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024745 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024746
William M. Brack21e4ef22005-01-02 09:53:13 +000024747#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000024748#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000024749 int mem_base;
24750 char * buf; /* an output buffer */
24751 int n_buf;
24752 xmlElementContentPtr content; /* An element table */
24753 int n_content;
24754 int glob; /* 1 if one must print the englobing parenthesis, 0 otherwise */
24755 int n_glob;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024756
Daniel Veillardce682bc2004-11-05 17:22:25 +000024757 for (n_buf = 0;n_buf < gen_nb_char_ptr;n_buf++) {
24758 for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) {
24759 for (n_glob = 0;n_glob < gen_nb_int;n_glob++) {
24760 mem_base = xmlMemBlocks();
24761 buf = gen_char_ptr(n_buf, 0);
24762 content = gen_xmlElementContentPtr(n_content, 1);
24763 glob = gen_int(n_glob, 2);
24764
24765 xmlSprintfElementContent(buf, content, glob);
24766 call_tests++;
24767 des_char_ptr(n_buf, buf, 0);
24768 des_xmlElementContentPtr(n_content, content, 1);
24769 des_int(n_glob, glob, 2);
24770 xmlResetLastError();
24771 if (mem_base != xmlMemBlocks()) {
24772 printf("Leak of %d blocks found in xmlSprintfElementContent",
24773 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024774 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024775 printf(" %d", n_buf);
24776 printf(" %d", n_content);
24777 printf(" %d", n_glob);
24778 printf("\n");
24779 }
24780 }
24781 }
24782 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024783 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000024784#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000024785#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000024786
Daniel Veillard42595322004-11-08 10:52:06 +000024787 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024788}
24789
24790
24791static int
24792test_xmlValidBuildContentModel(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024793 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024794
William M. Brack21e4ef22005-01-02 09:53:13 +000024795#if defined(LIBXML_VALID_ENABLED) && defined(LIBXML_REGEXP_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000024796 int mem_base;
24797 int ret_val;
24798 xmlValidCtxtPtr ctxt; /* a validation context */
24799 int n_ctxt;
24800 xmlElementPtr elem; /* an element declaration node */
24801 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024802
Daniel Veillardce682bc2004-11-05 17:22:25 +000024803 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
24804 for (n_elem = 0;n_elem < gen_nb_xmlElementPtr;n_elem++) {
24805 mem_base = xmlMemBlocks();
24806 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
24807 elem = gen_xmlElementPtr(n_elem, 1);
24808
24809 ret_val = xmlValidBuildContentModel(ctxt, elem);
24810 desret_int(ret_val);
24811 call_tests++;
24812 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
24813 des_xmlElementPtr(n_elem, elem, 1);
24814 xmlResetLastError();
24815 if (mem_base != xmlMemBlocks()) {
24816 printf("Leak of %d blocks found in xmlValidBuildContentModel",
24817 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024818 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024819 printf(" %d", n_ctxt);
24820 printf(" %d", n_elem);
24821 printf("\n");
24822 }
24823 }
24824 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024825 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024826#endif
24827
Daniel Veillard42595322004-11-08 10:52:06 +000024828 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024829}
24830
24831
24832static int
24833test_xmlValidCtxtNormalizeAttributeValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024834 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024835
William M. Brack21e4ef22005-01-02 09:53:13 +000024836#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024837 int mem_base;
24838 xmlChar * ret_val;
24839 xmlValidCtxtPtr ctxt; /* the validation context or NULL */
24840 int n_ctxt;
24841 xmlDocPtr doc; /* the document */
24842 int n_doc;
24843 xmlNodePtr elem; /* the parent */
24844 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024845 xmlChar * name; /* the attribute name */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024846 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024847 xmlChar * value; /* the attribute value */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024848 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024849
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024850 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
24851 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24852 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
24853 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24854 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
24855 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024856 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
24857 doc = gen_xmlDocPtr(n_doc, 1);
24858 elem = gen_xmlNodePtr(n_elem, 2);
24859 name = gen_const_xmlChar_ptr(n_name, 3);
24860 value = gen_const_xmlChar_ptr(n_value, 4);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024861
William M. Brackf13f77f2004-11-12 16:03:48 +000024862 ret_val = xmlValidCtxtNormalizeAttributeValue(ctxt, doc, elem, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024863 desret_xmlChar_ptr(ret_val);
24864 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024865 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
24866 des_xmlDocPtr(n_doc, doc, 1);
24867 des_xmlNodePtr(n_elem, elem, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000024868 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 3);
24869 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 4);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024870 xmlResetLastError();
24871 if (mem_base != xmlMemBlocks()) {
24872 printf("Leak of %d blocks found in xmlValidCtxtNormalizeAttributeValue",
24873 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024874 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024875 printf(" %d", n_ctxt);
24876 printf(" %d", n_doc);
24877 printf(" %d", n_elem);
24878 printf(" %d", n_name);
24879 printf(" %d", n_value);
24880 printf("\n");
24881 }
24882 }
24883 }
24884 }
24885 }
24886 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024887 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024888#endif
24889
Daniel Veillard42595322004-11-08 10:52:06 +000024890 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024891}
24892
24893
Daniel Veillardce682bc2004-11-05 17:22:25 +000024894#define gen_nb_xmlElementContent_ptr 1
24895static xmlElementContent * gen_xmlElementContent_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
24896 return(NULL);
24897}
24898static void des_xmlElementContent_ptr(int no ATTRIBUTE_UNUSED, xmlElementContent * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
24899}
24900
Daniel Veillardd93f6252004-11-02 15:53:51 +000024901static int
24902test_xmlValidGetPotentialChildren(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024903 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024904
William M. Brack21e4ef22005-01-02 09:53:13 +000024905#if defined(LIBXML_VALID_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000024906#ifdef LIBXML_VALID_ENABLED
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024907 int mem_base;
24908 int ret_val;
24909 xmlElementContent * ctree; /* an element content tree */
24910 int n_ctree;
24911 xmlChar ** list; /* an array to store the list of child names */
24912 int n_list;
24913 int * len; /* a pointer to the number of element in the list */
24914 int n_len;
24915 int max; /* the size of the array */
24916 int n_max;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024917
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024918 for (n_ctree = 0;n_ctree < gen_nb_xmlElementContent_ptr;n_ctree++) {
24919 for (n_list = 0;n_list < gen_nb_const_xmlChar_ptr_ptr;n_list++) {
24920 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
24921 for (n_max = 0;n_max < gen_nb_int;n_max++) {
24922 mem_base = xmlMemBlocks();
24923 ctree = gen_xmlElementContent_ptr(n_ctree, 0);
24924 list = gen_const_xmlChar_ptr_ptr(n_list, 1);
24925 len = gen_int_ptr(n_len, 2);
24926 max = gen_int(n_max, 3);
24927
William M. Brackf13f77f2004-11-12 16:03:48 +000024928 ret_val = xmlValidGetPotentialChildren(ctree, (const xmlChar **)list, len, max);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024929 desret_int(ret_val);
24930 call_tests++;
24931 des_xmlElementContent_ptr(n_ctree, ctree, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024932 des_const_xmlChar_ptr_ptr(n_list, (const xmlChar **)list, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024933 des_int_ptr(n_len, len, 2);
24934 des_int(n_max, max, 3);
24935 xmlResetLastError();
24936 if (mem_base != xmlMemBlocks()) {
24937 printf("Leak of %d blocks found in xmlValidGetPotentialChildren",
24938 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024939 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024940 printf(" %d", n_ctree);
24941 printf(" %d", n_list);
24942 printf(" %d", n_len);
24943 printf(" %d", n_max);
24944 printf("\n");
24945 }
24946 }
24947 }
24948 }
24949 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024950 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000024951#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000024952#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024953
Daniel Veillard42595322004-11-08 10:52:06 +000024954 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024955}
24956
24957
24958static int
24959test_xmlValidGetValidElements(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024960 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024961
William M. Brack21e4ef22005-01-02 09:53:13 +000024962#if defined(LIBXML_VALID_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000024963#ifdef LIBXML_VALID_ENABLED
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024964 int mem_base;
24965 int ret_val;
24966 xmlNode * prev; /* an element to insert after */
24967 int n_prev;
24968 xmlNode * next; /* an element to insert next */
24969 int n_next;
24970 xmlChar ** names; /* an array to store the list of child names */
24971 int n_names;
24972 int max; /* the size of the array */
24973 int n_max;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024974
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024975 for (n_prev = 0;n_prev < gen_nb_xmlNodePtr;n_prev++) {
24976 for (n_next = 0;n_next < gen_nb_xmlNodePtr;n_next++) {
24977 for (n_names = 0;n_names < gen_nb_const_xmlChar_ptr_ptr;n_names++) {
24978 for (n_max = 0;n_max < gen_nb_int;n_max++) {
24979 mem_base = xmlMemBlocks();
24980 prev = gen_xmlNodePtr(n_prev, 0);
24981 next = gen_xmlNodePtr(n_next, 1);
24982 names = gen_const_xmlChar_ptr_ptr(n_names, 2);
24983 max = gen_int(n_max, 3);
24984
William M. Brackf13f77f2004-11-12 16:03:48 +000024985 ret_val = xmlValidGetValidElements(prev, next, (const xmlChar **)names, max);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024986 desret_int(ret_val);
24987 call_tests++;
24988 des_xmlNodePtr(n_prev, prev, 0);
24989 des_xmlNodePtr(n_next, next, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000024990 des_const_xmlChar_ptr_ptr(n_names, (const xmlChar **)names, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024991 des_int(n_max, max, 3);
24992 xmlResetLastError();
24993 if (mem_base != xmlMemBlocks()) {
24994 printf("Leak of %d blocks found in xmlValidGetValidElements",
24995 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024996 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024997 printf(" %d", n_prev);
24998 printf(" %d", n_next);
24999 printf(" %d", n_names);
25000 printf(" %d", n_max);
25001 printf("\n");
25002 }
25003 }
25004 }
25005 }
25006 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025007 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000025008#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000025009#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000025010
Daniel Veillard42595322004-11-08 10:52:06 +000025011 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025012}
25013
25014
25015static int
25016test_xmlValidNormalizeAttributeValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025017 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025018
William M. Brack21e4ef22005-01-02 09:53:13 +000025019#if defined(LIBXML_VALID_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +000025020 int mem_base;
25021 xmlChar * ret_val;
25022 xmlDocPtr doc; /* the document */
25023 int n_doc;
25024 xmlNodePtr elem; /* the parent */
25025 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025026 xmlChar * name; /* the attribute name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000025027 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025028 xmlChar * value; /* the attribute value */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000025029 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025030
Daniel Veillard8a32fe42004-11-02 22:10:16 +000025031 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25032 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25033 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
25034 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25035 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025036 doc = gen_xmlDocPtr(n_doc, 0);
25037 elem = gen_xmlNodePtr(n_elem, 1);
25038 name = gen_const_xmlChar_ptr(n_name, 2);
25039 value = gen_const_xmlChar_ptr(n_value, 3);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000025040
William M. Brackf13f77f2004-11-12 16:03:48 +000025041 ret_val = xmlValidNormalizeAttributeValue(doc, elem, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000025042 desret_xmlChar_ptr(ret_val);
25043 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025044 des_xmlDocPtr(n_doc, doc, 0);
25045 des_xmlNodePtr(n_elem, elem, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000025046 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
25047 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 3);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000025048 xmlResetLastError();
25049 if (mem_base != xmlMemBlocks()) {
25050 printf("Leak of %d blocks found in xmlValidNormalizeAttributeValue",
25051 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025052 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000025053 printf(" %d", n_doc);
25054 printf(" %d", n_elem);
25055 printf(" %d", n_name);
25056 printf(" %d", n_value);
25057 printf("\n");
25058 }
25059 }
25060 }
25061 }
25062 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025063 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000025064#endif
25065
Daniel Veillard42595322004-11-08 10:52:06 +000025066 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025067}
25068
25069
25070static int
25071test_xmlValidateAttributeDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025072 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025073
William M. Brack21e4ef22005-01-02 09:53:13 +000025074#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000025075 int mem_base;
25076 int ret_val;
25077 xmlValidCtxtPtr ctxt; /* the validation context */
25078 int n_ctxt;
25079 xmlDocPtr doc; /* a document instance */
25080 int n_doc;
25081 xmlAttributePtr attr; /* an attribute definition */
25082 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025083
Daniel Veillardce682bc2004-11-05 17:22:25 +000025084 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25085 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25086 for (n_attr = 0;n_attr < gen_nb_xmlAttributePtr;n_attr++) {
25087 mem_base = xmlMemBlocks();
25088 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25089 doc = gen_xmlDocPtr(n_doc, 1);
25090 attr = gen_xmlAttributePtr(n_attr, 2);
25091
25092 ret_val = xmlValidateAttributeDecl(ctxt, doc, attr);
25093 desret_int(ret_val);
25094 call_tests++;
25095 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25096 des_xmlDocPtr(n_doc, doc, 1);
25097 des_xmlAttributePtr(n_attr, attr, 2);
25098 xmlResetLastError();
25099 if (mem_base != xmlMemBlocks()) {
25100 printf("Leak of %d blocks found in xmlValidateAttributeDecl",
25101 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025102 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025103 printf(" %d", n_ctxt);
25104 printf(" %d", n_doc);
25105 printf(" %d", n_attr);
25106 printf("\n");
25107 }
25108 }
25109 }
25110 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025111 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025112#endif
25113
Daniel Veillard42595322004-11-08 10:52:06 +000025114 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025115}
25116
25117
25118static int
25119test_xmlValidateAttributeValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025120 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025121
William M. Brack21e4ef22005-01-02 09:53:13 +000025122#if defined(LIBXML_VALID_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +000025123 int mem_base;
25124 int ret_val;
25125 xmlAttributeType type; /* an attribute type */
25126 int n_type;
25127 xmlChar * value; /* an attribute value */
25128 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025129
Daniel Veillard57b25162004-11-06 14:50:18 +000025130 for (n_type = 0;n_type < gen_nb_xmlAttributeType;n_type++) {
25131 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25132 mem_base = xmlMemBlocks();
25133 type = gen_xmlAttributeType(n_type, 0);
25134 value = gen_const_xmlChar_ptr(n_value, 1);
25135
William M. Brackf13f77f2004-11-12 16:03:48 +000025136 ret_val = xmlValidateAttributeValue(type, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000025137 desret_int(ret_val);
25138 call_tests++;
25139 des_xmlAttributeType(n_type, type, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000025140 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillard57b25162004-11-06 14:50:18 +000025141 xmlResetLastError();
25142 if (mem_base != xmlMemBlocks()) {
25143 printf("Leak of %d blocks found in xmlValidateAttributeValue",
25144 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025145 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000025146 printf(" %d", n_type);
25147 printf(" %d", n_value);
25148 printf("\n");
25149 }
25150 }
25151 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025152 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +000025153#endif
25154
Daniel Veillard42595322004-11-08 10:52:06 +000025155 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025156}
25157
25158
25159static int
25160test_xmlValidateDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025161 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025162
William M. Brack21e4ef22005-01-02 09:53:13 +000025163#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025164 int mem_base;
25165 int ret_val;
25166 xmlValidCtxtPtr ctxt; /* the validation context */
25167 int n_ctxt;
25168 xmlDocPtr doc; /* a document instance */
25169 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025170
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025171 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25172 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25173 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025174 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25175 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025176
25177 ret_val = xmlValidateDocument(ctxt, doc);
25178 desret_int(ret_val);
25179 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025180 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25181 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025182 xmlResetLastError();
25183 if (mem_base != xmlMemBlocks()) {
25184 printf("Leak of %d blocks found in xmlValidateDocument",
25185 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025186 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025187 printf(" %d", n_ctxt);
25188 printf(" %d", n_doc);
25189 printf("\n");
25190 }
25191 }
25192 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025193 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025194#endif
25195
Daniel Veillard42595322004-11-08 10:52:06 +000025196 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025197}
25198
25199
25200static int
25201test_xmlValidateDocumentFinal(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025202 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025203
William M. Brack21e4ef22005-01-02 09:53:13 +000025204#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025205 int mem_base;
25206 int ret_val;
25207 xmlValidCtxtPtr ctxt; /* the validation context */
25208 int n_ctxt;
25209 xmlDocPtr doc; /* a document instance */
25210 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025211
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025212 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25213 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25214 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025215 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25216 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025217
25218 ret_val = xmlValidateDocumentFinal(ctxt, doc);
25219 desret_int(ret_val);
25220 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025221 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25222 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025223 xmlResetLastError();
25224 if (mem_base != xmlMemBlocks()) {
25225 printf("Leak of %d blocks found in xmlValidateDocumentFinal",
25226 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025227 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025228 printf(" %d", n_ctxt);
25229 printf(" %d", n_doc);
25230 printf("\n");
25231 }
25232 }
25233 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025234 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025235#endif
25236
Daniel Veillard42595322004-11-08 10:52:06 +000025237 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025238}
25239
25240
25241static int
25242test_xmlValidateDtd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025243 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025244
William M. Brack21e4ef22005-01-02 09:53:13 +000025245#if defined(LIBXML_VALID_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000025246 int mem_base;
25247 int ret_val;
25248 xmlValidCtxtPtr ctxt; /* the validation context */
25249 int n_ctxt;
25250 xmlDocPtr doc; /* a document instance */
25251 int n_doc;
25252 xmlDtdPtr dtd; /* a dtd instance */
25253 int n_dtd;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025254
Daniel Veillard27f20102004-11-05 11:50:11 +000025255 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25256 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25257 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
25258 mem_base = xmlMemBlocks();
25259 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25260 doc = gen_xmlDocPtr(n_doc, 1);
25261 dtd = gen_xmlDtdPtr(n_dtd, 2);
25262
25263 ret_val = xmlValidateDtd(ctxt, doc, dtd);
25264 desret_int(ret_val);
25265 call_tests++;
25266 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25267 des_xmlDocPtr(n_doc, doc, 1);
25268 des_xmlDtdPtr(n_dtd, dtd, 2);
25269 xmlResetLastError();
25270 if (mem_base != xmlMemBlocks()) {
25271 printf("Leak of %d blocks found in xmlValidateDtd",
25272 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025273 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000025274 printf(" %d", n_ctxt);
25275 printf(" %d", n_doc);
25276 printf(" %d", n_dtd);
25277 printf("\n");
25278 }
25279 }
25280 }
25281 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025282 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000025283#endif
25284
Daniel Veillard42595322004-11-08 10:52:06 +000025285 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025286}
25287
25288
25289static int
25290test_xmlValidateDtdFinal(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025291 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025292
William M. Brack21e4ef22005-01-02 09:53:13 +000025293#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025294 int mem_base;
25295 int ret_val;
25296 xmlValidCtxtPtr ctxt; /* the validation context */
25297 int n_ctxt;
25298 xmlDocPtr doc; /* a document instance */
25299 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025300
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025301 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25302 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25303 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025304 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25305 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025306
25307 ret_val = xmlValidateDtdFinal(ctxt, doc);
25308 desret_int(ret_val);
25309 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025310 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25311 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025312 xmlResetLastError();
25313 if (mem_base != xmlMemBlocks()) {
25314 printf("Leak of %d blocks found in xmlValidateDtdFinal",
25315 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025316 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025317 printf(" %d", n_ctxt);
25318 printf(" %d", n_doc);
25319 printf("\n");
25320 }
25321 }
25322 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025323 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025324#endif
25325
Daniel Veillard42595322004-11-08 10:52:06 +000025326 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025327}
25328
25329
25330static int
25331test_xmlValidateElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025332 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025333
William M. Brack21e4ef22005-01-02 09:53:13 +000025334#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025335 int mem_base;
25336 int ret_val;
25337 xmlValidCtxtPtr ctxt; /* the validation context */
25338 int n_ctxt;
25339 xmlDocPtr doc; /* a document instance */
25340 int n_doc;
25341 xmlNodePtr elem; /* an element instance */
25342 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025343
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025344 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25345 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25346 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25347 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025348 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25349 doc = gen_xmlDocPtr(n_doc, 1);
25350 elem = gen_xmlNodePtr(n_elem, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025351
25352 ret_val = xmlValidateElement(ctxt, doc, elem);
25353 desret_int(ret_val);
25354 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025355 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25356 des_xmlDocPtr(n_doc, doc, 1);
25357 des_xmlNodePtr(n_elem, elem, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025358 xmlResetLastError();
25359 if (mem_base != xmlMemBlocks()) {
25360 printf("Leak of %d blocks found in xmlValidateElement",
25361 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025362 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025363 printf(" %d", n_ctxt);
25364 printf(" %d", n_doc);
25365 printf(" %d", n_elem);
25366 printf("\n");
25367 }
25368 }
25369 }
25370 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025371 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025372#endif
25373
Daniel Veillard42595322004-11-08 10:52:06 +000025374 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025375}
25376
25377
25378static int
25379test_xmlValidateElementDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025380 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025381
William M. Brack21e4ef22005-01-02 09:53:13 +000025382#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000025383 int mem_base;
25384 int ret_val;
25385 xmlValidCtxtPtr ctxt; /* the validation context */
25386 int n_ctxt;
25387 xmlDocPtr doc; /* a document instance */
25388 int n_doc;
25389 xmlElementPtr elem; /* an element definition */
25390 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025391
Daniel Veillardce682bc2004-11-05 17:22:25 +000025392 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25393 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25394 for (n_elem = 0;n_elem < gen_nb_xmlElementPtr;n_elem++) {
25395 mem_base = xmlMemBlocks();
25396 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25397 doc = gen_xmlDocPtr(n_doc, 1);
25398 elem = gen_xmlElementPtr(n_elem, 2);
25399
25400 ret_val = xmlValidateElementDecl(ctxt, doc, elem);
25401 desret_int(ret_val);
25402 call_tests++;
25403 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25404 des_xmlDocPtr(n_doc, doc, 1);
25405 des_xmlElementPtr(n_elem, elem, 2);
25406 xmlResetLastError();
25407 if (mem_base != xmlMemBlocks()) {
25408 printf("Leak of %d blocks found in xmlValidateElementDecl",
25409 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025410 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025411 printf(" %d", n_ctxt);
25412 printf(" %d", n_doc);
25413 printf(" %d", n_elem);
25414 printf("\n");
25415 }
25416 }
25417 }
25418 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025419 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025420#endif
25421
Daniel Veillard42595322004-11-08 10:52:06 +000025422 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025423}
25424
25425
25426static int
25427test_xmlValidateNameValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025428 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025429
William M. Brack21e4ef22005-01-02 09:53:13 +000025430#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000025431 int mem_base;
25432 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025433 xmlChar * value; /* an Name value */
Daniel Veillardd93f6252004-11-02 15:53:51 +000025434 int n_value;
25435
25436 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25437 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025438 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025439
William M. Brackf13f77f2004-11-12 16:03:48 +000025440 ret_val = xmlValidateNameValue((const xmlChar *)value);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025441 desret_int(ret_val);
25442 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000025443 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025444 xmlResetLastError();
25445 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025446 printf("Leak of %d blocks found in xmlValidateNameValue",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025447 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025448 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025449 printf(" %d", n_value);
25450 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025451 }
25452 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025453 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025454#endif
25455
Daniel Veillard42595322004-11-08 10:52:06 +000025456 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025457}
25458
25459
25460static int
25461test_xmlValidateNamesValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025462 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025463
William M. Brack21e4ef22005-01-02 09:53:13 +000025464#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000025465 int mem_base;
25466 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025467 xmlChar * value; /* an Names value */
Daniel Veillardd93f6252004-11-02 15:53:51 +000025468 int n_value;
25469
25470 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25471 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025472 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025473
William M. Brackf13f77f2004-11-12 16:03:48 +000025474 ret_val = xmlValidateNamesValue((const xmlChar *)value);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025475 desret_int(ret_val);
25476 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000025477 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025478 xmlResetLastError();
25479 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025480 printf("Leak of %d blocks found in xmlValidateNamesValue",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025481 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025482 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025483 printf(" %d", n_value);
25484 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025485 }
25486 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025487 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025488#endif
25489
Daniel Veillard42595322004-11-08 10:52:06 +000025490 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025491}
25492
25493
25494static int
25495test_xmlValidateNmtokenValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025496 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025497
William M. Brack21e4ef22005-01-02 09:53:13 +000025498#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000025499 int mem_base;
25500 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025501 xmlChar * value; /* an Nmtoken value */
Daniel Veillardd93f6252004-11-02 15:53:51 +000025502 int n_value;
25503
25504 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25505 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025506 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025507
William M. Brackf13f77f2004-11-12 16:03:48 +000025508 ret_val = xmlValidateNmtokenValue((const xmlChar *)value);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025509 desret_int(ret_val);
25510 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000025511 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025512 xmlResetLastError();
25513 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025514 printf("Leak of %d blocks found in xmlValidateNmtokenValue",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025515 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025516 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025517 printf(" %d", n_value);
25518 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025519 }
25520 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025521 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025522#endif
25523
Daniel Veillard42595322004-11-08 10:52:06 +000025524 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025525}
25526
25527
25528static int
25529test_xmlValidateNmtokensValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025530 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025531
William M. Brack21e4ef22005-01-02 09:53:13 +000025532#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000025533 int mem_base;
25534 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025535 xmlChar * value; /* an Nmtokens value */
Daniel Veillardd93f6252004-11-02 15:53:51 +000025536 int n_value;
25537
25538 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25539 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025540 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025541
William M. Brackf13f77f2004-11-12 16:03:48 +000025542 ret_val = xmlValidateNmtokensValue((const xmlChar *)value);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025543 desret_int(ret_val);
25544 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000025545 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025546 xmlResetLastError();
25547 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025548 printf("Leak of %d blocks found in xmlValidateNmtokensValue",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025549 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025550 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025551 printf(" %d", n_value);
25552 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025553 }
25554 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025555 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025556#endif
25557
Daniel Veillard42595322004-11-08 10:52:06 +000025558 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025559}
25560
25561
25562static int
25563test_xmlValidateNotationDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025564 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025565
William M. Brack21e4ef22005-01-02 09:53:13 +000025566#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000025567 int mem_base;
25568 int ret_val;
25569 xmlValidCtxtPtr ctxt; /* the validation context */
25570 int n_ctxt;
25571 xmlDocPtr doc; /* a document instance */
25572 int n_doc;
25573 xmlNotationPtr nota; /* a notation definition */
25574 int n_nota;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025575
Daniel Veillardce682bc2004-11-05 17:22:25 +000025576 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25577 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25578 for (n_nota = 0;n_nota < gen_nb_xmlNotationPtr;n_nota++) {
25579 mem_base = xmlMemBlocks();
25580 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25581 doc = gen_xmlDocPtr(n_doc, 1);
25582 nota = gen_xmlNotationPtr(n_nota, 2);
25583
25584 ret_val = xmlValidateNotationDecl(ctxt, doc, nota);
25585 desret_int(ret_val);
25586 call_tests++;
25587 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25588 des_xmlDocPtr(n_doc, doc, 1);
25589 des_xmlNotationPtr(n_nota, nota, 2);
25590 xmlResetLastError();
25591 if (mem_base != xmlMemBlocks()) {
25592 printf("Leak of %d blocks found in xmlValidateNotationDecl",
25593 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025594 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025595 printf(" %d", n_ctxt);
25596 printf(" %d", n_doc);
25597 printf(" %d", n_nota);
25598 printf("\n");
25599 }
25600 }
25601 }
25602 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025603 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025604#endif
25605
Daniel Veillard42595322004-11-08 10:52:06 +000025606 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025607}
25608
25609
25610static int
25611test_xmlValidateNotationUse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025612 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025613
William M. Brack21e4ef22005-01-02 09:53:13 +000025614#if defined(LIBXML_VALID_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025615 int mem_base;
25616 int ret_val;
25617 xmlValidCtxtPtr ctxt; /* the validation context */
25618 int n_ctxt;
25619 xmlDocPtr doc; /* the document */
25620 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025621 xmlChar * notationName; /* the notation name to check */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025622 int n_notationName;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025623
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025624 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25625 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25626 for (n_notationName = 0;n_notationName < gen_nb_const_xmlChar_ptr;n_notationName++) {
25627 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025628 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25629 doc = gen_xmlDocPtr(n_doc, 1);
25630 notationName = gen_const_xmlChar_ptr(n_notationName, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025631
William M. Brackf13f77f2004-11-12 16:03:48 +000025632 ret_val = xmlValidateNotationUse(ctxt, doc, (const xmlChar *)notationName);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025633 desret_int(ret_val);
25634 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025635 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25636 des_xmlDocPtr(n_doc, doc, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000025637 des_const_xmlChar_ptr(n_notationName, (const xmlChar *)notationName, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025638 xmlResetLastError();
25639 if (mem_base != xmlMemBlocks()) {
25640 printf("Leak of %d blocks found in xmlValidateNotationUse",
25641 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025642 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025643 printf(" %d", n_ctxt);
25644 printf(" %d", n_doc);
25645 printf(" %d", n_notationName);
25646 printf("\n");
25647 }
25648 }
25649 }
25650 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025651 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025652#endif
25653
Daniel Veillard42595322004-11-08 10:52:06 +000025654 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025655}
25656
25657
25658static int
25659test_xmlValidateOneAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025660 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025661
William M. Brack21e4ef22005-01-02 09:53:13 +000025662#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardce244ad2004-11-05 10:03:46 +000025663 int mem_base;
25664 int ret_val;
25665 xmlValidCtxtPtr ctxt; /* the validation context */
25666 int n_ctxt;
25667 xmlDocPtr doc; /* a document instance */
25668 int n_doc;
25669 xmlNodePtr elem; /* an element instance */
25670 int n_elem;
25671 xmlAttrPtr attr; /* an attribute instance */
25672 int n_attr;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025673 xmlChar * value; /* the attribute value (without entities processing) */
Daniel Veillardce244ad2004-11-05 10:03:46 +000025674 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025675
Daniel Veillardce244ad2004-11-05 10:03:46 +000025676 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25677 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25678 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25679 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
25680 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25681 mem_base = xmlMemBlocks();
25682 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25683 doc = gen_xmlDocPtr(n_doc, 1);
25684 elem = gen_xmlNodePtr(n_elem, 2);
25685 attr = gen_xmlAttrPtr(n_attr, 3);
25686 value = gen_const_xmlChar_ptr(n_value, 4);
25687
William M. Brackf13f77f2004-11-12 16:03:48 +000025688 ret_val = xmlValidateOneAttribute(ctxt, doc, elem, attr, (const xmlChar *)value);
Daniel Veillardce244ad2004-11-05 10:03:46 +000025689 desret_int(ret_val);
25690 call_tests++;
25691 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25692 des_xmlDocPtr(n_doc, doc, 1);
25693 des_xmlNodePtr(n_elem, elem, 2);
25694 des_xmlAttrPtr(n_attr, attr, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000025695 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 4);
Daniel Veillardce244ad2004-11-05 10:03:46 +000025696 xmlResetLastError();
25697 if (mem_base != xmlMemBlocks()) {
25698 printf("Leak of %d blocks found in xmlValidateOneAttribute",
25699 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025700 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000025701 printf(" %d", n_ctxt);
25702 printf(" %d", n_doc);
25703 printf(" %d", n_elem);
25704 printf(" %d", n_attr);
25705 printf(" %d", n_value);
25706 printf("\n");
25707 }
25708 }
25709 }
25710 }
25711 }
25712 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025713 function_tests++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000025714#endif
25715
Daniel Veillard42595322004-11-08 10:52:06 +000025716 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025717}
25718
25719
25720static int
25721test_xmlValidateOneElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025722 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025723
William M. Brack21e4ef22005-01-02 09:53:13 +000025724#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025725 int mem_base;
25726 int ret_val;
25727 xmlValidCtxtPtr ctxt; /* the validation context */
25728 int n_ctxt;
25729 xmlDocPtr doc; /* a document instance */
25730 int n_doc;
25731 xmlNodePtr elem; /* an element instance */
25732 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025733
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025734 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25735 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25736 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25737 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025738 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25739 doc = gen_xmlDocPtr(n_doc, 1);
25740 elem = gen_xmlNodePtr(n_elem, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025741
25742 ret_val = xmlValidateOneElement(ctxt, doc, elem);
25743 desret_int(ret_val);
25744 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025745 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25746 des_xmlDocPtr(n_doc, doc, 1);
25747 des_xmlNodePtr(n_elem, elem, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025748 xmlResetLastError();
25749 if (mem_base != xmlMemBlocks()) {
25750 printf("Leak of %d blocks found in xmlValidateOneElement",
25751 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025752 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025753 printf(" %d", n_ctxt);
25754 printf(" %d", n_doc);
25755 printf(" %d", n_elem);
25756 printf("\n");
25757 }
25758 }
25759 }
25760 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025761 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025762#endif
25763
Daniel Veillard42595322004-11-08 10:52:06 +000025764 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025765}
25766
25767
25768static int
25769test_xmlValidateOneNamespace(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025770 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025771
William M. Brack21e4ef22005-01-02 09:53:13 +000025772#if defined(LIBXML_VALID_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000025773 int mem_base;
25774 int ret_val;
25775 xmlValidCtxtPtr ctxt; /* the validation context */
25776 int n_ctxt;
25777 xmlDocPtr doc; /* a document instance */
25778 int n_doc;
25779 xmlNodePtr elem; /* an element instance */
25780 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025781 xmlChar * prefix; /* the namespace prefix */
Daniel Veillard27f20102004-11-05 11:50:11 +000025782 int n_prefix;
25783 xmlNsPtr ns; /* an namespace declaration instance */
25784 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025785 xmlChar * value; /* the attribute value (without entities processing) */
Daniel Veillard27f20102004-11-05 11:50:11 +000025786 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025787
Daniel Veillard27f20102004-11-05 11:50:11 +000025788 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25789 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25790 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25791 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
25792 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
25793 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25794 mem_base = xmlMemBlocks();
25795 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25796 doc = gen_xmlDocPtr(n_doc, 1);
25797 elem = gen_xmlNodePtr(n_elem, 2);
25798 prefix = gen_const_xmlChar_ptr(n_prefix, 3);
25799 ns = gen_xmlNsPtr(n_ns, 4);
25800 value = gen_const_xmlChar_ptr(n_value, 5);
25801
William M. Brackf13f77f2004-11-12 16:03:48 +000025802 ret_val = xmlValidateOneNamespace(ctxt, doc, elem, (const xmlChar *)prefix, ns, (const xmlChar *)value);
Daniel Veillard27f20102004-11-05 11:50:11 +000025803 desret_int(ret_val);
25804 call_tests++;
25805 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25806 des_xmlDocPtr(n_doc, doc, 1);
25807 des_xmlNodePtr(n_elem, elem, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000025808 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000025809 des_xmlNsPtr(n_ns, ns, 4);
William M. Brackf13f77f2004-11-12 16:03:48 +000025810 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 5);
Daniel Veillard27f20102004-11-05 11:50:11 +000025811 xmlResetLastError();
25812 if (mem_base != xmlMemBlocks()) {
25813 printf("Leak of %d blocks found in xmlValidateOneNamespace",
25814 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025815 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000025816 printf(" %d", n_ctxt);
25817 printf(" %d", n_doc);
25818 printf(" %d", n_elem);
25819 printf(" %d", n_prefix);
25820 printf(" %d", n_ns);
25821 printf(" %d", n_value);
25822 printf("\n");
25823 }
25824 }
25825 }
25826 }
25827 }
25828 }
25829 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025830 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000025831#endif
25832
Daniel Veillard42595322004-11-08 10:52:06 +000025833 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025834}
25835
25836
25837static int
25838test_xmlValidatePopElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025839 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025840
William M. Brack21e4ef22005-01-02 09:53:13 +000025841#if defined(LIBXML_VALID_ENABLED) && defined(LIBXML_REGEXP_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025842 int mem_base;
25843 int ret_val;
25844 xmlValidCtxtPtr ctxt; /* the validation context */
25845 int n_ctxt;
25846 xmlDocPtr doc; /* a document instance */
25847 int n_doc;
25848 xmlNodePtr elem; /* an element instance */
25849 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025850 xmlChar * qname; /* the qualified name as appearing in the serialization */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025851 int n_qname;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025852
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025853 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25854 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25855 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25856 for (n_qname = 0;n_qname < gen_nb_const_xmlChar_ptr;n_qname++) {
25857 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025858 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25859 doc = gen_xmlDocPtr(n_doc, 1);
25860 elem = gen_xmlNodePtr(n_elem, 2);
25861 qname = gen_const_xmlChar_ptr(n_qname, 3);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025862
William M. Brackf13f77f2004-11-12 16:03:48 +000025863 ret_val = xmlValidatePopElement(ctxt, doc, elem, (const xmlChar *)qname);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025864 desret_int(ret_val);
25865 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025866 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25867 des_xmlDocPtr(n_doc, doc, 1);
25868 des_xmlNodePtr(n_elem, elem, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000025869 des_const_xmlChar_ptr(n_qname, (const xmlChar *)qname, 3);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025870 xmlResetLastError();
25871 if (mem_base != xmlMemBlocks()) {
25872 printf("Leak of %d blocks found in xmlValidatePopElement",
25873 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025874 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025875 printf(" %d", n_ctxt);
25876 printf(" %d", n_doc);
25877 printf(" %d", n_elem);
25878 printf(" %d", n_qname);
25879 printf("\n");
25880 }
25881 }
25882 }
25883 }
25884 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025885 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025886#endif
25887
Daniel Veillard42595322004-11-08 10:52:06 +000025888 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025889}
25890
25891
25892static int
25893test_xmlValidatePushCData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025894 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025895
William M. Brack21e4ef22005-01-02 09:53:13 +000025896#if defined(LIBXML_VALID_ENABLED) && defined(LIBXML_REGEXP_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025897 int mem_base;
25898 int ret_val;
25899 xmlValidCtxtPtr ctxt; /* the validation context */
25900 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025901 xmlChar * data; /* some character data read */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025902 int n_data;
25903 int len; /* the lenght of the data */
25904 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025905
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025906 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25907 for (n_data = 0;n_data < gen_nb_const_xmlChar_ptr;n_data++) {
25908 for (n_len = 0;n_len < gen_nb_int;n_len++) {
25909 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025910 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25911 data = gen_const_xmlChar_ptr(n_data, 1);
25912 len = gen_int(n_len, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025913
William M. Brackf13f77f2004-11-12 16:03:48 +000025914 ret_val = xmlValidatePushCData(ctxt, (const xmlChar *)data, len);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025915 desret_int(ret_val);
25916 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025917 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000025918 des_const_xmlChar_ptr(n_data, (const xmlChar *)data, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000025919 des_int(n_len, len, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025920 xmlResetLastError();
25921 if (mem_base != xmlMemBlocks()) {
25922 printf("Leak of %d blocks found in xmlValidatePushCData",
25923 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025924 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025925 printf(" %d", n_ctxt);
25926 printf(" %d", n_data);
25927 printf(" %d", n_len);
25928 printf("\n");
25929 }
25930 }
25931 }
25932 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025933 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025934#endif
25935
Daniel Veillard42595322004-11-08 10:52:06 +000025936 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025937}
25938
25939
25940static int
25941test_xmlValidatePushElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025942 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025943
William M. Brack21e4ef22005-01-02 09:53:13 +000025944#if defined(LIBXML_VALID_ENABLED) && defined(LIBXML_REGEXP_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025945 int mem_base;
25946 int ret_val;
25947 xmlValidCtxtPtr ctxt; /* the validation context */
25948 int n_ctxt;
25949 xmlDocPtr doc; /* a document instance */
25950 int n_doc;
25951 xmlNodePtr elem; /* an element instance */
25952 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025953 xmlChar * qname; /* the qualified name as appearing in the serialization */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025954 int n_qname;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025955
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025956 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25957 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25958 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25959 for (n_qname = 0;n_qname < gen_nb_const_xmlChar_ptr;n_qname++) {
25960 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025961 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25962 doc = gen_xmlDocPtr(n_doc, 1);
25963 elem = gen_xmlNodePtr(n_elem, 2);
25964 qname = gen_const_xmlChar_ptr(n_qname, 3);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025965
William M. Brackf13f77f2004-11-12 16:03:48 +000025966 ret_val = xmlValidatePushElement(ctxt, doc, elem, (const xmlChar *)qname);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025967 desret_int(ret_val);
25968 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025969 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25970 des_xmlDocPtr(n_doc, doc, 1);
25971 des_xmlNodePtr(n_elem, elem, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000025972 des_const_xmlChar_ptr(n_qname, (const xmlChar *)qname, 3);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025973 xmlResetLastError();
25974 if (mem_base != xmlMemBlocks()) {
25975 printf("Leak of %d blocks found in xmlValidatePushElement",
25976 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025977 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025978 printf(" %d", n_ctxt);
25979 printf(" %d", n_doc);
25980 printf(" %d", n_elem);
25981 printf(" %d", n_qname);
25982 printf("\n");
25983 }
25984 }
25985 }
25986 }
25987 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025988 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025989#endif
25990
Daniel Veillard42595322004-11-08 10:52:06 +000025991 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025992}
25993
25994
25995static int
25996test_xmlValidateRoot(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025997 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025998
William M. Brack21e4ef22005-01-02 09:53:13 +000025999#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000026000 int mem_base;
26001 int ret_val;
26002 xmlValidCtxtPtr ctxt; /* the validation context */
26003 int n_ctxt;
26004 xmlDocPtr doc; /* a document instance */
26005 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026006
Daniel Veillardc0be74b2004-11-03 19:16:55 +000026007 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
26008 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
26009 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026010 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
26011 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000026012
26013 ret_val = xmlValidateRoot(ctxt, doc);
26014 desret_int(ret_val);
26015 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026016 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
26017 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000026018 xmlResetLastError();
26019 if (mem_base != xmlMemBlocks()) {
26020 printf("Leak of %d blocks found in xmlValidateRoot",
26021 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026022 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000026023 printf(" %d", n_ctxt);
26024 printf(" %d", n_doc);
26025 printf("\n");
26026 }
26027 }
26028 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026029 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000026030#endif
26031
Daniel Veillard42595322004-11-08 10:52:06 +000026032 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026033}
26034
26035static int
26036test_valid(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026037 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026038
Daniel Veillard2ae13382005-01-25 23:45:06 +000026039 if (quiet == 0) printf("Testing valid : 50 of 70 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000026040 test_ret += test_xmlAddAttributeDecl();
26041 test_ret += test_xmlAddElementDecl();
26042 test_ret += test_xmlAddID();
26043 test_ret += test_xmlAddNotationDecl();
26044 test_ret += test_xmlAddRef();
26045 test_ret += test_xmlCopyAttributeTable();
Daniel Veillard2ae13382005-01-25 23:45:06 +000026046 test_ret += test_xmlCopyDocElementContent();
Daniel Veillard42595322004-11-08 10:52:06 +000026047 test_ret += test_xmlCopyElementContent();
26048 test_ret += test_xmlCopyElementTable();
26049 test_ret += test_xmlCopyEnumeration();
26050 test_ret += test_xmlCopyNotationTable();
26051 test_ret += test_xmlCreateEnumeration();
26052 test_ret += test_xmlDumpAttributeDecl();
26053 test_ret += test_xmlDumpAttributeTable();
26054 test_ret += test_xmlDumpElementDecl();
26055 test_ret += test_xmlDumpElementTable();
26056 test_ret += test_xmlDumpNotationDecl();
26057 test_ret += test_xmlDumpNotationTable();
26058 test_ret += test_xmlGetDtdAttrDesc();
26059 test_ret += test_xmlGetDtdElementDesc();
26060 test_ret += test_xmlGetDtdNotationDesc();
26061 test_ret += test_xmlGetDtdQAttrDesc();
26062 test_ret += test_xmlGetDtdQElementDesc();
26063 test_ret += test_xmlGetID();
26064 test_ret += test_xmlGetRefs();
26065 test_ret += test_xmlIsID();
26066 test_ret += test_xmlIsMixedElement();
26067 test_ret += test_xmlIsRef();
Daniel Veillard2ae13382005-01-25 23:45:06 +000026068 test_ret += test_xmlNewDocElementContent();
Daniel Veillard42595322004-11-08 10:52:06 +000026069 test_ret += test_xmlNewElementContent();
26070 test_ret += test_xmlNewValidCtxt();
26071 test_ret += test_xmlRemoveID();
26072 test_ret += test_xmlRemoveRef();
26073 test_ret += test_xmlSnprintfElementContent();
26074 test_ret += test_xmlSprintfElementContent();
26075 test_ret += test_xmlValidBuildContentModel();
26076 test_ret += test_xmlValidCtxtNormalizeAttributeValue();
26077 test_ret += test_xmlValidGetPotentialChildren();
26078 test_ret += test_xmlValidGetValidElements();
26079 test_ret += test_xmlValidNormalizeAttributeValue();
26080 test_ret += test_xmlValidateAttributeDecl();
26081 test_ret += test_xmlValidateAttributeValue();
26082 test_ret += test_xmlValidateDocument();
26083 test_ret += test_xmlValidateDocumentFinal();
26084 test_ret += test_xmlValidateDtd();
26085 test_ret += test_xmlValidateDtdFinal();
26086 test_ret += test_xmlValidateElement();
26087 test_ret += test_xmlValidateElementDecl();
26088 test_ret += test_xmlValidateNameValue();
26089 test_ret += test_xmlValidateNamesValue();
26090 test_ret += test_xmlValidateNmtokenValue();
26091 test_ret += test_xmlValidateNmtokensValue();
26092 test_ret += test_xmlValidateNotationDecl();
26093 test_ret += test_xmlValidateNotationUse();
26094 test_ret += test_xmlValidateOneAttribute();
26095 test_ret += test_xmlValidateOneElement();
26096 test_ret += test_xmlValidateOneNamespace();
26097 test_ret += test_xmlValidatePopElement();
26098 test_ret += test_xmlValidatePushCData();
26099 test_ret += test_xmlValidatePushElement();
26100 test_ret += test_xmlValidateRoot();
Daniel Veillardd93f6252004-11-02 15:53:51 +000026101
Daniel Veillard42595322004-11-08 10:52:06 +000026102 if (test_ret != 0)
26103 printf("Module valid: %d errors\n", test_ret);
26104 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026105}
26106
26107static int
26108test_xmlXIncludeNewContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026109 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026110
26111
26112 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000026113 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026114}
26115
26116
26117static int
26118test_xmlXIncludeProcess(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026119 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026120
William M. Brack21e4ef22005-01-02 09:53:13 +000026121#if defined(LIBXML_XINCLUDE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000026122 int mem_base;
26123 int ret_val;
26124 xmlDocPtr doc; /* an XML document */
26125 int n_doc;
26126
26127 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
26128 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026129 doc = gen_xmlDocPtr(n_doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026130
26131 ret_val = xmlXIncludeProcess(doc);
26132 desret_int(ret_val);
26133 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026134 des_xmlDocPtr(n_doc, doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026135 xmlResetLastError();
26136 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026137 printf("Leak of %d blocks found in xmlXIncludeProcess",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026138 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026139 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026140 printf(" %d", n_doc);
26141 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026142 }
26143 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026144 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026145#endif
26146
Daniel Veillard42595322004-11-08 10:52:06 +000026147 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026148}
26149
26150
26151static int
26152test_xmlXIncludeProcessFlags(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026153 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026154
William M. Brack21e4ef22005-01-02 09:53:13 +000026155#if defined(LIBXML_XINCLUDE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000026156 int mem_base;
26157 int ret_val;
26158 xmlDocPtr doc; /* an XML document */
26159 int n_doc;
26160 int flags; /* a set of xmlParserOption used for parsing XML includes */
26161 int n_flags;
26162
26163 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
26164 for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
26165 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026166 doc = gen_xmlDocPtr(n_doc, 0);
26167 flags = gen_int(n_flags, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026168
26169 ret_val = xmlXIncludeProcessFlags(doc, flags);
26170 desret_int(ret_val);
26171 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026172 des_xmlDocPtr(n_doc, doc, 0);
26173 des_int(n_flags, flags, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026174 xmlResetLastError();
26175 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026176 printf("Leak of %d blocks found in xmlXIncludeProcessFlags",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026177 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026178 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026179 printf(" %d", n_doc);
26180 printf(" %d", n_flags);
26181 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026182 }
26183 }
26184 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026185 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026186#endif
26187
Daniel Veillard42595322004-11-08 10:52:06 +000026188 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026189}
26190
Daniel Veillarda521d282004-11-09 14:59:59 +000026191#ifdef LIBXML_XINCLUDE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000026192
Daniel Veillardce682bc2004-11-05 17:22:25 +000026193#define gen_nb_xmlXIncludeCtxtPtr 1
26194static xmlXIncludeCtxtPtr gen_xmlXIncludeCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
26195 return(NULL);
26196}
26197static void des_xmlXIncludeCtxtPtr(int no ATTRIBUTE_UNUSED, xmlXIncludeCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
26198}
Daniel Veillarda521d282004-11-09 14:59:59 +000026199#endif
26200
Daniel Veillardce682bc2004-11-05 17:22:25 +000026201
Daniel Veillardd93f6252004-11-02 15:53:51 +000026202static int
26203test_xmlXIncludeProcessNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026204 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026205
William M. Brack21e4ef22005-01-02 09:53:13 +000026206#if defined(LIBXML_XINCLUDE_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000026207 int mem_base;
26208 int ret_val;
26209 xmlXIncludeCtxtPtr ctxt; /* an existing XInclude context */
26210 int n_ctxt;
26211 xmlNodePtr node; /* a node in an XML document */
26212 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026213
Daniel Veillardce682bc2004-11-05 17:22:25 +000026214 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXIncludeCtxtPtr;n_ctxt++) {
26215 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
26216 mem_base = xmlMemBlocks();
26217 ctxt = gen_xmlXIncludeCtxtPtr(n_ctxt, 0);
26218 node = gen_xmlNodePtr(n_node, 1);
26219
26220 ret_val = xmlXIncludeProcessNode(ctxt, node);
26221 desret_int(ret_val);
26222 call_tests++;
26223 des_xmlXIncludeCtxtPtr(n_ctxt, ctxt, 0);
26224 des_xmlNodePtr(n_node, node, 1);
26225 xmlResetLastError();
26226 if (mem_base != xmlMemBlocks()) {
26227 printf("Leak of %d blocks found in xmlXIncludeProcessNode",
26228 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026229 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026230 printf(" %d", n_ctxt);
26231 printf(" %d", n_node);
26232 printf("\n");
26233 }
26234 }
26235 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026236 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026237#endif
26238
Daniel Veillard42595322004-11-08 10:52:06 +000026239 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026240}
26241
26242
26243static int
26244test_xmlXIncludeProcessTree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026245 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026246
William M. Brack21e4ef22005-01-02 09:53:13 +000026247#if defined(LIBXML_XINCLUDE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000026248 int mem_base;
26249 int ret_val;
26250 xmlNodePtr tree; /* a node in an XML document */
26251 int n_tree;
26252
26253 for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) {
26254 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026255 tree = gen_xmlNodePtr(n_tree, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026256
26257 ret_val = xmlXIncludeProcessTree(tree);
26258 desret_int(ret_val);
26259 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026260 des_xmlNodePtr(n_tree, tree, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026261 xmlResetLastError();
26262 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026263 printf("Leak of %d blocks found in xmlXIncludeProcessTree",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026264 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026265 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026266 printf(" %d", n_tree);
26267 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026268 }
26269 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026270 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026271#endif
26272
Daniel Veillard42595322004-11-08 10:52:06 +000026273 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026274}
26275
26276
26277static int
26278test_xmlXIncludeProcessTreeFlags(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026279 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026280
William M. Brack21e4ef22005-01-02 09:53:13 +000026281#if defined(LIBXML_XINCLUDE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000026282 int mem_base;
26283 int ret_val;
26284 xmlNodePtr tree; /* a node in an XML document */
26285 int n_tree;
26286 int flags; /* a set of xmlParserOption used for parsing XML includes */
26287 int n_flags;
26288
26289 for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) {
26290 for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
26291 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026292 tree = gen_xmlNodePtr(n_tree, 0);
26293 flags = gen_int(n_flags, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026294
26295 ret_val = xmlXIncludeProcessTreeFlags(tree, flags);
26296 desret_int(ret_val);
26297 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026298 des_xmlNodePtr(n_tree, tree, 0);
26299 des_int(n_flags, flags, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026300 xmlResetLastError();
26301 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026302 printf("Leak of %d blocks found in xmlXIncludeProcessTreeFlags",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026303 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026304 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026305 printf(" %d", n_tree);
26306 printf(" %d", n_flags);
26307 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026308 }
26309 }
26310 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026311 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026312#endif
26313
Daniel Veillard42595322004-11-08 10:52:06 +000026314 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026315}
26316
26317
26318static int
26319test_xmlXIncludeSetFlags(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026320 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026321
William M. Brack21e4ef22005-01-02 09:53:13 +000026322#if defined(LIBXML_XINCLUDE_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000026323 int mem_base;
26324 int ret_val;
26325 xmlXIncludeCtxtPtr ctxt; /* an XInclude processing context */
26326 int n_ctxt;
26327 int flags; /* a set of xmlParserOption used for parsing XML includes */
26328 int n_flags;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026329
Daniel Veillardce682bc2004-11-05 17:22:25 +000026330 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXIncludeCtxtPtr;n_ctxt++) {
26331 for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
26332 mem_base = xmlMemBlocks();
26333 ctxt = gen_xmlXIncludeCtxtPtr(n_ctxt, 0);
26334 flags = gen_int(n_flags, 1);
26335
26336 ret_val = xmlXIncludeSetFlags(ctxt, flags);
26337 desret_int(ret_val);
26338 call_tests++;
26339 des_xmlXIncludeCtxtPtr(n_ctxt, ctxt, 0);
26340 des_int(n_flags, flags, 1);
26341 xmlResetLastError();
26342 if (mem_base != xmlMemBlocks()) {
26343 printf("Leak of %d blocks found in xmlXIncludeSetFlags",
26344 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026345 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026346 printf(" %d", n_ctxt);
26347 printf(" %d", n_flags);
26348 printf("\n");
26349 }
26350 }
26351 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026352 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026353#endif
26354
Daniel Veillard42595322004-11-08 10:52:06 +000026355 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026356}
26357
26358static int
26359test_xinclude(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026360 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026361
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026362 if (quiet == 0) printf("Testing xinclude : 6 of 8 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000026363 test_ret += test_xmlXIncludeNewContext();
26364 test_ret += test_xmlXIncludeProcess();
26365 test_ret += test_xmlXIncludeProcessFlags();
26366 test_ret += test_xmlXIncludeProcessNode();
26367 test_ret += test_xmlXIncludeProcessTree();
26368 test_ret += test_xmlXIncludeProcessTreeFlags();
26369 test_ret += test_xmlXIncludeSetFlags();
Daniel Veillardd93f6252004-11-02 15:53:51 +000026370
Daniel Veillard42595322004-11-08 10:52:06 +000026371 if (test_ret != 0)
26372 printf("Module xinclude: %d errors\n", test_ret);
26373 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026374}
26375
26376static int
26377test_xmlAllocOutputBuffer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026378 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026379
William M. Brack21e4ef22005-01-02 09:53:13 +000026380#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000026381 int mem_base;
26382 xmlOutputBufferPtr ret_val;
26383 xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */
26384 int n_encoder;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026385
Daniel Veillard3d95c732004-11-06 22:25:14 +000026386 for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) {
26387 mem_base = xmlMemBlocks();
26388 encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 0);
26389
26390 ret_val = xmlAllocOutputBuffer(encoder);
26391 desret_xmlOutputBufferPtr(ret_val);
26392 call_tests++;
26393 des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 0);
26394 xmlResetLastError();
26395 if (mem_base != xmlMemBlocks()) {
26396 printf("Leak of %d blocks found in xmlAllocOutputBuffer",
26397 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026398 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000026399 printf(" %d", n_encoder);
26400 printf("\n");
26401 }
26402 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026403 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000026404#endif
26405
Daniel Veillard42595322004-11-08 10:52:06 +000026406 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026407}
26408
26409
26410static int
26411test_xmlAllocParserInputBuffer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026412 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026413
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026414 int mem_base;
26415 xmlParserInputBufferPtr ret_val;
26416 xmlCharEncoding enc; /* the charset encoding if known */
26417 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026418
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026419 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
26420 mem_base = xmlMemBlocks();
26421 enc = gen_xmlCharEncoding(n_enc, 0);
26422
26423 ret_val = xmlAllocParserInputBuffer(enc);
26424 desret_xmlParserInputBufferPtr(ret_val);
26425 call_tests++;
26426 des_xmlCharEncoding(n_enc, enc, 0);
26427 xmlResetLastError();
26428 if (mem_base != xmlMemBlocks()) {
26429 printf("Leak of %d blocks found in xmlAllocParserInputBuffer",
26430 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026431 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026432 printf(" %d", n_enc);
26433 printf("\n");
26434 }
26435 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026436 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026437
Daniel Veillard42595322004-11-08 10:52:06 +000026438 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026439}
26440
26441
26442static int
26443test_xmlCheckFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026444 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026445
26446 int mem_base;
26447 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026448 char * path; /* the path to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000026449 int n_path;
26450
26451 for (n_path = 0;n_path < gen_nb_const_char_ptr;n_path++) {
26452 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026453 path = gen_const_char_ptr(n_path, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026454
William M. Brackf13f77f2004-11-12 16:03:48 +000026455 ret_val = xmlCheckFilename((const char *)path);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026456 desret_int(ret_val);
26457 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000026458 des_const_char_ptr(n_path, (const char *)path, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026459 xmlResetLastError();
26460 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026461 printf("Leak of %d blocks found in xmlCheckFilename",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026462 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026463 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026464 printf(" %d", n_path);
26465 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026466 }
26467 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000026468 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026469
Daniel Veillard42595322004-11-08 10:52:06 +000026470 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026471}
26472
26473
26474static int
26475test_xmlCheckHTTPInput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026476 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026477
Daniel Veillard42595322004-11-08 10:52:06 +000026478 int mem_base;
26479 xmlParserInputPtr ret_val;
26480 xmlParserCtxtPtr ctxt; /* an XML parser context */
26481 int n_ctxt;
26482 xmlParserInputPtr ret; /* an XML parser input */
26483 int n_ret;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026484
Daniel Veillard42595322004-11-08 10:52:06 +000026485 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
26486 for (n_ret = 0;n_ret < gen_nb_xmlParserInputPtr;n_ret++) {
26487 mem_base = xmlMemBlocks();
26488 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
26489 ret = gen_xmlParserInputPtr(n_ret, 1);
26490
26491 ret_val = xmlCheckHTTPInput(ctxt, ret);
26492 desret_xmlParserInputPtr(ret_val);
26493 call_tests++;
26494 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
26495 des_xmlParserInputPtr(n_ret, ret, 1);
26496 xmlResetLastError();
26497 if (mem_base != xmlMemBlocks()) {
26498 printf("Leak of %d blocks found in xmlCheckHTTPInput",
26499 xmlMemBlocks() - mem_base);
26500 test_ret++;
26501 printf(" %d", n_ctxt);
26502 printf(" %d", n_ret);
26503 printf("\n");
26504 }
26505 }
26506 }
Daniel Veillard42595322004-11-08 10:52:06 +000026507 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026508
Daniel Veillard42595322004-11-08 10:52:06 +000026509 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026510}
26511
26512
26513static int
26514test_xmlCleanupInputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026515 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026516
26517 int mem_base;
26518
26519 mem_base = xmlMemBlocks();
26520
26521 xmlCleanupInputCallbacks();
26522 call_tests++;
26523 xmlResetLastError();
26524 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026525 printf("Leak of %d blocks found in xmlCleanupInputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026526 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026527 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026528 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026529 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000026530 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026531
Daniel Veillard42595322004-11-08 10:52:06 +000026532 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026533}
26534
26535
26536static int
26537test_xmlCleanupOutputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026538 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026539
William M. Brack21e4ef22005-01-02 09:53:13 +000026540#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000026541 int mem_base;
26542
26543 mem_base = xmlMemBlocks();
26544
26545 xmlCleanupOutputCallbacks();
26546 call_tests++;
26547 xmlResetLastError();
26548 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026549 printf("Leak of %d blocks found in xmlCleanupOutputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026550 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026551 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026552 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026553 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026554 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026555#endif
26556
Daniel Veillard42595322004-11-08 10:52:06 +000026557 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026558}
26559
26560
26561static int
26562test_xmlFileClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026563 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026564
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026565 int mem_base;
26566 int ret_val;
26567 void * context; /* the I/O context */
26568 int n_context;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026569
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026570 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26571 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026572 context = gen_void_ptr(n_context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026573
26574 ret_val = xmlFileClose(context);
26575 desret_int(ret_val);
26576 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026577 des_void_ptr(n_context, context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026578 xmlResetLastError();
26579 if (mem_base != xmlMemBlocks()) {
26580 printf("Leak of %d blocks found in xmlFileClose",
26581 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026582 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026583 printf(" %d", n_context);
26584 printf("\n");
26585 }
26586 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000026587 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026588
Daniel Veillard42595322004-11-08 10:52:06 +000026589 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026590}
26591
26592
26593static int
26594test_xmlFileMatch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026595 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026596
26597 int mem_base;
26598 int ret_val;
26599 const char * filename; /* the URI for matching */
26600 int n_filename;
26601
26602 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26603 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026604 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026605
26606 ret_val = xmlFileMatch(filename);
26607 desret_int(ret_val);
26608 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026609 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026610 xmlResetLastError();
26611 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026612 printf("Leak of %d blocks found in xmlFileMatch",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026613 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026614 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026615 printf(" %d", n_filename);
26616 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026617 }
26618 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000026619 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026620
Daniel Veillard42595322004-11-08 10:52:06 +000026621 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026622}
26623
26624
26625static int
26626test_xmlFileOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026627 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026628
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026629 int mem_base;
26630 void * ret_val;
26631 const char * filename; /* the URI for matching */
26632 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026633
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026634 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26635 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026636 filename = gen_filepath(n_filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026637
26638 ret_val = xmlFileOpen(filename);
26639 desret_void_ptr(ret_val);
26640 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026641 des_filepath(n_filename, filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026642 xmlResetLastError();
26643 if (mem_base != xmlMemBlocks()) {
26644 printf("Leak of %d blocks found in xmlFileOpen",
26645 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026646 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026647 printf(" %d", n_filename);
26648 printf("\n");
26649 }
26650 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000026651 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026652
Daniel Veillard42595322004-11-08 10:52:06 +000026653 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026654}
26655
26656
26657static int
26658test_xmlFileRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026659 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026660
Daniel Veillardce682bc2004-11-05 17:22:25 +000026661 int mem_base;
26662 int ret_val;
26663 void * context; /* the I/O context */
26664 int n_context;
26665 char * buffer; /* where to drop data */
26666 int n_buffer;
26667 int len; /* number of bytes to write */
26668 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026669
Daniel Veillardce682bc2004-11-05 17:22:25 +000026670 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26671 for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) {
26672 for (n_len = 0;n_len < gen_nb_int;n_len++) {
26673 mem_base = xmlMemBlocks();
26674 context = gen_void_ptr(n_context, 0);
26675 buffer = gen_char_ptr(n_buffer, 1);
26676 len = gen_int(n_len, 2);
26677
26678 ret_val = xmlFileRead(context, buffer, len);
26679 desret_int(ret_val);
26680 call_tests++;
26681 des_void_ptr(n_context, context, 0);
26682 des_char_ptr(n_buffer, buffer, 1);
26683 des_int(n_len, len, 2);
26684 xmlResetLastError();
26685 if (mem_base != xmlMemBlocks()) {
26686 printf("Leak of %d blocks found in xmlFileRead",
26687 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026688 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026689 printf(" %d", n_context);
26690 printf(" %d", n_buffer);
26691 printf(" %d", n_len);
26692 printf("\n");
26693 }
26694 }
26695 }
26696 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000026697 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026698
Daniel Veillard42595322004-11-08 10:52:06 +000026699 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026700}
26701
26702
26703static int
26704test_xmlIOFTPClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026705 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026706
William M. Brack21e4ef22005-01-02 09:53:13 +000026707#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026708 int mem_base;
26709 int ret_val;
26710 void * context; /* the I/O context */
26711 int n_context;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026712
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026713 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26714 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026715 context = gen_void_ptr(n_context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026716
26717 ret_val = xmlIOFTPClose(context);
26718 desret_int(ret_val);
26719 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026720 des_void_ptr(n_context, context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026721 xmlResetLastError();
26722 if (mem_base != xmlMemBlocks()) {
26723 printf("Leak of %d blocks found in xmlIOFTPClose",
26724 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026725 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026726 printf(" %d", n_context);
26727 printf("\n");
26728 }
26729 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026730 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026731#endif
26732
Daniel Veillard42595322004-11-08 10:52:06 +000026733 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026734}
26735
26736
26737static int
26738test_xmlIOFTPMatch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026739 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026740
William M. Brack21e4ef22005-01-02 09:53:13 +000026741#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000026742 int mem_base;
26743 int ret_val;
26744 const char * filename; /* the URI for matching */
26745 int n_filename;
26746
26747 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26748 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026749 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026750
26751 ret_val = xmlIOFTPMatch(filename);
26752 desret_int(ret_val);
26753 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026754 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026755 xmlResetLastError();
26756 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026757 printf("Leak of %d blocks found in xmlIOFTPMatch",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026758 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026759 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026760 printf(" %d", n_filename);
26761 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026762 }
26763 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026764 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026765#endif
26766
Daniel Veillard42595322004-11-08 10:52:06 +000026767 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026768}
26769
26770
26771static int
26772test_xmlIOFTPOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026773 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026774
William M. Brack21e4ef22005-01-02 09:53:13 +000026775#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026776 int mem_base;
26777 void * ret_val;
26778 const char * filename; /* the URI for matching */
26779 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026780
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026781 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26782 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026783 filename = gen_filepath(n_filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026784
26785 ret_val = xmlIOFTPOpen(filename);
26786 desret_void_ptr(ret_val);
26787 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026788 des_filepath(n_filename, filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026789 xmlResetLastError();
26790 if (mem_base != xmlMemBlocks()) {
26791 printf("Leak of %d blocks found in xmlIOFTPOpen",
26792 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026793 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026794 printf(" %d", n_filename);
26795 printf("\n");
26796 }
26797 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026798 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026799#endif
26800
Daniel Veillard42595322004-11-08 10:52:06 +000026801 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026802}
26803
26804
26805static int
26806test_xmlIOFTPRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026807 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026808
William M. Brack21e4ef22005-01-02 09:53:13 +000026809#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000026810 int mem_base;
26811 int ret_val;
26812 void * context; /* the I/O context */
26813 int n_context;
26814 char * buffer; /* where to drop data */
26815 int n_buffer;
26816 int len; /* number of bytes to write */
26817 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026818
Daniel Veillardce682bc2004-11-05 17:22:25 +000026819 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26820 for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) {
26821 for (n_len = 0;n_len < gen_nb_int;n_len++) {
26822 mem_base = xmlMemBlocks();
26823 context = gen_void_ptr(n_context, 0);
26824 buffer = gen_char_ptr(n_buffer, 1);
26825 len = gen_int(n_len, 2);
26826
26827 ret_val = xmlIOFTPRead(context, buffer, len);
26828 desret_int(ret_val);
26829 call_tests++;
26830 des_void_ptr(n_context, context, 0);
26831 des_char_ptr(n_buffer, buffer, 1);
26832 des_int(n_len, len, 2);
26833 xmlResetLastError();
26834 if (mem_base != xmlMemBlocks()) {
26835 printf("Leak of %d blocks found in xmlIOFTPRead",
26836 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026837 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026838 printf(" %d", n_context);
26839 printf(" %d", n_buffer);
26840 printf(" %d", n_len);
26841 printf("\n");
26842 }
26843 }
26844 }
26845 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026846 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026847#endif
26848
Daniel Veillard42595322004-11-08 10:52:06 +000026849 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026850}
26851
26852
26853static int
26854test_xmlIOHTTPClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026855 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026856
William M. Brack21e4ef22005-01-02 09:53:13 +000026857#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026858 int mem_base;
26859 int ret_val;
26860 void * context; /* the I/O context */
26861 int n_context;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026862
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026863 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26864 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026865 context = gen_void_ptr(n_context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026866
26867 ret_val = xmlIOHTTPClose(context);
26868 desret_int(ret_val);
26869 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026870 des_void_ptr(n_context, context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026871 xmlResetLastError();
26872 if (mem_base != xmlMemBlocks()) {
26873 printf("Leak of %d blocks found in xmlIOHTTPClose",
26874 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026875 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026876 printf(" %d", n_context);
26877 printf("\n");
26878 }
26879 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026880 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026881#endif
26882
Daniel Veillard42595322004-11-08 10:52:06 +000026883 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026884}
26885
26886
26887static int
26888test_xmlIOHTTPMatch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026889 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026890
William M. Brack21e4ef22005-01-02 09:53:13 +000026891#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000026892 int mem_base;
26893 int ret_val;
26894 const char * filename; /* the URI for matching */
26895 int n_filename;
26896
26897 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26898 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026899 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026900
26901 ret_val = xmlIOHTTPMatch(filename);
26902 desret_int(ret_val);
26903 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026904 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026905 xmlResetLastError();
26906 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026907 printf("Leak of %d blocks found in xmlIOHTTPMatch",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026908 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026909 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026910 printf(" %d", n_filename);
26911 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026912 }
26913 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026914 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026915#endif
26916
Daniel Veillard42595322004-11-08 10:52:06 +000026917 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026918}
26919
26920
26921static int
26922test_xmlIOHTTPOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026923 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026924
William M. Brack21e4ef22005-01-02 09:53:13 +000026925#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026926 int mem_base;
26927 void * ret_val;
26928 const char * filename; /* the URI for matching */
26929 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026930
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026931 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26932 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026933 filename = gen_filepath(n_filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026934
26935 ret_val = xmlIOHTTPOpen(filename);
William M. Brack015ccb22005-02-13 08:18:52 +000026936 desret_xmlNanoHTTPCtxtPtr(ret_val);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026937 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026938 des_filepath(n_filename, filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026939 xmlResetLastError();
26940 if (mem_base != xmlMemBlocks()) {
26941 printf("Leak of %d blocks found in xmlIOHTTPOpen",
26942 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026943 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026944 printf(" %d", n_filename);
26945 printf("\n");
26946 }
26947 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026948 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026949#endif
26950
Daniel Veillard42595322004-11-08 10:52:06 +000026951 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026952}
26953
26954
26955static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000026956test_xmlIOHTTPRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026957 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026958
William M. Brack21e4ef22005-01-02 09:53:13 +000026959#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000026960 int mem_base;
26961 int ret_val;
26962 void * context; /* the I/O context */
26963 int n_context;
26964 char * buffer; /* where to drop data */
26965 int n_buffer;
26966 int len; /* number of bytes to write */
26967 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026968
Daniel Veillardce682bc2004-11-05 17:22:25 +000026969 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26970 for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) {
26971 for (n_len = 0;n_len < gen_nb_int;n_len++) {
26972 mem_base = xmlMemBlocks();
26973 context = gen_void_ptr(n_context, 0);
26974 buffer = gen_char_ptr(n_buffer, 1);
26975 len = gen_int(n_len, 2);
26976
26977 ret_val = xmlIOHTTPRead(context, buffer, len);
26978 desret_int(ret_val);
26979 call_tests++;
26980 des_void_ptr(n_context, context, 0);
26981 des_char_ptr(n_buffer, buffer, 1);
26982 des_int(n_len, len, 2);
26983 xmlResetLastError();
26984 if (mem_base != xmlMemBlocks()) {
26985 printf("Leak of %d blocks found in xmlIOHTTPRead",
26986 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026987 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026988 printf(" %d", n_context);
26989 printf(" %d", n_buffer);
26990 printf(" %d", n_len);
26991 printf("\n");
26992 }
26993 }
26994 }
26995 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026996 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026997#endif
26998
Daniel Veillard42595322004-11-08 10:52:06 +000026999 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027000}
27001
27002
27003static int
27004test_xmlNoNetExternalEntityLoader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027005 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027006
Daniel Veillard42595322004-11-08 10:52:06 +000027007 int mem_base;
27008 xmlParserInputPtr ret_val;
27009 const char * URL; /* the URL for the entity to load */
27010 int n_URL;
27011 char * ID; /* the System ID for the entity to load */
27012 int n_ID;
27013 xmlParserCtxtPtr ctxt; /* the context in which the entity is called or NULL */
27014 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027015
Daniel Veillard42595322004-11-08 10:52:06 +000027016 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
27017 for (n_ID = 0;n_ID < gen_nb_const_char_ptr;n_ID++) {
27018 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
27019 mem_base = xmlMemBlocks();
27020 URL = gen_filepath(n_URL, 0);
27021 ID = gen_const_char_ptr(n_ID, 1);
27022 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 2);
27023
William M. Brackf13f77f2004-11-12 16:03:48 +000027024 ret_val = xmlNoNetExternalEntityLoader(URL, (const char *)ID, ctxt);
Daniel Veillard42595322004-11-08 10:52:06 +000027025 desret_xmlParserInputPtr(ret_val);
27026 call_tests++;
27027 des_filepath(n_URL, URL, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000027028 des_const_char_ptr(n_ID, (const char *)ID, 1);
Daniel Veillard42595322004-11-08 10:52:06 +000027029 des_xmlParserCtxtPtr(n_ctxt, ctxt, 2);
27030 xmlResetLastError();
27031 if (mem_base != xmlMemBlocks()) {
27032 printf("Leak of %d blocks found in xmlNoNetExternalEntityLoader",
27033 xmlMemBlocks() - mem_base);
27034 test_ret++;
27035 printf(" %d", n_URL);
27036 printf(" %d", n_ID);
27037 printf(" %d", n_ctxt);
27038 printf("\n");
27039 }
27040 }
27041 }
27042 }
Daniel Veillard42595322004-11-08 10:52:06 +000027043 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027044
Daniel Veillard42595322004-11-08 10:52:06 +000027045 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027046}
27047
27048
27049static int
27050test_xmlNormalizeWindowsPath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027051 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027052
Daniel Veillard8a32fe42004-11-02 22:10:16 +000027053 int mem_base;
27054 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027055 xmlChar * path; /* the input file path */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000027056 int n_path;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027057
Daniel Veillard8a32fe42004-11-02 22:10:16 +000027058 for (n_path = 0;n_path < gen_nb_const_xmlChar_ptr;n_path++) {
27059 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000027060 path = gen_const_xmlChar_ptr(n_path, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000027061
William M. Brackf13f77f2004-11-12 16:03:48 +000027062 ret_val = xmlNormalizeWindowsPath((const xmlChar *)path);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000027063 desret_xmlChar_ptr(ret_val);
27064 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000027065 des_const_xmlChar_ptr(n_path, (const xmlChar *)path, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000027066 xmlResetLastError();
27067 if (mem_base != xmlMemBlocks()) {
27068 printf("Leak of %d blocks found in xmlNormalizeWindowsPath",
27069 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027070 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000027071 printf(" %d", n_path);
27072 printf("\n");
27073 }
27074 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000027075 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027076
Daniel Veillard42595322004-11-08 10:52:06 +000027077 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027078}
27079
27080
27081static int
27082test_xmlOutputBufferCreateFd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027083 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027084
William M. Brack21e4ef22005-01-02 09:53:13 +000027085#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000027086 int mem_base;
27087 xmlOutputBufferPtr ret_val;
27088 int fd; /* a file descriptor number */
27089 int n_fd;
27090 xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */
27091 int n_encoder;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027092
Daniel Veillard3d95c732004-11-06 22:25:14 +000027093 for (n_fd = 0;n_fd < gen_nb_int;n_fd++) {
27094 for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) {
27095 mem_base = xmlMemBlocks();
27096 fd = gen_int(n_fd, 0);
27097 encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 1);
27098
27099 ret_val = xmlOutputBufferCreateFd(fd, encoder);
27100 desret_xmlOutputBufferPtr(ret_val);
27101 call_tests++;
27102 des_int(n_fd, fd, 0);
27103 des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 1);
27104 xmlResetLastError();
27105 if (mem_base != xmlMemBlocks()) {
27106 printf("Leak of %d blocks found in xmlOutputBufferCreateFd",
27107 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027108 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000027109 printf(" %d", n_fd);
27110 printf(" %d", n_encoder);
27111 printf("\n");
27112 }
27113 }
27114 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027115 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000027116#endif
27117
Daniel Veillard42595322004-11-08 10:52:06 +000027118 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027119}
27120
27121
27122static int
27123test_xmlOutputBufferCreateFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027124 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027125
William M. Brack21e4ef22005-01-02 09:53:13 +000027126#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000027127 int mem_base;
27128 xmlOutputBufferPtr ret_val;
27129 FILE * file; /* a FILE* */
27130 int n_file;
27131 xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */
27132 int n_encoder;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027133
Daniel Veillard3d95c732004-11-06 22:25:14 +000027134 for (n_file = 0;n_file < gen_nb_FILE_ptr;n_file++) {
27135 for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) {
27136 mem_base = xmlMemBlocks();
27137 file = gen_FILE_ptr(n_file, 0);
27138 encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 1);
27139
27140 ret_val = xmlOutputBufferCreateFile(file, encoder);
27141 desret_xmlOutputBufferPtr(ret_val);
27142 call_tests++;
27143 des_FILE_ptr(n_file, file, 0);
27144 des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 1);
27145 xmlResetLastError();
27146 if (mem_base != xmlMemBlocks()) {
27147 printf("Leak of %d blocks found in xmlOutputBufferCreateFile",
27148 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027149 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000027150 printf(" %d", n_file);
27151 printf(" %d", n_encoder);
27152 printf("\n");
27153 }
27154 }
27155 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027156 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000027157#endif
27158
Daniel Veillard42595322004-11-08 10:52:06 +000027159 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027160}
27161
27162
27163static int
27164test_xmlOutputBufferCreateFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027165 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027166
William M. Brack21e4ef22005-01-02 09:53:13 +000027167#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000027168 int mem_base;
27169 xmlOutputBufferPtr ret_val;
27170 const char * URI; /* a C string containing the URI or filename */
27171 int n_URI;
27172 xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */
27173 int n_encoder;
27174 int compression; /* the compression ration (0 none, 9 max). */
27175 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027176
Daniel Veillard42595322004-11-08 10:52:06 +000027177 for (n_URI = 0;n_URI < gen_nb_fileoutput;n_URI++) {
Daniel Veillard3d95c732004-11-06 22:25:14 +000027178 for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) {
27179 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
27180 mem_base = xmlMemBlocks();
Daniel Veillard42595322004-11-08 10:52:06 +000027181 URI = gen_fileoutput(n_URI, 0);
Daniel Veillard3d95c732004-11-06 22:25:14 +000027182 encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 1);
27183 compression = gen_int(n_compression, 2);
27184
27185 ret_val = xmlOutputBufferCreateFilename(URI, encoder, compression);
27186 desret_xmlOutputBufferPtr(ret_val);
27187 call_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027188 des_fileoutput(n_URI, URI, 0);
Daniel Veillard3d95c732004-11-06 22:25:14 +000027189 des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 1);
27190 des_int(n_compression, compression, 2);
27191 xmlResetLastError();
27192 if (mem_base != xmlMemBlocks()) {
27193 printf("Leak of %d blocks found in xmlOutputBufferCreateFilename",
27194 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027195 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000027196 printf(" %d", n_URI);
27197 printf(" %d", n_encoder);
27198 printf(" %d", n_compression);
27199 printf("\n");
27200 }
27201 }
27202 }
27203 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027204 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000027205#endif
27206
Daniel Veillard42595322004-11-08 10:52:06 +000027207 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027208}
27209
27210
27211static int
27212test_xmlOutputBufferFlush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027213 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027214
William M. Brack21e4ef22005-01-02 09:53:13 +000027215#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000027216 int mem_base;
27217 int ret_val;
27218 xmlOutputBufferPtr out; /* a buffered output */
27219 int n_out;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027220
Daniel Veillard3d97e662004-11-04 10:49:00 +000027221 for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) {
27222 mem_base = xmlMemBlocks();
27223 out = gen_xmlOutputBufferPtr(n_out, 0);
27224
27225 ret_val = xmlOutputBufferFlush(out);
27226 desret_int(ret_val);
27227 call_tests++;
27228 des_xmlOutputBufferPtr(n_out, out, 0);
27229 xmlResetLastError();
27230 if (mem_base != xmlMemBlocks()) {
27231 printf("Leak of %d blocks found in xmlOutputBufferFlush",
27232 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027233 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027234 printf(" %d", n_out);
27235 printf("\n");
27236 }
27237 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027238 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027239#endif
27240
Daniel Veillard42595322004-11-08 10:52:06 +000027241 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027242}
27243
27244
27245static int
27246test_xmlOutputBufferWrite(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027247 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027248
William M. Brack21e4ef22005-01-02 09:53:13 +000027249#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000027250 int mem_base;
27251 int ret_val;
27252 xmlOutputBufferPtr out; /* a buffered parser output */
27253 int n_out;
27254 int len; /* the size in bytes of the array. */
27255 int n_len;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027256 char * buf; /* an char array */
Daniel Veillard3d97e662004-11-04 10:49:00 +000027257 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027258
Daniel Veillard3d97e662004-11-04 10:49:00 +000027259 for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) {
27260 for (n_len = 0;n_len < gen_nb_int;n_len++) {
27261 for (n_buf = 0;n_buf < gen_nb_const_char_ptr;n_buf++) {
27262 mem_base = xmlMemBlocks();
27263 out = gen_xmlOutputBufferPtr(n_out, 0);
27264 len = gen_int(n_len, 1);
27265 buf = gen_const_char_ptr(n_buf, 2);
27266
William M. Brackf13f77f2004-11-12 16:03:48 +000027267 ret_val = xmlOutputBufferWrite(out, len, (const char *)buf);
Daniel Veillard3d97e662004-11-04 10:49:00 +000027268 desret_int(ret_val);
27269 call_tests++;
27270 des_xmlOutputBufferPtr(n_out, out, 0);
27271 des_int(n_len, len, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000027272 des_const_char_ptr(n_buf, (const char *)buf, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +000027273 xmlResetLastError();
27274 if (mem_base != xmlMemBlocks()) {
27275 printf("Leak of %d blocks found in xmlOutputBufferWrite",
27276 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027277 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027278 printf(" %d", n_out);
27279 printf(" %d", n_len);
27280 printf(" %d", n_buf);
27281 printf("\n");
27282 }
27283 }
27284 }
27285 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027286 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027287#endif
27288
Daniel Veillard42595322004-11-08 10:52:06 +000027289 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027290}
27291
27292
27293static int
27294test_xmlOutputBufferWriteEscape(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027295 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027296
27297
27298 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000027299 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027300}
27301
27302
27303static int
27304test_xmlOutputBufferWriteString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027305 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027306
William M. Brack21e4ef22005-01-02 09:53:13 +000027307#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000027308 int mem_base;
27309 int ret_val;
27310 xmlOutputBufferPtr out; /* a buffered parser output */
27311 int n_out;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027312 char * str; /* a zero terminated C string */
Daniel Veillard3d97e662004-11-04 10:49:00 +000027313 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027314
Daniel Veillard3d97e662004-11-04 10:49:00 +000027315 for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) {
27316 for (n_str = 0;n_str < gen_nb_const_char_ptr;n_str++) {
27317 mem_base = xmlMemBlocks();
27318 out = gen_xmlOutputBufferPtr(n_out, 0);
27319 str = gen_const_char_ptr(n_str, 1);
27320
William M. Brackf13f77f2004-11-12 16:03:48 +000027321 ret_val = xmlOutputBufferWriteString(out, (const char *)str);
Daniel Veillard3d97e662004-11-04 10:49:00 +000027322 desret_int(ret_val);
27323 call_tests++;
27324 des_xmlOutputBufferPtr(n_out, out, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000027325 des_const_char_ptr(n_str, (const char *)str, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000027326 xmlResetLastError();
27327 if (mem_base != xmlMemBlocks()) {
27328 printf("Leak of %d blocks found in xmlOutputBufferWriteString",
27329 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027330 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027331 printf(" %d", n_out);
27332 printf(" %d", n_str);
27333 printf("\n");
27334 }
27335 }
27336 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027337 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027338#endif
27339
Daniel Veillard42595322004-11-08 10:52:06 +000027340 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027341}
27342
27343
27344static int
27345test_xmlParserGetDirectory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027346 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027347
27348
27349 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000027350 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027351}
27352
27353
27354static int
27355test_xmlParserInputBufferCreateFd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027356 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027357
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027358 int mem_base;
27359 xmlParserInputBufferPtr ret_val;
27360 int fd; /* a file descriptor number */
27361 int n_fd;
27362 xmlCharEncoding enc; /* the charset encoding if known */
27363 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027364
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027365 for (n_fd = 0;n_fd < gen_nb_int;n_fd++) {
27366 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27367 mem_base = xmlMemBlocks();
27368 fd = gen_int(n_fd, 0);
27369 enc = gen_xmlCharEncoding(n_enc, 1);
27370 if (fd >= 0) fd = -1;
27371
27372 ret_val = xmlParserInputBufferCreateFd(fd, enc);
27373 desret_xmlParserInputBufferPtr(ret_val);
27374 call_tests++;
27375 des_int(n_fd, fd, 0);
27376 des_xmlCharEncoding(n_enc, enc, 1);
27377 xmlResetLastError();
27378 if (mem_base != xmlMemBlocks()) {
27379 printf("Leak of %d blocks found in xmlParserInputBufferCreateFd",
27380 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027381 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027382 printf(" %d", n_fd);
27383 printf(" %d", n_enc);
27384 printf("\n");
27385 }
27386 }
27387 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027388 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027389
Daniel Veillard42595322004-11-08 10:52:06 +000027390 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027391}
27392
27393
27394static int
27395test_xmlParserInputBufferCreateFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027396 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027397
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027398 int mem_base;
27399 xmlParserInputBufferPtr ret_val;
27400 FILE * file; /* a FILE* */
27401 int n_file;
27402 xmlCharEncoding enc; /* the charset encoding if known */
27403 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027404
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027405 for (n_file = 0;n_file < gen_nb_FILE_ptr;n_file++) {
27406 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27407 mem_base = xmlMemBlocks();
27408 file = gen_FILE_ptr(n_file, 0);
27409 enc = gen_xmlCharEncoding(n_enc, 1);
27410
27411 ret_val = xmlParserInputBufferCreateFile(file, enc);
27412 desret_xmlParserInputBufferPtr(ret_val);
27413 call_tests++;
27414 des_FILE_ptr(n_file, file, 0);
27415 des_xmlCharEncoding(n_enc, enc, 1);
27416 xmlResetLastError();
27417 if (mem_base != xmlMemBlocks()) {
27418 printf("Leak of %d blocks found in xmlParserInputBufferCreateFile",
27419 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027420 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027421 printf(" %d", n_file);
27422 printf(" %d", n_enc);
27423 printf("\n");
27424 }
27425 }
27426 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027427 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027428
Daniel Veillard42595322004-11-08 10:52:06 +000027429 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027430}
27431
27432
27433static int
27434test_xmlParserInputBufferCreateFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027435 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027436
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027437 int mem_base;
27438 xmlParserInputBufferPtr ret_val;
27439 const char * URI; /* a C string containing the URI or filename */
27440 int n_URI;
27441 xmlCharEncoding enc; /* the charset encoding if known */
27442 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027443
Daniel Veillard42595322004-11-08 10:52:06 +000027444 for (n_URI = 0;n_URI < gen_nb_fileoutput;n_URI++) {
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027445 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27446 mem_base = xmlMemBlocks();
Daniel Veillard42595322004-11-08 10:52:06 +000027447 URI = gen_fileoutput(n_URI, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027448 enc = gen_xmlCharEncoding(n_enc, 1);
27449
27450 ret_val = xmlParserInputBufferCreateFilename(URI, enc);
27451 desret_xmlParserInputBufferPtr(ret_val);
27452 call_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027453 des_fileoutput(n_URI, URI, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027454 des_xmlCharEncoding(n_enc, enc, 1);
27455 xmlResetLastError();
27456 if (mem_base != xmlMemBlocks()) {
27457 printf("Leak of %d blocks found in xmlParserInputBufferCreateFilename",
27458 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027459 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027460 printf(" %d", n_URI);
27461 printf(" %d", n_enc);
27462 printf("\n");
27463 }
27464 }
27465 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027466 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027467
Daniel Veillard42595322004-11-08 10:52:06 +000027468 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027469}
27470
27471
27472static int
27473test_xmlParserInputBufferCreateMem(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027474 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027475
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027476 int mem_base;
27477 xmlParserInputBufferPtr ret_val;
27478 char * mem; /* the memory input */
27479 int n_mem;
27480 int size; /* the length of the memory block */
27481 int n_size;
27482 xmlCharEncoding enc; /* the charset encoding if known */
27483 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027484
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027485 for (n_mem = 0;n_mem < gen_nb_const_char_ptr;n_mem++) {
27486 for (n_size = 0;n_size < gen_nb_int;n_size++) {
27487 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27488 mem_base = xmlMemBlocks();
27489 mem = gen_const_char_ptr(n_mem, 0);
27490 size = gen_int(n_size, 1);
27491 enc = gen_xmlCharEncoding(n_enc, 2);
27492
William M. Brackf13f77f2004-11-12 16:03:48 +000027493 ret_val = xmlParserInputBufferCreateMem((const char *)mem, size, enc);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027494 desret_xmlParserInputBufferPtr(ret_val);
27495 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000027496 des_const_char_ptr(n_mem, (const char *)mem, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027497 des_int(n_size, size, 1);
27498 des_xmlCharEncoding(n_enc, enc, 2);
27499 xmlResetLastError();
27500 if (mem_base != xmlMemBlocks()) {
27501 printf("Leak of %d blocks found in xmlParserInputBufferCreateMem",
27502 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027503 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027504 printf(" %d", n_mem);
27505 printf(" %d", n_size);
27506 printf(" %d", n_enc);
27507 printf("\n");
27508 }
27509 }
27510 }
27511 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027512 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027513
Daniel Veillard42595322004-11-08 10:52:06 +000027514 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027515}
27516
27517
27518static int
27519test_xmlParserInputBufferCreateStatic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027520 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027521
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027522 int mem_base;
27523 xmlParserInputBufferPtr ret_val;
27524 char * mem; /* the memory input */
27525 int n_mem;
27526 int size; /* the length of the memory block */
27527 int n_size;
27528 xmlCharEncoding enc; /* the charset encoding if known */
27529 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027530
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027531 for (n_mem = 0;n_mem < gen_nb_const_char_ptr;n_mem++) {
27532 for (n_size = 0;n_size < gen_nb_int;n_size++) {
27533 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27534 mem_base = xmlMemBlocks();
27535 mem = gen_const_char_ptr(n_mem, 0);
27536 size = gen_int(n_size, 1);
27537 enc = gen_xmlCharEncoding(n_enc, 2);
27538
William M. Brackf13f77f2004-11-12 16:03:48 +000027539 ret_val = xmlParserInputBufferCreateStatic((const char *)mem, size, enc);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027540 desret_xmlParserInputBufferPtr(ret_val);
27541 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000027542 des_const_char_ptr(n_mem, (const char *)mem, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027543 des_int(n_size, size, 1);
27544 des_xmlCharEncoding(n_enc, enc, 2);
27545 xmlResetLastError();
27546 if (mem_base != xmlMemBlocks()) {
27547 printf("Leak of %d blocks found in xmlParserInputBufferCreateStatic",
27548 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027549 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027550 printf(" %d", n_mem);
27551 printf(" %d", n_size);
27552 printf(" %d", n_enc);
27553 printf("\n");
27554 }
27555 }
27556 }
27557 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027558 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027559
Daniel Veillard42595322004-11-08 10:52:06 +000027560 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027561}
27562
27563
27564static int
27565test_xmlParserInputBufferGrow(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027566 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027567
Daniel Veillard34099b42004-11-04 17:34:35 +000027568 int mem_base;
27569 int ret_val;
27570 xmlParserInputBufferPtr in; /* a buffered parser input */
27571 int n_in;
27572 int len; /* indicative value of the amount of chars to read */
27573 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027574
Daniel Veillard34099b42004-11-04 17:34:35 +000027575 for (n_in = 0;n_in < gen_nb_xmlParserInputBufferPtr;n_in++) {
27576 for (n_len = 0;n_len < gen_nb_int;n_len++) {
27577 mem_base = xmlMemBlocks();
27578 in = gen_xmlParserInputBufferPtr(n_in, 0);
27579 len = gen_int(n_len, 1);
27580
27581 ret_val = xmlParserInputBufferGrow(in, len);
27582 desret_int(ret_val);
27583 call_tests++;
27584 des_xmlParserInputBufferPtr(n_in, in, 0);
27585 des_int(n_len, len, 1);
27586 xmlResetLastError();
27587 if (mem_base != xmlMemBlocks()) {
27588 printf("Leak of %d blocks found in xmlParserInputBufferGrow",
27589 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027590 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000027591 printf(" %d", n_in);
27592 printf(" %d", n_len);
27593 printf("\n");
27594 }
27595 }
27596 }
Daniel Veillard34099b42004-11-04 17:34:35 +000027597 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027598
Daniel Veillard42595322004-11-08 10:52:06 +000027599 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027600}
27601
27602
27603static int
27604test_xmlParserInputBufferPush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027605 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027606
Daniel Veillard34099b42004-11-04 17:34:35 +000027607 int mem_base;
27608 int ret_val;
27609 xmlParserInputBufferPtr in; /* a buffered parser input */
27610 int n_in;
27611 int len; /* the size in bytes of the array. */
27612 int n_len;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027613 char * buf; /* an char array */
Daniel Veillard34099b42004-11-04 17:34:35 +000027614 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027615
Daniel Veillard34099b42004-11-04 17:34:35 +000027616 for (n_in = 0;n_in < gen_nb_xmlParserInputBufferPtr;n_in++) {
27617 for (n_len = 0;n_len < gen_nb_int;n_len++) {
27618 for (n_buf = 0;n_buf < gen_nb_const_char_ptr;n_buf++) {
27619 mem_base = xmlMemBlocks();
27620 in = gen_xmlParserInputBufferPtr(n_in, 0);
27621 len = gen_int(n_len, 1);
27622 buf = gen_const_char_ptr(n_buf, 2);
27623
William M. Brackf13f77f2004-11-12 16:03:48 +000027624 ret_val = xmlParserInputBufferPush(in, len, (const char *)buf);
Daniel Veillard34099b42004-11-04 17:34:35 +000027625 desret_int(ret_val);
27626 call_tests++;
27627 des_xmlParserInputBufferPtr(n_in, in, 0);
27628 des_int(n_len, len, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000027629 des_const_char_ptr(n_buf, (const char *)buf, 2);
Daniel Veillard34099b42004-11-04 17:34:35 +000027630 xmlResetLastError();
27631 if (mem_base != xmlMemBlocks()) {
27632 printf("Leak of %d blocks found in xmlParserInputBufferPush",
27633 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027634 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000027635 printf(" %d", n_in);
27636 printf(" %d", n_len);
27637 printf(" %d", n_buf);
27638 printf("\n");
27639 }
27640 }
27641 }
27642 }
Daniel Veillard34099b42004-11-04 17:34:35 +000027643 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027644
Daniel Veillard42595322004-11-08 10:52:06 +000027645 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027646}
27647
27648
27649static int
27650test_xmlParserInputBufferRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027651 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027652
Daniel Veillard34099b42004-11-04 17:34:35 +000027653 int mem_base;
27654 int ret_val;
27655 xmlParserInputBufferPtr in; /* a buffered parser input */
27656 int n_in;
27657 int len; /* indicative value of the amount of chars to read */
27658 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027659
Daniel Veillard34099b42004-11-04 17:34:35 +000027660 for (n_in = 0;n_in < gen_nb_xmlParserInputBufferPtr;n_in++) {
27661 for (n_len = 0;n_len < gen_nb_int;n_len++) {
27662 mem_base = xmlMemBlocks();
27663 in = gen_xmlParserInputBufferPtr(n_in, 0);
27664 len = gen_int(n_len, 1);
27665
27666 ret_val = xmlParserInputBufferRead(in, len);
27667 desret_int(ret_val);
27668 call_tests++;
27669 des_xmlParserInputBufferPtr(n_in, in, 0);
27670 des_int(n_len, len, 1);
27671 xmlResetLastError();
27672 if (mem_base != xmlMemBlocks()) {
27673 printf("Leak of %d blocks found in xmlParserInputBufferRead",
27674 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027675 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000027676 printf(" %d", n_in);
27677 printf(" %d", n_len);
27678 printf("\n");
27679 }
27680 }
27681 }
Daniel Veillard34099b42004-11-04 17:34:35 +000027682 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027683
Daniel Veillard42595322004-11-08 10:52:06 +000027684 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027685}
27686
27687
27688static int
27689test_xmlPopInputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027690 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027691
27692 int mem_base;
27693 int ret_val;
27694
27695 mem_base = xmlMemBlocks();
27696
27697 ret_val = xmlPopInputCallbacks();
27698 desret_int(ret_val);
27699 call_tests++;
27700 xmlResetLastError();
27701 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000027702 printf("Leak of %d blocks found in xmlPopInputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000027703 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027704 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000027705 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000027706 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000027707 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027708
Daniel Veillard42595322004-11-08 10:52:06 +000027709 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027710}
27711
27712
27713static int
27714test_xmlRegisterDefaultInputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027715 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027716
27717 int mem_base;
27718
27719 mem_base = xmlMemBlocks();
27720
27721 xmlRegisterDefaultInputCallbacks();
27722 call_tests++;
27723 xmlResetLastError();
27724 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000027725 printf("Leak of %d blocks found in xmlRegisterDefaultInputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000027726 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027727 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000027728 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000027729 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000027730 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027731
Daniel Veillard42595322004-11-08 10:52:06 +000027732 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027733}
27734
27735
27736static int
27737test_xmlRegisterDefaultOutputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027738 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027739
William M. Brack21e4ef22005-01-02 09:53:13 +000027740#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000027741 int mem_base;
27742
27743 mem_base = xmlMemBlocks();
27744
27745 xmlRegisterDefaultOutputCallbacks();
27746 call_tests++;
27747 xmlResetLastError();
27748 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000027749 printf("Leak of %d blocks found in xmlRegisterDefaultOutputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000027750 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027751 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000027752 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000027753 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027754 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027755#endif
27756
Daniel Veillard42595322004-11-08 10:52:06 +000027757 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027758}
27759
27760
27761static int
27762test_xmlRegisterHTTPPostCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027763 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027764
William M. Brack21e4ef22005-01-02 09:53:13 +000027765#if defined(LIBXML_OUTPUT_ENABLED) && defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000027766 int mem_base;
27767
27768 mem_base = xmlMemBlocks();
27769
27770 xmlRegisterHTTPPostCallbacks();
27771 call_tests++;
27772 xmlResetLastError();
27773 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000027774 printf("Leak of %d blocks found in xmlRegisterHTTPPostCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000027775 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027776 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000027777 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000027778 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027779 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027780#endif
27781
Daniel Veillard42595322004-11-08 10:52:06 +000027782 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027783}
27784
27785static int
27786test_xmlIO(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027787 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027788
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027789 if (quiet == 0) printf("Testing xmlIO : 38 of 47 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000027790 test_ret += test_xmlAllocOutputBuffer();
27791 test_ret += test_xmlAllocParserInputBuffer();
27792 test_ret += test_xmlCheckFilename();
27793 test_ret += test_xmlCheckHTTPInput();
27794 test_ret += test_xmlCleanupInputCallbacks();
27795 test_ret += test_xmlCleanupOutputCallbacks();
27796 test_ret += test_xmlFileClose();
27797 test_ret += test_xmlFileMatch();
27798 test_ret += test_xmlFileOpen();
27799 test_ret += test_xmlFileRead();
27800 test_ret += test_xmlIOFTPClose();
27801 test_ret += test_xmlIOFTPMatch();
27802 test_ret += test_xmlIOFTPOpen();
27803 test_ret += test_xmlIOFTPRead();
27804 test_ret += test_xmlIOHTTPClose();
27805 test_ret += test_xmlIOHTTPMatch();
27806 test_ret += test_xmlIOHTTPOpen();
Daniel Veillard42595322004-11-08 10:52:06 +000027807 test_ret += test_xmlIOHTTPRead();
27808 test_ret += test_xmlNoNetExternalEntityLoader();
27809 test_ret += test_xmlNormalizeWindowsPath();
27810 test_ret += test_xmlOutputBufferCreateFd();
27811 test_ret += test_xmlOutputBufferCreateFile();
27812 test_ret += test_xmlOutputBufferCreateFilename();
27813 test_ret += test_xmlOutputBufferFlush();
27814 test_ret += test_xmlOutputBufferWrite();
27815 test_ret += test_xmlOutputBufferWriteEscape();
27816 test_ret += test_xmlOutputBufferWriteString();
27817 test_ret += test_xmlParserGetDirectory();
27818 test_ret += test_xmlParserInputBufferCreateFd();
27819 test_ret += test_xmlParserInputBufferCreateFile();
27820 test_ret += test_xmlParserInputBufferCreateFilename();
27821 test_ret += test_xmlParserInputBufferCreateMem();
27822 test_ret += test_xmlParserInputBufferCreateStatic();
27823 test_ret += test_xmlParserInputBufferGrow();
27824 test_ret += test_xmlParserInputBufferPush();
27825 test_ret += test_xmlParserInputBufferRead();
27826 test_ret += test_xmlPopInputCallbacks();
27827 test_ret += test_xmlRegisterDefaultInputCallbacks();
27828 test_ret += test_xmlRegisterDefaultOutputCallbacks();
27829 test_ret += test_xmlRegisterHTTPPostCallbacks();
Daniel Veillardd93f6252004-11-02 15:53:51 +000027830
Daniel Veillard42595322004-11-08 10:52:06 +000027831 if (test_ret != 0)
27832 printf("Module xmlIO: %d errors\n", test_ret);
27833 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027834}
Daniel Veillarda521d282004-11-09 14:59:59 +000027835#ifdef LIBXML_AUTOMATA_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000027836
Daniel Veillarda82b1822004-11-08 16:24:57 +000027837#define gen_nb_xmlAutomataPtr 1
27838static xmlAutomataPtr gen_xmlAutomataPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27839 return(NULL);
27840}
27841static void des_xmlAutomataPtr(int no ATTRIBUTE_UNUSED, xmlAutomataPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27842}
Daniel Veillarda521d282004-11-09 14:59:59 +000027843#endif
27844
Daniel Veillarda82b1822004-11-08 16:24:57 +000027845
27846static int
27847test_xmlAutomataCompile(void) {
27848 int test_ret = 0;
27849
27850
27851 /* missing type support */
27852 return(test_ret);
27853}
27854
27855
27856static int
27857test_xmlAutomataGetInitState(void) {
27858 int test_ret = 0;
27859
27860
27861 /* missing type support */
27862 return(test_ret);
27863}
27864
27865
27866static int
27867test_xmlAutomataIsDeterminist(void) {
27868 int test_ret = 0;
27869
William M. Brack21e4ef22005-01-02 09:53:13 +000027870#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_AUTOMATA_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000027871 int mem_base;
27872 int ret_val;
27873 xmlAutomataPtr am; /* an automata */
27874 int n_am;
27875
27876 for (n_am = 0;n_am < gen_nb_xmlAutomataPtr;n_am++) {
27877 mem_base = xmlMemBlocks();
27878 am = gen_xmlAutomataPtr(n_am, 0);
27879
27880 ret_val = xmlAutomataIsDeterminist(am);
27881 desret_int(ret_val);
27882 call_tests++;
27883 des_xmlAutomataPtr(n_am, am, 0);
27884 xmlResetLastError();
27885 if (mem_base != xmlMemBlocks()) {
27886 printf("Leak of %d blocks found in xmlAutomataIsDeterminist",
27887 xmlMemBlocks() - mem_base);
27888 test_ret++;
27889 printf(" %d", n_am);
27890 printf("\n");
27891 }
27892 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027893 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000027894#endif
27895
Daniel Veillarda82b1822004-11-08 16:24:57 +000027896 return(test_ret);
27897}
27898
Daniel Veillarda521d282004-11-09 14:59:59 +000027899#ifdef LIBXML_AUTOMATA_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +000027900
27901#define gen_nb_xmlAutomataStatePtr 1
27902static xmlAutomataStatePtr gen_xmlAutomataStatePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27903 return(NULL);
27904}
27905static void des_xmlAutomataStatePtr(int no ATTRIBUTE_UNUSED, xmlAutomataStatePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27906}
Daniel Veillarda521d282004-11-09 14:59:59 +000027907#endif
27908
Daniel Veillarda82b1822004-11-08 16:24:57 +000027909
27910static int
27911test_xmlAutomataNewAllTrans(void) {
27912 int test_ret = 0;
27913
27914
27915 /* missing type support */
27916 return(test_ret);
27917}
27918
27919
27920static int
27921test_xmlAutomataNewCountTrans(void) {
27922 int test_ret = 0;
27923
27924
27925 /* missing type support */
27926 return(test_ret);
27927}
27928
27929
27930static int
27931test_xmlAutomataNewCountTrans2(void) {
27932 int test_ret = 0;
27933
27934
27935 /* missing type support */
27936 return(test_ret);
27937}
27938
27939
27940static int
27941test_xmlAutomataNewCountedTrans(void) {
27942 int test_ret = 0;
27943
27944
27945 /* missing type support */
27946 return(test_ret);
27947}
27948
27949
27950static int
27951test_xmlAutomataNewCounter(void) {
27952 int test_ret = 0;
27953
William M. Brack21e4ef22005-01-02 09:53:13 +000027954#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_AUTOMATA_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000027955 int mem_base;
27956 int ret_val;
27957 xmlAutomataPtr am; /* an automata */
27958 int n_am;
27959 int min; /* the minimal value on the counter */
27960 int n_min;
27961 int max; /* the maximal value on the counter */
27962 int n_max;
27963
27964 for (n_am = 0;n_am < gen_nb_xmlAutomataPtr;n_am++) {
27965 for (n_min = 0;n_min < gen_nb_int;n_min++) {
27966 for (n_max = 0;n_max < gen_nb_int;n_max++) {
27967 mem_base = xmlMemBlocks();
27968 am = gen_xmlAutomataPtr(n_am, 0);
27969 min = gen_int(n_min, 1);
27970 max = gen_int(n_max, 2);
27971
27972 ret_val = xmlAutomataNewCounter(am, min, max);
27973 desret_int(ret_val);
27974 call_tests++;
27975 des_xmlAutomataPtr(n_am, am, 0);
27976 des_int(n_min, min, 1);
27977 des_int(n_max, max, 2);
27978 xmlResetLastError();
27979 if (mem_base != xmlMemBlocks()) {
27980 printf("Leak of %d blocks found in xmlAutomataNewCounter",
27981 xmlMemBlocks() - mem_base);
27982 test_ret++;
27983 printf(" %d", n_am);
27984 printf(" %d", n_min);
27985 printf(" %d", n_max);
27986 printf("\n");
27987 }
27988 }
27989 }
27990 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027991 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000027992#endif
27993
Daniel Veillarda82b1822004-11-08 16:24:57 +000027994 return(test_ret);
27995}
27996
27997
27998static int
27999test_xmlAutomataNewCounterTrans(void) {
28000 int test_ret = 0;
28001
28002
28003 /* missing type support */
28004 return(test_ret);
28005}
28006
28007
28008static int
28009test_xmlAutomataNewEpsilon(void) {
28010 int test_ret = 0;
28011
28012
28013 /* missing type support */
28014 return(test_ret);
28015}
28016
28017
28018static int
28019test_xmlAutomataNewOnceTrans(void) {
28020 int test_ret = 0;
28021
28022
28023 /* missing type support */
28024 return(test_ret);
28025}
28026
28027
28028static int
28029test_xmlAutomataNewOnceTrans2(void) {
28030 int test_ret = 0;
28031
28032
28033 /* missing type support */
28034 return(test_ret);
28035}
28036
28037
28038static int
28039test_xmlAutomataNewState(void) {
28040 int test_ret = 0;
28041
28042
28043 /* missing type support */
28044 return(test_ret);
28045}
28046
28047
28048static int
28049test_xmlAutomataNewTransition(void) {
28050 int test_ret = 0;
28051
28052
28053 /* missing type support */
28054 return(test_ret);
28055}
28056
28057
28058static int
28059test_xmlAutomataNewTransition2(void) {
28060 int test_ret = 0;
28061
28062
28063 /* missing type support */
28064 return(test_ret);
28065}
28066
28067
28068static int
28069test_xmlAutomataSetFinalState(void) {
28070 int test_ret = 0;
28071
William M. Brack21e4ef22005-01-02 09:53:13 +000028072#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_AUTOMATA_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000028073 int mem_base;
28074 int ret_val;
28075 xmlAutomataPtr am; /* an automata */
28076 int n_am;
28077 xmlAutomataStatePtr state; /* a state in this automata */
28078 int n_state;
28079
28080 for (n_am = 0;n_am < gen_nb_xmlAutomataPtr;n_am++) {
28081 for (n_state = 0;n_state < gen_nb_xmlAutomataStatePtr;n_state++) {
28082 mem_base = xmlMemBlocks();
28083 am = gen_xmlAutomataPtr(n_am, 0);
28084 state = gen_xmlAutomataStatePtr(n_state, 1);
28085
28086 ret_val = xmlAutomataSetFinalState(am, state);
28087 desret_int(ret_val);
28088 call_tests++;
28089 des_xmlAutomataPtr(n_am, am, 0);
28090 des_xmlAutomataStatePtr(n_state, state, 1);
28091 xmlResetLastError();
28092 if (mem_base != xmlMemBlocks()) {
28093 printf("Leak of %d blocks found in xmlAutomataSetFinalState",
28094 xmlMemBlocks() - mem_base);
28095 test_ret++;
28096 printf(" %d", n_am);
28097 printf(" %d", n_state);
28098 printf("\n");
28099 }
28100 }
28101 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028102 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000028103#endif
28104
Daniel Veillarda82b1822004-11-08 16:24:57 +000028105 return(test_ret);
28106}
28107
28108
28109static int
28110test_xmlNewAutomata(void) {
28111 int test_ret = 0;
28112
28113
28114 /* missing type support */
28115 return(test_ret);
28116}
28117
28118static int
28119test_xmlautomata(void) {
28120 int test_ret = 0;
28121
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028122 if (quiet == 0) printf("Testing xmlautomata : 3 of 18 functions ...\n");
Daniel Veillarda82b1822004-11-08 16:24:57 +000028123 test_ret += test_xmlAutomataCompile();
28124 test_ret += test_xmlAutomataGetInitState();
28125 test_ret += test_xmlAutomataIsDeterminist();
28126 test_ret += test_xmlAutomataNewAllTrans();
28127 test_ret += test_xmlAutomataNewCountTrans();
28128 test_ret += test_xmlAutomataNewCountTrans2();
28129 test_ret += test_xmlAutomataNewCountedTrans();
28130 test_ret += test_xmlAutomataNewCounter();
28131 test_ret += test_xmlAutomataNewCounterTrans();
28132 test_ret += test_xmlAutomataNewEpsilon();
28133 test_ret += test_xmlAutomataNewOnceTrans();
28134 test_ret += test_xmlAutomataNewOnceTrans2();
28135 test_ret += test_xmlAutomataNewState();
28136 test_ret += test_xmlAutomataNewTransition();
28137 test_ret += test_xmlAutomataNewTransition2();
28138 test_ret += test_xmlAutomataSetFinalState();
28139 test_ret += test_xmlNewAutomata();
28140
28141 if (test_ret != 0)
28142 printf("Module xmlautomata: %d errors\n", test_ret);
28143 return(test_ret);
28144}
28145
Daniel Veillardce682bc2004-11-05 17:22:25 +000028146#define gen_nb_xmlGenericErrorFunc_ptr 1
28147static xmlGenericErrorFunc * gen_xmlGenericErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
28148 return(NULL);
28149}
28150static void des_xmlGenericErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlGenericErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
28151}
28152
Daniel Veillardd93f6252004-11-02 15:53:51 +000028153static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000028154test_initGenericErrorDefaultFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028155 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028156
Daniel Veillardce682bc2004-11-05 17:22:25 +000028157 int mem_base;
28158 xmlGenericErrorFunc * handler; /* the handler */
28159 int n_handler;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028160
Daniel Veillardce682bc2004-11-05 17:22:25 +000028161 for (n_handler = 0;n_handler < gen_nb_xmlGenericErrorFunc_ptr;n_handler++) {
28162 mem_base = xmlMemBlocks();
28163 handler = gen_xmlGenericErrorFunc_ptr(n_handler, 0);
28164
28165 initGenericErrorDefaultFunc(handler);
28166 call_tests++;
28167 des_xmlGenericErrorFunc_ptr(n_handler, handler, 0);
28168 xmlResetLastError();
28169 if (mem_base != xmlMemBlocks()) {
28170 printf("Leak of %d blocks found in initGenericErrorDefaultFunc",
28171 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028172 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028173 printf(" %d", n_handler);
28174 printf("\n");
28175 }
28176 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000028177 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028178
Daniel Veillard42595322004-11-08 10:52:06 +000028179 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028180}
28181
28182
Daniel Veillardce682bc2004-11-05 17:22:25 +000028183#define gen_nb_xmlErrorPtr 1
28184static xmlErrorPtr gen_xmlErrorPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
28185 return(NULL);
28186}
28187static void des_xmlErrorPtr(int no ATTRIBUTE_UNUSED, xmlErrorPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
28188}
28189
Daniel Veillardd93f6252004-11-02 15:53:51 +000028190static int
28191test_xmlCopyError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028192 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028193
Daniel Veillardce682bc2004-11-05 17:22:25 +000028194 int mem_base;
28195 int ret_val;
28196 xmlErrorPtr from; /* a source error */
28197 int n_from;
28198 xmlErrorPtr to; /* a target error */
28199 int n_to;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028200
Daniel Veillardce682bc2004-11-05 17:22:25 +000028201 for (n_from = 0;n_from < gen_nb_xmlErrorPtr;n_from++) {
28202 for (n_to = 0;n_to < gen_nb_xmlErrorPtr;n_to++) {
28203 mem_base = xmlMemBlocks();
28204 from = gen_xmlErrorPtr(n_from, 0);
28205 to = gen_xmlErrorPtr(n_to, 1);
28206
28207 ret_val = xmlCopyError(from, to);
28208 desret_int(ret_val);
28209 call_tests++;
28210 des_xmlErrorPtr(n_from, from, 0);
28211 des_xmlErrorPtr(n_to, to, 1);
28212 xmlResetLastError();
28213 if (mem_base != xmlMemBlocks()) {
28214 printf("Leak of %d blocks found in xmlCopyError",
28215 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028216 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028217 printf(" %d", n_from);
28218 printf(" %d", n_to);
28219 printf("\n");
28220 }
28221 }
28222 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000028223 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028224
Daniel Veillard42595322004-11-08 10:52:06 +000028225 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028226}
28227
28228
28229static int
28230test_xmlCtxtGetLastError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028231 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028232
28233
28234 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028235 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028236}
28237
28238
28239static int
28240test_xmlCtxtResetLastError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028241 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028242
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000028243 int mem_base;
28244 void * ctx; /* an XML parser context */
28245 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028246
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000028247 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
28248 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028249 ctx = gen_void_ptr(n_ctx, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000028250
28251 xmlCtxtResetLastError(ctx);
28252 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028253 des_void_ptr(n_ctx, ctx, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000028254 xmlResetLastError();
28255 if (mem_base != xmlMemBlocks()) {
28256 printf("Leak of %d blocks found in xmlCtxtResetLastError",
28257 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028258 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000028259 printf(" %d", n_ctx);
28260 printf("\n");
28261 }
28262 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000028263 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028264
Daniel Veillard42595322004-11-08 10:52:06 +000028265 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028266}
28267
28268
28269static int
28270test_xmlGetLastError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028271 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028272
28273
28274 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028275 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028276}
28277
28278
28279static int
28280test_xmlParserError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028281 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028282
28283
28284 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028285 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028286}
28287
28288
28289static int
28290test_xmlParserPrintFileContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028291 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028292
Daniel Veillardce682bc2004-11-05 17:22:25 +000028293 int mem_base;
28294 xmlParserInputPtr input; /* an xmlParserInputPtr input */
28295 int n_input;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028296
Daniel Veillardce682bc2004-11-05 17:22:25 +000028297 for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) {
28298 mem_base = xmlMemBlocks();
28299 input = gen_xmlParserInputPtr(n_input, 0);
28300
28301 xmlParserPrintFileContext(input);
28302 call_tests++;
28303 des_xmlParserInputPtr(n_input, input, 0);
28304 xmlResetLastError();
28305 if (mem_base != xmlMemBlocks()) {
28306 printf("Leak of %d blocks found in xmlParserPrintFileContext",
28307 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028308 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028309 printf(" %d", n_input);
28310 printf("\n");
28311 }
28312 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000028313 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028314
Daniel Veillard42595322004-11-08 10:52:06 +000028315 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028316}
28317
28318
28319static int
28320test_xmlParserPrintFileInfo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028321 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028322
Daniel Veillardce682bc2004-11-05 17:22:25 +000028323 int mem_base;
28324 xmlParserInputPtr input; /* an xmlParserInputPtr input */
28325 int n_input;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028326
Daniel Veillardce682bc2004-11-05 17:22:25 +000028327 for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) {
28328 mem_base = xmlMemBlocks();
28329 input = gen_xmlParserInputPtr(n_input, 0);
28330
28331 xmlParserPrintFileInfo(input);
28332 call_tests++;
28333 des_xmlParserInputPtr(n_input, input, 0);
28334 xmlResetLastError();
28335 if (mem_base != xmlMemBlocks()) {
28336 printf("Leak of %d blocks found in xmlParserPrintFileInfo",
28337 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028338 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028339 printf(" %d", n_input);
28340 printf("\n");
28341 }
28342 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000028343 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028344
Daniel Veillard42595322004-11-08 10:52:06 +000028345 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028346}
28347
28348
28349static int
28350test_xmlParserValidityError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028351 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028352
28353
28354 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028355 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028356}
28357
28358
28359static int
28360test_xmlParserValidityWarning(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028361 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028362
28363
28364 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028365 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028366}
28367
28368
28369static int
28370test_xmlParserWarning(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028371 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028372
28373
28374 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028375 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028376}
28377
28378
28379static int
28380test_xmlResetError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028381 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028382
Daniel Veillardce682bc2004-11-05 17:22:25 +000028383 int mem_base;
28384 xmlErrorPtr err; /* pointer to the error. */
28385 int n_err;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028386
Daniel Veillardce682bc2004-11-05 17:22:25 +000028387 for (n_err = 0;n_err < gen_nb_xmlErrorPtr;n_err++) {
28388 mem_base = xmlMemBlocks();
28389 err = gen_xmlErrorPtr(n_err, 0);
28390
28391 xmlResetError(err);
28392 call_tests++;
28393 des_xmlErrorPtr(n_err, err, 0);
28394 xmlResetLastError();
28395 if (mem_base != xmlMemBlocks()) {
28396 printf("Leak of %d blocks found in xmlResetError",
28397 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028398 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028399 printf(" %d", n_err);
28400 printf("\n");
28401 }
28402 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000028403 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028404
Daniel Veillard42595322004-11-08 10:52:06 +000028405 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028406}
28407
28408
28409static int
28410test_xmlResetLastError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028411 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028412
28413
28414
28415 xmlResetLastError();
28416 call_tests++;
28417 xmlResetLastError();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028418 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028419
Daniel Veillard42595322004-11-08 10:52:06 +000028420 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028421}
28422
28423
28424static int
28425test_xmlSetGenericErrorFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028426 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028427
28428
28429 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028430 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028431}
28432
28433
28434static int
28435test_xmlSetStructuredErrorFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028436 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028437
28438
28439 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028440 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028441}
28442
28443static int
28444test_xmlerror(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028445 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028446
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028447 if (quiet == 0) printf("Testing xmlerror : 7 of 15 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000028448 test_ret += test_initGenericErrorDefaultFunc();
28449 test_ret += test_xmlCopyError();
28450 test_ret += test_xmlCtxtGetLastError();
28451 test_ret += test_xmlCtxtResetLastError();
28452 test_ret += test_xmlGetLastError();
28453 test_ret += test_xmlParserError();
28454 test_ret += test_xmlParserPrintFileContext();
28455 test_ret += test_xmlParserPrintFileInfo();
28456 test_ret += test_xmlParserValidityError();
28457 test_ret += test_xmlParserValidityWarning();
28458 test_ret += test_xmlParserWarning();
28459 test_ret += test_xmlResetError();
28460 test_ret += test_xmlResetLastError();
28461 test_ret += test_xmlSetGenericErrorFunc();
28462 test_ret += test_xmlSetStructuredErrorFunc();
Daniel Veillardd93f6252004-11-02 15:53:51 +000028463
Daniel Veillard42595322004-11-08 10:52:06 +000028464 if (test_ret != 0)
28465 printf("Module xmlerror: %d errors\n", test_ret);
28466 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028467}
Daniel Veillardfc0b6f62005-01-09 17:48:02 +000028468#ifdef LIBXML_MODULES_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000028469
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028470#define gen_nb_xmlModulePtr 1
28471static xmlModulePtr gen_xmlModulePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
28472 return(NULL);
28473}
28474static void des_xmlModulePtr(int no ATTRIBUTE_UNUSED, xmlModulePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
28475}
Daniel Veillardfc0b6f62005-01-09 17:48:02 +000028476#endif
28477
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028478
28479static int
28480test_xmlModuleClose(void) {
28481 int test_ret = 0;
28482
28483#if defined(LIBXML_MODULES_ENABLED)
28484 int mem_base;
28485 int ret_val;
28486 xmlModulePtr module; /* the module handle */
28487 int n_module;
28488
28489 for (n_module = 0;n_module < gen_nb_xmlModulePtr;n_module++) {
28490 mem_base = xmlMemBlocks();
28491 module = gen_xmlModulePtr(n_module, 0);
28492
28493 ret_val = xmlModuleClose(module);
28494 desret_int(ret_val);
28495 call_tests++;
28496 des_xmlModulePtr(n_module, module, 0);
28497 xmlResetLastError();
28498 if (mem_base != xmlMemBlocks()) {
28499 printf("Leak of %d blocks found in xmlModuleClose",
28500 xmlMemBlocks() - mem_base);
28501 test_ret++;
28502 printf(" %d", n_module);
28503 printf("\n");
28504 }
28505 }
28506 function_tests++;
28507#endif
28508
28509 return(test_ret);
28510}
28511
28512
28513static int
28514test_xmlModuleOpen(void) {
28515 int test_ret = 0;
28516
28517
28518 /* missing type support */
28519 return(test_ret);
28520}
28521
28522
28523static int
28524test_xmlModuleSymbol(void) {
28525 int test_ret = 0;
28526
28527#if defined(LIBXML_MODULES_ENABLED)
28528 int mem_base;
Daniel Veillardbe076e92005-01-04 20:18:14 +000028529 int ret_val;
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028530 xmlModulePtr module; /* the module */
28531 int n_module;
28532 char * name; /* the name of the symbol */
28533 int n_name;
Daniel Veillardbe076e92005-01-04 20:18:14 +000028534 void ** symbol; /* the resulting symbol address */
28535 int n_symbol;
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028536
28537 for (n_module = 0;n_module < gen_nb_xmlModulePtr;n_module++) {
28538 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
Daniel Veillardbe076e92005-01-04 20:18:14 +000028539 for (n_symbol = 0;n_symbol < gen_nb_void_ptr_ptr;n_symbol++) {
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028540 mem_base = xmlMemBlocks();
28541 module = gen_xmlModulePtr(n_module, 0);
28542 name = gen_const_char_ptr(n_name, 1);
Daniel Veillardbe076e92005-01-04 20:18:14 +000028543 symbol = gen_void_ptr_ptr(n_symbol, 2);
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028544
Daniel Veillardbe076e92005-01-04 20:18:14 +000028545 ret_val = xmlModuleSymbol(module, (const char *)name, symbol);
28546 desret_int(ret_val);
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028547 call_tests++;
28548 des_xmlModulePtr(n_module, module, 0);
28549 des_const_char_ptr(n_name, (const char *)name, 1);
Daniel Veillardbe076e92005-01-04 20:18:14 +000028550 des_void_ptr_ptr(n_symbol, symbol, 2);
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028551 xmlResetLastError();
28552 if (mem_base != xmlMemBlocks()) {
28553 printf("Leak of %d blocks found in xmlModuleSymbol",
28554 xmlMemBlocks() - mem_base);
28555 test_ret++;
28556 printf(" %d", n_module);
28557 printf(" %d", n_name);
Daniel Veillardbe076e92005-01-04 20:18:14 +000028558 printf(" %d", n_symbol);
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028559 printf("\n");
28560 }
28561 }
28562 }
Daniel Veillardbe076e92005-01-04 20:18:14 +000028563 }
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028564 function_tests++;
28565#endif
28566
28567 return(test_ret);
28568}
28569
28570static int
28571test_xmlmodule(void) {
28572 int test_ret = 0;
28573
28574 if (quiet == 0) printf("Testing xmlmodule : 2 of 4 functions ...\n");
28575 test_ret += test_xmlModuleClose();
28576 test_ret += test_xmlModuleOpen();
28577 test_ret += test_xmlModuleSymbol();
28578
28579 if (test_ret != 0)
28580 printf("Module xmlmodule: %d errors\n", test_ret);
28581 return(test_ret);
28582}
28583
Daniel Veillardd93f6252004-11-02 15:53:51 +000028584static int
28585test_xmlNewTextReader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028586 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028587
William M. Brack21e4ef22005-01-02 09:53:13 +000028588#if defined(LIBXML_READER_ENABLED)
Daniel Veillard34099b42004-11-04 17:34:35 +000028589 int mem_base;
28590 xmlTextReaderPtr ret_val;
28591 xmlParserInputBufferPtr input; /* the xmlParserInputBufferPtr used to read data */
28592 int n_input;
28593 const char * URI; /* the URI information for the source if available */
28594 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028595
Daniel Veillard34099b42004-11-04 17:34:35 +000028596 for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
28597 for (n_URI = 0;n_URI < gen_nb_filepath;n_URI++) {
28598 mem_base = xmlMemBlocks();
28599 input = gen_xmlParserInputBufferPtr(n_input, 0);
28600 URI = gen_filepath(n_URI, 1);
28601
28602 ret_val = xmlNewTextReader(input, URI);
28603 desret_xmlTextReaderPtr(ret_val);
28604 call_tests++;
28605 des_xmlParserInputBufferPtr(n_input, input, 0);
28606 des_filepath(n_URI, URI, 1);
28607 xmlResetLastError();
28608 if (mem_base != xmlMemBlocks()) {
28609 printf("Leak of %d blocks found in xmlNewTextReader",
28610 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028611 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000028612 printf(" %d", n_input);
28613 printf(" %d", n_URI);
28614 printf("\n");
28615 }
28616 }
28617 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028618 function_tests++;
Daniel Veillard34099b42004-11-04 17:34:35 +000028619#endif
28620
Daniel Veillard42595322004-11-08 10:52:06 +000028621 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028622}
28623
28624
28625static int
28626test_xmlNewTextReaderFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028627 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028628
William M. Brack21e4ef22005-01-02 09:53:13 +000028629#if defined(LIBXML_READER_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028630 int mem_base;
28631 xmlTextReaderPtr ret_val;
28632 const char * URI; /* the URI of the resource to process */
28633 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028634
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028635 for (n_URI = 0;n_URI < gen_nb_filepath;n_URI++) {
28636 mem_base = xmlMemBlocks();
28637 URI = gen_filepath(n_URI, 0);
28638
28639 ret_val = xmlNewTextReaderFilename(URI);
28640 desret_xmlTextReaderPtr(ret_val);
28641 call_tests++;
28642 des_filepath(n_URI, URI, 0);
28643 xmlResetLastError();
28644 if (mem_base != xmlMemBlocks()) {
28645 printf("Leak of %d blocks found in xmlNewTextReaderFilename",
28646 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028647 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028648 printf(" %d", n_URI);
28649 printf("\n");
28650 }
28651 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028652 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028653#endif
28654
Daniel Veillard42595322004-11-08 10:52:06 +000028655 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028656}
28657
28658
28659static int
28660test_xmlReaderForDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028661 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028662
William M. Brack21e4ef22005-01-02 09:53:13 +000028663#if defined(LIBXML_READER_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028664 int mem_base;
28665 xmlTextReaderPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028666 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028667 int n_cur;
28668 const char * URL; /* the base URL to use for the document */
28669 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028670 char * encoding; /* the document encoding, or NULL */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028671 int n_encoding;
28672 int options; /* a combination of xmlParserOption */
28673 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028674
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028675 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
28676 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
28677 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028678 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028679 mem_base = xmlMemBlocks();
28680 cur = gen_const_xmlChar_ptr(n_cur, 0);
28681 URL = gen_filepath(n_URL, 1);
28682 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000028683 options = gen_parseroptions(n_options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028684
William M. Brackf13f77f2004-11-12 16:03:48 +000028685 ret_val = xmlReaderForDoc((const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028686 desret_xmlTextReaderPtr(ret_val);
28687 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000028688 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028689 des_filepath(n_URL, URL, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000028690 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000028691 des_parseroptions(n_options, options, 3);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028692 xmlResetLastError();
28693 if (mem_base != xmlMemBlocks()) {
28694 printf("Leak of %d blocks found in xmlReaderForDoc",
28695 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028696 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028697 printf(" %d", n_cur);
28698 printf(" %d", n_URL);
28699 printf(" %d", n_encoding);
28700 printf(" %d", n_options);
28701 printf("\n");
28702 }
28703 }
28704 }
28705 }
28706 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028707 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028708#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000028709
Daniel Veillard42595322004-11-08 10:52:06 +000028710 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028711}
28712
28713
28714static int
28715test_xmlReaderForFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028716 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028717
William M. Brack21e4ef22005-01-02 09:53:13 +000028718#if defined(LIBXML_READER_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028719 int mem_base;
28720 xmlTextReaderPtr ret_val;
28721 const char * filename; /* a file or URL */
28722 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028723 char * encoding; /* the document encoding, or NULL */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028724 int n_encoding;
28725 int options; /* a combination of xmlParserOption */
28726 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028727
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028728 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
28729 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028730 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028731 mem_base = xmlMemBlocks();
28732 filename = gen_filepath(n_filename, 0);
28733 encoding = gen_const_char_ptr(n_encoding, 1);
Daniel Veillard6128c012004-11-08 17:16:15 +000028734 options = gen_parseroptions(n_options, 2);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028735
William M. Brackf13f77f2004-11-12 16:03:48 +000028736 ret_val = xmlReaderForFile(filename, (const char *)encoding, options);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028737 desret_xmlTextReaderPtr(ret_val);
28738 call_tests++;
28739 des_filepath(n_filename, filename, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000028740 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillard6128c012004-11-08 17:16:15 +000028741 des_parseroptions(n_options, options, 2);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028742 xmlResetLastError();
28743 if (mem_base != xmlMemBlocks()) {
28744 printf("Leak of %d blocks found in xmlReaderForFile",
28745 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028746 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028747 printf(" %d", n_filename);
28748 printf(" %d", n_encoding);
28749 printf(" %d", n_options);
28750 printf("\n");
28751 }
28752 }
28753 }
28754 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028755 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028756#endif
28757
Daniel Veillard42595322004-11-08 10:52:06 +000028758 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028759}
28760
28761
28762static int
28763test_xmlReaderForMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028764 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028765
William M. Brack21e4ef22005-01-02 09:53:13 +000028766#if defined(LIBXML_READER_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028767 int mem_base;
28768 xmlTextReaderPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028769 char * buffer; /* a pointer to a char array */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028770 int n_buffer;
28771 int size; /* the size of the array */
28772 int n_size;
28773 const char * URL; /* the base URL to use for the document */
28774 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028775 char * encoding; /* the document encoding, or NULL */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028776 int n_encoding;
28777 int options; /* a combination of xmlParserOption */
28778 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028779
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028780 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
28781 for (n_size = 0;n_size < gen_nb_int;n_size++) {
28782 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
28783 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028784 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028785 mem_base = xmlMemBlocks();
28786 buffer = gen_const_char_ptr(n_buffer, 0);
28787 size = gen_int(n_size, 1);
28788 URL = gen_filepath(n_URL, 2);
28789 encoding = gen_const_char_ptr(n_encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000028790 options = gen_parseroptions(n_options, 4);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028791
William M. Brackf13f77f2004-11-12 16:03:48 +000028792 ret_val = xmlReaderForMemory((const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028793 desret_xmlTextReaderPtr(ret_val);
28794 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000028795 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028796 des_int(n_size, size, 1);
28797 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000028798 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000028799 des_parseroptions(n_options, options, 4);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028800 xmlResetLastError();
28801 if (mem_base != xmlMemBlocks()) {
28802 printf("Leak of %d blocks found in xmlReaderForMemory",
28803 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028804 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028805 printf(" %d", n_buffer);
28806 printf(" %d", n_size);
28807 printf(" %d", n_URL);
28808 printf(" %d", n_encoding);
28809 printf(" %d", n_options);
28810 printf("\n");
28811 }
28812 }
28813 }
28814 }
28815 }
28816 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028817 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028818#endif
28819
Daniel Veillard42595322004-11-08 10:52:06 +000028820 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028821}
28822
28823
28824static int
28825test_xmlReaderNewDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028826 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028827
William M. Brack21e4ef22005-01-02 09:53:13 +000028828#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028829 int mem_base;
28830 int ret_val;
28831 xmlTextReaderPtr reader; /* an XML reader */
28832 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028833 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028834 int n_cur;
28835 const char * URL; /* the base URL to use for the document */
28836 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028837 char * encoding; /* the document encoding, or NULL */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028838 int n_encoding;
28839 int options; /* a combination of xmlParserOption */
28840 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028841
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028842 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28843 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
28844 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
28845 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028846 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028847 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028848 reader = gen_xmlTextReaderPtr(n_reader, 0);
28849 cur = gen_const_xmlChar_ptr(n_cur, 1);
28850 URL = gen_filepath(n_URL, 2);
28851 encoding = gen_const_char_ptr(n_encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000028852 options = gen_parseroptions(n_options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028853
William M. Brackf13f77f2004-11-12 16:03:48 +000028854 ret_val = xmlReaderNewDoc(reader, (const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028855 desret_int(ret_val);
28856 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028857 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000028858 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000028859 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000028860 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000028861 des_parseroptions(n_options, options, 4);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028862 xmlResetLastError();
28863 if (mem_base != xmlMemBlocks()) {
28864 printf("Leak of %d blocks found in xmlReaderNewDoc",
28865 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028866 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028867 printf(" %d", n_reader);
28868 printf(" %d", n_cur);
28869 printf(" %d", n_URL);
28870 printf(" %d", n_encoding);
28871 printf(" %d", n_options);
28872 printf("\n");
28873 }
28874 }
28875 }
28876 }
28877 }
28878 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028879 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028880#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000028881
Daniel Veillard42595322004-11-08 10:52:06 +000028882 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028883}
28884
28885
28886static int
28887test_xmlReaderNewFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028888 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028889
William M. Brack21e4ef22005-01-02 09:53:13 +000028890#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028891 int mem_base;
28892 int ret_val;
28893 xmlTextReaderPtr reader; /* an XML reader */
28894 int n_reader;
28895 const char * filename; /* a file or URL */
28896 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028897 char * encoding; /* the document encoding, or NULL */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028898 int n_encoding;
28899 int options; /* a combination of xmlParserOption */
28900 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028901
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028902 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28903 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
28904 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028905 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028906 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028907 reader = gen_xmlTextReaderPtr(n_reader, 0);
28908 filename = gen_filepath(n_filename, 1);
28909 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000028910 options = gen_parseroptions(n_options, 3);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028911
William M. Brackf13f77f2004-11-12 16:03:48 +000028912 ret_val = xmlReaderNewFile(reader, filename, (const char *)encoding, options);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028913 desret_int(ret_val);
28914 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028915 des_xmlTextReaderPtr(n_reader, reader, 0);
28916 des_filepath(n_filename, filename, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000028917 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000028918 des_parseroptions(n_options, options, 3);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028919 xmlResetLastError();
28920 if (mem_base != xmlMemBlocks()) {
28921 printf("Leak of %d blocks found in xmlReaderNewFile",
28922 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028923 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028924 printf(" %d", n_reader);
28925 printf(" %d", n_filename);
28926 printf(" %d", n_encoding);
28927 printf(" %d", n_options);
28928 printf("\n");
28929 }
28930 }
28931 }
28932 }
28933 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028934 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028935#endif
28936
Daniel Veillard42595322004-11-08 10:52:06 +000028937 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028938}
28939
28940
28941static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000028942test_xmlReaderNewMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028943 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028944
William M. Brack21e4ef22005-01-02 09:53:13 +000028945#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028946 int mem_base;
28947 int ret_val;
28948 xmlTextReaderPtr reader; /* an XML reader */
28949 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028950 char * buffer; /* a pointer to a char array */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028951 int n_buffer;
28952 int size; /* the size of the array */
28953 int n_size;
28954 const char * URL; /* the base URL to use for the document */
28955 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028956 char * encoding; /* the document encoding, or NULL */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028957 int n_encoding;
28958 int options; /* a combination of xmlParserOption */
28959 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028960
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028961 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28962 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
28963 for (n_size = 0;n_size < gen_nb_int;n_size++) {
28964 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
28965 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028966 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028967 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028968 reader = gen_xmlTextReaderPtr(n_reader, 0);
28969 buffer = gen_const_char_ptr(n_buffer, 1);
28970 size = gen_int(n_size, 2);
28971 URL = gen_filepath(n_URL, 3);
28972 encoding = gen_const_char_ptr(n_encoding, 4);
Daniel Veillard6128c012004-11-08 17:16:15 +000028973 options = gen_parseroptions(n_options, 5);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028974
William M. Brackf13f77f2004-11-12 16:03:48 +000028975 ret_val = xmlReaderNewMemory(reader, (const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028976 desret_int(ret_val);
28977 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028978 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000028979 des_const_char_ptr(n_buffer, (const char *)buffer, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000028980 des_int(n_size, size, 2);
28981 des_filepath(n_URL, URL, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000028982 des_const_char_ptr(n_encoding, (const char *)encoding, 4);
Daniel Veillard6128c012004-11-08 17:16:15 +000028983 des_parseroptions(n_options, options, 5);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028984 xmlResetLastError();
28985 if (mem_base != xmlMemBlocks()) {
28986 printf("Leak of %d blocks found in xmlReaderNewMemory",
28987 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028988 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028989 printf(" %d", n_reader);
28990 printf(" %d", n_buffer);
28991 printf(" %d", n_size);
28992 printf(" %d", n_URL);
28993 printf(" %d", n_encoding);
28994 printf(" %d", n_options);
28995 printf("\n");
28996 }
28997 }
28998 }
28999 }
29000 }
29001 }
29002 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029003 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029004#endif
29005
Daniel Veillard42595322004-11-08 10:52:06 +000029006 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029007}
29008
29009
29010static int
29011test_xmlReaderNewWalker(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029012 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029013
William M. Brack21e4ef22005-01-02 09:53:13 +000029014#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029015 int mem_base;
29016 int ret_val;
29017 xmlTextReaderPtr reader; /* an XML reader */
29018 int n_reader;
29019 xmlDocPtr doc; /* a preparsed document */
29020 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029021
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029022 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29023 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
29024 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029025 reader = gen_xmlTextReaderPtr(n_reader, 0);
29026 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029027
29028 ret_val = xmlReaderNewWalker(reader, doc);
29029 desret_int(ret_val);
29030 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029031 des_xmlTextReaderPtr(n_reader, reader, 0);
29032 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029033 xmlResetLastError();
29034 if (mem_base != xmlMemBlocks()) {
29035 printf("Leak of %d blocks found in xmlReaderNewWalker",
29036 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029037 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029038 printf(" %d", n_reader);
29039 printf(" %d", n_doc);
29040 printf("\n");
29041 }
29042 }
29043 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029044 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029045#endif
29046
Daniel Veillard42595322004-11-08 10:52:06 +000029047 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029048}
29049
29050
29051static int
29052test_xmlReaderWalker(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029053 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029054
William M. Brack21e4ef22005-01-02 09:53:13 +000029055#if defined(LIBXML_READER_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000029056 int mem_base;
29057 xmlTextReaderPtr ret_val;
29058 xmlDocPtr doc; /* a preparsed document */
29059 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029060
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000029061 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
29062 mem_base = xmlMemBlocks();
29063 doc = gen_xmlDocPtr(n_doc, 0);
29064
29065 ret_val = xmlReaderWalker(doc);
29066 desret_xmlTextReaderPtr(ret_val);
29067 call_tests++;
29068 des_xmlDocPtr(n_doc, doc, 0);
29069 xmlResetLastError();
29070 if (mem_base != xmlMemBlocks()) {
29071 printf("Leak of %d blocks found in xmlReaderWalker",
29072 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029073 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000029074 printf(" %d", n_doc);
29075 printf("\n");
29076 }
29077 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029078 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000029079#endif
29080
Daniel Veillard42595322004-11-08 10:52:06 +000029081 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029082}
29083
29084
29085static int
29086test_xmlTextReaderAttributeCount(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029087 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029088
William M. Brack21e4ef22005-01-02 09:53:13 +000029089#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029090 int mem_base;
29091 int ret_val;
29092 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29093 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029094
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029095 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29096 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029097 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029098
29099 ret_val = xmlTextReaderAttributeCount(reader);
29100 desret_int(ret_val);
29101 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029102 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029103 xmlResetLastError();
29104 if (mem_base != xmlMemBlocks()) {
29105 printf("Leak of %d blocks found in xmlTextReaderAttributeCount",
29106 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029107 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029108 printf(" %d", n_reader);
29109 printf("\n");
29110 }
29111 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029112 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029113#endif
29114
Daniel Veillard42595322004-11-08 10:52:06 +000029115 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029116}
29117
29118
29119static int
29120test_xmlTextReaderBaseUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029121 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029122
William M. Brack21e4ef22005-01-02 09:53:13 +000029123#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029124 int mem_base;
29125 xmlChar * ret_val;
29126 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29127 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029128
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029129 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29130 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029131 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029132
29133 ret_val = xmlTextReaderBaseUri(reader);
29134 desret_xmlChar_ptr(ret_val);
29135 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029136 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029137 xmlResetLastError();
29138 if (mem_base != xmlMemBlocks()) {
29139 printf("Leak of %d blocks found in xmlTextReaderBaseUri",
29140 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029141 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029142 printf(" %d", n_reader);
29143 printf("\n");
29144 }
29145 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029146 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029147#endif
29148
Daniel Veillard42595322004-11-08 10:52:06 +000029149 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029150}
29151
29152
29153static int
Daniel Veillardb5839c32005-02-19 18:27:14 +000029154test_xmlTextReaderByteConsumed(void) {
29155 int test_ret = 0;
29156
29157#if defined(LIBXML_READER_ENABLED)
29158 int mem_base;
29159 long ret_val;
29160 xmlTextReaderPtr reader; /* an XML reader */
29161 int n_reader;
29162
29163 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29164 mem_base = xmlMemBlocks();
29165 reader = gen_xmlTextReaderPtr(n_reader, 0);
29166
29167 ret_val = xmlTextReaderByteConsumed(reader);
29168 desret_long(ret_val);
29169 call_tests++;
29170 des_xmlTextReaderPtr(n_reader, reader, 0);
29171 xmlResetLastError();
29172 if (mem_base != xmlMemBlocks()) {
29173 printf("Leak of %d blocks found in xmlTextReaderByteConsumed",
29174 xmlMemBlocks() - mem_base);
29175 test_ret++;
29176 printf(" %d", n_reader);
29177 printf("\n");
29178 }
29179 }
29180 function_tests++;
29181#endif
29182
29183 return(test_ret);
29184}
29185
29186
29187static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000029188test_xmlTextReaderClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029189 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029190
William M. Brack21e4ef22005-01-02 09:53:13 +000029191#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029192 int mem_base;
29193 int ret_val;
29194 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29195 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029196
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029197 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29198 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029199 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029200
29201 ret_val = xmlTextReaderClose(reader);
29202 desret_int(ret_val);
29203 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029204 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029205 xmlResetLastError();
29206 if (mem_base != xmlMemBlocks()) {
29207 printf("Leak of %d blocks found in xmlTextReaderClose",
29208 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029209 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029210 printf(" %d", n_reader);
29211 printf("\n");
29212 }
29213 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029214 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029215#endif
29216
Daniel Veillard42595322004-11-08 10:52:06 +000029217 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029218}
29219
29220
29221static int
29222test_xmlTextReaderConstBaseUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029223 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029224
William M. Brack21e4ef22005-01-02 09:53:13 +000029225#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029226 int mem_base;
29227 const xmlChar * ret_val;
29228 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29229 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029230
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029231 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29232 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029233 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029234
29235 ret_val = xmlTextReaderConstBaseUri(reader);
29236 desret_const_xmlChar_ptr(ret_val);
29237 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029238 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029239 xmlResetLastError();
29240 if (mem_base != xmlMemBlocks()) {
29241 printf("Leak of %d blocks found in xmlTextReaderConstBaseUri",
29242 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029243 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029244 printf(" %d", n_reader);
29245 printf("\n");
29246 }
29247 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029248 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029249#endif
29250
Daniel Veillard42595322004-11-08 10:52:06 +000029251 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029252}
29253
29254
29255static int
29256test_xmlTextReaderConstEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029257 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029258
William M. Brack21e4ef22005-01-02 09:53:13 +000029259#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029260 int mem_base;
29261 const xmlChar * ret_val;
29262 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29263 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029264
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029265 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29266 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029267 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029268
29269 ret_val = xmlTextReaderConstEncoding(reader);
29270 desret_const_xmlChar_ptr(ret_val);
29271 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029272 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029273 xmlResetLastError();
29274 if (mem_base != xmlMemBlocks()) {
29275 printf("Leak of %d blocks found in xmlTextReaderConstEncoding",
29276 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029277 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029278 printf(" %d", n_reader);
29279 printf("\n");
29280 }
29281 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029282 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029283#endif
29284
Daniel Veillard42595322004-11-08 10:52:06 +000029285 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029286}
29287
29288
29289static int
29290test_xmlTextReaderConstLocalName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029291 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029292
William M. Brack21e4ef22005-01-02 09:53:13 +000029293#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029294 int mem_base;
29295 const xmlChar * ret_val;
29296 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29297 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029298
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029299 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29300 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029301 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029302
29303 ret_val = xmlTextReaderConstLocalName(reader);
29304 desret_const_xmlChar_ptr(ret_val);
29305 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029306 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029307 xmlResetLastError();
29308 if (mem_base != xmlMemBlocks()) {
29309 printf("Leak of %d blocks found in xmlTextReaderConstLocalName",
29310 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029311 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029312 printf(" %d", n_reader);
29313 printf("\n");
29314 }
29315 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029316 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029317#endif
29318
Daniel Veillard42595322004-11-08 10:52:06 +000029319 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029320}
29321
29322
29323static int
29324test_xmlTextReaderConstName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029325 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029326
William M. Brack21e4ef22005-01-02 09:53:13 +000029327#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029328 int mem_base;
29329 const xmlChar * ret_val;
29330 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29331 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029332
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029333 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29334 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029335 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029336
29337 ret_val = xmlTextReaderConstName(reader);
29338 desret_const_xmlChar_ptr(ret_val);
29339 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029340 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029341 xmlResetLastError();
29342 if (mem_base != xmlMemBlocks()) {
29343 printf("Leak of %d blocks found in xmlTextReaderConstName",
29344 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029345 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029346 printf(" %d", n_reader);
29347 printf("\n");
29348 }
29349 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029350 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029351#endif
29352
Daniel Veillard42595322004-11-08 10:52:06 +000029353 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029354}
29355
29356
29357static int
29358test_xmlTextReaderConstNamespaceUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029359 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029360
William M. Brack21e4ef22005-01-02 09:53:13 +000029361#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029362 int mem_base;
29363 const xmlChar * ret_val;
29364 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29365 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029366
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029367 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29368 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029369 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029370
29371 ret_val = xmlTextReaderConstNamespaceUri(reader);
29372 desret_const_xmlChar_ptr(ret_val);
29373 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029374 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029375 xmlResetLastError();
29376 if (mem_base != xmlMemBlocks()) {
29377 printf("Leak of %d blocks found in xmlTextReaderConstNamespaceUri",
29378 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029379 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029380 printf(" %d", n_reader);
29381 printf("\n");
29382 }
29383 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029384 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029385#endif
29386
Daniel Veillard42595322004-11-08 10:52:06 +000029387 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029388}
29389
29390
29391static int
29392test_xmlTextReaderConstPrefix(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029393 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029394
William M. Brack21e4ef22005-01-02 09:53:13 +000029395#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029396 int mem_base;
29397 const xmlChar * ret_val;
29398 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29399 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029400
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029401 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29402 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029403 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029404
29405 ret_val = xmlTextReaderConstPrefix(reader);
29406 desret_const_xmlChar_ptr(ret_val);
29407 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029408 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029409 xmlResetLastError();
29410 if (mem_base != xmlMemBlocks()) {
29411 printf("Leak of %d blocks found in xmlTextReaderConstPrefix",
29412 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029413 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029414 printf(" %d", n_reader);
29415 printf("\n");
29416 }
29417 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029418 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029419#endif
29420
Daniel Veillard42595322004-11-08 10:52:06 +000029421 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029422}
29423
29424
29425static int
29426test_xmlTextReaderConstString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029427 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029428
William M. Brack21e4ef22005-01-02 09:53:13 +000029429#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029430 int mem_base;
29431 const xmlChar * ret_val;
29432 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29433 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029434 xmlChar * str; /* the string to intern. */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029435 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029436
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029437 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29438 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
29439 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029440 reader = gen_xmlTextReaderPtr(n_reader, 0);
29441 str = gen_const_xmlChar_ptr(n_str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029442
William M. Brackf13f77f2004-11-12 16:03:48 +000029443 ret_val = xmlTextReaderConstString(reader, (const xmlChar *)str);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029444 desret_const_xmlChar_ptr(ret_val);
29445 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029446 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000029447 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029448 xmlResetLastError();
29449 if (mem_base != xmlMemBlocks()) {
29450 printf("Leak of %d blocks found in xmlTextReaderConstString",
29451 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029452 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029453 printf(" %d", n_reader);
29454 printf(" %d", n_str);
29455 printf("\n");
29456 }
29457 }
29458 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029459 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029460#endif
29461
Daniel Veillard42595322004-11-08 10:52:06 +000029462 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029463}
29464
29465
29466static int
29467test_xmlTextReaderConstValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029468 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029469
William M. Brack21e4ef22005-01-02 09:53:13 +000029470#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029471 int mem_base;
29472 const xmlChar * ret_val;
29473 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29474 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029475
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029476 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29477 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029478 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029479
29480 ret_val = xmlTextReaderConstValue(reader);
29481 desret_const_xmlChar_ptr(ret_val);
29482 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029483 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029484 xmlResetLastError();
29485 if (mem_base != xmlMemBlocks()) {
29486 printf("Leak of %d blocks found in xmlTextReaderConstValue",
29487 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029488 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029489 printf(" %d", n_reader);
29490 printf("\n");
29491 }
29492 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029493 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029494#endif
29495
Daniel Veillard42595322004-11-08 10:52:06 +000029496 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029497}
29498
29499
29500static int
29501test_xmlTextReaderConstXmlLang(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029502 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029503
William M. Brack21e4ef22005-01-02 09:53:13 +000029504#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029505 int mem_base;
29506 const xmlChar * ret_val;
29507 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29508 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029509
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029510 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29511 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029512 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029513
29514 ret_val = xmlTextReaderConstXmlLang(reader);
29515 desret_const_xmlChar_ptr(ret_val);
29516 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029517 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029518 xmlResetLastError();
29519 if (mem_base != xmlMemBlocks()) {
29520 printf("Leak of %d blocks found in xmlTextReaderConstXmlLang",
29521 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029522 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029523 printf(" %d", n_reader);
29524 printf("\n");
29525 }
29526 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029527 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029528#endif
29529
Daniel Veillard42595322004-11-08 10:52:06 +000029530 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029531}
29532
29533
29534static int
29535test_xmlTextReaderConstXmlVersion(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029536 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029537
William M. Brack21e4ef22005-01-02 09:53:13 +000029538#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029539 int mem_base;
29540 const xmlChar * ret_val;
29541 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29542 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029543
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029544 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29545 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029546 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029547
29548 ret_val = xmlTextReaderConstXmlVersion(reader);
29549 desret_const_xmlChar_ptr(ret_val);
29550 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029551 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029552 xmlResetLastError();
29553 if (mem_base != xmlMemBlocks()) {
29554 printf("Leak of %d blocks found in xmlTextReaderConstXmlVersion",
29555 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029556 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029557 printf(" %d", n_reader);
29558 printf("\n");
29559 }
29560 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029561 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029562#endif
29563
Daniel Veillard42595322004-11-08 10:52:06 +000029564 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029565}
29566
29567
29568static int
29569test_xmlTextReaderCurrentDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029570 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029571
William M. Brack21e4ef22005-01-02 09:53:13 +000029572#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029573 int mem_base;
29574 xmlDocPtr ret_val;
29575 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29576 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029577
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029578 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29579 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029580 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029581
29582 ret_val = xmlTextReaderCurrentDoc(reader);
29583 desret_xmlDocPtr(ret_val);
29584 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029585 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029586 xmlResetLastError();
29587 if (mem_base != xmlMemBlocks()) {
29588 printf("Leak of %d blocks found in xmlTextReaderCurrentDoc",
29589 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029590 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029591 printf(" %d", n_reader);
29592 printf("\n");
29593 }
29594 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029595 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029596#endif
29597
Daniel Veillard42595322004-11-08 10:52:06 +000029598 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029599}
29600
29601
29602static int
29603test_xmlTextReaderCurrentNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029604 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029605
William M. Brack21e4ef22005-01-02 09:53:13 +000029606#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029607 int mem_base;
29608 xmlNodePtr ret_val;
29609 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29610 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029611
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029612 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29613 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029614 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029615
29616 ret_val = xmlTextReaderCurrentNode(reader);
29617 desret_xmlNodePtr(ret_val);
29618 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029619 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029620 xmlResetLastError();
29621 if (mem_base != xmlMemBlocks()) {
29622 printf("Leak of %d blocks found in xmlTextReaderCurrentNode",
29623 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029624 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029625 printf(" %d", n_reader);
29626 printf("\n");
29627 }
29628 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029629 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029630#endif
29631
Daniel Veillard42595322004-11-08 10:52:06 +000029632 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029633}
29634
29635
29636static int
29637test_xmlTextReaderDepth(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029638 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029639
William M. Brack21e4ef22005-01-02 09:53:13 +000029640#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029641 int mem_base;
29642 int ret_val;
29643 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29644 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029645
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029646 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29647 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029648 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029649
29650 ret_val = xmlTextReaderDepth(reader);
29651 desret_int(ret_val);
29652 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029653 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029654 xmlResetLastError();
29655 if (mem_base != xmlMemBlocks()) {
29656 printf("Leak of %d blocks found in xmlTextReaderDepth",
29657 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029658 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029659 printf(" %d", n_reader);
29660 printf("\n");
29661 }
29662 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029663 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029664#endif
29665
Daniel Veillard42595322004-11-08 10:52:06 +000029666 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029667}
29668
29669
29670static int
29671test_xmlTextReaderExpand(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029672 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029673
William M. Brack21e4ef22005-01-02 09:53:13 +000029674#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029675 int mem_base;
29676 xmlNodePtr ret_val;
29677 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29678 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029679
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029680 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29681 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029682 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029683
29684 ret_val = xmlTextReaderExpand(reader);
29685 desret_xmlNodePtr(ret_val);
29686 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029687 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029688 xmlResetLastError();
29689 if (mem_base != xmlMemBlocks()) {
29690 printf("Leak of %d blocks found in xmlTextReaderExpand",
29691 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029692 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029693 printf(" %d", n_reader);
29694 printf("\n");
29695 }
29696 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029697 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029698#endif
29699
Daniel Veillard42595322004-11-08 10:52:06 +000029700 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029701}
29702
29703
29704static int
29705test_xmlTextReaderGetAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029706 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029707
William M. Brack21e4ef22005-01-02 09:53:13 +000029708#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029709 int mem_base;
29710 xmlChar * ret_val;
29711 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29712 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029713 xmlChar * name; /* the qualified name of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029714 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029715
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029716 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29717 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
29718 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029719 reader = gen_xmlTextReaderPtr(n_reader, 0);
29720 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029721
William M. Brackf13f77f2004-11-12 16:03:48 +000029722 ret_val = xmlTextReaderGetAttribute(reader, (const xmlChar *)name);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029723 desret_xmlChar_ptr(ret_val);
29724 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029725 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000029726 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029727 xmlResetLastError();
29728 if (mem_base != xmlMemBlocks()) {
29729 printf("Leak of %d blocks found in xmlTextReaderGetAttribute",
29730 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029731 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029732 printf(" %d", n_reader);
29733 printf(" %d", n_name);
29734 printf("\n");
29735 }
29736 }
29737 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029738 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029739#endif
29740
Daniel Veillard42595322004-11-08 10:52:06 +000029741 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029742}
29743
29744
29745static int
29746test_xmlTextReaderGetAttributeNo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029747 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029748
William M. Brack21e4ef22005-01-02 09:53:13 +000029749#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029750 int mem_base;
29751 xmlChar * ret_val;
29752 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29753 int n_reader;
29754 int no; /* the zero-based index of the attribute relative to the containing element */
29755 int n_no;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029756
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029757 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29758 for (n_no = 0;n_no < gen_nb_int;n_no++) {
29759 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029760 reader = gen_xmlTextReaderPtr(n_reader, 0);
29761 no = gen_int(n_no, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029762
29763 ret_val = xmlTextReaderGetAttributeNo(reader, no);
29764 desret_xmlChar_ptr(ret_val);
29765 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029766 des_xmlTextReaderPtr(n_reader, reader, 0);
29767 des_int(n_no, no, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029768 xmlResetLastError();
29769 if (mem_base != xmlMemBlocks()) {
29770 printf("Leak of %d blocks found in xmlTextReaderGetAttributeNo",
29771 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029772 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029773 printf(" %d", n_reader);
29774 printf(" %d", n_no);
29775 printf("\n");
29776 }
29777 }
29778 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029779 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029780#endif
29781
Daniel Veillard42595322004-11-08 10:52:06 +000029782 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029783}
29784
29785
29786static int
29787test_xmlTextReaderGetAttributeNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029788 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029789
William M. Brack21e4ef22005-01-02 09:53:13 +000029790#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029791 int mem_base;
29792 xmlChar * ret_val;
29793 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29794 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029795 xmlChar * localName; /* the local name of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029796 int n_localName;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029797 xmlChar * namespaceURI; /* the namespace URI of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029798 int n_namespaceURI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029799
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029800 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29801 for (n_localName = 0;n_localName < gen_nb_const_xmlChar_ptr;n_localName++) {
29802 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
29803 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029804 reader = gen_xmlTextReaderPtr(n_reader, 0);
29805 localName = gen_const_xmlChar_ptr(n_localName, 1);
29806 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029807
William M. Brackf13f77f2004-11-12 16:03:48 +000029808 ret_val = xmlTextReaderGetAttributeNs(reader, (const xmlChar *)localName, (const xmlChar *)namespaceURI);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029809 desret_xmlChar_ptr(ret_val);
29810 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029811 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000029812 des_const_xmlChar_ptr(n_localName, (const xmlChar *)localName, 1);
29813 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029814 xmlResetLastError();
29815 if (mem_base != xmlMemBlocks()) {
29816 printf("Leak of %d blocks found in xmlTextReaderGetAttributeNs",
29817 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029818 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029819 printf(" %d", n_reader);
29820 printf(" %d", n_localName);
29821 printf(" %d", n_namespaceURI);
29822 printf("\n");
29823 }
29824 }
29825 }
29826 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029827 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029828#endif
29829
Daniel Veillard42595322004-11-08 10:52:06 +000029830 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029831}
29832
Daniel Veillarda521d282004-11-09 14:59:59 +000029833#ifdef LIBXML_READER_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000029834
Daniel Veillardce682bc2004-11-05 17:22:25 +000029835#define gen_nb_xmlTextReaderErrorFunc_ptr 1
29836static xmlTextReaderErrorFunc * gen_xmlTextReaderErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
29837 return(NULL);
29838}
29839static void des_xmlTextReaderErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlTextReaderErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
29840}
Daniel Veillarda521d282004-11-09 14:59:59 +000029841#endif
29842
Daniel Veillardce682bc2004-11-05 17:22:25 +000029843
Daniel Veillardd93f6252004-11-02 15:53:51 +000029844static int
29845test_xmlTextReaderGetErrorHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029846 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029847
William M. Brack21e4ef22005-01-02 09:53:13 +000029848#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029849 int mem_base;
29850 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29851 int n_reader;
29852 xmlTextReaderErrorFunc * f; /* the callback function or NULL is no callback has been registered */
29853 int n_f;
29854 void ** arg; /* a user argument */
29855 int n_arg;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029856
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029857 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29858 for (n_f = 0;n_f < gen_nb_xmlTextReaderErrorFunc_ptr;n_f++) {
29859 for (n_arg = 0;n_arg < gen_nb_void_ptr_ptr;n_arg++) {
29860 mem_base = xmlMemBlocks();
29861 reader = gen_xmlTextReaderPtr(n_reader, 0);
29862 f = gen_xmlTextReaderErrorFunc_ptr(n_f, 1);
29863 arg = gen_void_ptr_ptr(n_arg, 2);
29864
29865 xmlTextReaderGetErrorHandler(reader, f, arg);
29866 call_tests++;
29867 des_xmlTextReaderPtr(n_reader, reader, 0);
29868 des_xmlTextReaderErrorFunc_ptr(n_f, f, 1);
29869 des_void_ptr_ptr(n_arg, arg, 2);
29870 xmlResetLastError();
29871 if (mem_base != xmlMemBlocks()) {
29872 printf("Leak of %d blocks found in xmlTextReaderGetErrorHandler",
29873 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029874 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029875 printf(" %d", n_reader);
29876 printf(" %d", n_f);
29877 printf(" %d", n_arg);
29878 printf("\n");
29879 }
29880 }
29881 }
29882 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029883 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029884#endif
29885
Daniel Veillard42595322004-11-08 10:52:06 +000029886 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029887}
29888
29889
29890static int
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000029891test_xmlTextReaderGetParserColumnNumber(void) {
29892 int test_ret = 0;
29893
29894#if defined(LIBXML_READER_ENABLED)
29895 int mem_base;
29896 int ret_val;
29897 xmlTextReaderPtr reader; /* the user data (XML reader context) */
29898 int n_reader;
29899
29900 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29901 mem_base = xmlMemBlocks();
29902 reader = gen_xmlTextReaderPtr(n_reader, 0);
29903
29904 ret_val = xmlTextReaderGetParserColumnNumber(reader);
29905 desret_int(ret_val);
29906 call_tests++;
29907 des_xmlTextReaderPtr(n_reader, reader, 0);
29908 xmlResetLastError();
29909 if (mem_base != xmlMemBlocks()) {
29910 printf("Leak of %d blocks found in xmlTextReaderGetParserColumnNumber",
29911 xmlMemBlocks() - mem_base);
29912 test_ret++;
29913 printf(" %d", n_reader);
29914 printf("\n");
29915 }
29916 }
29917 function_tests++;
29918#endif
29919
29920 return(test_ret);
29921}
29922
29923
29924static int
29925test_xmlTextReaderGetParserLineNumber(void) {
29926 int test_ret = 0;
29927
29928#if defined(LIBXML_READER_ENABLED)
29929 int mem_base;
29930 int ret_val;
29931 xmlTextReaderPtr reader; /* the user data (XML reader context) */
29932 int n_reader;
29933
29934 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29935 mem_base = xmlMemBlocks();
29936 reader = gen_xmlTextReaderPtr(n_reader, 0);
29937
29938 ret_val = xmlTextReaderGetParserLineNumber(reader);
29939 desret_int(ret_val);
29940 call_tests++;
29941 des_xmlTextReaderPtr(n_reader, reader, 0);
29942 xmlResetLastError();
29943 if (mem_base != xmlMemBlocks()) {
29944 printf("Leak of %d blocks found in xmlTextReaderGetParserLineNumber",
29945 xmlMemBlocks() - mem_base);
29946 test_ret++;
29947 printf(" %d", n_reader);
29948 printf("\n");
29949 }
29950 }
29951 function_tests++;
29952#endif
29953
29954 return(test_ret);
29955}
29956
29957
29958static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000029959test_xmlTextReaderGetParserProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029960 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029961
William M. Brack21e4ef22005-01-02 09:53:13 +000029962#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029963 int mem_base;
29964 int ret_val;
29965 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29966 int n_reader;
29967 int prop; /* the xmlParserProperties to get */
29968 int n_prop;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029969
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029970 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29971 for (n_prop = 0;n_prop < gen_nb_int;n_prop++) {
29972 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029973 reader = gen_xmlTextReaderPtr(n_reader, 0);
29974 prop = gen_int(n_prop, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029975
29976 ret_val = xmlTextReaderGetParserProp(reader, prop);
29977 desret_int(ret_val);
29978 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029979 des_xmlTextReaderPtr(n_reader, reader, 0);
29980 des_int(n_prop, prop, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029981 xmlResetLastError();
29982 if (mem_base != xmlMemBlocks()) {
29983 printf("Leak of %d blocks found in xmlTextReaderGetParserProp",
29984 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029985 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029986 printf(" %d", n_reader);
29987 printf(" %d", n_prop);
29988 printf("\n");
29989 }
29990 }
29991 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029992 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029993#endif
29994
Daniel Veillard42595322004-11-08 10:52:06 +000029995 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029996}
29997
29998
29999static int
30000test_xmlTextReaderGetRemainder(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030001 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030002
William M. Brack21e4ef22005-01-02 09:53:13 +000030003#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030004 int mem_base;
30005 xmlParserInputBufferPtr ret_val;
30006 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30007 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030008
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030009 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30010 mem_base = xmlMemBlocks();
30011 reader = gen_xmlTextReaderPtr(n_reader, 0);
30012
30013 ret_val = xmlTextReaderGetRemainder(reader);
30014 desret_xmlParserInputBufferPtr(ret_val);
30015 call_tests++;
30016 des_xmlTextReaderPtr(n_reader, reader, 0);
30017 xmlResetLastError();
30018 if (mem_base != xmlMemBlocks()) {
30019 printf("Leak of %d blocks found in xmlTextReaderGetRemainder",
30020 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030021 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030022 printf(" %d", n_reader);
30023 printf("\n");
30024 }
30025 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030026 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030027#endif
30028
Daniel Veillard42595322004-11-08 10:52:06 +000030029 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030030}
30031
30032
30033static int
30034test_xmlTextReaderHasAttributes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030035 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030036
William M. Brack21e4ef22005-01-02 09:53:13 +000030037#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030038 int mem_base;
30039 int ret_val;
30040 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30041 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030042
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030043 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30044 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030045 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030046
30047 ret_val = xmlTextReaderHasAttributes(reader);
30048 desret_int(ret_val);
30049 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030050 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030051 xmlResetLastError();
30052 if (mem_base != xmlMemBlocks()) {
30053 printf("Leak of %d blocks found in xmlTextReaderHasAttributes",
30054 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030055 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030056 printf(" %d", n_reader);
30057 printf("\n");
30058 }
30059 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030060 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030061#endif
30062
Daniel Veillard42595322004-11-08 10:52:06 +000030063 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030064}
30065
30066
30067static int
30068test_xmlTextReaderHasValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030069 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030070
William M. Brack21e4ef22005-01-02 09:53:13 +000030071#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030072 int mem_base;
30073 int ret_val;
30074 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30075 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030076
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030077 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30078 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030079 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030080
30081 ret_val = xmlTextReaderHasValue(reader);
30082 desret_int(ret_val);
30083 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030084 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030085 xmlResetLastError();
30086 if (mem_base != xmlMemBlocks()) {
30087 printf("Leak of %d blocks found in xmlTextReaderHasValue",
30088 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030089 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030090 printf(" %d", n_reader);
30091 printf("\n");
30092 }
30093 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030094 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030095#endif
30096
Daniel Veillard42595322004-11-08 10:52:06 +000030097 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030098}
30099
30100
30101static int
30102test_xmlTextReaderIsDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030103 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030104
William M. Brack21e4ef22005-01-02 09:53:13 +000030105#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030106 int mem_base;
30107 int ret_val;
30108 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30109 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030110
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030111 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30112 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030113 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030114
30115 ret_val = xmlTextReaderIsDefault(reader);
30116 desret_int(ret_val);
30117 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030118 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030119 xmlResetLastError();
30120 if (mem_base != xmlMemBlocks()) {
30121 printf("Leak of %d blocks found in xmlTextReaderIsDefault",
30122 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030123 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030124 printf(" %d", n_reader);
30125 printf("\n");
30126 }
30127 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030128 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030129#endif
30130
Daniel Veillard42595322004-11-08 10:52:06 +000030131 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030132}
30133
30134
30135static int
30136test_xmlTextReaderIsEmptyElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030137 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030138
William M. Brack21e4ef22005-01-02 09:53:13 +000030139#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030140 int mem_base;
30141 int ret_val;
30142 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30143 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030144
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030145 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30146 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030147 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030148
30149 ret_val = xmlTextReaderIsEmptyElement(reader);
30150 desret_int(ret_val);
30151 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030152 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030153 xmlResetLastError();
30154 if (mem_base != xmlMemBlocks()) {
30155 printf("Leak of %d blocks found in xmlTextReaderIsEmptyElement",
30156 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030157 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030158 printf(" %d", n_reader);
30159 printf("\n");
30160 }
30161 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030162 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030163#endif
30164
Daniel Veillard42595322004-11-08 10:52:06 +000030165 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030166}
30167
30168
30169static int
30170test_xmlTextReaderIsNamespaceDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030171 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030172
William M. Brack21e4ef22005-01-02 09:53:13 +000030173#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030174 int mem_base;
30175 int ret_val;
30176 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30177 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030178
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030179 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30180 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030181 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030182
30183 ret_val = xmlTextReaderIsNamespaceDecl(reader);
30184 desret_int(ret_val);
30185 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030186 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030187 xmlResetLastError();
30188 if (mem_base != xmlMemBlocks()) {
30189 printf("Leak of %d blocks found in xmlTextReaderIsNamespaceDecl",
30190 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030191 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030192 printf(" %d", n_reader);
30193 printf("\n");
30194 }
30195 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030196 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030197#endif
30198
Daniel Veillard42595322004-11-08 10:52:06 +000030199 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030200}
30201
30202
30203static int
30204test_xmlTextReaderIsValid(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030205 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030206
William M. Brack21e4ef22005-01-02 09:53:13 +000030207#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030208 int mem_base;
30209 int ret_val;
30210 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30211 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030212
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030213 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30214 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030215 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030216
30217 ret_val = xmlTextReaderIsValid(reader);
30218 desret_int(ret_val);
30219 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030220 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030221 xmlResetLastError();
30222 if (mem_base != xmlMemBlocks()) {
30223 printf("Leak of %d blocks found in xmlTextReaderIsValid",
30224 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030225 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030226 printf(" %d", n_reader);
30227 printf("\n");
30228 }
30229 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030230 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030231#endif
30232
Daniel Veillard42595322004-11-08 10:52:06 +000030233 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030234}
30235
30236
30237static int
30238test_xmlTextReaderLocalName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030239 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030240
William M. Brack21e4ef22005-01-02 09:53:13 +000030241#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030242 int mem_base;
30243 xmlChar * ret_val;
30244 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30245 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030246
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030247 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30248 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030249 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030250
30251 ret_val = xmlTextReaderLocalName(reader);
30252 desret_xmlChar_ptr(ret_val);
30253 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030254 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030255 xmlResetLastError();
30256 if (mem_base != xmlMemBlocks()) {
30257 printf("Leak of %d blocks found in xmlTextReaderLocalName",
30258 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030259 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030260 printf(" %d", n_reader);
30261 printf("\n");
30262 }
30263 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030264 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030265#endif
30266
Daniel Veillard42595322004-11-08 10:52:06 +000030267 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030268}
30269
Daniel Veillarda521d282004-11-09 14:59:59 +000030270#ifdef LIBXML_READER_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000030271
Daniel Veillardce682bc2004-11-05 17:22:25 +000030272#define gen_nb_xmlTextReaderLocatorPtr 1
30273static xmlTextReaderLocatorPtr gen_xmlTextReaderLocatorPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
30274 return(NULL);
30275}
30276static void des_xmlTextReaderLocatorPtr(int no ATTRIBUTE_UNUSED, xmlTextReaderLocatorPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
30277}
Daniel Veillarda521d282004-11-09 14:59:59 +000030278#endif
30279
Daniel Veillardce682bc2004-11-05 17:22:25 +000030280
Daniel Veillardd93f6252004-11-02 15:53:51 +000030281static int
30282test_xmlTextReaderLocatorBaseURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030283 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030284
William M. Brack21e4ef22005-01-02 09:53:13 +000030285#if defined(LIBXML_READER_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000030286 int mem_base;
30287 xmlChar * ret_val;
30288 xmlTextReaderLocatorPtr locator; /* the xmlTextReaderLocatorPtr used */
30289 int n_locator;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030290
Daniel Veillardce682bc2004-11-05 17:22:25 +000030291 for (n_locator = 0;n_locator < gen_nb_xmlTextReaderLocatorPtr;n_locator++) {
30292 mem_base = xmlMemBlocks();
30293 locator = gen_xmlTextReaderLocatorPtr(n_locator, 0);
30294
30295 ret_val = xmlTextReaderLocatorBaseURI(locator);
30296 desret_xmlChar_ptr(ret_val);
30297 call_tests++;
30298 des_xmlTextReaderLocatorPtr(n_locator, locator, 0);
30299 xmlResetLastError();
30300 if (mem_base != xmlMemBlocks()) {
30301 printf("Leak of %d blocks found in xmlTextReaderLocatorBaseURI",
30302 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030303 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030304 printf(" %d", n_locator);
30305 printf("\n");
30306 }
30307 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030308 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030309#endif
30310
Daniel Veillard42595322004-11-08 10:52:06 +000030311 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030312}
30313
30314
30315static int
30316test_xmlTextReaderLocatorLineNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030317 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030318
William M. Brack21e4ef22005-01-02 09:53:13 +000030319#if defined(LIBXML_READER_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000030320 int mem_base;
30321 int ret_val;
30322 xmlTextReaderLocatorPtr locator; /* the xmlTextReaderLocatorPtr used */
30323 int n_locator;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030324
Daniel Veillardce682bc2004-11-05 17:22:25 +000030325 for (n_locator = 0;n_locator < gen_nb_xmlTextReaderLocatorPtr;n_locator++) {
30326 mem_base = xmlMemBlocks();
30327 locator = gen_xmlTextReaderLocatorPtr(n_locator, 0);
30328
30329 ret_val = xmlTextReaderLocatorLineNumber(locator);
30330 desret_int(ret_val);
30331 call_tests++;
30332 des_xmlTextReaderLocatorPtr(n_locator, locator, 0);
30333 xmlResetLastError();
30334 if (mem_base != xmlMemBlocks()) {
30335 printf("Leak of %d blocks found in xmlTextReaderLocatorLineNumber",
30336 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030337 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030338 printf(" %d", n_locator);
30339 printf("\n");
30340 }
30341 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030342 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030343#endif
30344
Daniel Veillard42595322004-11-08 10:52:06 +000030345 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030346}
30347
30348
30349static int
30350test_xmlTextReaderLookupNamespace(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030351 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030352
William M. Brack21e4ef22005-01-02 09:53:13 +000030353#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030354 int mem_base;
30355 xmlChar * ret_val;
30356 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30357 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030358 xmlChar * prefix; /* the prefix whose namespace URI is to be resolved. To return the default namespace, specify NULL */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030359 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030360
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030361 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30362 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
30363 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030364 reader = gen_xmlTextReaderPtr(n_reader, 0);
30365 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030366
William M. Brackf13f77f2004-11-12 16:03:48 +000030367 ret_val = xmlTextReaderLookupNamespace(reader, (const xmlChar *)prefix);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030368 desret_xmlChar_ptr(ret_val);
30369 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030370 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000030371 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030372 xmlResetLastError();
30373 if (mem_base != xmlMemBlocks()) {
30374 printf("Leak of %d blocks found in xmlTextReaderLookupNamespace",
30375 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030376 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030377 printf(" %d", n_reader);
30378 printf(" %d", n_prefix);
30379 printf("\n");
30380 }
30381 }
30382 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030383 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030384#endif
30385
Daniel Veillard42595322004-11-08 10:52:06 +000030386 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030387}
30388
30389
30390static int
30391test_xmlTextReaderMoveToAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030392 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030393
William M. Brack21e4ef22005-01-02 09:53:13 +000030394#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030395 int mem_base;
30396 int ret_val;
30397 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30398 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030399 xmlChar * name; /* the qualified name of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030400 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030401
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030402 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30403 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
30404 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030405 reader = gen_xmlTextReaderPtr(n_reader, 0);
30406 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030407
William M. Brackf13f77f2004-11-12 16:03:48 +000030408 ret_val = xmlTextReaderMoveToAttribute(reader, (const xmlChar *)name);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030409 desret_int(ret_val);
30410 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030411 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000030412 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030413 xmlResetLastError();
30414 if (mem_base != xmlMemBlocks()) {
30415 printf("Leak of %d blocks found in xmlTextReaderMoveToAttribute",
30416 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030417 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030418 printf(" %d", n_reader);
30419 printf(" %d", n_name);
30420 printf("\n");
30421 }
30422 }
30423 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030424 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030425#endif
30426
Daniel Veillard42595322004-11-08 10:52:06 +000030427 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030428}
30429
30430
30431static int
30432test_xmlTextReaderMoveToAttributeNo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030433 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030434
William M. Brack21e4ef22005-01-02 09:53:13 +000030435#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030436 int mem_base;
30437 int ret_val;
30438 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30439 int n_reader;
30440 int no; /* the zero-based index of the attribute relative to the containing element. */
30441 int n_no;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030442
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030443 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30444 for (n_no = 0;n_no < gen_nb_int;n_no++) {
30445 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030446 reader = gen_xmlTextReaderPtr(n_reader, 0);
30447 no = gen_int(n_no, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030448
30449 ret_val = xmlTextReaderMoveToAttributeNo(reader, no);
30450 desret_int(ret_val);
30451 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030452 des_xmlTextReaderPtr(n_reader, reader, 0);
30453 des_int(n_no, no, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030454 xmlResetLastError();
30455 if (mem_base != xmlMemBlocks()) {
30456 printf("Leak of %d blocks found in xmlTextReaderMoveToAttributeNo",
30457 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030458 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030459 printf(" %d", n_reader);
30460 printf(" %d", n_no);
30461 printf("\n");
30462 }
30463 }
30464 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030465 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030466#endif
30467
Daniel Veillard42595322004-11-08 10:52:06 +000030468 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030469}
30470
30471
30472static int
30473test_xmlTextReaderMoveToAttributeNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030474 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030475
William M. Brack21e4ef22005-01-02 09:53:13 +000030476#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030477 int mem_base;
30478 int ret_val;
30479 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30480 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030481 xmlChar * localName; /* the local name of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030482 int n_localName;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030483 xmlChar * namespaceURI; /* the namespace URI of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030484 int n_namespaceURI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030485
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030486 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30487 for (n_localName = 0;n_localName < gen_nb_const_xmlChar_ptr;n_localName++) {
30488 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
30489 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030490 reader = gen_xmlTextReaderPtr(n_reader, 0);
30491 localName = gen_const_xmlChar_ptr(n_localName, 1);
30492 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030493
William M. Brackf13f77f2004-11-12 16:03:48 +000030494 ret_val = xmlTextReaderMoveToAttributeNs(reader, (const xmlChar *)localName, (const xmlChar *)namespaceURI);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030495 desret_int(ret_val);
30496 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030497 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000030498 des_const_xmlChar_ptr(n_localName, (const xmlChar *)localName, 1);
30499 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030500 xmlResetLastError();
30501 if (mem_base != xmlMemBlocks()) {
30502 printf("Leak of %d blocks found in xmlTextReaderMoveToAttributeNs",
30503 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030504 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030505 printf(" %d", n_reader);
30506 printf(" %d", n_localName);
30507 printf(" %d", n_namespaceURI);
30508 printf("\n");
30509 }
30510 }
30511 }
30512 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030513 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030514#endif
30515
Daniel Veillard42595322004-11-08 10:52:06 +000030516 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030517}
30518
30519
30520static int
30521test_xmlTextReaderMoveToElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030522 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030523
William M. Brack21e4ef22005-01-02 09:53:13 +000030524#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030525 int mem_base;
30526 int ret_val;
30527 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30528 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030529
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030530 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30531 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030532 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030533
30534 ret_val = xmlTextReaderMoveToElement(reader);
30535 desret_int(ret_val);
30536 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030537 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030538 xmlResetLastError();
30539 if (mem_base != xmlMemBlocks()) {
30540 printf("Leak of %d blocks found in xmlTextReaderMoveToElement",
30541 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030542 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030543 printf(" %d", n_reader);
30544 printf("\n");
30545 }
30546 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030547 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030548#endif
30549
Daniel Veillard42595322004-11-08 10:52:06 +000030550 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030551}
30552
30553
30554static int
30555test_xmlTextReaderMoveToFirstAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030556 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030557
William M. Brack21e4ef22005-01-02 09:53:13 +000030558#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030559 int mem_base;
30560 int ret_val;
30561 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30562 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030563
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030564 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30565 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030566 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030567
30568 ret_val = xmlTextReaderMoveToFirstAttribute(reader);
30569 desret_int(ret_val);
30570 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030571 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030572 xmlResetLastError();
30573 if (mem_base != xmlMemBlocks()) {
30574 printf("Leak of %d blocks found in xmlTextReaderMoveToFirstAttribute",
30575 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030576 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030577 printf(" %d", n_reader);
30578 printf("\n");
30579 }
30580 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030581 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030582#endif
30583
Daniel Veillard42595322004-11-08 10:52:06 +000030584 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030585}
30586
30587
30588static int
30589test_xmlTextReaderMoveToNextAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030590 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030591
William M. Brack21e4ef22005-01-02 09:53:13 +000030592#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030593 int mem_base;
30594 int ret_val;
30595 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30596 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030597
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030598 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30599 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030600 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030601
30602 ret_val = xmlTextReaderMoveToNextAttribute(reader);
30603 desret_int(ret_val);
30604 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030605 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030606 xmlResetLastError();
30607 if (mem_base != xmlMemBlocks()) {
30608 printf("Leak of %d blocks found in xmlTextReaderMoveToNextAttribute",
30609 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030610 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030611 printf(" %d", n_reader);
30612 printf("\n");
30613 }
30614 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030615 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030616#endif
30617
Daniel Veillard42595322004-11-08 10:52:06 +000030618 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030619}
30620
30621
30622static int
30623test_xmlTextReaderName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030624 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030625
William M. Brack21e4ef22005-01-02 09:53:13 +000030626#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030627 int mem_base;
30628 xmlChar * ret_val;
30629 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30630 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030631
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030632 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30633 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030634 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030635
30636 ret_val = xmlTextReaderName(reader);
30637 desret_xmlChar_ptr(ret_val);
30638 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030639 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030640 xmlResetLastError();
30641 if (mem_base != xmlMemBlocks()) {
30642 printf("Leak of %d blocks found in xmlTextReaderName",
30643 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030644 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030645 printf(" %d", n_reader);
30646 printf("\n");
30647 }
30648 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030649 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030650#endif
30651
Daniel Veillard42595322004-11-08 10:52:06 +000030652 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030653}
30654
30655
30656static int
30657test_xmlTextReaderNamespaceUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030658 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030659
William M. Brack21e4ef22005-01-02 09:53:13 +000030660#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030661 int mem_base;
30662 xmlChar * ret_val;
30663 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30664 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030665
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030666 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30667 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030668 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030669
30670 ret_val = xmlTextReaderNamespaceUri(reader);
30671 desret_xmlChar_ptr(ret_val);
30672 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030673 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030674 xmlResetLastError();
30675 if (mem_base != xmlMemBlocks()) {
30676 printf("Leak of %d blocks found in xmlTextReaderNamespaceUri",
30677 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030678 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030679 printf(" %d", n_reader);
30680 printf("\n");
30681 }
30682 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030683 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030684#endif
30685
Daniel Veillard42595322004-11-08 10:52:06 +000030686 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030687}
30688
30689
30690static int
30691test_xmlTextReaderNext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030692 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030693
William M. Brack21e4ef22005-01-02 09:53:13 +000030694#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030695 int mem_base;
30696 int ret_val;
30697 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30698 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030699
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030700 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30701 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030702 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030703
30704 ret_val = xmlTextReaderNext(reader);
30705 desret_int(ret_val);
30706 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030707 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030708 xmlResetLastError();
30709 if (mem_base != xmlMemBlocks()) {
30710 printf("Leak of %d blocks found in xmlTextReaderNext",
30711 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030712 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030713 printf(" %d", n_reader);
30714 printf("\n");
30715 }
30716 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030717 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030718#endif
30719
Daniel Veillard42595322004-11-08 10:52:06 +000030720 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030721}
30722
30723
30724static int
30725test_xmlTextReaderNextSibling(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030726 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030727
William M. Brack21e4ef22005-01-02 09:53:13 +000030728#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030729 int mem_base;
30730 int ret_val;
30731 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30732 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030733
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030734 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30735 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030736 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030737
30738 ret_val = xmlTextReaderNextSibling(reader);
30739 desret_int(ret_val);
30740 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030741 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030742 xmlResetLastError();
30743 if (mem_base != xmlMemBlocks()) {
30744 printf("Leak of %d blocks found in xmlTextReaderNextSibling",
30745 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030746 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030747 printf(" %d", n_reader);
30748 printf("\n");
30749 }
30750 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030751 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030752#endif
30753
Daniel Veillard42595322004-11-08 10:52:06 +000030754 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030755}
30756
30757
30758static int
30759test_xmlTextReaderNodeType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030760 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030761
William M. Brack21e4ef22005-01-02 09:53:13 +000030762#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030763 int mem_base;
30764 int ret_val;
30765 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30766 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030767
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030768 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30769 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030770 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030771
30772 ret_val = xmlTextReaderNodeType(reader);
30773 desret_int(ret_val);
30774 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030775 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030776 xmlResetLastError();
30777 if (mem_base != xmlMemBlocks()) {
30778 printf("Leak of %d blocks found in xmlTextReaderNodeType",
30779 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030780 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030781 printf(" %d", n_reader);
30782 printf("\n");
30783 }
30784 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030785 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030786#endif
30787
Daniel Veillard42595322004-11-08 10:52:06 +000030788 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030789}
30790
30791
30792static int
30793test_xmlTextReaderNormalization(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030794 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030795
William M. Brack21e4ef22005-01-02 09:53:13 +000030796#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030797 int mem_base;
30798 int ret_val;
30799 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30800 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030801
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030802 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30803 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030804 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030805
30806 ret_val = xmlTextReaderNormalization(reader);
30807 desret_int(ret_val);
30808 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030809 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030810 xmlResetLastError();
30811 if (mem_base != xmlMemBlocks()) {
30812 printf("Leak of %d blocks found in xmlTextReaderNormalization",
30813 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030814 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030815 printf(" %d", n_reader);
30816 printf("\n");
30817 }
30818 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030819 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030820#endif
30821
Daniel Veillard42595322004-11-08 10:52:06 +000030822 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030823}
30824
30825
30826static int
30827test_xmlTextReaderPrefix(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030828 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030829
William M. Brack21e4ef22005-01-02 09:53:13 +000030830#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030831 int mem_base;
30832 xmlChar * ret_val;
30833 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30834 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030835
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030836 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30837 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030838 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030839
30840 ret_val = xmlTextReaderPrefix(reader);
30841 desret_xmlChar_ptr(ret_val);
30842 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030843 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030844 xmlResetLastError();
30845 if (mem_base != xmlMemBlocks()) {
30846 printf("Leak of %d blocks found in xmlTextReaderPrefix",
30847 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030848 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030849 printf(" %d", n_reader);
30850 printf("\n");
30851 }
30852 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030853 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030854#endif
30855
Daniel Veillard42595322004-11-08 10:52:06 +000030856 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030857}
30858
30859
30860static int
30861test_xmlTextReaderPreserve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030862 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030863
William M. Brack21e4ef22005-01-02 09:53:13 +000030864#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030865 int mem_base;
30866 xmlNodePtr ret_val;
30867 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30868 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030869
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030870 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30871 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030872 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030873
30874 ret_val = xmlTextReaderPreserve(reader);
30875 desret_xmlNodePtr(ret_val);
30876 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030877 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030878 xmlResetLastError();
30879 if (mem_base != xmlMemBlocks()) {
30880 printf("Leak of %d blocks found in xmlTextReaderPreserve",
30881 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030882 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030883 printf(" %d", n_reader);
30884 printf("\n");
30885 }
30886 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030887 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030888#endif
30889
Daniel Veillard42595322004-11-08 10:52:06 +000030890 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030891}
30892
30893
30894static int
30895test_xmlTextReaderPreservePattern(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030896 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030897
William M. Brack21e4ef22005-01-02 09:53:13 +000030898#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_PATTERN_ENABLED)
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030899#ifdef LIBXML_PATTERN_ENABLED
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030900 int mem_base;
30901 int ret_val;
30902 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30903 int n_reader;
30904 xmlChar * pattern; /* an XPath subset pattern */
30905 int n_pattern;
30906 xmlChar ** namespaces; /* the prefix definitions, array of [URI, prefix] or NULL */
30907 int n_namespaces;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030908
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030909 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30910 for (n_pattern = 0;n_pattern < gen_nb_const_xmlChar_ptr;n_pattern++) {
30911 for (n_namespaces = 0;n_namespaces < gen_nb_const_xmlChar_ptr_ptr;n_namespaces++) {
30912 mem_base = xmlMemBlocks();
30913 reader = gen_xmlTextReaderPtr(n_reader, 0);
30914 pattern = gen_const_xmlChar_ptr(n_pattern, 1);
30915 namespaces = gen_const_xmlChar_ptr_ptr(n_namespaces, 2);
30916
William M. Brackf13f77f2004-11-12 16:03:48 +000030917 ret_val = xmlTextReaderPreservePattern(reader, (const xmlChar *)pattern, (const xmlChar **)namespaces);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030918 desret_int(ret_val);
30919 call_tests++;
30920 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000030921 des_const_xmlChar_ptr(n_pattern, (const xmlChar *)pattern, 1);
30922 des_const_xmlChar_ptr_ptr(n_namespaces, (const xmlChar **)namespaces, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030923 xmlResetLastError();
30924 if (mem_base != xmlMemBlocks()) {
30925 printf("Leak of %d blocks found in xmlTextReaderPreservePattern",
30926 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030927 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030928 printf(" %d", n_reader);
30929 printf(" %d", n_pattern);
30930 printf(" %d", n_namespaces);
30931 printf("\n");
30932 }
30933 }
30934 }
30935 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030936 function_tests++;
30937#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030938#endif
30939
Daniel Veillard42595322004-11-08 10:52:06 +000030940 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030941}
30942
30943
30944static int
30945test_xmlTextReaderQuoteChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030946 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030947
William M. Brack21e4ef22005-01-02 09:53:13 +000030948#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030949 int mem_base;
30950 int ret_val;
30951 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30952 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030953
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030954 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30955 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030956 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030957
30958 ret_val = xmlTextReaderQuoteChar(reader);
30959 desret_int(ret_val);
30960 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030961 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030962 xmlResetLastError();
30963 if (mem_base != xmlMemBlocks()) {
30964 printf("Leak of %d blocks found in xmlTextReaderQuoteChar",
30965 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030966 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030967 printf(" %d", n_reader);
30968 printf("\n");
30969 }
30970 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030971 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030972#endif
30973
Daniel Veillard42595322004-11-08 10:52:06 +000030974 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030975}
30976
30977
30978static int
30979test_xmlTextReaderRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030980 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030981
William M. Brack21e4ef22005-01-02 09:53:13 +000030982#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030983 int mem_base;
30984 int ret_val;
30985 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30986 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030987
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030988 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30989 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030990 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030991
30992 ret_val = xmlTextReaderRead(reader);
30993 desret_int(ret_val);
30994 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030995 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030996 xmlResetLastError();
30997 if (mem_base != xmlMemBlocks()) {
30998 printf("Leak of %d blocks found in xmlTextReaderRead",
30999 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031000 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031001 printf(" %d", n_reader);
31002 printf("\n");
31003 }
31004 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031005 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031006#endif
31007
Daniel Veillard42595322004-11-08 10:52:06 +000031008 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031009}
31010
31011
31012static int
31013test_xmlTextReaderReadAttributeValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031014 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031015
William M. Brack21e4ef22005-01-02 09:53:13 +000031016#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031017 int mem_base;
31018 int ret_val;
31019 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31020 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031021
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031022 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31023 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000031024 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031025
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031026 ret_val = xmlTextReaderReadAttributeValue(reader);
31027 desret_int(ret_val);
31028 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000031029 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031030 xmlResetLastError();
31031 if (mem_base != xmlMemBlocks()) {
31032 printf("Leak of %d blocks found in xmlTextReaderReadAttributeValue",
31033 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031034 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031035 printf(" %d", n_reader);
31036 printf("\n");
31037 }
31038 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031039 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031040#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000031041
Daniel Veillard42595322004-11-08 10:52:06 +000031042 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031043}
31044
31045
31046static int
31047test_xmlTextReaderReadState(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031048 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031049
William M. Brack21e4ef22005-01-02 09:53:13 +000031050#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031051 int mem_base;
31052 int ret_val;
31053 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31054 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031055
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031056 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31057 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000031058 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031059
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031060 ret_val = xmlTextReaderReadState(reader);
31061 desret_int(ret_val);
31062 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000031063 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031064 xmlResetLastError();
31065 if (mem_base != xmlMemBlocks()) {
31066 printf("Leak of %d blocks found in xmlTextReaderReadState",
31067 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031068 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031069 printf(" %d", n_reader);
31070 printf("\n");
31071 }
31072 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031073 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031074#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000031075
Daniel Veillard42595322004-11-08 10:52:06 +000031076 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031077}
31078
31079
31080static int
31081test_xmlTextReaderRelaxNGSetSchema(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031082 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031083
William M. Brack21e4ef22005-01-02 09:53:13 +000031084#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000031085 int mem_base;
31086 int ret_val;
31087 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31088 int n_reader;
31089 xmlRelaxNGPtr schema; /* a precompiled RelaxNG schema */
31090 int n_schema;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031091
Daniel Veillardce682bc2004-11-05 17:22:25 +000031092 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31093 for (n_schema = 0;n_schema < gen_nb_xmlRelaxNGPtr;n_schema++) {
31094 mem_base = xmlMemBlocks();
31095 reader = gen_xmlTextReaderPtr(n_reader, 0);
31096 schema = gen_xmlRelaxNGPtr(n_schema, 1);
31097
31098 ret_val = xmlTextReaderRelaxNGSetSchema(reader, schema);
31099 desret_int(ret_val);
31100 call_tests++;
31101 des_xmlTextReaderPtr(n_reader, reader, 0);
31102 des_xmlRelaxNGPtr(n_schema, schema, 1);
31103 xmlResetLastError();
31104 if (mem_base != xmlMemBlocks()) {
31105 printf("Leak of %d blocks found in xmlTextReaderRelaxNGSetSchema",
31106 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031107 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031108 printf(" %d", n_reader);
31109 printf(" %d", n_schema);
31110 printf("\n");
31111 }
31112 }
31113 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031114 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031115#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000031116
Daniel Veillard42595322004-11-08 10:52:06 +000031117 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031118}
31119
31120
31121static int
31122test_xmlTextReaderRelaxNGValidate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031123 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031124
William M. Brack21e4ef22005-01-02 09:53:13 +000031125#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031126 int mem_base;
31127 int ret_val;
31128 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31129 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031130 char * rng; /* the path to a RelaxNG schema or NULL */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031131 int n_rng;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031132
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031133 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31134 for (n_rng = 0;n_rng < gen_nb_const_char_ptr;n_rng++) {
31135 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000031136 reader = gen_xmlTextReaderPtr(n_reader, 0);
31137 rng = gen_const_char_ptr(n_rng, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031138
William M. Brackf13f77f2004-11-12 16:03:48 +000031139 ret_val = xmlTextReaderRelaxNGValidate(reader, (const char *)rng);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031140 desret_int(ret_val);
31141 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000031142 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000031143 des_const_char_ptr(n_rng, (const char *)rng, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031144 xmlResetLastError();
31145 if (mem_base != xmlMemBlocks()) {
31146 printf("Leak of %d blocks found in xmlTextReaderRelaxNGValidate",
31147 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031148 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031149 printf(" %d", n_reader);
31150 printf(" %d", n_rng);
31151 printf("\n");
31152 }
31153 }
31154 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031155 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031156#endif
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031157
Daniel Veillard42595322004-11-08 10:52:06 +000031158 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031159}
31160
31161
31162static int
31163test_xmlTextReaderSetErrorHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031164 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031165
31166
31167 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031168 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031169}
31170
31171
31172static int
31173test_xmlTextReaderSetParserProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031174 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031175
William M. Brack21e4ef22005-01-02 09:53:13 +000031176#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031177 int mem_base;
31178 int ret_val;
31179 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31180 int n_reader;
31181 int prop; /* the xmlParserProperties to set */
31182 int n_prop;
31183 int value; /* usually 0 or 1 to (de)activate it */
31184 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031185
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031186 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31187 for (n_prop = 0;n_prop < gen_nb_int;n_prop++) {
31188 for (n_value = 0;n_value < gen_nb_int;n_value++) {
31189 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000031190 reader = gen_xmlTextReaderPtr(n_reader, 0);
31191 prop = gen_int(n_prop, 1);
31192 value = gen_int(n_value, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031193
31194 ret_val = xmlTextReaderSetParserProp(reader, prop, value);
31195 desret_int(ret_val);
31196 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000031197 des_xmlTextReaderPtr(n_reader, reader, 0);
31198 des_int(n_prop, prop, 1);
31199 des_int(n_value, value, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031200 xmlResetLastError();
31201 if (mem_base != xmlMemBlocks()) {
31202 printf("Leak of %d blocks found in xmlTextReaderSetParserProp",
31203 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031204 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031205 printf(" %d", n_reader);
31206 printf(" %d", n_prop);
31207 printf(" %d", n_value);
31208 printf("\n");
31209 }
31210 }
31211 }
31212 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031213 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031214#endif
31215
Daniel Veillard42595322004-11-08 10:52:06 +000031216 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031217}
31218
31219
31220static int
31221test_xmlTextReaderSetStructuredErrorHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031222 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031223
31224
31225 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031226 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031227}
31228
31229
31230static int
31231test_xmlTextReaderStandalone(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031232 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031233
William M. Brack21e4ef22005-01-02 09:53:13 +000031234#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031235 int mem_base;
31236 int ret_val;
31237 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31238 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031239
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031240 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31241 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000031242 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031243
31244 ret_val = xmlTextReaderStandalone(reader);
31245 desret_int(ret_val);
31246 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000031247 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031248 xmlResetLastError();
31249 if (mem_base != xmlMemBlocks()) {
31250 printf("Leak of %d blocks found in xmlTextReaderStandalone",
31251 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031252 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031253 printf(" %d", n_reader);
31254 printf("\n");
31255 }
31256 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031257 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031258#endif
31259
Daniel Veillard42595322004-11-08 10:52:06 +000031260 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031261}
31262
31263
31264static int
31265test_xmlTextReaderValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031266 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031267
William M. Brack21e4ef22005-01-02 09:53:13 +000031268#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031269 int mem_base;
31270 xmlChar * ret_val;
31271 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31272 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031273
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031274 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31275 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000031276 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031277
31278 ret_val = xmlTextReaderValue(reader);
31279 desret_xmlChar_ptr(ret_val);
31280 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000031281 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031282 xmlResetLastError();
31283 if (mem_base != xmlMemBlocks()) {
31284 printf("Leak of %d blocks found in xmlTextReaderValue",
31285 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031286 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031287 printf(" %d", n_reader);
31288 printf("\n");
31289 }
31290 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031291 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031292#endif
31293
Daniel Veillard42595322004-11-08 10:52:06 +000031294 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031295}
31296
31297
31298static int
31299test_xmlTextReaderXmlLang(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031300 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031301
William M. Brack21e4ef22005-01-02 09:53:13 +000031302#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031303 int mem_base;
31304 xmlChar * ret_val;
31305 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31306 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031307
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031308 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31309 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000031310 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031311
31312 ret_val = xmlTextReaderXmlLang(reader);
31313 desret_xmlChar_ptr(ret_val);
31314 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000031315 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031316 xmlResetLastError();
31317 if (mem_base != xmlMemBlocks()) {
31318 printf("Leak of %d blocks found in xmlTextReaderXmlLang",
31319 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031320 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031321 printf(" %d", n_reader);
31322 printf("\n");
31323 }
31324 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031325 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031326#endif
31327
Daniel Veillard42595322004-11-08 10:52:06 +000031328 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031329}
31330
31331static int
31332test_xmlreader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031333 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031334
Daniel Veillardb5839c32005-02-19 18:27:14 +000031335 if (quiet == 0) printf("Testing xmlreader : 71 of 81 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000031336 test_ret += test_xmlNewTextReader();
31337 test_ret += test_xmlNewTextReaderFilename();
31338 test_ret += test_xmlReaderForDoc();
31339 test_ret += test_xmlReaderForFile();
31340 test_ret += test_xmlReaderForMemory();
31341 test_ret += test_xmlReaderNewDoc();
31342 test_ret += test_xmlReaderNewFile();
31343 test_ret += test_xmlReaderNewMemory();
31344 test_ret += test_xmlReaderNewWalker();
31345 test_ret += test_xmlReaderWalker();
31346 test_ret += test_xmlTextReaderAttributeCount();
31347 test_ret += test_xmlTextReaderBaseUri();
Daniel Veillardb5839c32005-02-19 18:27:14 +000031348 test_ret += test_xmlTextReaderByteConsumed();
Daniel Veillard42595322004-11-08 10:52:06 +000031349 test_ret += test_xmlTextReaderClose();
31350 test_ret += test_xmlTextReaderConstBaseUri();
31351 test_ret += test_xmlTextReaderConstEncoding();
31352 test_ret += test_xmlTextReaderConstLocalName();
31353 test_ret += test_xmlTextReaderConstName();
31354 test_ret += test_xmlTextReaderConstNamespaceUri();
31355 test_ret += test_xmlTextReaderConstPrefix();
31356 test_ret += test_xmlTextReaderConstString();
31357 test_ret += test_xmlTextReaderConstValue();
31358 test_ret += test_xmlTextReaderConstXmlLang();
31359 test_ret += test_xmlTextReaderConstXmlVersion();
31360 test_ret += test_xmlTextReaderCurrentDoc();
31361 test_ret += test_xmlTextReaderCurrentNode();
31362 test_ret += test_xmlTextReaderDepth();
31363 test_ret += test_xmlTextReaderExpand();
31364 test_ret += test_xmlTextReaderGetAttribute();
31365 test_ret += test_xmlTextReaderGetAttributeNo();
31366 test_ret += test_xmlTextReaderGetAttributeNs();
31367 test_ret += test_xmlTextReaderGetErrorHandler();
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000031368 test_ret += test_xmlTextReaderGetParserColumnNumber();
31369 test_ret += test_xmlTextReaderGetParserLineNumber();
Daniel Veillard42595322004-11-08 10:52:06 +000031370 test_ret += test_xmlTextReaderGetParserProp();
31371 test_ret += test_xmlTextReaderGetRemainder();
31372 test_ret += test_xmlTextReaderHasAttributes();
31373 test_ret += test_xmlTextReaderHasValue();
31374 test_ret += test_xmlTextReaderIsDefault();
31375 test_ret += test_xmlTextReaderIsEmptyElement();
31376 test_ret += test_xmlTextReaderIsNamespaceDecl();
31377 test_ret += test_xmlTextReaderIsValid();
31378 test_ret += test_xmlTextReaderLocalName();
31379 test_ret += test_xmlTextReaderLocatorBaseURI();
31380 test_ret += test_xmlTextReaderLocatorLineNumber();
31381 test_ret += test_xmlTextReaderLookupNamespace();
31382 test_ret += test_xmlTextReaderMoveToAttribute();
31383 test_ret += test_xmlTextReaderMoveToAttributeNo();
31384 test_ret += test_xmlTextReaderMoveToAttributeNs();
31385 test_ret += test_xmlTextReaderMoveToElement();
31386 test_ret += test_xmlTextReaderMoveToFirstAttribute();
31387 test_ret += test_xmlTextReaderMoveToNextAttribute();
31388 test_ret += test_xmlTextReaderName();
31389 test_ret += test_xmlTextReaderNamespaceUri();
31390 test_ret += test_xmlTextReaderNext();
31391 test_ret += test_xmlTextReaderNextSibling();
31392 test_ret += test_xmlTextReaderNodeType();
31393 test_ret += test_xmlTextReaderNormalization();
31394 test_ret += test_xmlTextReaderPrefix();
31395 test_ret += test_xmlTextReaderPreserve();
31396 test_ret += test_xmlTextReaderPreservePattern();
31397 test_ret += test_xmlTextReaderQuoteChar();
31398 test_ret += test_xmlTextReaderRead();
31399 test_ret += test_xmlTextReaderReadAttributeValue();
31400 test_ret += test_xmlTextReaderReadState();
31401 test_ret += test_xmlTextReaderRelaxNGSetSchema();
31402 test_ret += test_xmlTextReaderRelaxNGValidate();
31403 test_ret += test_xmlTextReaderSetErrorHandler();
31404 test_ret += test_xmlTextReaderSetParserProp();
31405 test_ret += test_xmlTextReaderSetStructuredErrorHandler();
31406 test_ret += test_xmlTextReaderStandalone();
31407 test_ret += test_xmlTextReaderValue();
31408 test_ret += test_xmlTextReaderXmlLang();
Daniel Veillardd93f6252004-11-02 15:53:51 +000031409
Daniel Veillard42595322004-11-08 10:52:06 +000031410 if (test_ret != 0)
31411 printf("Module xmlreader: %d errors\n", test_ret);
31412 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031413}
Daniel Veillarda521d282004-11-09 14:59:59 +000031414#ifdef LIBXML_REGEXP_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000031415
Daniel Veillarda82b1822004-11-08 16:24:57 +000031416#define gen_nb_xmlRegExecCtxtPtr 1
31417static xmlRegExecCtxtPtr gen_xmlRegExecCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31418 return(NULL);
31419}
31420static void des_xmlRegExecCtxtPtr(int no ATTRIBUTE_UNUSED, xmlRegExecCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31421}
Daniel Veillarda521d282004-11-09 14:59:59 +000031422#endif
31423
Daniel Veillarda82b1822004-11-08 16:24:57 +000031424
31425static int
Daniel Veillardf47d2e32005-01-12 14:16:08 +000031426test_xmlRegExecErrInfo(void) {
31427 int test_ret = 0;
31428
31429#if defined(LIBXML_REGEXP_ENABLED)
31430 int mem_base;
31431 int ret_val;
31432 xmlRegExecCtxtPtr exec; /* a regexp execution context generating an error */
31433 int n_exec;
31434 xmlChar ** string; /* return value for the error string */
31435 int n_string;
31436 int * nbval; /* pointer to the number of accepted values IN/OUT */
31437 int n_nbval;
31438 int * nbneg; /* return number of negative transitions */
31439 int n_nbneg;
31440 xmlChar ** values; /* pointer to the array of acceptable values */
31441 int n_values;
31442 int * terminal; /* return value if this was a terminal state */
31443 int n_terminal;
31444
31445 for (n_exec = 0;n_exec < gen_nb_xmlRegExecCtxtPtr;n_exec++) {
31446 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr_ptr;n_string++) {
31447 for (n_nbval = 0;n_nbval < gen_nb_int_ptr;n_nbval++) {
31448 for (n_nbneg = 0;n_nbneg < gen_nb_int_ptr;n_nbneg++) {
31449 for (n_values = 0;n_values < gen_nb_xmlChar_ptr_ptr;n_values++) {
31450 for (n_terminal = 0;n_terminal < gen_nb_int_ptr;n_terminal++) {
31451 mem_base = xmlMemBlocks();
31452 exec = gen_xmlRegExecCtxtPtr(n_exec, 0);
31453 string = gen_const_xmlChar_ptr_ptr(n_string, 1);
31454 nbval = gen_int_ptr(n_nbval, 2);
31455 nbneg = gen_int_ptr(n_nbneg, 3);
31456 values = gen_xmlChar_ptr_ptr(n_values, 4);
31457 terminal = gen_int_ptr(n_terminal, 5);
31458
31459 ret_val = xmlRegExecErrInfo(exec, (const xmlChar **)string, nbval, nbneg, values, terminal);
31460 desret_int(ret_val);
31461 call_tests++;
31462 des_xmlRegExecCtxtPtr(n_exec, exec, 0);
31463 des_const_xmlChar_ptr_ptr(n_string, (const xmlChar **)string, 1);
31464 des_int_ptr(n_nbval, nbval, 2);
31465 des_int_ptr(n_nbneg, nbneg, 3);
31466 des_xmlChar_ptr_ptr(n_values, values, 4);
31467 des_int_ptr(n_terminal, terminal, 5);
31468 xmlResetLastError();
31469 if (mem_base != xmlMemBlocks()) {
31470 printf("Leak of %d blocks found in xmlRegExecErrInfo",
31471 xmlMemBlocks() - mem_base);
31472 test_ret++;
31473 printf(" %d", n_exec);
31474 printf(" %d", n_string);
31475 printf(" %d", n_nbval);
31476 printf(" %d", n_nbneg);
31477 printf(" %d", n_values);
31478 printf(" %d", n_terminal);
31479 printf("\n");
31480 }
31481 }
31482 }
31483 }
31484 }
31485 }
31486 }
31487 function_tests++;
31488#endif
31489
31490 return(test_ret);
31491}
31492
31493
31494static int
31495test_xmlRegExecNextValues(void) {
31496 int test_ret = 0;
31497
31498#if defined(LIBXML_REGEXP_ENABLED)
31499 int mem_base;
31500 int ret_val;
31501 xmlRegExecCtxtPtr exec; /* a regexp execution context */
31502 int n_exec;
31503 int * nbval; /* pointer to the number of accepted values IN/OUT */
31504 int n_nbval;
31505 int * nbneg; /* return number of negative transitions */
31506 int n_nbneg;
31507 xmlChar ** values; /* pointer to the array of acceptable values */
31508 int n_values;
31509 int * terminal; /* return value if this was a terminal state */
31510 int n_terminal;
31511
31512 for (n_exec = 0;n_exec < gen_nb_xmlRegExecCtxtPtr;n_exec++) {
31513 for (n_nbval = 0;n_nbval < gen_nb_int_ptr;n_nbval++) {
31514 for (n_nbneg = 0;n_nbneg < gen_nb_int_ptr;n_nbneg++) {
31515 for (n_values = 0;n_values < gen_nb_xmlChar_ptr_ptr;n_values++) {
31516 for (n_terminal = 0;n_terminal < gen_nb_int_ptr;n_terminal++) {
31517 mem_base = xmlMemBlocks();
31518 exec = gen_xmlRegExecCtxtPtr(n_exec, 0);
31519 nbval = gen_int_ptr(n_nbval, 1);
31520 nbneg = gen_int_ptr(n_nbneg, 2);
31521 values = gen_xmlChar_ptr_ptr(n_values, 3);
31522 terminal = gen_int_ptr(n_terminal, 4);
31523
31524 ret_val = xmlRegExecNextValues(exec, nbval, nbneg, values, terminal);
31525 desret_int(ret_val);
31526 call_tests++;
31527 des_xmlRegExecCtxtPtr(n_exec, exec, 0);
31528 des_int_ptr(n_nbval, nbval, 1);
31529 des_int_ptr(n_nbneg, nbneg, 2);
31530 des_xmlChar_ptr_ptr(n_values, values, 3);
31531 des_int_ptr(n_terminal, terminal, 4);
31532 xmlResetLastError();
31533 if (mem_base != xmlMemBlocks()) {
31534 printf("Leak of %d blocks found in xmlRegExecNextValues",
31535 xmlMemBlocks() - mem_base);
31536 test_ret++;
31537 printf(" %d", n_exec);
31538 printf(" %d", n_nbval);
31539 printf(" %d", n_nbneg);
31540 printf(" %d", n_values);
31541 printf(" %d", n_terminal);
31542 printf("\n");
31543 }
31544 }
31545 }
31546 }
31547 }
31548 }
31549 function_tests++;
31550#endif
31551
31552 return(test_ret);
31553}
31554
31555
31556static int
Daniel Veillarda82b1822004-11-08 16:24:57 +000031557test_xmlRegExecPushString(void) {
31558 int test_ret = 0;
31559
William M. Brack21e4ef22005-01-02 09:53:13 +000031560#if defined(LIBXML_REGEXP_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000031561 int mem_base;
31562 int ret_val;
31563 xmlRegExecCtxtPtr exec; /* a regexp execution context or NULL to indicate the end */
31564 int n_exec;
31565 xmlChar * value; /* a string token input */
31566 int n_value;
31567 void * data; /* data associated to the token to reuse in callbacks */
31568 int n_data;
31569
31570 for (n_exec = 0;n_exec < gen_nb_xmlRegExecCtxtPtr;n_exec++) {
31571 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
31572 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
31573 mem_base = xmlMemBlocks();
31574 exec = gen_xmlRegExecCtxtPtr(n_exec, 0);
31575 value = gen_const_xmlChar_ptr(n_value, 1);
31576 data = gen_userdata(n_data, 2);
31577
William M. Brackf13f77f2004-11-12 16:03:48 +000031578 ret_val = xmlRegExecPushString(exec, (const xmlChar *)value, data);
Daniel Veillarda82b1822004-11-08 16:24:57 +000031579 desret_int(ret_val);
31580 call_tests++;
31581 des_xmlRegExecCtxtPtr(n_exec, exec, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000031582 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +000031583 des_userdata(n_data, data, 2);
31584 xmlResetLastError();
31585 if (mem_base != xmlMemBlocks()) {
31586 printf("Leak of %d blocks found in xmlRegExecPushString",
31587 xmlMemBlocks() - mem_base);
31588 test_ret++;
31589 printf(" %d", n_exec);
31590 printf(" %d", n_value);
31591 printf(" %d", n_data);
31592 printf("\n");
31593 }
31594 }
31595 }
31596 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031597 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000031598#endif
31599
Daniel Veillarda82b1822004-11-08 16:24:57 +000031600 return(test_ret);
31601}
31602
31603
31604static int
31605test_xmlRegExecPushString2(void) {
31606 int test_ret = 0;
31607
William M. Brack21e4ef22005-01-02 09:53:13 +000031608#if defined(LIBXML_REGEXP_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000031609 int mem_base;
31610 int ret_val;
31611 xmlRegExecCtxtPtr exec; /* a regexp execution context or NULL to indicate the end */
31612 int n_exec;
31613 xmlChar * value; /* the first string token input */
31614 int n_value;
31615 xmlChar * value2; /* the second string token input */
31616 int n_value2;
31617 void * data; /* data associated to the token to reuse in callbacks */
31618 int n_data;
31619
31620 for (n_exec = 0;n_exec < gen_nb_xmlRegExecCtxtPtr;n_exec++) {
31621 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
31622 for (n_value2 = 0;n_value2 < gen_nb_const_xmlChar_ptr;n_value2++) {
31623 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
31624 mem_base = xmlMemBlocks();
31625 exec = gen_xmlRegExecCtxtPtr(n_exec, 0);
31626 value = gen_const_xmlChar_ptr(n_value, 1);
31627 value2 = gen_const_xmlChar_ptr(n_value2, 2);
31628 data = gen_userdata(n_data, 3);
31629
William M. Brackf13f77f2004-11-12 16:03:48 +000031630 ret_val = xmlRegExecPushString2(exec, (const xmlChar *)value, (const xmlChar *)value2, data);
Daniel Veillarda82b1822004-11-08 16:24:57 +000031631 desret_int(ret_val);
31632 call_tests++;
31633 des_xmlRegExecCtxtPtr(n_exec, exec, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000031634 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
31635 des_const_xmlChar_ptr(n_value2, (const xmlChar *)value2, 2);
Daniel Veillarda82b1822004-11-08 16:24:57 +000031636 des_userdata(n_data, data, 3);
31637 xmlResetLastError();
31638 if (mem_base != xmlMemBlocks()) {
31639 printf("Leak of %d blocks found in xmlRegExecPushString2",
31640 xmlMemBlocks() - mem_base);
31641 test_ret++;
31642 printf(" %d", n_exec);
31643 printf(" %d", n_value);
31644 printf(" %d", n_value2);
31645 printf(" %d", n_data);
31646 printf("\n");
31647 }
31648 }
31649 }
31650 }
31651 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031652 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000031653#endif
31654
Daniel Veillarda82b1822004-11-08 16:24:57 +000031655 return(test_ret);
31656}
31657
Daniel Veillarda521d282004-11-09 14:59:59 +000031658#ifdef LIBXML_REGEXP_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +000031659
31660#define gen_nb_xmlRegexpPtr 1
31661static xmlRegexpPtr gen_xmlRegexpPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31662 return(NULL);
31663}
31664static void des_xmlRegexpPtr(int no ATTRIBUTE_UNUSED, xmlRegexpPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31665}
Daniel Veillarda521d282004-11-09 14:59:59 +000031666#endif
31667
Daniel Veillarda82b1822004-11-08 16:24:57 +000031668
31669static int
31670test_xmlRegNewExecCtxt(void) {
31671 int test_ret = 0;
31672
31673
31674 /* missing type support */
31675 return(test_ret);
31676}
31677
31678
31679static int
31680test_xmlRegexpCompile(void) {
31681 int test_ret = 0;
31682
31683
31684 /* missing type support */
31685 return(test_ret);
31686}
31687
31688
31689static int
31690test_xmlRegexpExec(void) {
31691 int test_ret = 0;
31692
William M. Brack21e4ef22005-01-02 09:53:13 +000031693#if defined(LIBXML_REGEXP_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000031694 int mem_base;
31695 int ret_val;
31696 xmlRegexpPtr comp; /* the compiled regular expression */
31697 int n_comp;
31698 xmlChar * content; /* the value to check against the regular expression */
31699 int n_content;
31700
31701 for (n_comp = 0;n_comp < gen_nb_xmlRegexpPtr;n_comp++) {
31702 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
31703 mem_base = xmlMemBlocks();
31704 comp = gen_xmlRegexpPtr(n_comp, 0);
31705 content = gen_const_xmlChar_ptr(n_content, 1);
31706
William M. Brackf13f77f2004-11-12 16:03:48 +000031707 ret_val = xmlRegexpExec(comp, (const xmlChar *)content);
Daniel Veillarda82b1822004-11-08 16:24:57 +000031708 desret_int(ret_val);
31709 call_tests++;
31710 des_xmlRegexpPtr(n_comp, comp, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000031711 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +000031712 xmlResetLastError();
31713 if (mem_base != xmlMemBlocks()) {
31714 printf("Leak of %d blocks found in xmlRegexpExec",
31715 xmlMemBlocks() - mem_base);
31716 test_ret++;
31717 printf(" %d", n_comp);
31718 printf(" %d", n_content);
31719 printf("\n");
31720 }
31721 }
31722 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031723 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000031724#endif
31725
Daniel Veillarda82b1822004-11-08 16:24:57 +000031726 return(test_ret);
31727}
31728
31729
31730static int
31731test_xmlRegexpIsDeterminist(void) {
31732 int test_ret = 0;
31733
William M. Brack21e4ef22005-01-02 09:53:13 +000031734#if defined(LIBXML_REGEXP_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000031735 int mem_base;
31736 int ret_val;
31737 xmlRegexpPtr comp; /* the compiled regular expression */
31738 int n_comp;
31739
31740 for (n_comp = 0;n_comp < gen_nb_xmlRegexpPtr;n_comp++) {
31741 mem_base = xmlMemBlocks();
31742 comp = gen_xmlRegexpPtr(n_comp, 0);
31743
31744 ret_val = xmlRegexpIsDeterminist(comp);
31745 desret_int(ret_val);
31746 call_tests++;
31747 des_xmlRegexpPtr(n_comp, comp, 0);
31748 xmlResetLastError();
31749 if (mem_base != xmlMemBlocks()) {
31750 printf("Leak of %d blocks found in xmlRegexpIsDeterminist",
31751 xmlMemBlocks() - mem_base);
31752 test_ret++;
31753 printf(" %d", n_comp);
31754 printf("\n");
31755 }
31756 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031757 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000031758#endif
31759
Daniel Veillarda82b1822004-11-08 16:24:57 +000031760 return(test_ret);
31761}
31762
31763
31764static int
31765test_xmlRegexpPrint(void) {
31766 int test_ret = 0;
31767
William M. Brack21e4ef22005-01-02 09:53:13 +000031768#if defined(LIBXML_REGEXP_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000031769 int mem_base;
31770 FILE * output; /* the file for the output debug */
31771 int n_output;
31772 xmlRegexpPtr regexp; /* the compiled regexp */
31773 int n_regexp;
31774
31775 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
31776 for (n_regexp = 0;n_regexp < gen_nb_xmlRegexpPtr;n_regexp++) {
31777 mem_base = xmlMemBlocks();
31778 output = gen_FILE_ptr(n_output, 0);
31779 regexp = gen_xmlRegexpPtr(n_regexp, 1);
31780
31781 xmlRegexpPrint(output, regexp);
31782 call_tests++;
31783 des_FILE_ptr(n_output, output, 0);
31784 des_xmlRegexpPtr(n_regexp, regexp, 1);
31785 xmlResetLastError();
31786 if (mem_base != xmlMemBlocks()) {
31787 printf("Leak of %d blocks found in xmlRegexpPrint",
31788 xmlMemBlocks() - mem_base);
31789 test_ret++;
31790 printf(" %d", n_output);
31791 printf(" %d", n_regexp);
31792 printf("\n");
31793 }
31794 }
31795 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031796 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000031797#endif
31798
Daniel Veillarda82b1822004-11-08 16:24:57 +000031799 return(test_ret);
31800}
31801
31802static int
31803test_xmlregexp(void) {
31804 int test_ret = 0;
31805
Daniel Veillardf47d2e32005-01-12 14:16:08 +000031806 if (quiet == 0) printf("Testing xmlregexp : 7 of 11 functions ...\n");
31807 test_ret += test_xmlRegExecErrInfo();
31808 test_ret += test_xmlRegExecNextValues();
Daniel Veillarda82b1822004-11-08 16:24:57 +000031809 test_ret += test_xmlRegExecPushString();
31810 test_ret += test_xmlRegExecPushString2();
31811 test_ret += test_xmlRegNewExecCtxt();
31812 test_ret += test_xmlRegexpCompile();
31813 test_ret += test_xmlRegexpExec();
31814 test_ret += test_xmlRegexpIsDeterminist();
31815 test_ret += test_xmlRegexpPrint();
31816
31817 if (test_ret != 0)
31818 printf("Module xmlregexp: %d errors\n", test_ret);
31819 return(test_ret);
31820}
Daniel Veillarda521d282004-11-09 14:59:59 +000031821#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +000031822
Daniel Veillardce682bc2004-11-05 17:22:25 +000031823#define gen_nb_xmlSaveCtxtPtr 1
31824static xmlSaveCtxtPtr gen_xmlSaveCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31825 return(NULL);
31826}
31827static void des_xmlSaveCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSaveCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31828}
Daniel Veillarda521d282004-11-09 14:59:59 +000031829#endif
31830
Daniel Veillardce682bc2004-11-05 17:22:25 +000031831
Daniel Veillardd93f6252004-11-02 15:53:51 +000031832static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000031833test_xmlSaveClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031834 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031835
William M. Brack21e4ef22005-01-02 09:53:13 +000031836#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000031837 int mem_base;
31838 int ret_val;
31839 xmlSaveCtxtPtr ctxt; /* a document saving context */
31840 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031841
Daniel Veillardce682bc2004-11-05 17:22:25 +000031842 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
31843 mem_base = xmlMemBlocks();
31844 ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
31845
31846 ret_val = xmlSaveClose(ctxt);
31847 desret_int(ret_val);
31848 call_tests++;
31849 des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
31850 xmlResetLastError();
31851 if (mem_base != xmlMemBlocks()) {
31852 printf("Leak of %d blocks found in xmlSaveClose",
31853 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031854 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031855 printf(" %d", n_ctxt);
31856 printf("\n");
31857 }
31858 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031859 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031860#endif
31861
Daniel Veillard42595322004-11-08 10:52:06 +000031862 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031863}
31864
31865
31866static int
31867test_xmlSaveDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031868 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031869
William M. Brack21e4ef22005-01-02 09:53:13 +000031870#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000031871 int mem_base;
31872 long ret_val;
31873 xmlSaveCtxtPtr ctxt; /* a document saving context */
31874 int n_ctxt;
31875 xmlDocPtr doc; /* a document */
31876 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031877
Daniel Veillardce682bc2004-11-05 17:22:25 +000031878 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
31879 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
31880 mem_base = xmlMemBlocks();
31881 ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
31882 doc = gen_xmlDocPtr(n_doc, 1);
31883
31884 ret_val = xmlSaveDoc(ctxt, doc);
31885 desret_long(ret_val);
31886 call_tests++;
31887 des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
31888 des_xmlDocPtr(n_doc, doc, 1);
31889 xmlResetLastError();
31890 if (mem_base != xmlMemBlocks()) {
31891 printf("Leak of %d blocks found in xmlSaveDoc",
31892 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031893 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031894 printf(" %d", n_ctxt);
31895 printf(" %d", n_doc);
31896 printf("\n");
31897 }
31898 }
31899 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031900 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031901#endif
31902
Daniel Veillard42595322004-11-08 10:52:06 +000031903 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031904}
31905
31906
31907static int
31908test_xmlSaveFlush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031909 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031910
William M. Brack21e4ef22005-01-02 09:53:13 +000031911#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000031912 int mem_base;
31913 int ret_val;
31914 xmlSaveCtxtPtr ctxt; /* a document saving context */
31915 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031916
Daniel Veillardce682bc2004-11-05 17:22:25 +000031917 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
31918 mem_base = xmlMemBlocks();
31919 ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
31920
31921 ret_val = xmlSaveFlush(ctxt);
31922 desret_int(ret_val);
31923 call_tests++;
31924 des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
31925 xmlResetLastError();
31926 if (mem_base != xmlMemBlocks()) {
31927 printf("Leak of %d blocks found in xmlSaveFlush",
31928 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031929 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031930 printf(" %d", n_ctxt);
31931 printf("\n");
31932 }
31933 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031934 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031935#endif
31936
Daniel Veillard42595322004-11-08 10:52:06 +000031937 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031938}
31939
31940
31941static int
31942test_xmlSaveSetAttrEscape(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031943 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031944
31945
31946 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031947 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031948}
31949
31950
31951static int
31952test_xmlSaveSetEscape(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031953 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031954
31955
31956 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031957 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031958}
31959
31960
31961static int
31962test_xmlSaveToFd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031963 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031964
31965
31966 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031967 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031968}
31969
31970
31971static int
31972test_xmlSaveToFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031973 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031974
31975
31976 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031977 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031978}
31979
31980
31981static int
31982test_xmlSaveTree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031983 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031984
William M. Brack21e4ef22005-01-02 09:53:13 +000031985#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000031986 int mem_base;
31987 long ret_val;
31988 xmlSaveCtxtPtr ctxt; /* a document saving context */
31989 int n_ctxt;
31990 xmlNodePtr node; /* a document */
31991 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031992
Daniel Veillardce682bc2004-11-05 17:22:25 +000031993 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
31994 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
31995 mem_base = xmlMemBlocks();
31996 ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
31997 node = gen_xmlNodePtr(n_node, 1);
31998
31999 ret_val = xmlSaveTree(ctxt, node);
32000 desret_long(ret_val);
32001 call_tests++;
32002 des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
32003 des_xmlNodePtr(n_node, node, 1);
32004 xmlResetLastError();
32005 if (mem_base != xmlMemBlocks()) {
32006 printf("Leak of %d blocks found in xmlSaveTree",
32007 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032008 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032009 printf(" %d", n_ctxt);
32010 printf(" %d", n_node);
32011 printf("\n");
32012 }
32013 }
32014 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032015 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032016#endif
32017
Daniel Veillard42595322004-11-08 10:52:06 +000032018 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032019}
32020
32021static int
32022test_xmlsave(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032023 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032024
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032025 if (quiet == 0) printf("Testing xmlsave : 4 of 9 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000032026 test_ret += test_xmlSaveClose();
32027 test_ret += test_xmlSaveDoc();
32028 test_ret += test_xmlSaveFlush();
32029 test_ret += test_xmlSaveSetAttrEscape();
32030 test_ret += test_xmlSaveSetEscape();
32031 test_ret += test_xmlSaveToFd();
32032 test_ret += test_xmlSaveToFilename();
32033 test_ret += test_xmlSaveTree();
Daniel Veillardd93f6252004-11-02 15:53:51 +000032034
Daniel Veillard42595322004-11-08 10:52:06 +000032035 if (test_ret != 0)
32036 printf("Module xmlsave: %d errors\n", test_ret);
32037 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032038}
Daniel Veillarda521d282004-11-09 14:59:59 +000032039#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000032040
Daniel Veillardce682bc2004-11-05 17:22:25 +000032041#define gen_nb_xmlSchemaPtr 1
32042static xmlSchemaPtr gen_xmlSchemaPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32043 return(NULL);
32044}
32045static void des_xmlSchemaPtr(int no ATTRIBUTE_UNUSED, xmlSchemaPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32046}
Daniel Veillarda521d282004-11-09 14:59:59 +000032047#endif
32048
Daniel Veillardce682bc2004-11-05 17:22:25 +000032049
Daniel Veillardd93f6252004-11-02 15:53:51 +000032050static int
32051test_xmlSchemaDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032052 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032053
William M. Brack21e4ef22005-01-02 09:53:13 +000032054#if defined(LIBXML_SCHEMAS_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032055 int mem_base;
32056 FILE * output; /* the file output */
32057 int n_output;
32058 xmlSchemaPtr schema; /* a schema structure */
32059 int n_schema;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032060
Daniel Veillardce682bc2004-11-05 17:22:25 +000032061 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
32062 for (n_schema = 0;n_schema < gen_nb_xmlSchemaPtr;n_schema++) {
32063 mem_base = xmlMemBlocks();
32064 output = gen_FILE_ptr(n_output, 0);
32065 schema = gen_xmlSchemaPtr(n_schema, 1);
32066
32067 xmlSchemaDump(output, schema);
32068 call_tests++;
32069 des_FILE_ptr(n_output, output, 0);
32070 des_xmlSchemaPtr(n_schema, schema, 1);
32071 xmlResetLastError();
32072 if (mem_base != xmlMemBlocks()) {
32073 printf("Leak of %d blocks found in xmlSchemaDump",
32074 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032075 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032076 printf(" %d", n_output);
32077 printf(" %d", n_schema);
32078 printf("\n");
32079 }
32080 }
32081 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032082 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032083#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000032084
Daniel Veillard42595322004-11-08 10:52:06 +000032085 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032086}
32087
Daniel Veillarda521d282004-11-09 14:59:59 +000032088#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000032089
Daniel Veillardce682bc2004-11-05 17:22:25 +000032090#define gen_nb_xmlSchemaParserCtxtPtr 1
32091static xmlSchemaParserCtxtPtr gen_xmlSchemaParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32092 return(NULL);
32093}
32094static void des_xmlSchemaParserCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSchemaParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32095}
Daniel Veillarda521d282004-11-09 14:59:59 +000032096#endif
32097
32098#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000032099
32100#define gen_nb_xmlSchemaValidityErrorFunc_ptr 1
32101static xmlSchemaValidityErrorFunc * gen_xmlSchemaValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32102 return(NULL);
32103}
32104static void des_xmlSchemaValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlSchemaValidityErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32105}
Daniel Veillarda521d282004-11-09 14:59:59 +000032106#endif
32107
32108#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000032109
32110#define gen_nb_xmlSchemaValidityWarningFunc_ptr 1
32111static xmlSchemaValidityWarningFunc * gen_xmlSchemaValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32112 return(NULL);
32113}
32114static void des_xmlSchemaValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, xmlSchemaValidityWarningFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32115}
Daniel Veillarda521d282004-11-09 14:59:59 +000032116#endif
32117
Daniel Veillardce682bc2004-11-05 17:22:25 +000032118
Daniel Veillardd93f6252004-11-02 15:53:51 +000032119static int
32120test_xmlSchemaGetParserErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032121 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032122
William M. Brack21e4ef22005-01-02 09:53:13 +000032123#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000032124 int mem_base;
32125 int ret_val;
32126 xmlSchemaParserCtxtPtr ctxt; /* a XMl-Schema parser context */
32127 int n_ctxt;
32128 xmlSchemaValidityErrorFunc * err; /* the error callback result */
32129 int n_err;
32130 xmlSchemaValidityWarningFunc * warn; /* the warning callback result */
32131 int n_warn;
32132 void ** ctx; /* contextual data for the callbacks result */
32133 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032134
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000032135 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaParserCtxtPtr;n_ctxt++) {
32136 for (n_err = 0;n_err < gen_nb_xmlSchemaValidityErrorFunc_ptr;n_err++) {
32137 for (n_warn = 0;n_warn < gen_nb_xmlSchemaValidityWarningFunc_ptr;n_warn++) {
32138 for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
32139 mem_base = xmlMemBlocks();
32140 ctxt = gen_xmlSchemaParserCtxtPtr(n_ctxt, 0);
32141 err = gen_xmlSchemaValidityErrorFunc_ptr(n_err, 1);
32142 warn = gen_xmlSchemaValidityWarningFunc_ptr(n_warn, 2);
32143 ctx = gen_void_ptr_ptr(n_ctx, 3);
32144
32145 ret_val = xmlSchemaGetParserErrors(ctxt, err, warn, ctx);
32146 desret_int(ret_val);
32147 call_tests++;
32148 des_xmlSchemaParserCtxtPtr(n_ctxt, ctxt, 0);
32149 des_xmlSchemaValidityErrorFunc_ptr(n_err, err, 1);
32150 des_xmlSchemaValidityWarningFunc_ptr(n_warn, warn, 2);
32151 des_void_ptr_ptr(n_ctx, ctx, 3);
32152 xmlResetLastError();
32153 if (mem_base != xmlMemBlocks()) {
32154 printf("Leak of %d blocks found in xmlSchemaGetParserErrors",
32155 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032156 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000032157 printf(" %d", n_ctxt);
32158 printf(" %d", n_err);
32159 printf(" %d", n_warn);
32160 printf(" %d", n_ctx);
32161 printf("\n");
32162 }
32163 }
32164 }
32165 }
32166 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032167 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000032168#endif
32169
Daniel Veillard42595322004-11-08 10:52:06 +000032170 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032171}
32172
Daniel Veillarda521d282004-11-09 14:59:59 +000032173#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000032174
Daniel Veillardce682bc2004-11-05 17:22:25 +000032175#define gen_nb_xmlSchemaValidCtxtPtr 1
32176static xmlSchemaValidCtxtPtr gen_xmlSchemaValidCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32177 return(NULL);
32178}
32179static void des_xmlSchemaValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSchemaValidCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32180}
Daniel Veillarda521d282004-11-09 14:59:59 +000032181#endif
32182
Daniel Veillardce682bc2004-11-05 17:22:25 +000032183
Daniel Veillardd93f6252004-11-02 15:53:51 +000032184static int
32185test_xmlSchemaGetValidErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032186 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032187
William M. Brack21e4ef22005-01-02 09:53:13 +000032188#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000032189 int mem_base;
32190 int ret_val;
32191 xmlSchemaValidCtxtPtr ctxt; /* a XML-Schema validation context */
32192 int n_ctxt;
32193 xmlSchemaValidityErrorFunc * err; /* the error function result */
32194 int n_err;
32195 xmlSchemaValidityWarningFunc * warn; /* the warning function result */
32196 int n_warn;
32197 void ** ctx; /* the functions context result */
32198 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032199
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000032200 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
32201 for (n_err = 0;n_err < gen_nb_xmlSchemaValidityErrorFunc_ptr;n_err++) {
32202 for (n_warn = 0;n_warn < gen_nb_xmlSchemaValidityWarningFunc_ptr;n_warn++) {
32203 for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
32204 mem_base = xmlMemBlocks();
32205 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
32206 err = gen_xmlSchemaValidityErrorFunc_ptr(n_err, 1);
32207 warn = gen_xmlSchemaValidityWarningFunc_ptr(n_warn, 2);
32208 ctx = gen_void_ptr_ptr(n_ctx, 3);
32209
32210 ret_val = xmlSchemaGetValidErrors(ctxt, err, warn, ctx);
32211 desret_int(ret_val);
32212 call_tests++;
32213 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
32214 des_xmlSchemaValidityErrorFunc_ptr(n_err, err, 1);
32215 des_xmlSchemaValidityWarningFunc_ptr(n_warn, warn, 2);
32216 des_void_ptr_ptr(n_ctx, ctx, 3);
32217 xmlResetLastError();
32218 if (mem_base != xmlMemBlocks()) {
32219 printf("Leak of %d blocks found in xmlSchemaGetValidErrors",
32220 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032221 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000032222 printf(" %d", n_ctxt);
32223 printf(" %d", n_err);
32224 printf(" %d", n_warn);
32225 printf(" %d", n_ctx);
32226 printf("\n");
32227 }
32228 }
32229 }
32230 }
32231 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032232 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000032233#endif
32234
Daniel Veillard42595322004-11-08 10:52:06 +000032235 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032236}
32237
32238
32239static int
32240test_xmlSchemaNewDocParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032241 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032242
William M. Brack21e4ef22005-01-02 09:53:13 +000032243#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000032244 int mem_base;
32245 xmlSchemaParserCtxtPtr ret_val;
32246 xmlDocPtr doc; /* a preparsed document tree */
32247 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032248
Daniel Veillard42595322004-11-08 10:52:06 +000032249 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
32250 mem_base = xmlMemBlocks();
32251 doc = gen_xmlDocPtr(n_doc, 0);
32252
32253 ret_val = xmlSchemaNewDocParserCtxt(doc);
32254 desret_xmlSchemaParserCtxtPtr(ret_val);
32255 call_tests++;
32256 des_xmlDocPtr(n_doc, doc, 0);
32257 xmlResetLastError();
32258 if (mem_base != xmlMemBlocks()) {
32259 printf("Leak of %d blocks found in xmlSchemaNewDocParserCtxt",
32260 xmlMemBlocks() - mem_base);
32261 test_ret++;
32262 printf(" %d", n_doc);
32263 printf("\n");
32264 }
32265 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032266 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032267#endif
32268
Daniel Veillard42595322004-11-08 10:52:06 +000032269 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032270}
32271
32272
32273static int
32274test_xmlSchemaNewMemParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032275 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032276
William M. Brack21e4ef22005-01-02 09:53:13 +000032277#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000032278 int mem_base;
32279 xmlSchemaParserCtxtPtr ret_val;
32280 char * buffer; /* a pointer to a char array containing the schemas */
32281 int n_buffer;
32282 int size; /* the size of the array */
32283 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032284
Daniel Veillard42595322004-11-08 10:52:06 +000032285 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
32286 for (n_size = 0;n_size < gen_nb_int;n_size++) {
32287 mem_base = xmlMemBlocks();
32288 buffer = gen_const_char_ptr(n_buffer, 0);
32289 size = gen_int(n_size, 1);
32290
William M. Brackf13f77f2004-11-12 16:03:48 +000032291 ret_val = xmlSchemaNewMemParserCtxt((const char *)buffer, size);
Daniel Veillard42595322004-11-08 10:52:06 +000032292 desret_xmlSchemaParserCtxtPtr(ret_val);
32293 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000032294 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard42595322004-11-08 10:52:06 +000032295 des_int(n_size, size, 1);
32296 xmlResetLastError();
32297 if (mem_base != xmlMemBlocks()) {
32298 printf("Leak of %d blocks found in xmlSchemaNewMemParserCtxt",
32299 xmlMemBlocks() - mem_base);
32300 test_ret++;
32301 printf(" %d", n_buffer);
32302 printf(" %d", n_size);
32303 printf("\n");
32304 }
32305 }
32306 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032307 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032308#endif
32309
Daniel Veillard42595322004-11-08 10:52:06 +000032310 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032311}
32312
32313
32314static int
32315test_xmlSchemaNewParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032316 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032317
William M. Brack21e4ef22005-01-02 09:53:13 +000032318#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000032319 int mem_base;
32320 xmlSchemaParserCtxtPtr ret_val;
32321 char * URL; /* the location of the schema */
32322 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032323
Daniel Veillard42595322004-11-08 10:52:06 +000032324 for (n_URL = 0;n_URL < gen_nb_const_char_ptr;n_URL++) {
32325 mem_base = xmlMemBlocks();
32326 URL = gen_const_char_ptr(n_URL, 0);
32327
William M. Brackf13f77f2004-11-12 16:03:48 +000032328 ret_val = xmlSchemaNewParserCtxt((const char *)URL);
Daniel Veillard42595322004-11-08 10:52:06 +000032329 desret_xmlSchemaParserCtxtPtr(ret_val);
32330 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000032331 des_const_char_ptr(n_URL, (const char *)URL, 0);
Daniel Veillard42595322004-11-08 10:52:06 +000032332 xmlResetLastError();
32333 if (mem_base != xmlMemBlocks()) {
32334 printf("Leak of %d blocks found in xmlSchemaNewParserCtxt",
32335 xmlMemBlocks() - mem_base);
32336 test_ret++;
32337 printf(" %d", n_URL);
32338 printf("\n");
32339 }
32340 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032341 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032342#endif
32343
Daniel Veillard42595322004-11-08 10:52:06 +000032344 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032345}
32346
32347
32348static int
32349test_xmlSchemaNewValidCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032350 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032351
32352
32353 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000032354 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032355}
32356
32357
32358static int
32359test_xmlSchemaParse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032360 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032361
32362
32363 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000032364 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032365}
32366
32367
32368static int
32369test_xmlSchemaSetParserErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032370 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032371
32372
32373 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000032374 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032375}
32376
32377
32378static int
32379test_xmlSchemaSetValidErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032380 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032381
32382
32383 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000032384 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032385}
32386
32387
32388static int
32389test_xmlSchemaSetValidOptions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032390 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032391
William M. Brack21e4ef22005-01-02 09:53:13 +000032392#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032393 int mem_base;
32394 int ret_val;
32395 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
32396 int n_ctxt;
32397 int options; /* a combination of xmlSchemaValidOption */
32398 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032399
Daniel Veillardce682bc2004-11-05 17:22:25 +000032400 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
32401 for (n_options = 0;n_options < gen_nb_int;n_options++) {
32402 mem_base = xmlMemBlocks();
32403 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
32404 options = gen_int(n_options, 1);
32405
32406 ret_val = xmlSchemaSetValidOptions(ctxt, options);
32407 desret_int(ret_val);
32408 call_tests++;
32409 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
32410 des_int(n_options, options, 1);
32411 xmlResetLastError();
32412 if (mem_base != xmlMemBlocks()) {
32413 printf("Leak of %d blocks found in xmlSchemaSetValidOptions",
32414 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032415 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032416 printf(" %d", n_ctxt);
32417 printf(" %d", n_options);
32418 printf("\n");
32419 }
32420 }
32421 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032422 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032423#endif
32424
Daniel Veillard42595322004-11-08 10:52:06 +000032425 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032426}
32427
32428
32429static int
32430test_xmlSchemaValidCtxtGetOptions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032431 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032432
William M. Brack21e4ef22005-01-02 09:53:13 +000032433#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032434 int mem_base;
32435 int ret_val;
32436 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
32437 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032438
Daniel Veillardce682bc2004-11-05 17:22:25 +000032439 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
32440 mem_base = xmlMemBlocks();
32441 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
32442
32443 ret_val = xmlSchemaValidCtxtGetOptions(ctxt);
32444 desret_int(ret_val);
32445 call_tests++;
32446 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
32447 xmlResetLastError();
32448 if (mem_base != xmlMemBlocks()) {
32449 printf("Leak of %d blocks found in xmlSchemaValidCtxtGetOptions",
32450 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032451 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032452 printf(" %d", n_ctxt);
32453 printf("\n");
32454 }
32455 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032456 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032457#endif
32458
Daniel Veillard42595322004-11-08 10:52:06 +000032459 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032460}
32461
32462
32463static int
32464test_xmlSchemaValidateDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032465 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032466
William M. Brack21e4ef22005-01-02 09:53:13 +000032467#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032468 int mem_base;
32469 int ret_val;
32470 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
32471 int n_ctxt;
32472 xmlDocPtr doc; /* a parsed document tree */
32473 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032474
Daniel Veillardce682bc2004-11-05 17:22:25 +000032475 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
32476 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
32477 mem_base = xmlMemBlocks();
32478 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
32479 doc = gen_xmlDocPtr(n_doc, 1);
32480
32481 ret_val = xmlSchemaValidateDoc(ctxt, doc);
32482 desret_int(ret_val);
32483 call_tests++;
32484 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
32485 des_xmlDocPtr(n_doc, doc, 1);
32486 xmlResetLastError();
32487 if (mem_base != xmlMemBlocks()) {
32488 printf("Leak of %d blocks found in xmlSchemaValidateDoc",
32489 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032490 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032491 printf(" %d", n_ctxt);
32492 printf(" %d", n_doc);
32493 printf("\n");
32494 }
32495 }
32496 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032497 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032498#endif
32499
Daniel Veillard42595322004-11-08 10:52:06 +000032500 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032501}
32502
32503
32504static int
32505test_xmlSchemaValidateOneElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032506 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032507
William M. Brack21e4ef22005-01-02 09:53:13 +000032508#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032509 int mem_base;
32510 int ret_val;
32511 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
32512 int n_ctxt;
32513 xmlNodePtr elem; /* an element node */
32514 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032515
Daniel Veillardce682bc2004-11-05 17:22:25 +000032516 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
32517 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
32518 mem_base = xmlMemBlocks();
32519 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
32520 elem = gen_xmlNodePtr(n_elem, 1);
32521
32522 ret_val = xmlSchemaValidateOneElement(ctxt, elem);
32523 desret_int(ret_val);
32524 call_tests++;
32525 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
32526 des_xmlNodePtr(n_elem, elem, 1);
32527 xmlResetLastError();
32528 if (mem_base != xmlMemBlocks()) {
32529 printf("Leak of %d blocks found in xmlSchemaValidateOneElement",
32530 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032531 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032532 printf(" %d", n_ctxt);
32533 printf(" %d", n_elem);
32534 printf("\n");
32535 }
32536 }
32537 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032538 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032539#endif
32540
Daniel Veillard42595322004-11-08 10:52:06 +000032541 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032542}
32543
32544
32545static int
32546test_xmlSchemaValidateStream(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032547 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032548
William M. Brack21e4ef22005-01-02 09:53:13 +000032549#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032550 int mem_base;
32551 int ret_val;
32552 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
32553 int n_ctxt;
32554 xmlParserInputBufferPtr input; /* the input to use for reading the data */
32555 int n_input;
32556 xmlCharEncoding enc; /* an optional encoding information */
32557 int n_enc;
32558 xmlSAXHandlerPtr sax; /* a SAX handler for the resulting events */
32559 int n_sax;
32560 void * user_data; /* the context to provide to the SAX handler. */
32561 int n_user_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032562
Daniel Veillardce682bc2004-11-05 17:22:25 +000032563 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
32564 for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
32565 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
32566 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
32567 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
32568 mem_base = xmlMemBlocks();
32569 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
32570 input = gen_xmlParserInputBufferPtr(n_input, 1);
32571 enc = gen_xmlCharEncoding(n_enc, 2);
32572 sax = gen_xmlSAXHandlerPtr(n_sax, 3);
32573 user_data = gen_userdata(n_user_data, 4);
32574
32575 ret_val = xmlSchemaValidateStream(ctxt, input, enc, sax, user_data);
32576 desret_int(ret_val);
32577 call_tests++;
32578 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
32579 des_xmlParserInputBufferPtr(n_input, input, 1);
32580 des_xmlCharEncoding(n_enc, enc, 2);
32581 des_xmlSAXHandlerPtr(n_sax, sax, 3);
32582 des_userdata(n_user_data, user_data, 4);
32583 xmlResetLastError();
32584 if (mem_base != xmlMemBlocks()) {
32585 printf("Leak of %d blocks found in xmlSchemaValidateStream",
32586 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032587 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032588 printf(" %d", n_ctxt);
32589 printf(" %d", n_input);
32590 printf(" %d", n_enc);
32591 printf(" %d", n_sax);
32592 printf(" %d", n_user_data);
32593 printf("\n");
32594 }
32595 }
32596 }
32597 }
32598 }
32599 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032600 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032601#endif
32602
Daniel Veillard42595322004-11-08 10:52:06 +000032603 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032604}
32605
32606static int
32607test_xmlschemas(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032608 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032609
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032610 if (quiet == 0) printf("Testing xmlschemas : 11 of 18 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000032611 test_ret += test_xmlSchemaDump();
32612 test_ret += test_xmlSchemaGetParserErrors();
32613 test_ret += test_xmlSchemaGetValidErrors();
32614 test_ret += test_xmlSchemaNewDocParserCtxt();
32615 test_ret += test_xmlSchemaNewMemParserCtxt();
32616 test_ret += test_xmlSchemaNewParserCtxt();
32617 test_ret += test_xmlSchemaNewValidCtxt();
32618 test_ret += test_xmlSchemaParse();
32619 test_ret += test_xmlSchemaSetParserErrors();
32620 test_ret += test_xmlSchemaSetValidErrors();
32621 test_ret += test_xmlSchemaSetValidOptions();
32622 test_ret += test_xmlSchemaValidCtxtGetOptions();
32623 test_ret += test_xmlSchemaValidateDoc();
32624 test_ret += test_xmlSchemaValidateOneElement();
32625 test_ret += test_xmlSchemaValidateStream();
Daniel Veillardd93f6252004-11-02 15:53:51 +000032626
Daniel Veillard42595322004-11-08 10:52:06 +000032627 if (test_ret != 0)
32628 printf("Module xmlschemas: %d errors\n", test_ret);
32629 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032630}
Daniel Veillarda521d282004-11-09 14:59:59 +000032631#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000032632
Daniel Veillardce682bc2004-11-05 17:22:25 +000032633#define gen_nb_xmlSchemaFacetPtr 1
32634static xmlSchemaFacetPtr gen_xmlSchemaFacetPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32635 return(NULL);
32636}
32637static void des_xmlSchemaFacetPtr(int no ATTRIBUTE_UNUSED, xmlSchemaFacetPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32638}
Daniel Veillarda521d282004-11-09 14:59:59 +000032639#endif
32640
32641#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000032642
32643#define gen_nb_xmlSchemaTypePtr 1
32644static xmlSchemaTypePtr gen_xmlSchemaTypePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32645 return(NULL);
32646}
32647static void des_xmlSchemaTypePtr(int no ATTRIBUTE_UNUSED, xmlSchemaTypePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32648}
Daniel Veillarda521d282004-11-09 14:59:59 +000032649#endif
32650
Daniel Veillardce682bc2004-11-05 17:22:25 +000032651
Daniel Veillardd93f6252004-11-02 15:53:51 +000032652static int
32653test_xmlSchemaCheckFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032654 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032655
William M. Brack21e4ef22005-01-02 09:53:13 +000032656#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032657 int mem_base;
32658 int ret_val;
32659 xmlSchemaFacetPtr facet; /* the facet */
32660 int n_facet;
32661 xmlSchemaTypePtr typeDecl; /* the schema type definition */
32662 int n_typeDecl;
32663 xmlSchemaParserCtxtPtr ctxt; /* the schema parser context or NULL */
32664 int n_ctxt;
32665 xmlChar * name; /* name of the type */
32666 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032667
Daniel Veillardce682bc2004-11-05 17:22:25 +000032668 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
32669 for (n_typeDecl = 0;n_typeDecl < gen_nb_xmlSchemaTypePtr;n_typeDecl++) {
32670 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaParserCtxtPtr;n_ctxt++) {
32671 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
32672 mem_base = xmlMemBlocks();
32673 facet = gen_xmlSchemaFacetPtr(n_facet, 0);
32674 typeDecl = gen_xmlSchemaTypePtr(n_typeDecl, 1);
32675 ctxt = gen_xmlSchemaParserCtxtPtr(n_ctxt, 2);
32676 name = gen_const_xmlChar_ptr(n_name, 3);
32677
William M. Brackf13f77f2004-11-12 16:03:48 +000032678 ret_val = xmlSchemaCheckFacet(facet, typeDecl, ctxt, (const xmlChar *)name);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032679 desret_int(ret_val);
32680 call_tests++;
32681 des_xmlSchemaFacetPtr(n_facet, facet, 0);
32682 des_xmlSchemaTypePtr(n_typeDecl, typeDecl, 1);
32683 des_xmlSchemaParserCtxtPtr(n_ctxt, ctxt, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000032684 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 3);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032685 xmlResetLastError();
32686 if (mem_base != xmlMemBlocks()) {
32687 printf("Leak of %d blocks found in xmlSchemaCheckFacet",
32688 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032689 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032690 printf(" %d", n_facet);
32691 printf(" %d", n_typeDecl);
32692 printf(" %d", n_ctxt);
32693 printf(" %d", n_name);
32694 printf("\n");
32695 }
32696 }
32697 }
32698 }
32699 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032700 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032701#endif
32702
Daniel Veillard42595322004-11-08 10:52:06 +000032703 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032704}
32705
32706
32707static int
32708test_xmlSchemaCleanupTypes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032709 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032710
William M. Brack21e4ef22005-01-02 09:53:13 +000032711#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000032712 int mem_base;
32713
32714 mem_base = xmlMemBlocks();
32715
32716 xmlSchemaCleanupTypes();
32717 call_tests++;
32718 xmlResetLastError();
32719 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000032720 printf("Leak of %d blocks found in xmlSchemaCleanupTypes",
Daniel Veillardd93f6252004-11-02 15:53:51 +000032721 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032722 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000032723 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000032724 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032725 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032726#endif
32727
Daniel Veillard42595322004-11-08 10:52:06 +000032728 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032729}
32730
32731
32732static int
32733test_xmlSchemaCollapseString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032734 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032735
William M. Brack21e4ef22005-01-02 09:53:13 +000032736#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032737 int mem_base;
32738 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032739 xmlChar * value; /* a value */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032740 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032741
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032742 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32743 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000032744 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032745
William M. Brackf13f77f2004-11-12 16:03:48 +000032746 ret_val = xmlSchemaCollapseString((const xmlChar *)value);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032747 desret_xmlChar_ptr(ret_val);
32748 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000032749 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032750 xmlResetLastError();
32751 if (mem_base != xmlMemBlocks()) {
32752 printf("Leak of %d blocks found in xmlSchemaCollapseString",
32753 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032754 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032755 printf(" %d", n_value);
32756 printf("\n");
32757 }
32758 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032759 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032760#endif
32761
Daniel Veillard42595322004-11-08 10:52:06 +000032762 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032763}
32764
Daniel Veillarda521d282004-11-09 14:59:59 +000032765#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000032766
Daniel Veillardce682bc2004-11-05 17:22:25 +000032767#define gen_nb_xmlSchemaValPtr 1
32768static xmlSchemaValPtr gen_xmlSchemaValPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32769 return(NULL);
32770}
32771static void des_xmlSchemaValPtr(int no ATTRIBUTE_UNUSED, xmlSchemaValPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32772}
Daniel Veillarda521d282004-11-09 14:59:59 +000032773#endif
32774
Daniel Veillardce682bc2004-11-05 17:22:25 +000032775
Daniel Veillardd93f6252004-11-02 15:53:51 +000032776static int
32777test_xmlSchemaCompareValues(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032778 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032779
William M. Brack21e4ef22005-01-02 09:53:13 +000032780#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032781 int mem_base;
32782 int ret_val;
32783 xmlSchemaValPtr x; /* a first value */
32784 int n_x;
32785 xmlSchemaValPtr y; /* a second value */
32786 int n_y;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032787
Daniel Veillardce682bc2004-11-05 17:22:25 +000032788 for (n_x = 0;n_x < gen_nb_xmlSchemaValPtr;n_x++) {
32789 for (n_y = 0;n_y < gen_nb_xmlSchemaValPtr;n_y++) {
32790 mem_base = xmlMemBlocks();
32791 x = gen_xmlSchemaValPtr(n_x, 0);
32792 y = gen_xmlSchemaValPtr(n_y, 1);
32793
32794 ret_val = xmlSchemaCompareValues(x, y);
32795 desret_int(ret_val);
32796 call_tests++;
32797 des_xmlSchemaValPtr(n_x, x, 0);
32798 des_xmlSchemaValPtr(n_y, y, 1);
32799 xmlResetLastError();
32800 if (mem_base != xmlMemBlocks()) {
32801 printf("Leak of %d blocks found in xmlSchemaCompareValues",
32802 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032803 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032804 printf(" %d", n_x);
32805 printf(" %d", n_y);
32806 printf("\n");
32807 }
32808 }
32809 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032810 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032811#endif
32812
Daniel Veillard42595322004-11-08 10:52:06 +000032813 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032814}
32815
32816
32817static int
Daniel Veillardb5839c32005-02-19 18:27:14 +000032818test_xmlSchemaCompareValuesWhtsp(void) {
32819 int test_ret = 0;
32820
32821#if defined(LIBXML_SCHEMAS_ENABLED)
32822 int mem_base;
32823 int ret_val;
32824 xmlSchemaValPtr x; /* a first value */
32825 int n_x;
32826 xmlSchemaWhitespaceValueType xws; /* the whitespace value of x */
32827 int n_xws;
32828 xmlSchemaValPtr y; /* a second value */
32829 int n_y;
32830 xmlSchemaWhitespaceValueType yws; /* the whitespace value of y */
32831 int n_yws;
32832
32833 for (n_x = 0;n_x < gen_nb_xmlSchemaValPtr;n_x++) {
32834 for (n_xws = 0;n_xws < gen_nb_xmlSchemaWhitespaceValueType;n_xws++) {
32835 for (n_y = 0;n_y < gen_nb_xmlSchemaValPtr;n_y++) {
32836 for (n_yws = 0;n_yws < gen_nb_xmlSchemaWhitespaceValueType;n_yws++) {
32837 mem_base = xmlMemBlocks();
32838 x = gen_xmlSchemaValPtr(n_x, 0);
32839 xws = gen_xmlSchemaWhitespaceValueType(n_xws, 1);
32840 y = gen_xmlSchemaValPtr(n_y, 2);
32841 yws = gen_xmlSchemaWhitespaceValueType(n_yws, 3);
32842
32843 ret_val = xmlSchemaCompareValuesWhtsp(x, xws, y, yws);
32844 desret_int(ret_val);
32845 call_tests++;
32846 des_xmlSchemaValPtr(n_x, x, 0);
32847 des_xmlSchemaWhitespaceValueType(n_xws, xws, 1);
32848 des_xmlSchemaValPtr(n_y, y, 2);
32849 des_xmlSchemaWhitespaceValueType(n_yws, yws, 3);
32850 xmlResetLastError();
32851 if (mem_base != xmlMemBlocks()) {
32852 printf("Leak of %d blocks found in xmlSchemaCompareValuesWhtsp",
32853 xmlMemBlocks() - mem_base);
32854 test_ret++;
32855 printf(" %d", n_x);
32856 printf(" %d", n_xws);
32857 printf(" %d", n_y);
32858 printf(" %d", n_yws);
32859 printf("\n");
32860 }
32861 }
32862 }
32863 }
32864 }
32865 function_tests++;
32866#endif
32867
32868 return(test_ret);
32869}
32870
32871
32872static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000032873test_xmlSchemaGetBuiltInListSimpleTypeItemType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032874 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032875
William M. Brack21e4ef22005-01-02 09:53:13 +000032876#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000032877 int mem_base;
32878 xmlSchemaTypePtr ret_val;
32879 xmlSchemaTypePtr type; /* the built-in simple type. */
32880 int n_type;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032881
Daniel Veillard42595322004-11-08 10:52:06 +000032882 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
32883 mem_base = xmlMemBlocks();
32884 type = gen_xmlSchemaTypePtr(n_type, 0);
32885
32886 ret_val = xmlSchemaGetBuiltInListSimpleTypeItemType(type);
32887 desret_xmlSchemaTypePtr(ret_val);
32888 call_tests++;
32889 des_xmlSchemaTypePtr(n_type, type, 0);
32890 xmlResetLastError();
32891 if (mem_base != xmlMemBlocks()) {
32892 printf("Leak of %d blocks found in xmlSchemaGetBuiltInListSimpleTypeItemType",
32893 xmlMemBlocks() - mem_base);
32894 test_ret++;
32895 printf(" %d", n_type);
32896 printf("\n");
32897 }
32898 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032899 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032900#endif
32901
Daniel Veillard42595322004-11-08 10:52:06 +000032902 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032903}
32904
32905
32906static int
32907test_xmlSchemaGetBuiltInType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032908 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032909
William M. Brack21e4ef22005-01-02 09:53:13 +000032910#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000032911 xmlSchemaTypePtr ret_val;
32912 xmlSchemaValType type; /* the type of the built in type */
32913 int n_type;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032914
Daniel Veillard42595322004-11-08 10:52:06 +000032915 for (n_type = 0;n_type < gen_nb_xmlSchemaValType;n_type++) {
32916 type = gen_xmlSchemaValType(n_type, 0);
32917
32918 ret_val = xmlSchemaGetBuiltInType(type);
32919 desret_xmlSchemaTypePtr(ret_val);
32920 call_tests++;
32921 des_xmlSchemaValType(n_type, type, 0);
32922 xmlResetLastError();
32923 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032924 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032925#endif
32926
Daniel Veillard42595322004-11-08 10:52:06 +000032927 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032928}
32929
32930
32931static int
Daniel Veillardb5839c32005-02-19 18:27:14 +000032932test_xmlSchemaGetCanonValue(void) {
32933 int test_ret = 0;
32934
32935#if defined(LIBXML_SCHEMAS_ENABLED)
32936 int mem_base;
32937 int ret_val;
32938 xmlSchemaValPtr val; /* the precomputed value */
32939 int n_val;
32940 xmlChar ** retValue; /* the returned value */
32941 int n_retValue;
32942
32943 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr;n_val++) {
32944 for (n_retValue = 0;n_retValue < gen_nb_const_xmlChar_ptr_ptr;n_retValue++) {
32945 mem_base = xmlMemBlocks();
32946 val = gen_xmlSchemaValPtr(n_val, 0);
32947 retValue = gen_const_xmlChar_ptr_ptr(n_retValue, 1);
32948
32949 ret_val = xmlSchemaGetCanonValue(val, (const xmlChar **)retValue);
32950 desret_int(ret_val);
32951 call_tests++;
32952 des_xmlSchemaValPtr(n_val, val, 0);
32953 des_const_xmlChar_ptr_ptr(n_retValue, (const xmlChar **)retValue, 1);
32954 xmlResetLastError();
32955 if (mem_base != xmlMemBlocks()) {
32956 printf("Leak of %d blocks found in xmlSchemaGetCanonValue",
32957 xmlMemBlocks() - mem_base);
32958 test_ret++;
32959 printf(" %d", n_val);
32960 printf(" %d", n_retValue);
32961 printf("\n");
32962 }
32963 }
32964 }
32965 function_tests++;
32966#endif
32967
32968 return(test_ret);
32969}
32970
32971
32972static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000032973test_xmlSchemaGetFacetValueAsULong(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032974 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032975
William M. Brack21e4ef22005-01-02 09:53:13 +000032976#if defined(LIBXML_SCHEMAS_ENABLED)
William M. Brack094dd862004-11-14 14:28:34 +000032977 int mem_base;
32978 unsigned long ret_val;
32979 xmlSchemaFacetPtr facet; /* an schemas type facet */
32980 int n_facet;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032981
William M. Brack094dd862004-11-14 14:28:34 +000032982 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
32983 mem_base = xmlMemBlocks();
32984 facet = gen_xmlSchemaFacetPtr(n_facet, 0);
32985
32986 ret_val = xmlSchemaGetFacetValueAsULong(facet);
32987 desret_unsigned_long(ret_val);
32988 call_tests++;
32989 des_xmlSchemaFacetPtr(n_facet, facet, 0);
32990 xmlResetLastError();
32991 if (mem_base != xmlMemBlocks()) {
32992 printf("Leak of %d blocks found in xmlSchemaGetFacetValueAsULong",
32993 xmlMemBlocks() - mem_base);
32994 test_ret++;
32995 printf(" %d", n_facet);
32996 printf("\n");
32997 }
32998 }
32999 function_tests++;
33000#endif
33001
Daniel Veillard42595322004-11-08 10:52:06 +000033002 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033003}
33004
33005
33006static int
33007test_xmlSchemaGetPredefinedType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033008 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033009
William M. Brack21e4ef22005-01-02 09:53:13 +000033010#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000033011 int mem_base;
33012 xmlSchemaTypePtr ret_val;
33013 xmlChar * name; /* the type name */
33014 int n_name;
33015 xmlChar * ns; /* the URI of the namespace usually "http://www.w3.org/2001/XMLSchema" */
33016 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033017
Daniel Veillard42595322004-11-08 10:52:06 +000033018 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
33019 for (n_ns = 0;n_ns < gen_nb_const_xmlChar_ptr;n_ns++) {
33020 mem_base = xmlMemBlocks();
33021 name = gen_const_xmlChar_ptr(n_name, 0);
33022 ns = gen_const_xmlChar_ptr(n_ns, 1);
33023
William M. Brackf13f77f2004-11-12 16:03:48 +000033024 ret_val = xmlSchemaGetPredefinedType((const xmlChar *)name, (const xmlChar *)ns);
Daniel Veillard42595322004-11-08 10:52:06 +000033025 desret_xmlSchemaTypePtr(ret_val);
33026 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033027 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
33028 des_const_xmlChar_ptr(n_ns, (const xmlChar *)ns, 1);
Daniel Veillard42595322004-11-08 10:52:06 +000033029 xmlResetLastError();
33030 if (mem_base != xmlMemBlocks()) {
33031 printf("Leak of %d blocks found in xmlSchemaGetPredefinedType",
33032 xmlMemBlocks() - mem_base);
33033 test_ret++;
33034 printf(" %d", n_name);
33035 printf(" %d", n_ns);
33036 printf("\n");
33037 }
33038 }
33039 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033040 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000033041#endif
33042
Daniel Veillard42595322004-11-08 10:52:06 +000033043 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033044}
33045
33046
33047static int
33048test_xmlSchemaInitTypes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033049 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033050
William M. Brack21e4ef22005-01-02 09:53:13 +000033051#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000033052
33053
33054 xmlSchemaInitTypes();
33055 call_tests++;
33056 xmlResetLastError();
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033057 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033058#endif
33059
Daniel Veillard42595322004-11-08 10:52:06 +000033060 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033061}
33062
33063
33064static int
33065test_xmlSchemaIsBuiltInTypeFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033066 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033067
William M. Brack21e4ef22005-01-02 09:53:13 +000033068#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000033069 int mem_base;
33070 int ret_val;
33071 xmlSchemaTypePtr type; /* the built-in type */
33072 int n_type;
33073 int facetType; /* the facet type */
33074 int n_facetType;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033075
Daniel Veillardce682bc2004-11-05 17:22:25 +000033076 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
33077 for (n_facetType = 0;n_facetType < gen_nb_int;n_facetType++) {
33078 mem_base = xmlMemBlocks();
33079 type = gen_xmlSchemaTypePtr(n_type, 0);
33080 facetType = gen_int(n_facetType, 1);
33081
33082 ret_val = xmlSchemaIsBuiltInTypeFacet(type, facetType);
33083 desret_int(ret_val);
33084 call_tests++;
33085 des_xmlSchemaTypePtr(n_type, type, 0);
33086 des_int(n_facetType, facetType, 1);
33087 xmlResetLastError();
33088 if (mem_base != xmlMemBlocks()) {
33089 printf("Leak of %d blocks found in xmlSchemaIsBuiltInTypeFacet",
33090 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033091 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033092 printf(" %d", n_type);
33093 printf(" %d", n_facetType);
33094 printf("\n");
33095 }
33096 }
33097 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033098 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033099#endif
33100
Daniel Veillard42595322004-11-08 10:52:06 +000033101 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033102}
33103
33104
33105static int
33106test_xmlSchemaNewFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033107 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033108
33109
33110 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000033111 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033112}
33113
Daniel Veillardb5839c32005-02-19 18:27:14 +000033114
33115static int
33116test_xmlSchemaNewNOTATIONValue(void) {
33117 int test_ret = 0;
33118
33119
33120 /* missing type support */
33121 return(test_ret);
33122}
33123
33124
33125static int
33126test_xmlSchemaNewStringValue(void) {
33127 int test_ret = 0;
33128
33129
33130 /* missing type support */
33131 return(test_ret);
33132}
33133
Daniel Veillarda521d282004-11-09 14:59:59 +000033134#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000033135
Daniel Veillardce682bc2004-11-05 17:22:25 +000033136#define gen_nb_xmlSchemaValPtr_ptr 1
33137static xmlSchemaValPtr * gen_xmlSchemaValPtr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
33138 return(NULL);
33139}
33140static void des_xmlSchemaValPtr_ptr(int no ATTRIBUTE_UNUSED, xmlSchemaValPtr * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
33141}
Daniel Veillarda521d282004-11-09 14:59:59 +000033142#endif
33143
Daniel Veillardce682bc2004-11-05 17:22:25 +000033144
Daniel Veillardd93f6252004-11-02 15:53:51 +000033145static int
33146test_xmlSchemaValPredefTypeNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033147 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033148
William M. Brack21e4ef22005-01-02 09:53:13 +000033149#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000033150 int mem_base;
33151 int ret_val;
33152 xmlSchemaTypePtr type; /* the predefined type */
33153 int n_type;
33154 xmlChar * value; /* the value to check */
33155 int n_value;
33156 xmlSchemaValPtr * val; /* the return computed value */
33157 int n_val;
33158 xmlNodePtr node; /* the node containing the value */
33159 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033160
Daniel Veillardce682bc2004-11-05 17:22:25 +000033161 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
33162 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
33163 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr_ptr;n_val++) {
33164 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
33165 mem_base = xmlMemBlocks();
33166 type = gen_xmlSchemaTypePtr(n_type, 0);
33167 value = gen_const_xmlChar_ptr(n_value, 1);
33168 val = gen_xmlSchemaValPtr_ptr(n_val, 2);
33169 node = gen_xmlNodePtr(n_node, 3);
33170
William M. Brackf13f77f2004-11-12 16:03:48 +000033171 ret_val = xmlSchemaValPredefTypeNode(type, (const xmlChar *)value, val, node);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033172 desret_int(ret_val);
33173 call_tests++;
33174 des_xmlSchemaTypePtr(n_type, type, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000033175 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033176 des_xmlSchemaValPtr_ptr(n_val, val, 2);
33177 des_xmlNodePtr(n_node, node, 3);
33178 xmlResetLastError();
33179 if (mem_base != xmlMemBlocks()) {
33180 printf("Leak of %d blocks found in xmlSchemaValPredefTypeNode",
33181 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033182 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033183 printf(" %d", n_type);
33184 printf(" %d", n_value);
33185 printf(" %d", n_val);
33186 printf(" %d", n_node);
33187 printf("\n");
33188 }
33189 }
33190 }
33191 }
33192 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033193 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033194#endif
33195
Daniel Veillard42595322004-11-08 10:52:06 +000033196 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033197}
33198
33199
33200static int
33201test_xmlSchemaValPredefTypeNodeNoNorm(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033202 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033203
William M. Brack21e4ef22005-01-02 09:53:13 +000033204#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000033205 int mem_base;
33206 int ret_val;
33207 xmlSchemaTypePtr type; /* the predefined type */
33208 int n_type;
33209 xmlChar * value; /* the value to check */
33210 int n_value;
33211 xmlSchemaValPtr * val; /* the return computed value */
33212 int n_val;
33213 xmlNodePtr node; /* the node containing the value */
33214 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033215
Daniel Veillardce682bc2004-11-05 17:22:25 +000033216 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
33217 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
33218 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr_ptr;n_val++) {
33219 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
33220 mem_base = xmlMemBlocks();
33221 type = gen_xmlSchemaTypePtr(n_type, 0);
33222 value = gen_const_xmlChar_ptr(n_value, 1);
33223 val = gen_xmlSchemaValPtr_ptr(n_val, 2);
33224 node = gen_xmlNodePtr(n_node, 3);
33225
William M. Brackf13f77f2004-11-12 16:03:48 +000033226 ret_val = xmlSchemaValPredefTypeNodeNoNorm(type, (const xmlChar *)value, val, node);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033227 desret_int(ret_val);
33228 call_tests++;
33229 des_xmlSchemaTypePtr(n_type, type, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000033230 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033231 des_xmlSchemaValPtr_ptr(n_val, val, 2);
33232 des_xmlNodePtr(n_node, node, 3);
33233 xmlResetLastError();
33234 if (mem_base != xmlMemBlocks()) {
33235 printf("Leak of %d blocks found in xmlSchemaValPredefTypeNodeNoNorm",
33236 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033237 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033238 printf(" %d", n_type);
33239 printf(" %d", n_value);
33240 printf(" %d", n_val);
33241 printf(" %d", n_node);
33242 printf("\n");
33243 }
33244 }
33245 }
33246 }
33247 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033248 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033249#endif
33250
Daniel Veillard42595322004-11-08 10:52:06 +000033251 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033252}
33253
33254
33255static int
33256test_xmlSchemaValidateFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033257 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033258
William M. Brack21e4ef22005-01-02 09:53:13 +000033259#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000033260 int mem_base;
33261 int ret_val;
33262 xmlSchemaTypePtr base; /* the base type */
33263 int n_base;
33264 xmlSchemaFacetPtr facet; /* the facet to check */
33265 int n_facet;
33266 xmlChar * value; /* the lexical repr of the value to validate */
33267 int n_value;
33268 xmlSchemaValPtr val; /* the precomputed value */
33269 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033270
Daniel Veillardce682bc2004-11-05 17:22:25 +000033271 for (n_base = 0;n_base < gen_nb_xmlSchemaTypePtr;n_base++) {
33272 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
33273 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
33274 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr;n_val++) {
33275 mem_base = xmlMemBlocks();
33276 base = gen_xmlSchemaTypePtr(n_base, 0);
33277 facet = gen_xmlSchemaFacetPtr(n_facet, 1);
33278 value = gen_const_xmlChar_ptr(n_value, 2);
33279 val = gen_xmlSchemaValPtr(n_val, 3);
33280
William M. Brackf13f77f2004-11-12 16:03:48 +000033281 ret_val = xmlSchemaValidateFacet(base, facet, (const xmlChar *)value, val);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033282 desret_int(ret_val);
33283 call_tests++;
33284 des_xmlSchemaTypePtr(n_base, base, 0);
33285 des_xmlSchemaFacetPtr(n_facet, facet, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000033286 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033287 des_xmlSchemaValPtr(n_val, val, 3);
33288 xmlResetLastError();
33289 if (mem_base != xmlMemBlocks()) {
33290 printf("Leak of %d blocks found in xmlSchemaValidateFacet",
33291 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033292 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033293 printf(" %d", n_base);
33294 printf(" %d", n_facet);
33295 printf(" %d", n_value);
33296 printf(" %d", n_val);
33297 printf("\n");
33298 }
33299 }
33300 }
33301 }
33302 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033303 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033304#endif
33305
Daniel Veillard42595322004-11-08 10:52:06 +000033306 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033307}
33308
33309
33310static int
33311test_xmlSchemaValidateLengthFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033312 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033313
William M. Brack21e4ef22005-01-02 09:53:13 +000033314#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000033315 int mem_base;
33316 int ret_val;
33317 xmlSchemaTypePtr type; /* the built-in type */
33318 int n_type;
33319 xmlSchemaFacetPtr facet; /* the facet to check */
33320 int n_facet;
33321 xmlChar * value; /* the lexical repr. of the value to be validated */
33322 int n_value;
33323 xmlSchemaValPtr val; /* the precomputed value */
33324 int n_val;
33325 unsigned long * length; /* the actual length of the value */
33326 int n_length;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033327
Daniel Veillardce682bc2004-11-05 17:22:25 +000033328 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
33329 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
33330 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
33331 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr;n_val++) {
33332 for (n_length = 0;n_length < gen_nb_unsigned_long_ptr;n_length++) {
33333 mem_base = xmlMemBlocks();
33334 type = gen_xmlSchemaTypePtr(n_type, 0);
33335 facet = gen_xmlSchemaFacetPtr(n_facet, 1);
33336 value = gen_const_xmlChar_ptr(n_value, 2);
33337 val = gen_xmlSchemaValPtr(n_val, 3);
33338 length = gen_unsigned_long_ptr(n_length, 4);
33339
William M. Brackf13f77f2004-11-12 16:03:48 +000033340 ret_val = xmlSchemaValidateLengthFacet(type, facet, (const xmlChar *)value, val, length);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033341 desret_int(ret_val);
33342 call_tests++;
33343 des_xmlSchemaTypePtr(n_type, type, 0);
33344 des_xmlSchemaFacetPtr(n_facet, facet, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000033345 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033346 des_xmlSchemaValPtr(n_val, val, 3);
33347 des_unsigned_long_ptr(n_length, length, 4);
33348 xmlResetLastError();
33349 if (mem_base != xmlMemBlocks()) {
33350 printf("Leak of %d blocks found in xmlSchemaValidateLengthFacet",
33351 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033352 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033353 printf(" %d", n_type);
33354 printf(" %d", n_facet);
33355 printf(" %d", n_value);
33356 printf(" %d", n_val);
33357 printf(" %d", n_length);
33358 printf("\n");
33359 }
33360 }
33361 }
33362 }
33363 }
33364 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033365 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033366#endif
33367
Daniel Veillard42595322004-11-08 10:52:06 +000033368 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033369}
33370
33371
33372static int
33373test_xmlSchemaValidateListSimpleTypeFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033374 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033375
William M. Brack21e4ef22005-01-02 09:53:13 +000033376#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000033377 int mem_base;
33378 int ret_val;
33379 xmlSchemaFacetPtr facet; /* the facet to check */
33380 int n_facet;
33381 xmlChar * value; /* the lexical repr of the value to validate */
33382 int n_value;
33383 unsigned long actualLen; /* the number of list items */
33384 int n_actualLen;
33385 unsigned long * expectedLen; /* the resulting expected number of list items */
33386 int n_expectedLen;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033387
Daniel Veillardce682bc2004-11-05 17:22:25 +000033388 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
33389 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
33390 for (n_actualLen = 0;n_actualLen < gen_nb_unsigned_long;n_actualLen++) {
33391 for (n_expectedLen = 0;n_expectedLen < gen_nb_unsigned_long_ptr;n_expectedLen++) {
33392 mem_base = xmlMemBlocks();
33393 facet = gen_xmlSchemaFacetPtr(n_facet, 0);
33394 value = gen_const_xmlChar_ptr(n_value, 1);
33395 actualLen = gen_unsigned_long(n_actualLen, 2);
33396 expectedLen = gen_unsigned_long_ptr(n_expectedLen, 3);
33397
William M. Brackf13f77f2004-11-12 16:03:48 +000033398 ret_val = xmlSchemaValidateListSimpleTypeFacet(facet, (const xmlChar *)value, actualLen, expectedLen);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033399 desret_int(ret_val);
33400 call_tests++;
33401 des_xmlSchemaFacetPtr(n_facet, facet, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000033402 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033403 des_unsigned_long(n_actualLen, actualLen, 2);
33404 des_unsigned_long_ptr(n_expectedLen, expectedLen, 3);
33405 xmlResetLastError();
33406 if (mem_base != xmlMemBlocks()) {
33407 printf("Leak of %d blocks found in xmlSchemaValidateListSimpleTypeFacet",
33408 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033409 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033410 printf(" %d", n_facet);
33411 printf(" %d", n_value);
33412 printf(" %d", n_actualLen);
33413 printf(" %d", n_expectedLen);
33414 printf("\n");
33415 }
33416 }
33417 }
33418 }
33419 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033420 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033421#endif
33422
Daniel Veillard42595322004-11-08 10:52:06 +000033423 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033424}
33425
33426
33427static int
33428test_xmlSchemaValidatePredefinedType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033429 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033430
William M. Brack21e4ef22005-01-02 09:53:13 +000033431#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000033432 int mem_base;
33433 int ret_val;
33434 xmlSchemaTypePtr type; /* the predefined type */
33435 int n_type;
33436 xmlChar * value; /* the value to check */
33437 int n_value;
33438 xmlSchemaValPtr * val; /* the return computed value */
33439 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033440
Daniel Veillardce682bc2004-11-05 17:22:25 +000033441 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
33442 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
33443 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr_ptr;n_val++) {
33444 mem_base = xmlMemBlocks();
33445 type = gen_xmlSchemaTypePtr(n_type, 0);
33446 value = gen_const_xmlChar_ptr(n_value, 1);
33447 val = gen_xmlSchemaValPtr_ptr(n_val, 2);
33448
William M. Brackf13f77f2004-11-12 16:03:48 +000033449 ret_val = xmlSchemaValidatePredefinedType(type, (const xmlChar *)value, val);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033450 desret_int(ret_val);
33451 call_tests++;
33452 des_xmlSchemaTypePtr(n_type, type, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000033453 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033454 des_xmlSchemaValPtr_ptr(n_val, val, 2);
33455 xmlResetLastError();
33456 if (mem_base != xmlMemBlocks()) {
33457 printf("Leak of %d blocks found in xmlSchemaValidatePredefinedType",
33458 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033459 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033460 printf(" %d", n_type);
33461 printf(" %d", n_value);
33462 printf(" %d", n_val);
33463 printf("\n");
33464 }
33465 }
33466 }
33467 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033468 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033469#endif
33470
Daniel Veillard42595322004-11-08 10:52:06 +000033471 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033472}
33473
Daniel Veillard91b955c2004-12-10 10:26:42 +000033474
33475static int
33476test_xmlSchemaWhiteSpaceReplace(void) {
33477 int test_ret = 0;
33478
William M. Brack21e4ef22005-01-02 09:53:13 +000033479#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard91b955c2004-12-10 10:26:42 +000033480 int mem_base;
33481 xmlChar * ret_val;
33482 xmlChar * value; /* a value */
33483 int n_value;
33484
33485 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
33486 mem_base = xmlMemBlocks();
33487 value = gen_const_xmlChar_ptr(n_value, 0);
33488
33489 ret_val = xmlSchemaWhiteSpaceReplace((const xmlChar *)value);
33490 desret_xmlChar_ptr(ret_val);
33491 call_tests++;
33492 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
33493 xmlResetLastError();
33494 if (mem_base != xmlMemBlocks()) {
33495 printf("Leak of %d blocks found in xmlSchemaWhiteSpaceReplace",
33496 xmlMemBlocks() - mem_base);
33497 test_ret++;
33498 printf(" %d", n_value);
33499 printf("\n");
33500 }
33501 }
33502 function_tests++;
33503#endif
33504
33505 return(test_ret);
33506}
33507
Daniel Veillardd93f6252004-11-02 15:53:51 +000033508static int
33509test_xmlschemastypes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033510 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033511
Daniel Veillardb5839c32005-02-19 18:27:14 +000033512 if (quiet == 0) printf("Testing xmlschemastypes : 19 of 24 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000033513 test_ret += test_xmlSchemaCheckFacet();
33514 test_ret += test_xmlSchemaCleanupTypes();
33515 test_ret += test_xmlSchemaCollapseString();
33516 test_ret += test_xmlSchemaCompareValues();
Daniel Veillardb5839c32005-02-19 18:27:14 +000033517 test_ret += test_xmlSchemaCompareValuesWhtsp();
Daniel Veillard42595322004-11-08 10:52:06 +000033518 test_ret += test_xmlSchemaGetBuiltInListSimpleTypeItemType();
33519 test_ret += test_xmlSchemaGetBuiltInType();
Daniel Veillardb5839c32005-02-19 18:27:14 +000033520 test_ret += test_xmlSchemaGetCanonValue();
Daniel Veillard42595322004-11-08 10:52:06 +000033521 test_ret += test_xmlSchemaGetFacetValueAsULong();
33522 test_ret += test_xmlSchemaGetPredefinedType();
33523 test_ret += test_xmlSchemaInitTypes();
33524 test_ret += test_xmlSchemaIsBuiltInTypeFacet();
33525 test_ret += test_xmlSchemaNewFacet();
Daniel Veillardb5839c32005-02-19 18:27:14 +000033526 test_ret += test_xmlSchemaNewNOTATIONValue();
33527 test_ret += test_xmlSchemaNewStringValue();
Daniel Veillard42595322004-11-08 10:52:06 +000033528 test_ret += test_xmlSchemaValPredefTypeNode();
33529 test_ret += test_xmlSchemaValPredefTypeNodeNoNorm();
33530 test_ret += test_xmlSchemaValidateFacet();
33531 test_ret += test_xmlSchemaValidateLengthFacet();
33532 test_ret += test_xmlSchemaValidateListSimpleTypeFacet();
33533 test_ret += test_xmlSchemaValidatePredefinedType();
Daniel Veillard91b955c2004-12-10 10:26:42 +000033534 test_ret += test_xmlSchemaWhiteSpaceReplace();
Daniel Veillardd93f6252004-11-02 15:53:51 +000033535
Daniel Veillard42595322004-11-08 10:52:06 +000033536 if (test_ret != 0)
33537 printf("Module xmlschemastypes: %d errors\n", test_ret);
33538 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033539}
33540
33541static int
33542test_xmlCharStrdup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033543 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033544
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033545 int mem_base;
33546 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033547 char * cur; /* the input char * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033548 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033549
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033550 for (n_cur = 0;n_cur < gen_nb_const_char_ptr;n_cur++) {
33551 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033552 cur = gen_const_char_ptr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033553
William M. Brackf13f77f2004-11-12 16:03:48 +000033554 ret_val = xmlCharStrdup((const char *)cur);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033555 desret_xmlChar_ptr(ret_val);
33556 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033557 des_const_char_ptr(n_cur, (const char *)cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033558 xmlResetLastError();
33559 if (mem_base != xmlMemBlocks()) {
33560 printf("Leak of %d blocks found in xmlCharStrdup",
33561 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033562 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033563 printf(" %d", n_cur);
33564 printf("\n");
33565 }
33566 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033567 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033568
Daniel Veillard42595322004-11-08 10:52:06 +000033569 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033570}
33571
33572
33573static int
33574test_xmlCharStrndup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033575 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033576
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033577 int mem_base;
33578 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033579 char * cur; /* the input char * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033580 int n_cur;
33581 int len; /* the len of @cur */
33582 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033583
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033584 for (n_cur = 0;n_cur < gen_nb_const_char_ptr;n_cur++) {
33585 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33586 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033587 cur = gen_const_char_ptr(n_cur, 0);
33588 len = gen_int(n_len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033589
William M. Brackf13f77f2004-11-12 16:03:48 +000033590 ret_val = xmlCharStrndup((const char *)cur, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033591 desret_xmlChar_ptr(ret_val);
33592 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033593 des_const_char_ptr(n_cur, (const char *)cur, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033594 des_int(n_len, len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033595 xmlResetLastError();
33596 if (mem_base != xmlMemBlocks()) {
33597 printf("Leak of %d blocks found in xmlCharStrndup",
33598 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033599 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033600 printf(" %d", n_cur);
33601 printf(" %d", n_len);
33602 printf("\n");
33603 }
33604 }
33605 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033606 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033607
Daniel Veillard42595322004-11-08 10:52:06 +000033608 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033609}
33610
33611
33612static int
33613test_xmlCheckUTF8(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033614 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033615
Daniel Veillardce682bc2004-11-05 17:22:25 +000033616 int mem_base;
33617 int ret_val;
33618 unsigned char * utf; /* Pointer to putative UTF-8 encoded string. */
33619 int n_utf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033620
Daniel Veillardce682bc2004-11-05 17:22:25 +000033621 for (n_utf = 0;n_utf < gen_nb_const_unsigned_char_ptr;n_utf++) {
33622 mem_base = xmlMemBlocks();
33623 utf = gen_const_unsigned_char_ptr(n_utf, 0);
33624
William M. Brackf13f77f2004-11-12 16:03:48 +000033625 ret_val = xmlCheckUTF8((const unsigned char *)utf);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033626 desret_int(ret_val);
33627 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033628 des_const_unsigned_char_ptr(n_utf, (const unsigned char *)utf, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033629 xmlResetLastError();
33630 if (mem_base != xmlMemBlocks()) {
33631 printf("Leak of %d blocks found in xmlCheckUTF8",
33632 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033633 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033634 printf(" %d", n_utf);
33635 printf("\n");
33636 }
33637 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000033638 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033639
Daniel Veillard42595322004-11-08 10:52:06 +000033640 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033641}
33642
33643
33644static int
33645test_xmlGetUTF8Char(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033646 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033647
Daniel Veillardce682bc2004-11-05 17:22:25 +000033648 int mem_base;
33649 int ret_val;
33650 unsigned char * utf; /* a sequence of UTF-8 encoded bytes */
33651 int n_utf;
33652 int * len; /* a pointer to the minimum number of bytes present in the sequence. This is used to assure the next character is completely contained within the sequence. */
33653 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033654
Daniel Veillardce682bc2004-11-05 17:22:25 +000033655 for (n_utf = 0;n_utf < gen_nb_const_unsigned_char_ptr;n_utf++) {
33656 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
33657 mem_base = xmlMemBlocks();
33658 utf = gen_const_unsigned_char_ptr(n_utf, 0);
33659 len = gen_int_ptr(n_len, 1);
33660
William M. Brackf13f77f2004-11-12 16:03:48 +000033661 ret_val = xmlGetUTF8Char((const unsigned char *)utf, len);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033662 desret_int(ret_val);
33663 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033664 des_const_unsigned_char_ptr(n_utf, (const unsigned char *)utf, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033665 des_int_ptr(n_len, len, 1);
33666 xmlResetLastError();
33667 if (mem_base != xmlMemBlocks()) {
33668 printf("Leak of %d blocks found in xmlGetUTF8Char",
33669 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033670 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033671 printf(" %d", n_utf);
33672 printf(" %d", n_len);
33673 printf("\n");
33674 }
33675 }
33676 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000033677 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033678
Daniel Veillard42595322004-11-08 10:52:06 +000033679 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033680}
33681
33682
33683static int
33684test_xmlStrEqual(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033685 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033686
33687 int mem_base;
33688 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033689 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033690 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033691 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033692 int n_str2;
33693
33694 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
33695 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
33696 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033697 str1 = gen_const_xmlChar_ptr(n_str1, 0);
33698 str2 = gen_const_xmlChar_ptr(n_str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033699
William M. Brackf13f77f2004-11-12 16:03:48 +000033700 ret_val = xmlStrEqual((const xmlChar *)str1, (const xmlChar *)str2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033701 desret_int(ret_val);
33702 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033703 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
33704 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033705 xmlResetLastError();
33706 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033707 printf("Leak of %d blocks found in xmlStrEqual",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033708 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033709 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033710 printf(" %d", n_str1);
33711 printf(" %d", n_str2);
33712 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033713 }
33714 }
33715 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033716 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033717
Daniel Veillard42595322004-11-08 10:52:06 +000033718 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033719}
33720
33721
33722static int
33723test_xmlStrPrintf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033724 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033725
33726
33727 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000033728 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033729}
33730
33731
33732static int
33733test_xmlStrQEqual(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033734 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033735
33736 int mem_base;
33737 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033738 xmlChar * pref; /* the prefix of the QName */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033739 int n_pref;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033740 xmlChar * name; /* the localname of the QName */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033741 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033742 xmlChar * str; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033743 int n_str;
33744
33745 for (n_pref = 0;n_pref < gen_nb_const_xmlChar_ptr;n_pref++) {
33746 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
33747 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33748 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033749 pref = gen_const_xmlChar_ptr(n_pref, 0);
33750 name = gen_const_xmlChar_ptr(n_name, 1);
33751 str = gen_const_xmlChar_ptr(n_str, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033752
William M. Brackf13f77f2004-11-12 16:03:48 +000033753 ret_val = xmlStrQEqual((const xmlChar *)pref, (const xmlChar *)name, (const xmlChar *)str);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033754 desret_int(ret_val);
33755 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033756 des_const_xmlChar_ptr(n_pref, (const xmlChar *)pref, 0);
33757 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
33758 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033759 xmlResetLastError();
33760 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033761 printf("Leak of %d blocks found in xmlStrQEqual",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033762 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033763 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033764 printf(" %d", n_pref);
33765 printf(" %d", n_name);
33766 printf(" %d", n_str);
33767 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033768 }
33769 }
33770 }
33771 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033772 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033773
Daniel Veillard42595322004-11-08 10:52:06 +000033774 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033775}
33776
33777
33778static int
33779test_xmlStrVPrintf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033780 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033781
33782
33783 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000033784 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033785}
33786
33787
33788static int
33789test_xmlStrcasecmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033790 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033791
33792 int mem_base;
33793 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033794 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033795 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033796 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033797 int n_str2;
33798
33799 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
33800 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
33801 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033802 str1 = gen_const_xmlChar_ptr(n_str1, 0);
33803 str2 = gen_const_xmlChar_ptr(n_str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033804
William M. Brackf13f77f2004-11-12 16:03:48 +000033805 ret_val = xmlStrcasecmp((const xmlChar *)str1, (const xmlChar *)str2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033806 desret_int(ret_val);
33807 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033808 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
33809 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033810 xmlResetLastError();
33811 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033812 printf("Leak of %d blocks found in xmlStrcasecmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033813 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033814 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033815 printf(" %d", n_str1);
33816 printf(" %d", n_str2);
33817 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033818 }
33819 }
33820 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033821 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033822
Daniel Veillard42595322004-11-08 10:52:06 +000033823 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033824}
33825
33826
33827static int
33828test_xmlStrcasestr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033829 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033830
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033831 int mem_base;
33832 const xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033833 xmlChar * str; /* the xmlChar * array (haystack) */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033834 int n_str;
33835 xmlChar * val; /* the xmlChar to search (needle) */
33836 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033837
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033838 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33839 for (n_val = 0;n_val < gen_nb_xmlChar_ptr;n_val++) {
33840 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033841 str = gen_const_xmlChar_ptr(n_str, 0);
33842 val = gen_xmlChar_ptr(n_val, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033843
William M. Brackf13f77f2004-11-12 16:03:48 +000033844 ret_val = xmlStrcasestr((const xmlChar *)str, val);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033845 desret_const_xmlChar_ptr(ret_val);
33846 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033847 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033848 des_xmlChar_ptr(n_val, val, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033849 xmlResetLastError();
33850 if (mem_base != xmlMemBlocks()) {
33851 printf("Leak of %d blocks found in xmlStrcasestr",
33852 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033853 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033854 printf(" %d", n_str);
33855 printf(" %d", n_val);
33856 printf("\n");
33857 }
33858 }
33859 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033860 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033861
Daniel Veillard42595322004-11-08 10:52:06 +000033862 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033863}
33864
33865
33866static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000033867test_xmlStrchr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033868 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033869
Daniel Veillardf2a36f92004-11-08 17:55:01 +000033870 int mem_base;
33871 const xmlChar * ret_val;
33872 xmlChar * str; /* the xmlChar * array */
33873 int n_str;
33874 xmlChar val; /* the xmlChar to search */
33875 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033876
Daniel Veillardf2a36f92004-11-08 17:55:01 +000033877 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33878 for (n_val = 0;n_val < gen_nb_xmlChar;n_val++) {
33879 mem_base = xmlMemBlocks();
33880 str = gen_const_xmlChar_ptr(n_str, 0);
33881 val = gen_xmlChar(n_val, 1);
33882
William M. Brackf13f77f2004-11-12 16:03:48 +000033883 ret_val = xmlStrchr((const xmlChar *)str, val);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000033884 desret_const_xmlChar_ptr(ret_val);
33885 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033886 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000033887 des_xmlChar(n_val, val, 1);
33888 xmlResetLastError();
33889 if (mem_base != xmlMemBlocks()) {
33890 printf("Leak of %d blocks found in xmlStrchr",
33891 xmlMemBlocks() - mem_base);
33892 test_ret++;
33893 printf(" %d", n_str);
33894 printf(" %d", n_val);
33895 printf("\n");
33896 }
33897 }
33898 }
Daniel Veillardf2a36f92004-11-08 17:55:01 +000033899 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033900
Daniel Veillard42595322004-11-08 10:52:06 +000033901 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033902}
33903
33904
33905static int
33906test_xmlStrcmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033907 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033908
33909 int mem_base;
33910 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033911 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033912 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033913 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033914 int n_str2;
33915
33916 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
33917 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
33918 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033919 str1 = gen_const_xmlChar_ptr(n_str1, 0);
33920 str2 = gen_const_xmlChar_ptr(n_str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033921
William M. Brackf13f77f2004-11-12 16:03:48 +000033922 ret_val = xmlStrcmp((const xmlChar *)str1, (const xmlChar *)str2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033923 desret_int(ret_val);
33924 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033925 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
33926 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033927 xmlResetLastError();
33928 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033929 printf("Leak of %d blocks found in xmlStrcmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033930 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033931 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033932 printf(" %d", n_str1);
33933 printf(" %d", n_str2);
33934 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033935 }
33936 }
33937 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033938 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033939
Daniel Veillard42595322004-11-08 10:52:06 +000033940 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033941}
33942
33943
33944static int
33945test_xmlStrdup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033946 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033947
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033948 int mem_base;
33949 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033950 xmlChar * cur; /* the input xmlChar * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033951 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033952
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033953 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
33954 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033955 cur = gen_const_xmlChar_ptr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033956
William M. Brackf13f77f2004-11-12 16:03:48 +000033957 ret_val = xmlStrdup((const xmlChar *)cur);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033958 desret_xmlChar_ptr(ret_val);
33959 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033960 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033961 xmlResetLastError();
33962 if (mem_base != xmlMemBlocks()) {
33963 printf("Leak of %d blocks found in xmlStrdup",
33964 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033965 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033966 printf(" %d", n_cur);
33967 printf("\n");
33968 }
33969 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033970 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033971
Daniel Veillard42595322004-11-08 10:52:06 +000033972 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033973}
33974
33975
33976static int
33977test_xmlStrlen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033978 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033979
33980 int mem_base;
33981 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033982 xmlChar * str; /* the xmlChar * array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033983 int n_str;
33984
33985 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33986 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033987 str = gen_const_xmlChar_ptr(n_str, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033988
William M. Brackf13f77f2004-11-12 16:03:48 +000033989 ret_val = xmlStrlen((const xmlChar *)str);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033990 desret_int(ret_val);
33991 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033992 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033993 xmlResetLastError();
33994 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033995 printf("Leak of %d blocks found in xmlStrlen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033996 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033997 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033998 printf(" %d", n_str);
33999 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000034000 }
34001 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034002 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034003
Daniel Veillard42595322004-11-08 10:52:06 +000034004 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034005}
34006
34007
34008static int
34009test_xmlStrncasecmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034010 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034011
34012 int mem_base;
34013 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034014 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034015 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034016 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034017 int n_str2;
34018 int len; /* the max comparison length */
34019 int n_len;
34020
34021 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
34022 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
34023 for (n_len = 0;n_len < gen_nb_int;n_len++) {
34024 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034025 str1 = gen_const_xmlChar_ptr(n_str1, 0);
34026 str2 = gen_const_xmlChar_ptr(n_str2, 1);
34027 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034028
William M. Brackf13f77f2004-11-12 16:03:48 +000034029 ret_val = xmlStrncasecmp((const xmlChar *)str1, (const xmlChar *)str2, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034030 desret_int(ret_val);
34031 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034032 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
34033 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000034034 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034035 xmlResetLastError();
34036 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000034037 printf("Leak of %d blocks found in xmlStrncasecmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000034038 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034039 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000034040 printf(" %d", n_str1);
34041 printf(" %d", n_str2);
34042 printf(" %d", n_len);
34043 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000034044 }
34045 }
34046 }
34047 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034048 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034049
Daniel Veillard42595322004-11-08 10:52:06 +000034050 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034051}
34052
34053
34054static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000034055test_xmlStrncatNew(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034056 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034057
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034058 int mem_base;
34059 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034060 xmlChar * str1; /* first xmlChar string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034061 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034062 xmlChar * str2; /* second xmlChar string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034063 int n_str2;
34064 int len; /* the len of @str2 */
34065 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034066
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034067 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
34068 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
34069 for (n_len = 0;n_len < gen_nb_int;n_len++) {
34070 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034071 str1 = gen_const_xmlChar_ptr(n_str1, 0);
34072 str2 = gen_const_xmlChar_ptr(n_str2, 1);
34073 len = gen_int(n_len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034074
William M. Brackf13f77f2004-11-12 16:03:48 +000034075 ret_val = xmlStrncatNew((const xmlChar *)str1, (const xmlChar *)str2, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034076 desret_xmlChar_ptr(ret_val);
34077 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034078 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
34079 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000034080 des_int(n_len, len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034081 xmlResetLastError();
34082 if (mem_base != xmlMemBlocks()) {
34083 printf("Leak of %d blocks found in xmlStrncatNew",
34084 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034085 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034086 printf(" %d", n_str1);
34087 printf(" %d", n_str2);
34088 printf(" %d", n_len);
34089 printf("\n");
34090 }
34091 }
34092 }
34093 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034094 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034095
Daniel Veillard42595322004-11-08 10:52:06 +000034096 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034097}
34098
34099
34100static int
34101test_xmlStrncmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034102 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034103
34104 int mem_base;
34105 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034106 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034107 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034108 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034109 int n_str2;
34110 int len; /* the max comparison length */
34111 int n_len;
34112
34113 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
34114 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
34115 for (n_len = 0;n_len < gen_nb_int;n_len++) {
34116 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034117 str1 = gen_const_xmlChar_ptr(n_str1, 0);
34118 str2 = gen_const_xmlChar_ptr(n_str2, 1);
34119 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034120
William M. Brackf13f77f2004-11-12 16:03:48 +000034121 ret_val = xmlStrncmp((const xmlChar *)str1, (const xmlChar *)str2, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034122 desret_int(ret_val);
34123 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034124 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
34125 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000034126 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034127 xmlResetLastError();
34128 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000034129 printf("Leak of %d blocks found in xmlStrncmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000034130 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034131 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000034132 printf(" %d", n_str1);
34133 printf(" %d", n_str2);
34134 printf(" %d", n_len);
34135 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000034136 }
34137 }
34138 }
34139 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034140 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034141
Daniel Veillard42595322004-11-08 10:52:06 +000034142 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034143}
34144
34145
34146static int
34147test_xmlStrndup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034148 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034149
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034150 int mem_base;
34151 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034152 xmlChar * cur; /* the input xmlChar * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034153 int n_cur;
34154 int len; /* the len of @cur */
34155 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034156
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034157 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
34158 for (n_len = 0;n_len < gen_nb_int;n_len++) {
34159 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034160 cur = gen_const_xmlChar_ptr(n_cur, 0);
34161 len = gen_int(n_len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034162
William M. Brackf13f77f2004-11-12 16:03:48 +000034163 ret_val = xmlStrndup((const xmlChar *)cur, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034164 desret_xmlChar_ptr(ret_val);
34165 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034166 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000034167 des_int(n_len, len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034168 xmlResetLastError();
34169 if (mem_base != xmlMemBlocks()) {
34170 printf("Leak of %d blocks found in xmlStrndup",
34171 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034172 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034173 printf(" %d", n_cur);
34174 printf(" %d", n_len);
34175 printf("\n");
34176 }
34177 }
34178 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034179 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034180
Daniel Veillard42595322004-11-08 10:52:06 +000034181 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034182}
34183
34184
34185static int
34186test_xmlStrstr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034187 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034188
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034189 int mem_base;
34190 const xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034191 xmlChar * str; /* the xmlChar * array (haystack) */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034192 int n_str;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034193 xmlChar * val; /* the xmlChar to search (needle) */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034194 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034195
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034196 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
34197 for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
34198 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034199 str = gen_const_xmlChar_ptr(n_str, 0);
34200 val = gen_const_xmlChar_ptr(n_val, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034201
William M. Brackf13f77f2004-11-12 16:03:48 +000034202 ret_val = xmlStrstr((const xmlChar *)str, (const xmlChar *)val);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034203 desret_const_xmlChar_ptr(ret_val);
34204 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034205 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
34206 des_const_xmlChar_ptr(n_val, (const xmlChar *)val, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034207 xmlResetLastError();
34208 if (mem_base != xmlMemBlocks()) {
34209 printf("Leak of %d blocks found in xmlStrstr",
34210 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034211 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034212 printf(" %d", n_str);
34213 printf(" %d", n_val);
34214 printf("\n");
34215 }
34216 }
34217 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034218 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034219
Daniel Veillard42595322004-11-08 10:52:06 +000034220 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034221}
34222
34223
34224static int
34225test_xmlStrsub(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034226 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034227
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034228 int mem_base;
34229 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034230 xmlChar * str; /* the xmlChar * array (haystack) */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034231 int n_str;
34232 int start; /* the index of the first char (zero based) */
34233 int n_start;
34234 int len; /* the length of the substring */
34235 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034236
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034237 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
34238 for (n_start = 0;n_start < gen_nb_int;n_start++) {
34239 for (n_len = 0;n_len < gen_nb_int;n_len++) {
34240 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034241 str = gen_const_xmlChar_ptr(n_str, 0);
34242 start = gen_int(n_start, 1);
34243 len = gen_int(n_len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034244
William M. Brackf13f77f2004-11-12 16:03:48 +000034245 ret_val = xmlStrsub((const xmlChar *)str, start, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034246 desret_xmlChar_ptr(ret_val);
34247 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034248 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000034249 des_int(n_start, start, 1);
34250 des_int(n_len, len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034251 xmlResetLastError();
34252 if (mem_base != xmlMemBlocks()) {
34253 printf("Leak of %d blocks found in xmlStrsub",
34254 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034255 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034256 printf(" %d", n_str);
34257 printf(" %d", n_start);
34258 printf(" %d", n_len);
34259 printf("\n");
34260 }
34261 }
34262 }
34263 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034264 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034265
Daniel Veillard42595322004-11-08 10:52:06 +000034266 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034267}
34268
34269
34270static int
34271test_xmlUTF8Charcmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034272 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034273
34274 int mem_base;
34275 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034276 xmlChar * utf1; /* pointer to first UTF8 char */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034277 int n_utf1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034278 xmlChar * utf2; /* pointer to second UTF8 char */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034279 int n_utf2;
34280
34281 for (n_utf1 = 0;n_utf1 < gen_nb_const_xmlChar_ptr;n_utf1++) {
34282 for (n_utf2 = 0;n_utf2 < gen_nb_const_xmlChar_ptr;n_utf2++) {
34283 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034284 utf1 = gen_const_xmlChar_ptr(n_utf1, 0);
34285 utf2 = gen_const_xmlChar_ptr(n_utf2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034286
William M. Brackf13f77f2004-11-12 16:03:48 +000034287 ret_val = xmlUTF8Charcmp((const xmlChar *)utf1, (const xmlChar *)utf2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034288 desret_int(ret_val);
34289 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034290 des_const_xmlChar_ptr(n_utf1, (const xmlChar *)utf1, 0);
34291 des_const_xmlChar_ptr(n_utf2, (const xmlChar *)utf2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034292 xmlResetLastError();
34293 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000034294 printf("Leak of %d blocks found in xmlUTF8Charcmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000034295 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034296 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000034297 printf(" %d", n_utf1);
34298 printf(" %d", n_utf2);
34299 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000034300 }
34301 }
34302 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034303 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034304
Daniel Veillard42595322004-11-08 10:52:06 +000034305 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034306}
34307
34308
34309static int
34310test_xmlUTF8Size(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034311 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034312
34313 int mem_base;
34314 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034315 xmlChar * utf; /* pointer to the UTF8 character */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034316 int n_utf;
34317
34318 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
34319 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034320 utf = gen_const_xmlChar_ptr(n_utf, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034321
William M. Brackf13f77f2004-11-12 16:03:48 +000034322 ret_val = xmlUTF8Size((const xmlChar *)utf);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034323 desret_int(ret_val);
34324 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034325 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034326 xmlResetLastError();
34327 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000034328 printf("Leak of %d blocks found in xmlUTF8Size",
Daniel Veillardd93f6252004-11-02 15:53:51 +000034329 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034330 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000034331 printf(" %d", n_utf);
34332 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000034333 }
34334 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034335 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034336
Daniel Veillard42595322004-11-08 10:52:06 +000034337 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034338}
34339
34340
34341static int
34342test_xmlUTF8Strlen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034343 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034344
34345 int mem_base;
34346 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034347 xmlChar * utf; /* a sequence of UTF-8 encoded bytes */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034348 int n_utf;
34349
34350 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
34351 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034352 utf = gen_const_xmlChar_ptr(n_utf, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034353
William M. Brackf13f77f2004-11-12 16:03:48 +000034354 ret_val = xmlUTF8Strlen((const xmlChar *)utf);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034355 desret_int(ret_val);
34356 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034357 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034358 xmlResetLastError();
34359 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000034360 printf("Leak of %d blocks found in xmlUTF8Strlen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000034361 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034362 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000034363 printf(" %d", n_utf);
34364 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000034365 }
34366 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034367 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034368
Daniel Veillard42595322004-11-08 10:52:06 +000034369 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034370}
34371
34372
34373static int
34374test_xmlUTF8Strloc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034375 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034376
34377 int mem_base;
34378 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034379 xmlChar * utf; /* the input UTF8 * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034380 int n_utf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034381 xmlChar * utfchar; /* the UTF8 character to be found */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034382 int n_utfchar;
34383
34384 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
34385 for (n_utfchar = 0;n_utfchar < gen_nb_const_xmlChar_ptr;n_utfchar++) {
34386 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034387 utf = gen_const_xmlChar_ptr(n_utf, 0);
34388 utfchar = gen_const_xmlChar_ptr(n_utfchar, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034389
William M. Brackf13f77f2004-11-12 16:03:48 +000034390 ret_val = xmlUTF8Strloc((const xmlChar *)utf, (const xmlChar *)utfchar);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034391 desret_int(ret_val);
34392 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034393 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
34394 des_const_xmlChar_ptr(n_utfchar, (const xmlChar *)utfchar, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034395 xmlResetLastError();
34396 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000034397 printf("Leak of %d blocks found in xmlUTF8Strloc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000034398 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034399 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000034400 printf(" %d", n_utf);
34401 printf(" %d", n_utfchar);
34402 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000034403 }
34404 }
34405 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034406 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034407
Daniel Veillard42595322004-11-08 10:52:06 +000034408 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034409}
34410
34411
34412static int
34413test_xmlUTF8Strndup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034414 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034415
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034416 int mem_base;
34417 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034418 xmlChar * utf; /* the input UTF8 * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034419 int n_utf;
34420 int len; /* the len of @utf (in chars) */
34421 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034422
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034423 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
34424 for (n_len = 0;n_len < gen_nb_int;n_len++) {
34425 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034426 utf = gen_const_xmlChar_ptr(n_utf, 0);
34427 len = gen_int(n_len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034428
William M. Brackf13f77f2004-11-12 16:03:48 +000034429 ret_val = xmlUTF8Strndup((const xmlChar *)utf, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034430 desret_xmlChar_ptr(ret_val);
34431 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034432 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000034433 des_int(n_len, len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034434 xmlResetLastError();
34435 if (mem_base != xmlMemBlocks()) {
34436 printf("Leak of %d blocks found in xmlUTF8Strndup",
34437 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034438 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034439 printf(" %d", n_utf);
34440 printf(" %d", n_len);
34441 printf("\n");
34442 }
34443 }
34444 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034445 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034446
Daniel Veillard42595322004-11-08 10:52:06 +000034447 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034448}
34449
34450
34451static int
34452test_xmlUTF8Strpos(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034453 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034454
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034455 int mem_base;
34456 const xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034457 xmlChar * utf; /* the input UTF8 * */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034458 int n_utf;
34459 int pos; /* the position of the desired UTF8 char (in chars) */
34460 int n_pos;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034461
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034462 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
34463 for (n_pos = 0;n_pos < gen_nb_int;n_pos++) {
34464 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034465 utf = gen_const_xmlChar_ptr(n_utf, 0);
34466 pos = gen_int(n_pos, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034467
William M. Brackf13f77f2004-11-12 16:03:48 +000034468 ret_val = xmlUTF8Strpos((const xmlChar *)utf, pos);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034469 desret_const_xmlChar_ptr(ret_val);
34470 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034471 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000034472 des_int(n_pos, pos, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034473 xmlResetLastError();
34474 if (mem_base != xmlMemBlocks()) {
34475 printf("Leak of %d blocks found in xmlUTF8Strpos",
34476 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034477 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000034478 printf(" %d", n_utf);
34479 printf(" %d", n_pos);
34480 printf("\n");
34481 }
34482 }
34483 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034484 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034485
Daniel Veillard42595322004-11-08 10:52:06 +000034486 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034487}
34488
34489
34490static int
34491test_xmlUTF8Strsize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034492 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034493
34494 int mem_base;
34495 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034496 xmlChar * utf; /* a sequence of UTF-8 encoded bytes */
Daniel Veillardd93f6252004-11-02 15:53:51 +000034497 int n_utf;
34498 int len; /* the number of characters in the array */
34499 int n_len;
34500
34501 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
34502 for (n_len = 0;n_len < gen_nb_int;n_len++) {
34503 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034504 utf = gen_const_xmlChar_ptr(n_utf, 0);
34505 len = gen_int(n_len, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034506
William M. Brackf13f77f2004-11-12 16:03:48 +000034507 ret_val = xmlUTF8Strsize((const xmlChar *)utf, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034508 desret_int(ret_val);
34509 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034510 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000034511 des_int(n_len, len, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034512 xmlResetLastError();
34513 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000034514 printf("Leak of %d blocks found in xmlUTF8Strsize",
Daniel Veillardd93f6252004-11-02 15:53:51 +000034515 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034516 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000034517 printf(" %d", n_utf);
34518 printf(" %d", n_len);
34519 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000034520 }
34521 }
34522 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034523 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034524
Daniel Veillard42595322004-11-08 10:52:06 +000034525 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034526}
34527
34528
34529static int
34530test_xmlUTF8Strsub(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034531 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034532
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034533 int mem_base;
34534 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034535 xmlChar * utf; /* a sequence of UTF-8 encoded bytes */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034536 int n_utf;
34537 int start; /* relative pos of first char */
34538 int n_start;
34539 int len; /* total number to copy */
34540 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034541
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034542 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
34543 for (n_start = 0;n_start < gen_nb_int;n_start++) {
34544 for (n_len = 0;n_len < gen_nb_int;n_len++) {
34545 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034546 utf = gen_const_xmlChar_ptr(n_utf, 0);
34547 start = gen_int(n_start, 1);
34548 len = gen_int(n_len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034549
William M. Brackf13f77f2004-11-12 16:03:48 +000034550 ret_val = xmlUTF8Strsub((const xmlChar *)utf, start, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034551 desret_xmlChar_ptr(ret_val);
34552 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034553 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000034554 des_int(n_start, start, 1);
34555 des_int(n_len, len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034556 xmlResetLastError();
34557 if (mem_base != xmlMemBlocks()) {
34558 printf("Leak of %d blocks found in xmlUTF8Strsub",
34559 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034560 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034561 printf(" %d", n_utf);
34562 printf(" %d", n_start);
34563 printf(" %d", n_len);
34564 printf("\n");
34565 }
34566 }
34567 }
34568 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034569 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034570
Daniel Veillard42595322004-11-08 10:52:06 +000034571 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034572}
34573
34574static int
34575test_xmlstring(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034576 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034577
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034578 if (quiet == 0) printf("Testing xmlstring : 26 of 30 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000034579 test_ret += test_xmlCharStrdup();
34580 test_ret += test_xmlCharStrndup();
34581 test_ret += test_xmlCheckUTF8();
34582 test_ret += test_xmlGetUTF8Char();
34583 test_ret += test_xmlStrEqual();
34584 test_ret += test_xmlStrPrintf();
34585 test_ret += test_xmlStrQEqual();
34586 test_ret += test_xmlStrVPrintf();
34587 test_ret += test_xmlStrcasecmp();
34588 test_ret += test_xmlStrcasestr();
34589 test_ret += test_xmlStrchr();
34590 test_ret += test_xmlStrcmp();
34591 test_ret += test_xmlStrdup();
34592 test_ret += test_xmlStrlen();
34593 test_ret += test_xmlStrncasecmp();
34594 test_ret += test_xmlStrncatNew();
34595 test_ret += test_xmlStrncmp();
34596 test_ret += test_xmlStrndup();
34597 test_ret += test_xmlStrstr();
34598 test_ret += test_xmlStrsub();
34599 test_ret += test_xmlUTF8Charcmp();
34600 test_ret += test_xmlUTF8Size();
34601 test_ret += test_xmlUTF8Strlen();
34602 test_ret += test_xmlUTF8Strloc();
34603 test_ret += test_xmlUTF8Strndup();
34604 test_ret += test_xmlUTF8Strpos();
34605 test_ret += test_xmlUTF8Strsize();
34606 test_ret += test_xmlUTF8Strsub();
Daniel Veillardd93f6252004-11-02 15:53:51 +000034607
Daniel Veillard42595322004-11-08 10:52:06 +000034608 if (test_ret != 0)
34609 printf("Module xmlstring: %d errors\n", test_ret);
34610 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034611}
34612
34613static int
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034614test_xmlUCSIsAegeanNumbers(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034615 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034616
William M. Brack21e4ef22005-01-02 09:53:13 +000034617#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034618 int mem_base;
34619 int ret_val;
34620 int code; /* UCS code point */
34621 int n_code;
34622
34623 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34624 mem_base = xmlMemBlocks();
34625 code = gen_int(n_code, 0);
34626
34627 ret_val = xmlUCSIsAegeanNumbers(code);
34628 desret_int(ret_val);
34629 call_tests++;
34630 des_int(n_code, code, 0);
34631 xmlResetLastError();
34632 if (mem_base != xmlMemBlocks()) {
34633 printf("Leak of %d blocks found in xmlUCSIsAegeanNumbers",
34634 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034635 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034636 printf(" %d", n_code);
34637 printf("\n");
34638 }
34639 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034640 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034641#endif
34642
Daniel Veillard42595322004-11-08 10:52:06 +000034643 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034644}
34645
34646
34647static int
34648test_xmlUCSIsAlphabeticPresentationForms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034649 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034650
William M. Brack21e4ef22005-01-02 09:53:13 +000034651#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034652 int mem_base;
34653 int ret_val;
34654 int code; /* UCS code point */
34655 int n_code;
34656
34657 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34658 mem_base = xmlMemBlocks();
34659 code = gen_int(n_code, 0);
34660
34661 ret_val = xmlUCSIsAlphabeticPresentationForms(code);
34662 desret_int(ret_val);
34663 call_tests++;
34664 des_int(n_code, code, 0);
34665 xmlResetLastError();
34666 if (mem_base != xmlMemBlocks()) {
34667 printf("Leak of %d blocks found in xmlUCSIsAlphabeticPresentationForms",
34668 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034669 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034670 printf(" %d", n_code);
34671 printf("\n");
34672 }
34673 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034674 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034675#endif
34676
Daniel Veillard42595322004-11-08 10:52:06 +000034677 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034678}
34679
34680
34681static int
34682test_xmlUCSIsArabic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034683 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034684
William M. Brack21e4ef22005-01-02 09:53:13 +000034685#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034686 int mem_base;
34687 int ret_val;
34688 int code; /* UCS code point */
34689 int n_code;
34690
34691 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34692 mem_base = xmlMemBlocks();
34693 code = gen_int(n_code, 0);
34694
34695 ret_val = xmlUCSIsArabic(code);
34696 desret_int(ret_val);
34697 call_tests++;
34698 des_int(n_code, code, 0);
34699 xmlResetLastError();
34700 if (mem_base != xmlMemBlocks()) {
34701 printf("Leak of %d blocks found in xmlUCSIsArabic",
34702 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034703 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034704 printf(" %d", n_code);
34705 printf("\n");
34706 }
34707 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034708 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034709#endif
34710
Daniel Veillard42595322004-11-08 10:52:06 +000034711 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034712}
34713
34714
34715static int
34716test_xmlUCSIsArabicPresentationFormsA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034717 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034718
William M. Brack21e4ef22005-01-02 09:53:13 +000034719#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034720 int mem_base;
34721 int ret_val;
34722 int code; /* UCS code point */
34723 int n_code;
34724
34725 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34726 mem_base = xmlMemBlocks();
34727 code = gen_int(n_code, 0);
34728
34729 ret_val = xmlUCSIsArabicPresentationFormsA(code);
34730 desret_int(ret_val);
34731 call_tests++;
34732 des_int(n_code, code, 0);
34733 xmlResetLastError();
34734 if (mem_base != xmlMemBlocks()) {
34735 printf("Leak of %d blocks found in xmlUCSIsArabicPresentationFormsA",
34736 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034737 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034738 printf(" %d", n_code);
34739 printf("\n");
34740 }
34741 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034742 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034743#endif
34744
Daniel Veillard42595322004-11-08 10:52:06 +000034745 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034746}
34747
34748
34749static int
34750test_xmlUCSIsArabicPresentationFormsB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034751 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034752
William M. Brack21e4ef22005-01-02 09:53:13 +000034753#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034754 int mem_base;
34755 int ret_val;
34756 int code; /* UCS code point */
34757 int n_code;
34758
34759 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34760 mem_base = xmlMemBlocks();
34761 code = gen_int(n_code, 0);
34762
34763 ret_val = xmlUCSIsArabicPresentationFormsB(code);
34764 desret_int(ret_val);
34765 call_tests++;
34766 des_int(n_code, code, 0);
34767 xmlResetLastError();
34768 if (mem_base != xmlMemBlocks()) {
34769 printf("Leak of %d blocks found in xmlUCSIsArabicPresentationFormsB",
34770 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034771 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034772 printf(" %d", n_code);
34773 printf("\n");
34774 }
34775 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034776 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034777#endif
34778
Daniel Veillard42595322004-11-08 10:52:06 +000034779 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034780}
34781
34782
34783static int
34784test_xmlUCSIsArmenian(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034785 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034786
William M. Brack21e4ef22005-01-02 09:53:13 +000034787#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034788 int mem_base;
34789 int ret_val;
34790 int code; /* UCS code point */
34791 int n_code;
34792
34793 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34794 mem_base = xmlMemBlocks();
34795 code = gen_int(n_code, 0);
34796
34797 ret_val = xmlUCSIsArmenian(code);
34798 desret_int(ret_val);
34799 call_tests++;
34800 des_int(n_code, code, 0);
34801 xmlResetLastError();
34802 if (mem_base != xmlMemBlocks()) {
34803 printf("Leak of %d blocks found in xmlUCSIsArmenian",
34804 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034805 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034806 printf(" %d", n_code);
34807 printf("\n");
34808 }
34809 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034810 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034811#endif
34812
Daniel Veillard42595322004-11-08 10:52:06 +000034813 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034814}
34815
34816
34817static int
34818test_xmlUCSIsArrows(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034819 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034820
William M. Brack21e4ef22005-01-02 09:53:13 +000034821#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034822 int mem_base;
34823 int ret_val;
34824 int code; /* UCS code point */
34825 int n_code;
34826
34827 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34828 mem_base = xmlMemBlocks();
34829 code = gen_int(n_code, 0);
34830
34831 ret_val = xmlUCSIsArrows(code);
34832 desret_int(ret_val);
34833 call_tests++;
34834 des_int(n_code, code, 0);
34835 xmlResetLastError();
34836 if (mem_base != xmlMemBlocks()) {
34837 printf("Leak of %d blocks found in xmlUCSIsArrows",
34838 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034839 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034840 printf(" %d", n_code);
34841 printf("\n");
34842 }
34843 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034844 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034845#endif
34846
Daniel Veillard42595322004-11-08 10:52:06 +000034847 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034848}
34849
34850
34851static int
34852test_xmlUCSIsBasicLatin(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034853 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034854
William M. Brack21e4ef22005-01-02 09:53:13 +000034855#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034856 int mem_base;
34857 int ret_val;
34858 int code; /* UCS code point */
34859 int n_code;
34860
34861 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34862 mem_base = xmlMemBlocks();
34863 code = gen_int(n_code, 0);
34864
34865 ret_val = xmlUCSIsBasicLatin(code);
34866 desret_int(ret_val);
34867 call_tests++;
34868 des_int(n_code, code, 0);
34869 xmlResetLastError();
34870 if (mem_base != xmlMemBlocks()) {
34871 printf("Leak of %d blocks found in xmlUCSIsBasicLatin",
34872 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034873 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034874 printf(" %d", n_code);
34875 printf("\n");
34876 }
34877 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034878 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034879#endif
34880
Daniel Veillard42595322004-11-08 10:52:06 +000034881 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034882}
34883
34884
34885static int
34886test_xmlUCSIsBengali(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034887 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034888
William M. Brack21e4ef22005-01-02 09:53:13 +000034889#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034890 int mem_base;
34891 int ret_val;
34892 int code; /* UCS code point */
34893 int n_code;
34894
34895 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34896 mem_base = xmlMemBlocks();
34897 code = gen_int(n_code, 0);
34898
34899 ret_val = xmlUCSIsBengali(code);
34900 desret_int(ret_val);
34901 call_tests++;
34902 des_int(n_code, code, 0);
34903 xmlResetLastError();
34904 if (mem_base != xmlMemBlocks()) {
34905 printf("Leak of %d blocks found in xmlUCSIsBengali",
34906 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034907 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034908 printf(" %d", n_code);
34909 printf("\n");
34910 }
34911 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034912 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034913#endif
34914
Daniel Veillard42595322004-11-08 10:52:06 +000034915 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034916}
34917
34918
34919static int
34920test_xmlUCSIsBlock(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034921 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034922
William M. Brack21e4ef22005-01-02 09:53:13 +000034923#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034924 int mem_base;
34925 int ret_val;
34926 int code; /* UCS code point */
34927 int n_code;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034928 char * block; /* UCS block name */
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034929 int n_block;
34930
34931 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34932 for (n_block = 0;n_block < gen_nb_const_char_ptr;n_block++) {
34933 mem_base = xmlMemBlocks();
34934 code = gen_int(n_code, 0);
34935 block = gen_const_char_ptr(n_block, 1);
34936
William M. Brackf13f77f2004-11-12 16:03:48 +000034937 ret_val = xmlUCSIsBlock(code, (const char *)block);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034938 desret_int(ret_val);
34939 call_tests++;
34940 des_int(n_code, code, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000034941 des_const_char_ptr(n_block, (const char *)block, 1);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034942 xmlResetLastError();
34943 if (mem_base != xmlMemBlocks()) {
34944 printf("Leak of %d blocks found in xmlUCSIsBlock",
34945 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034946 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034947 printf(" %d", n_code);
34948 printf(" %d", n_block);
34949 printf("\n");
34950 }
34951 }
34952 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034953 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034954#endif
34955
Daniel Veillard42595322004-11-08 10:52:06 +000034956 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034957}
34958
34959
34960static int
34961test_xmlUCSIsBlockElements(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034962 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034963
William M. Brack21e4ef22005-01-02 09:53:13 +000034964#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034965 int mem_base;
34966 int ret_val;
34967 int code; /* UCS code point */
34968 int n_code;
34969
34970 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34971 mem_base = xmlMemBlocks();
34972 code = gen_int(n_code, 0);
34973
34974 ret_val = xmlUCSIsBlockElements(code);
34975 desret_int(ret_val);
34976 call_tests++;
34977 des_int(n_code, code, 0);
34978 xmlResetLastError();
34979 if (mem_base != xmlMemBlocks()) {
34980 printf("Leak of %d blocks found in xmlUCSIsBlockElements",
34981 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034982 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034983 printf(" %d", n_code);
34984 printf("\n");
34985 }
34986 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034987 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034988#endif
34989
Daniel Veillard42595322004-11-08 10:52:06 +000034990 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034991}
34992
34993
34994static int
34995test_xmlUCSIsBopomofo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034996 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034997
William M. Brack21e4ef22005-01-02 09:53:13 +000034998#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034999 int mem_base;
35000 int ret_val;
35001 int code; /* UCS code point */
35002 int n_code;
35003
35004 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35005 mem_base = xmlMemBlocks();
35006 code = gen_int(n_code, 0);
35007
35008 ret_val = xmlUCSIsBopomofo(code);
35009 desret_int(ret_val);
35010 call_tests++;
35011 des_int(n_code, code, 0);
35012 xmlResetLastError();
35013 if (mem_base != xmlMemBlocks()) {
35014 printf("Leak of %d blocks found in xmlUCSIsBopomofo",
35015 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035016 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035017 printf(" %d", n_code);
35018 printf("\n");
35019 }
35020 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035021 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035022#endif
35023
Daniel Veillard42595322004-11-08 10:52:06 +000035024 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035025}
35026
35027
35028static int
35029test_xmlUCSIsBopomofoExtended(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035030 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035031
William M. Brack21e4ef22005-01-02 09:53:13 +000035032#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035033 int mem_base;
35034 int ret_val;
35035 int code; /* UCS code point */
35036 int n_code;
35037
35038 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35039 mem_base = xmlMemBlocks();
35040 code = gen_int(n_code, 0);
35041
35042 ret_val = xmlUCSIsBopomofoExtended(code);
35043 desret_int(ret_val);
35044 call_tests++;
35045 des_int(n_code, code, 0);
35046 xmlResetLastError();
35047 if (mem_base != xmlMemBlocks()) {
35048 printf("Leak of %d blocks found in xmlUCSIsBopomofoExtended",
35049 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035050 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035051 printf(" %d", n_code);
35052 printf("\n");
35053 }
35054 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035055 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035056#endif
35057
Daniel Veillard42595322004-11-08 10:52:06 +000035058 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035059}
35060
35061
35062static int
35063test_xmlUCSIsBoxDrawing(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035064 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035065
William M. Brack21e4ef22005-01-02 09:53:13 +000035066#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035067 int mem_base;
35068 int ret_val;
35069 int code; /* UCS code point */
35070 int n_code;
35071
35072 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35073 mem_base = xmlMemBlocks();
35074 code = gen_int(n_code, 0);
35075
35076 ret_val = xmlUCSIsBoxDrawing(code);
35077 desret_int(ret_val);
35078 call_tests++;
35079 des_int(n_code, code, 0);
35080 xmlResetLastError();
35081 if (mem_base != xmlMemBlocks()) {
35082 printf("Leak of %d blocks found in xmlUCSIsBoxDrawing",
35083 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035084 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035085 printf(" %d", n_code);
35086 printf("\n");
35087 }
35088 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035089 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035090#endif
35091
Daniel Veillard42595322004-11-08 10:52:06 +000035092 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035093}
35094
35095
35096static int
35097test_xmlUCSIsBraillePatterns(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035098 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035099
William M. Brack21e4ef22005-01-02 09:53:13 +000035100#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035101 int mem_base;
35102 int ret_val;
35103 int code; /* UCS code point */
35104 int n_code;
35105
35106 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35107 mem_base = xmlMemBlocks();
35108 code = gen_int(n_code, 0);
35109
35110 ret_val = xmlUCSIsBraillePatterns(code);
35111 desret_int(ret_val);
35112 call_tests++;
35113 des_int(n_code, code, 0);
35114 xmlResetLastError();
35115 if (mem_base != xmlMemBlocks()) {
35116 printf("Leak of %d blocks found in xmlUCSIsBraillePatterns",
35117 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035118 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035119 printf(" %d", n_code);
35120 printf("\n");
35121 }
35122 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035123 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035124#endif
35125
Daniel Veillard42595322004-11-08 10:52:06 +000035126 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035127}
35128
35129
35130static int
35131test_xmlUCSIsBuhid(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035132 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035133
William M. Brack21e4ef22005-01-02 09:53:13 +000035134#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035135 int mem_base;
35136 int ret_val;
35137 int code; /* UCS code point */
35138 int n_code;
35139
35140 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35141 mem_base = xmlMemBlocks();
35142 code = gen_int(n_code, 0);
35143
35144 ret_val = xmlUCSIsBuhid(code);
35145 desret_int(ret_val);
35146 call_tests++;
35147 des_int(n_code, code, 0);
35148 xmlResetLastError();
35149 if (mem_base != xmlMemBlocks()) {
35150 printf("Leak of %d blocks found in xmlUCSIsBuhid",
35151 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035152 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035153 printf(" %d", n_code);
35154 printf("\n");
35155 }
35156 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035157 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035158#endif
35159
Daniel Veillard42595322004-11-08 10:52:06 +000035160 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035161}
35162
35163
35164static int
35165test_xmlUCSIsByzantineMusicalSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035166 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035167
William M. Brack21e4ef22005-01-02 09:53:13 +000035168#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035169 int mem_base;
35170 int ret_val;
35171 int code; /* UCS code point */
35172 int n_code;
35173
35174 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35175 mem_base = xmlMemBlocks();
35176 code = gen_int(n_code, 0);
35177
35178 ret_val = xmlUCSIsByzantineMusicalSymbols(code);
35179 desret_int(ret_val);
35180 call_tests++;
35181 des_int(n_code, code, 0);
35182 xmlResetLastError();
35183 if (mem_base != xmlMemBlocks()) {
35184 printf("Leak of %d blocks found in xmlUCSIsByzantineMusicalSymbols",
35185 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035186 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035187 printf(" %d", n_code);
35188 printf("\n");
35189 }
35190 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035191 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035192#endif
35193
Daniel Veillard42595322004-11-08 10:52:06 +000035194 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035195}
35196
35197
35198static int
35199test_xmlUCSIsCJKCompatibility(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035200 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035201
William M. Brack21e4ef22005-01-02 09:53:13 +000035202#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035203 int mem_base;
35204 int ret_val;
35205 int code; /* UCS code point */
35206 int n_code;
35207
35208 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35209 mem_base = xmlMemBlocks();
35210 code = gen_int(n_code, 0);
35211
35212 ret_val = xmlUCSIsCJKCompatibility(code);
35213 desret_int(ret_val);
35214 call_tests++;
35215 des_int(n_code, code, 0);
35216 xmlResetLastError();
35217 if (mem_base != xmlMemBlocks()) {
35218 printf("Leak of %d blocks found in xmlUCSIsCJKCompatibility",
35219 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035220 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035221 printf(" %d", n_code);
35222 printf("\n");
35223 }
35224 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035225 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035226#endif
35227
Daniel Veillard42595322004-11-08 10:52:06 +000035228 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035229}
35230
35231
35232static int
35233test_xmlUCSIsCJKCompatibilityForms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035234 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035235
William M. Brack21e4ef22005-01-02 09:53:13 +000035236#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035237 int mem_base;
35238 int ret_val;
35239 int code; /* UCS code point */
35240 int n_code;
35241
35242 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35243 mem_base = xmlMemBlocks();
35244 code = gen_int(n_code, 0);
35245
35246 ret_val = xmlUCSIsCJKCompatibilityForms(code);
35247 desret_int(ret_val);
35248 call_tests++;
35249 des_int(n_code, code, 0);
35250 xmlResetLastError();
35251 if (mem_base != xmlMemBlocks()) {
35252 printf("Leak of %d blocks found in xmlUCSIsCJKCompatibilityForms",
35253 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035254 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035255 printf(" %d", n_code);
35256 printf("\n");
35257 }
35258 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035259 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035260#endif
35261
Daniel Veillard42595322004-11-08 10:52:06 +000035262 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035263}
35264
35265
35266static int
35267test_xmlUCSIsCJKCompatibilityIdeographs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035268 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035269
William M. Brack21e4ef22005-01-02 09:53:13 +000035270#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035271 int mem_base;
35272 int ret_val;
35273 int code; /* UCS code point */
35274 int n_code;
35275
35276 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35277 mem_base = xmlMemBlocks();
35278 code = gen_int(n_code, 0);
35279
35280 ret_val = xmlUCSIsCJKCompatibilityIdeographs(code);
35281 desret_int(ret_val);
35282 call_tests++;
35283 des_int(n_code, code, 0);
35284 xmlResetLastError();
35285 if (mem_base != xmlMemBlocks()) {
35286 printf("Leak of %d blocks found in xmlUCSIsCJKCompatibilityIdeographs",
35287 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035288 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035289 printf(" %d", n_code);
35290 printf("\n");
35291 }
35292 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035293 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035294#endif
35295
Daniel Veillard42595322004-11-08 10:52:06 +000035296 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035297}
35298
35299
35300static int
35301test_xmlUCSIsCJKCompatibilityIdeographsSupplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035302 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035303
William M. Brack21e4ef22005-01-02 09:53:13 +000035304#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035305 int mem_base;
35306 int ret_val;
35307 int code; /* UCS code point */
35308 int n_code;
35309
35310 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35311 mem_base = xmlMemBlocks();
35312 code = gen_int(n_code, 0);
35313
35314 ret_val = xmlUCSIsCJKCompatibilityIdeographsSupplement(code);
35315 desret_int(ret_val);
35316 call_tests++;
35317 des_int(n_code, code, 0);
35318 xmlResetLastError();
35319 if (mem_base != xmlMemBlocks()) {
35320 printf("Leak of %d blocks found in xmlUCSIsCJKCompatibilityIdeographsSupplement",
35321 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035322 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035323 printf(" %d", n_code);
35324 printf("\n");
35325 }
35326 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035327 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035328#endif
35329
Daniel Veillard42595322004-11-08 10:52:06 +000035330 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035331}
35332
35333
35334static int
35335test_xmlUCSIsCJKRadicalsSupplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035336 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035337
William M. Brack21e4ef22005-01-02 09:53:13 +000035338#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035339 int mem_base;
35340 int ret_val;
35341 int code; /* UCS code point */
35342 int n_code;
35343
35344 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35345 mem_base = xmlMemBlocks();
35346 code = gen_int(n_code, 0);
35347
35348 ret_val = xmlUCSIsCJKRadicalsSupplement(code);
35349 desret_int(ret_val);
35350 call_tests++;
35351 des_int(n_code, code, 0);
35352 xmlResetLastError();
35353 if (mem_base != xmlMemBlocks()) {
35354 printf("Leak of %d blocks found in xmlUCSIsCJKRadicalsSupplement",
35355 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035356 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035357 printf(" %d", n_code);
35358 printf("\n");
35359 }
35360 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035361 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035362#endif
35363
Daniel Veillard42595322004-11-08 10:52:06 +000035364 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035365}
35366
35367
35368static int
35369test_xmlUCSIsCJKSymbolsandPunctuation(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035370 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035371
William M. Brack21e4ef22005-01-02 09:53:13 +000035372#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035373 int mem_base;
35374 int ret_val;
35375 int code; /* UCS code point */
35376 int n_code;
35377
35378 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35379 mem_base = xmlMemBlocks();
35380 code = gen_int(n_code, 0);
35381
35382 ret_val = xmlUCSIsCJKSymbolsandPunctuation(code);
35383 desret_int(ret_val);
35384 call_tests++;
35385 des_int(n_code, code, 0);
35386 xmlResetLastError();
35387 if (mem_base != xmlMemBlocks()) {
35388 printf("Leak of %d blocks found in xmlUCSIsCJKSymbolsandPunctuation",
35389 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035390 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035391 printf(" %d", n_code);
35392 printf("\n");
35393 }
35394 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035395 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035396#endif
35397
Daniel Veillard42595322004-11-08 10:52:06 +000035398 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035399}
35400
35401
35402static int
35403test_xmlUCSIsCJKUnifiedIdeographs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035404 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035405
William M. Brack21e4ef22005-01-02 09:53:13 +000035406#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035407 int mem_base;
35408 int ret_val;
35409 int code; /* UCS code point */
35410 int n_code;
35411
35412 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35413 mem_base = xmlMemBlocks();
35414 code = gen_int(n_code, 0);
35415
35416 ret_val = xmlUCSIsCJKUnifiedIdeographs(code);
35417 desret_int(ret_val);
35418 call_tests++;
35419 des_int(n_code, code, 0);
35420 xmlResetLastError();
35421 if (mem_base != xmlMemBlocks()) {
35422 printf("Leak of %d blocks found in xmlUCSIsCJKUnifiedIdeographs",
35423 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035424 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035425 printf(" %d", n_code);
35426 printf("\n");
35427 }
35428 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035429 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035430#endif
35431
Daniel Veillard42595322004-11-08 10:52:06 +000035432 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035433}
35434
35435
35436static int
35437test_xmlUCSIsCJKUnifiedIdeographsExtensionA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035438 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035439
William M. Brack21e4ef22005-01-02 09:53:13 +000035440#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035441 int mem_base;
35442 int ret_val;
35443 int code; /* UCS code point */
35444 int n_code;
35445
35446 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35447 mem_base = xmlMemBlocks();
35448 code = gen_int(n_code, 0);
35449
35450 ret_val = xmlUCSIsCJKUnifiedIdeographsExtensionA(code);
35451 desret_int(ret_val);
35452 call_tests++;
35453 des_int(n_code, code, 0);
35454 xmlResetLastError();
35455 if (mem_base != xmlMemBlocks()) {
35456 printf("Leak of %d blocks found in xmlUCSIsCJKUnifiedIdeographsExtensionA",
35457 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035458 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035459 printf(" %d", n_code);
35460 printf("\n");
35461 }
35462 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035463 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035464#endif
35465
Daniel Veillard42595322004-11-08 10:52:06 +000035466 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035467}
35468
35469
35470static int
35471test_xmlUCSIsCJKUnifiedIdeographsExtensionB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035472 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035473
William M. Brack21e4ef22005-01-02 09:53:13 +000035474#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035475 int mem_base;
35476 int ret_val;
35477 int code; /* UCS code point */
35478 int n_code;
35479
35480 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35481 mem_base = xmlMemBlocks();
35482 code = gen_int(n_code, 0);
35483
35484 ret_val = xmlUCSIsCJKUnifiedIdeographsExtensionB(code);
35485 desret_int(ret_val);
35486 call_tests++;
35487 des_int(n_code, code, 0);
35488 xmlResetLastError();
35489 if (mem_base != xmlMemBlocks()) {
35490 printf("Leak of %d blocks found in xmlUCSIsCJKUnifiedIdeographsExtensionB",
35491 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035492 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035493 printf(" %d", n_code);
35494 printf("\n");
35495 }
35496 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035497 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035498#endif
35499
Daniel Veillard42595322004-11-08 10:52:06 +000035500 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035501}
35502
35503
35504static int
35505test_xmlUCSIsCat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035506 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035507
William M. Brack21e4ef22005-01-02 09:53:13 +000035508#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035509 int mem_base;
35510 int ret_val;
35511 int code; /* UCS code point */
35512 int n_code;
Daniel Veillardce682bc2004-11-05 17:22:25 +000035513 char * cat; /* UCS Category name */
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035514 int n_cat;
35515
35516 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35517 for (n_cat = 0;n_cat < gen_nb_const_char_ptr;n_cat++) {
35518 mem_base = xmlMemBlocks();
35519 code = gen_int(n_code, 0);
35520 cat = gen_const_char_ptr(n_cat, 1);
35521
William M. Brackf13f77f2004-11-12 16:03:48 +000035522 ret_val = xmlUCSIsCat(code, (const char *)cat);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035523 desret_int(ret_val);
35524 call_tests++;
35525 des_int(n_code, code, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000035526 des_const_char_ptr(n_cat, (const char *)cat, 1);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035527 xmlResetLastError();
35528 if (mem_base != xmlMemBlocks()) {
35529 printf("Leak of %d blocks found in xmlUCSIsCat",
35530 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035531 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035532 printf(" %d", n_code);
35533 printf(" %d", n_cat);
35534 printf("\n");
35535 }
35536 }
35537 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035538 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035539#endif
35540
Daniel Veillard42595322004-11-08 10:52:06 +000035541 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035542}
35543
35544
35545static int
35546test_xmlUCSIsCatC(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035547 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035548
William M. Brack21e4ef22005-01-02 09:53:13 +000035549#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035550 int mem_base;
35551 int ret_val;
35552 int code; /* UCS code point */
35553 int n_code;
35554
35555 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35556 mem_base = xmlMemBlocks();
35557 code = gen_int(n_code, 0);
35558
35559 ret_val = xmlUCSIsCatC(code);
35560 desret_int(ret_val);
35561 call_tests++;
35562 des_int(n_code, code, 0);
35563 xmlResetLastError();
35564 if (mem_base != xmlMemBlocks()) {
35565 printf("Leak of %d blocks found in xmlUCSIsCatC",
35566 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035567 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035568 printf(" %d", n_code);
35569 printf("\n");
35570 }
35571 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035572 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035573#endif
35574
Daniel Veillard42595322004-11-08 10:52:06 +000035575 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035576}
35577
35578
35579static int
35580test_xmlUCSIsCatCc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035581 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035582
William M. Brack21e4ef22005-01-02 09:53:13 +000035583#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035584 int mem_base;
35585 int ret_val;
35586 int code; /* UCS code point */
35587 int n_code;
35588
35589 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35590 mem_base = xmlMemBlocks();
35591 code = gen_int(n_code, 0);
35592
35593 ret_val = xmlUCSIsCatCc(code);
35594 desret_int(ret_val);
35595 call_tests++;
35596 des_int(n_code, code, 0);
35597 xmlResetLastError();
35598 if (mem_base != xmlMemBlocks()) {
35599 printf("Leak of %d blocks found in xmlUCSIsCatCc",
35600 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035601 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035602 printf(" %d", n_code);
35603 printf("\n");
35604 }
35605 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035606 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035607#endif
35608
Daniel Veillard42595322004-11-08 10:52:06 +000035609 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035610}
35611
35612
35613static int
35614test_xmlUCSIsCatCf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035615 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035616
William M. Brack21e4ef22005-01-02 09:53:13 +000035617#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035618 int mem_base;
35619 int ret_val;
35620 int code; /* UCS code point */
35621 int n_code;
35622
35623 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35624 mem_base = xmlMemBlocks();
35625 code = gen_int(n_code, 0);
35626
35627 ret_val = xmlUCSIsCatCf(code);
35628 desret_int(ret_val);
35629 call_tests++;
35630 des_int(n_code, code, 0);
35631 xmlResetLastError();
35632 if (mem_base != xmlMemBlocks()) {
35633 printf("Leak of %d blocks found in xmlUCSIsCatCf",
35634 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035635 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035636 printf(" %d", n_code);
35637 printf("\n");
35638 }
35639 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035640 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035641#endif
35642
Daniel Veillard42595322004-11-08 10:52:06 +000035643 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035644}
35645
35646
35647static int
35648test_xmlUCSIsCatCo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035649 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035650
William M. Brack21e4ef22005-01-02 09:53:13 +000035651#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035652 int mem_base;
35653 int ret_val;
35654 int code; /* UCS code point */
35655 int n_code;
35656
35657 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35658 mem_base = xmlMemBlocks();
35659 code = gen_int(n_code, 0);
35660
35661 ret_val = xmlUCSIsCatCo(code);
35662 desret_int(ret_val);
35663 call_tests++;
35664 des_int(n_code, code, 0);
35665 xmlResetLastError();
35666 if (mem_base != xmlMemBlocks()) {
35667 printf("Leak of %d blocks found in xmlUCSIsCatCo",
35668 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035669 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035670 printf(" %d", n_code);
35671 printf("\n");
35672 }
35673 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035674 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035675#endif
35676
Daniel Veillard42595322004-11-08 10:52:06 +000035677 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035678}
35679
35680
35681static int
35682test_xmlUCSIsCatCs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035683 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035684
William M. Brack21e4ef22005-01-02 09:53:13 +000035685#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035686 int mem_base;
35687 int ret_val;
35688 int code; /* UCS code point */
35689 int n_code;
35690
35691 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35692 mem_base = xmlMemBlocks();
35693 code = gen_int(n_code, 0);
35694
35695 ret_val = xmlUCSIsCatCs(code);
35696 desret_int(ret_val);
35697 call_tests++;
35698 des_int(n_code, code, 0);
35699 xmlResetLastError();
35700 if (mem_base != xmlMemBlocks()) {
35701 printf("Leak of %d blocks found in xmlUCSIsCatCs",
35702 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035703 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035704 printf(" %d", n_code);
35705 printf("\n");
35706 }
35707 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035708 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035709#endif
35710
Daniel Veillard42595322004-11-08 10:52:06 +000035711 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035712}
35713
35714
35715static int
35716test_xmlUCSIsCatL(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035717 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035718
William M. Brack21e4ef22005-01-02 09:53:13 +000035719#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035720 int mem_base;
35721 int ret_val;
35722 int code; /* UCS code point */
35723 int n_code;
35724
35725 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35726 mem_base = xmlMemBlocks();
35727 code = gen_int(n_code, 0);
35728
35729 ret_val = xmlUCSIsCatL(code);
35730 desret_int(ret_val);
35731 call_tests++;
35732 des_int(n_code, code, 0);
35733 xmlResetLastError();
35734 if (mem_base != xmlMemBlocks()) {
35735 printf("Leak of %d blocks found in xmlUCSIsCatL",
35736 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035737 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035738 printf(" %d", n_code);
35739 printf("\n");
35740 }
35741 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035742 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035743#endif
35744
Daniel Veillard42595322004-11-08 10:52:06 +000035745 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035746}
35747
35748
35749static int
35750test_xmlUCSIsCatLl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035751 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035752
William M. Brack21e4ef22005-01-02 09:53:13 +000035753#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035754 int mem_base;
35755 int ret_val;
35756 int code; /* UCS code point */
35757 int n_code;
35758
35759 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35760 mem_base = xmlMemBlocks();
35761 code = gen_int(n_code, 0);
35762
35763 ret_val = xmlUCSIsCatLl(code);
35764 desret_int(ret_val);
35765 call_tests++;
35766 des_int(n_code, code, 0);
35767 xmlResetLastError();
35768 if (mem_base != xmlMemBlocks()) {
35769 printf("Leak of %d blocks found in xmlUCSIsCatLl",
35770 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035771 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035772 printf(" %d", n_code);
35773 printf("\n");
35774 }
35775 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035776 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035777#endif
35778
Daniel Veillard42595322004-11-08 10:52:06 +000035779 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035780}
35781
35782
35783static int
35784test_xmlUCSIsCatLm(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035785 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035786
William M. Brack21e4ef22005-01-02 09:53:13 +000035787#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035788 int mem_base;
35789 int ret_val;
35790 int code; /* UCS code point */
35791 int n_code;
35792
35793 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35794 mem_base = xmlMemBlocks();
35795 code = gen_int(n_code, 0);
35796
35797 ret_val = xmlUCSIsCatLm(code);
35798 desret_int(ret_val);
35799 call_tests++;
35800 des_int(n_code, code, 0);
35801 xmlResetLastError();
35802 if (mem_base != xmlMemBlocks()) {
35803 printf("Leak of %d blocks found in xmlUCSIsCatLm",
35804 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035805 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035806 printf(" %d", n_code);
35807 printf("\n");
35808 }
35809 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035810 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035811#endif
35812
Daniel Veillard42595322004-11-08 10:52:06 +000035813 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035814}
35815
35816
35817static int
35818test_xmlUCSIsCatLo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035819 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035820
William M. Brack21e4ef22005-01-02 09:53:13 +000035821#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035822 int mem_base;
35823 int ret_val;
35824 int code; /* UCS code point */
35825 int n_code;
35826
35827 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35828 mem_base = xmlMemBlocks();
35829 code = gen_int(n_code, 0);
35830
35831 ret_val = xmlUCSIsCatLo(code);
35832 desret_int(ret_val);
35833 call_tests++;
35834 des_int(n_code, code, 0);
35835 xmlResetLastError();
35836 if (mem_base != xmlMemBlocks()) {
35837 printf("Leak of %d blocks found in xmlUCSIsCatLo",
35838 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035839 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035840 printf(" %d", n_code);
35841 printf("\n");
35842 }
35843 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035844 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035845#endif
35846
Daniel Veillard42595322004-11-08 10:52:06 +000035847 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035848}
35849
35850
35851static int
35852test_xmlUCSIsCatLt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035853 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035854
William M. Brack21e4ef22005-01-02 09:53:13 +000035855#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035856 int mem_base;
35857 int ret_val;
35858 int code; /* UCS code point */
35859 int n_code;
35860
35861 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35862 mem_base = xmlMemBlocks();
35863 code = gen_int(n_code, 0);
35864
35865 ret_val = xmlUCSIsCatLt(code);
35866 desret_int(ret_val);
35867 call_tests++;
35868 des_int(n_code, code, 0);
35869 xmlResetLastError();
35870 if (mem_base != xmlMemBlocks()) {
35871 printf("Leak of %d blocks found in xmlUCSIsCatLt",
35872 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035873 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035874 printf(" %d", n_code);
35875 printf("\n");
35876 }
35877 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035878 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035879#endif
35880
Daniel Veillard42595322004-11-08 10:52:06 +000035881 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035882}
35883
35884
35885static int
35886test_xmlUCSIsCatLu(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035887 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035888
William M. Brack21e4ef22005-01-02 09:53:13 +000035889#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035890 int mem_base;
35891 int ret_val;
35892 int code; /* UCS code point */
35893 int n_code;
35894
35895 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35896 mem_base = xmlMemBlocks();
35897 code = gen_int(n_code, 0);
35898
35899 ret_val = xmlUCSIsCatLu(code);
35900 desret_int(ret_val);
35901 call_tests++;
35902 des_int(n_code, code, 0);
35903 xmlResetLastError();
35904 if (mem_base != xmlMemBlocks()) {
35905 printf("Leak of %d blocks found in xmlUCSIsCatLu",
35906 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035907 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035908 printf(" %d", n_code);
35909 printf("\n");
35910 }
35911 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035912 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035913#endif
35914
Daniel Veillard42595322004-11-08 10:52:06 +000035915 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035916}
35917
35918
35919static int
35920test_xmlUCSIsCatM(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035921 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035922
William M. Brack21e4ef22005-01-02 09:53:13 +000035923#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035924 int mem_base;
35925 int ret_val;
35926 int code; /* UCS code point */
35927 int n_code;
35928
35929 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35930 mem_base = xmlMemBlocks();
35931 code = gen_int(n_code, 0);
35932
35933 ret_val = xmlUCSIsCatM(code);
35934 desret_int(ret_val);
35935 call_tests++;
35936 des_int(n_code, code, 0);
35937 xmlResetLastError();
35938 if (mem_base != xmlMemBlocks()) {
35939 printf("Leak of %d blocks found in xmlUCSIsCatM",
35940 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035941 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035942 printf(" %d", n_code);
35943 printf("\n");
35944 }
35945 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035946 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035947#endif
35948
Daniel Veillard42595322004-11-08 10:52:06 +000035949 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035950}
35951
35952
35953static int
35954test_xmlUCSIsCatMc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035955 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035956
William M. Brack21e4ef22005-01-02 09:53:13 +000035957#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035958 int mem_base;
35959 int ret_val;
35960 int code; /* UCS code point */
35961 int n_code;
35962
35963 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35964 mem_base = xmlMemBlocks();
35965 code = gen_int(n_code, 0);
35966
35967 ret_val = xmlUCSIsCatMc(code);
35968 desret_int(ret_val);
35969 call_tests++;
35970 des_int(n_code, code, 0);
35971 xmlResetLastError();
35972 if (mem_base != xmlMemBlocks()) {
35973 printf("Leak of %d blocks found in xmlUCSIsCatMc",
35974 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035975 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035976 printf(" %d", n_code);
35977 printf("\n");
35978 }
35979 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035980 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035981#endif
35982
Daniel Veillard42595322004-11-08 10:52:06 +000035983 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035984}
35985
35986
35987static int
35988test_xmlUCSIsCatMe(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035989 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035990
William M. Brack21e4ef22005-01-02 09:53:13 +000035991#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035992 int mem_base;
35993 int ret_val;
35994 int code; /* UCS code point */
35995 int n_code;
35996
35997 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35998 mem_base = xmlMemBlocks();
35999 code = gen_int(n_code, 0);
36000
36001 ret_val = xmlUCSIsCatMe(code);
36002 desret_int(ret_val);
36003 call_tests++;
36004 des_int(n_code, code, 0);
36005 xmlResetLastError();
36006 if (mem_base != xmlMemBlocks()) {
36007 printf("Leak of %d blocks found in xmlUCSIsCatMe",
36008 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036009 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036010 printf(" %d", n_code);
36011 printf("\n");
36012 }
36013 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036014 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036015#endif
36016
Daniel Veillard42595322004-11-08 10:52:06 +000036017 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036018}
36019
36020
36021static int
36022test_xmlUCSIsCatMn(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036023 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036024
William M. Brack21e4ef22005-01-02 09:53:13 +000036025#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036026 int mem_base;
36027 int ret_val;
36028 int code; /* UCS code point */
36029 int n_code;
36030
36031 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36032 mem_base = xmlMemBlocks();
36033 code = gen_int(n_code, 0);
36034
36035 ret_val = xmlUCSIsCatMn(code);
36036 desret_int(ret_val);
36037 call_tests++;
36038 des_int(n_code, code, 0);
36039 xmlResetLastError();
36040 if (mem_base != xmlMemBlocks()) {
36041 printf("Leak of %d blocks found in xmlUCSIsCatMn",
36042 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036043 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036044 printf(" %d", n_code);
36045 printf("\n");
36046 }
36047 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036048 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036049#endif
36050
Daniel Veillard42595322004-11-08 10:52:06 +000036051 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036052}
36053
36054
36055static int
36056test_xmlUCSIsCatN(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036057 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036058
William M. Brack21e4ef22005-01-02 09:53:13 +000036059#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036060 int mem_base;
36061 int ret_val;
36062 int code; /* UCS code point */
36063 int n_code;
36064
36065 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36066 mem_base = xmlMemBlocks();
36067 code = gen_int(n_code, 0);
36068
36069 ret_val = xmlUCSIsCatN(code);
36070 desret_int(ret_val);
36071 call_tests++;
36072 des_int(n_code, code, 0);
36073 xmlResetLastError();
36074 if (mem_base != xmlMemBlocks()) {
36075 printf("Leak of %d blocks found in xmlUCSIsCatN",
36076 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036077 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036078 printf(" %d", n_code);
36079 printf("\n");
36080 }
36081 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036082 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036083#endif
36084
Daniel Veillard42595322004-11-08 10:52:06 +000036085 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036086}
36087
36088
36089static int
36090test_xmlUCSIsCatNd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036091 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036092
William M. Brack21e4ef22005-01-02 09:53:13 +000036093#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036094 int mem_base;
36095 int ret_val;
36096 int code; /* UCS code point */
36097 int n_code;
36098
36099 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36100 mem_base = xmlMemBlocks();
36101 code = gen_int(n_code, 0);
36102
36103 ret_val = xmlUCSIsCatNd(code);
36104 desret_int(ret_val);
36105 call_tests++;
36106 des_int(n_code, code, 0);
36107 xmlResetLastError();
36108 if (mem_base != xmlMemBlocks()) {
36109 printf("Leak of %d blocks found in xmlUCSIsCatNd",
36110 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036111 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036112 printf(" %d", n_code);
36113 printf("\n");
36114 }
36115 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036116 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036117#endif
36118
Daniel Veillard42595322004-11-08 10:52:06 +000036119 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036120}
36121
36122
36123static int
36124test_xmlUCSIsCatNl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036125 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036126
William M. Brack21e4ef22005-01-02 09:53:13 +000036127#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036128 int mem_base;
36129 int ret_val;
36130 int code; /* UCS code point */
36131 int n_code;
36132
36133 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36134 mem_base = xmlMemBlocks();
36135 code = gen_int(n_code, 0);
36136
36137 ret_val = xmlUCSIsCatNl(code);
36138 desret_int(ret_val);
36139 call_tests++;
36140 des_int(n_code, code, 0);
36141 xmlResetLastError();
36142 if (mem_base != xmlMemBlocks()) {
36143 printf("Leak of %d blocks found in xmlUCSIsCatNl",
36144 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036145 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036146 printf(" %d", n_code);
36147 printf("\n");
36148 }
36149 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036150 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036151#endif
36152
Daniel Veillard42595322004-11-08 10:52:06 +000036153 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036154}
36155
36156
36157static int
36158test_xmlUCSIsCatNo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036159 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036160
William M. Brack21e4ef22005-01-02 09:53:13 +000036161#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036162 int mem_base;
36163 int ret_val;
36164 int code; /* UCS code point */
36165 int n_code;
36166
36167 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36168 mem_base = xmlMemBlocks();
36169 code = gen_int(n_code, 0);
36170
36171 ret_val = xmlUCSIsCatNo(code);
36172 desret_int(ret_val);
36173 call_tests++;
36174 des_int(n_code, code, 0);
36175 xmlResetLastError();
36176 if (mem_base != xmlMemBlocks()) {
36177 printf("Leak of %d blocks found in xmlUCSIsCatNo",
36178 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036179 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036180 printf(" %d", n_code);
36181 printf("\n");
36182 }
36183 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036184 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036185#endif
36186
Daniel Veillard42595322004-11-08 10:52:06 +000036187 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036188}
36189
36190
36191static int
36192test_xmlUCSIsCatP(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036193 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036194
William M. Brack21e4ef22005-01-02 09:53:13 +000036195#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036196 int mem_base;
36197 int ret_val;
36198 int code; /* UCS code point */
36199 int n_code;
36200
36201 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36202 mem_base = xmlMemBlocks();
36203 code = gen_int(n_code, 0);
36204
36205 ret_val = xmlUCSIsCatP(code);
36206 desret_int(ret_val);
36207 call_tests++;
36208 des_int(n_code, code, 0);
36209 xmlResetLastError();
36210 if (mem_base != xmlMemBlocks()) {
36211 printf("Leak of %d blocks found in xmlUCSIsCatP",
36212 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036213 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036214 printf(" %d", n_code);
36215 printf("\n");
36216 }
36217 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036218 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036219#endif
36220
Daniel Veillard42595322004-11-08 10:52:06 +000036221 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036222}
36223
36224
36225static int
36226test_xmlUCSIsCatPc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036227 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036228
William M. Brack21e4ef22005-01-02 09:53:13 +000036229#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036230 int mem_base;
36231 int ret_val;
36232 int code; /* UCS code point */
36233 int n_code;
36234
36235 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36236 mem_base = xmlMemBlocks();
36237 code = gen_int(n_code, 0);
36238
36239 ret_val = xmlUCSIsCatPc(code);
36240 desret_int(ret_val);
36241 call_tests++;
36242 des_int(n_code, code, 0);
36243 xmlResetLastError();
36244 if (mem_base != xmlMemBlocks()) {
36245 printf("Leak of %d blocks found in xmlUCSIsCatPc",
36246 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036247 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036248 printf(" %d", n_code);
36249 printf("\n");
36250 }
36251 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036252 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036253#endif
36254
Daniel Veillard42595322004-11-08 10:52:06 +000036255 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036256}
36257
36258
36259static int
36260test_xmlUCSIsCatPd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036261 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036262
William M. Brack21e4ef22005-01-02 09:53:13 +000036263#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036264 int mem_base;
36265 int ret_val;
36266 int code; /* UCS code point */
36267 int n_code;
36268
36269 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36270 mem_base = xmlMemBlocks();
36271 code = gen_int(n_code, 0);
36272
36273 ret_val = xmlUCSIsCatPd(code);
36274 desret_int(ret_val);
36275 call_tests++;
36276 des_int(n_code, code, 0);
36277 xmlResetLastError();
36278 if (mem_base != xmlMemBlocks()) {
36279 printf("Leak of %d blocks found in xmlUCSIsCatPd",
36280 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036281 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036282 printf(" %d", n_code);
36283 printf("\n");
36284 }
36285 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036286 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036287#endif
36288
Daniel Veillard42595322004-11-08 10:52:06 +000036289 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036290}
36291
36292
36293static int
36294test_xmlUCSIsCatPe(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036295 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036296
William M. Brack21e4ef22005-01-02 09:53:13 +000036297#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036298 int mem_base;
36299 int ret_val;
36300 int code; /* UCS code point */
36301 int n_code;
36302
36303 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36304 mem_base = xmlMemBlocks();
36305 code = gen_int(n_code, 0);
36306
36307 ret_val = xmlUCSIsCatPe(code);
36308 desret_int(ret_val);
36309 call_tests++;
36310 des_int(n_code, code, 0);
36311 xmlResetLastError();
36312 if (mem_base != xmlMemBlocks()) {
36313 printf("Leak of %d blocks found in xmlUCSIsCatPe",
36314 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036315 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036316 printf(" %d", n_code);
36317 printf("\n");
36318 }
36319 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036320 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036321#endif
36322
Daniel Veillard42595322004-11-08 10:52:06 +000036323 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036324}
36325
36326
36327static int
36328test_xmlUCSIsCatPf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036329 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036330
William M. Brack21e4ef22005-01-02 09:53:13 +000036331#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036332 int mem_base;
36333 int ret_val;
36334 int code; /* UCS code point */
36335 int n_code;
36336
36337 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36338 mem_base = xmlMemBlocks();
36339 code = gen_int(n_code, 0);
36340
36341 ret_val = xmlUCSIsCatPf(code);
36342 desret_int(ret_val);
36343 call_tests++;
36344 des_int(n_code, code, 0);
36345 xmlResetLastError();
36346 if (mem_base != xmlMemBlocks()) {
36347 printf("Leak of %d blocks found in xmlUCSIsCatPf",
36348 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036349 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036350 printf(" %d", n_code);
36351 printf("\n");
36352 }
36353 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036354 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036355#endif
36356
Daniel Veillard42595322004-11-08 10:52:06 +000036357 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036358}
36359
36360
36361static int
36362test_xmlUCSIsCatPi(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036363 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036364
William M. Brack21e4ef22005-01-02 09:53:13 +000036365#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036366 int mem_base;
36367 int ret_val;
36368 int code; /* UCS code point */
36369 int n_code;
36370
36371 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36372 mem_base = xmlMemBlocks();
36373 code = gen_int(n_code, 0);
36374
36375 ret_val = xmlUCSIsCatPi(code);
36376 desret_int(ret_val);
36377 call_tests++;
36378 des_int(n_code, code, 0);
36379 xmlResetLastError();
36380 if (mem_base != xmlMemBlocks()) {
36381 printf("Leak of %d blocks found in xmlUCSIsCatPi",
36382 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036383 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036384 printf(" %d", n_code);
36385 printf("\n");
36386 }
36387 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036388 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036389#endif
36390
Daniel Veillard42595322004-11-08 10:52:06 +000036391 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036392}
36393
36394
36395static int
36396test_xmlUCSIsCatPo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036397 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036398
William M. Brack21e4ef22005-01-02 09:53:13 +000036399#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036400 int mem_base;
36401 int ret_val;
36402 int code; /* UCS code point */
36403 int n_code;
36404
36405 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36406 mem_base = xmlMemBlocks();
36407 code = gen_int(n_code, 0);
36408
36409 ret_val = xmlUCSIsCatPo(code);
36410 desret_int(ret_val);
36411 call_tests++;
36412 des_int(n_code, code, 0);
36413 xmlResetLastError();
36414 if (mem_base != xmlMemBlocks()) {
36415 printf("Leak of %d blocks found in xmlUCSIsCatPo",
36416 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036417 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036418 printf(" %d", n_code);
36419 printf("\n");
36420 }
36421 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036422 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036423#endif
36424
Daniel Veillard42595322004-11-08 10:52:06 +000036425 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036426}
36427
36428
36429static int
36430test_xmlUCSIsCatPs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036431 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036432
William M. Brack21e4ef22005-01-02 09:53:13 +000036433#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036434 int mem_base;
36435 int ret_val;
36436 int code; /* UCS code point */
36437 int n_code;
36438
36439 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36440 mem_base = xmlMemBlocks();
36441 code = gen_int(n_code, 0);
36442
36443 ret_val = xmlUCSIsCatPs(code);
36444 desret_int(ret_val);
36445 call_tests++;
36446 des_int(n_code, code, 0);
36447 xmlResetLastError();
36448 if (mem_base != xmlMemBlocks()) {
36449 printf("Leak of %d blocks found in xmlUCSIsCatPs",
36450 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036451 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036452 printf(" %d", n_code);
36453 printf("\n");
36454 }
36455 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036456 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036457#endif
36458
Daniel Veillard42595322004-11-08 10:52:06 +000036459 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036460}
36461
36462
36463static int
36464test_xmlUCSIsCatS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036465 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036466
William M. Brack21e4ef22005-01-02 09:53:13 +000036467#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036468 int mem_base;
36469 int ret_val;
36470 int code; /* UCS code point */
36471 int n_code;
36472
36473 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36474 mem_base = xmlMemBlocks();
36475 code = gen_int(n_code, 0);
36476
36477 ret_val = xmlUCSIsCatS(code);
36478 desret_int(ret_val);
36479 call_tests++;
36480 des_int(n_code, code, 0);
36481 xmlResetLastError();
36482 if (mem_base != xmlMemBlocks()) {
36483 printf("Leak of %d blocks found in xmlUCSIsCatS",
36484 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036485 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036486 printf(" %d", n_code);
36487 printf("\n");
36488 }
36489 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036490 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036491#endif
36492
Daniel Veillard42595322004-11-08 10:52:06 +000036493 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036494}
36495
36496
36497static int
36498test_xmlUCSIsCatSc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036499 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036500
William M. Brack21e4ef22005-01-02 09:53:13 +000036501#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036502 int mem_base;
36503 int ret_val;
36504 int code; /* UCS code point */
36505 int n_code;
36506
36507 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36508 mem_base = xmlMemBlocks();
36509 code = gen_int(n_code, 0);
36510
36511 ret_val = xmlUCSIsCatSc(code);
36512 desret_int(ret_val);
36513 call_tests++;
36514 des_int(n_code, code, 0);
36515 xmlResetLastError();
36516 if (mem_base != xmlMemBlocks()) {
36517 printf("Leak of %d blocks found in xmlUCSIsCatSc",
36518 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036519 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036520 printf(" %d", n_code);
36521 printf("\n");
36522 }
36523 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036524 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036525#endif
36526
Daniel Veillard42595322004-11-08 10:52:06 +000036527 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036528}
36529
36530
36531static int
36532test_xmlUCSIsCatSk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036533 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036534
William M. Brack21e4ef22005-01-02 09:53:13 +000036535#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036536 int mem_base;
36537 int ret_val;
36538 int code; /* UCS code point */
36539 int n_code;
36540
36541 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36542 mem_base = xmlMemBlocks();
36543 code = gen_int(n_code, 0);
36544
36545 ret_val = xmlUCSIsCatSk(code);
36546 desret_int(ret_val);
36547 call_tests++;
36548 des_int(n_code, code, 0);
36549 xmlResetLastError();
36550 if (mem_base != xmlMemBlocks()) {
36551 printf("Leak of %d blocks found in xmlUCSIsCatSk",
36552 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036553 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036554 printf(" %d", n_code);
36555 printf("\n");
36556 }
36557 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036558 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036559#endif
36560
Daniel Veillard42595322004-11-08 10:52:06 +000036561 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036562}
36563
36564
36565static int
36566test_xmlUCSIsCatSm(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036567 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036568
William M. Brack21e4ef22005-01-02 09:53:13 +000036569#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036570 int mem_base;
36571 int ret_val;
36572 int code; /* UCS code point */
36573 int n_code;
36574
36575 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36576 mem_base = xmlMemBlocks();
36577 code = gen_int(n_code, 0);
36578
36579 ret_val = xmlUCSIsCatSm(code);
36580 desret_int(ret_val);
36581 call_tests++;
36582 des_int(n_code, code, 0);
36583 xmlResetLastError();
36584 if (mem_base != xmlMemBlocks()) {
36585 printf("Leak of %d blocks found in xmlUCSIsCatSm",
36586 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036587 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036588 printf(" %d", n_code);
36589 printf("\n");
36590 }
36591 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036592 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036593#endif
36594
Daniel Veillard42595322004-11-08 10:52:06 +000036595 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036596}
36597
36598
36599static int
36600test_xmlUCSIsCatSo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036601 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036602
William M. Brack21e4ef22005-01-02 09:53:13 +000036603#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036604 int mem_base;
36605 int ret_val;
36606 int code; /* UCS code point */
36607 int n_code;
36608
36609 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36610 mem_base = xmlMemBlocks();
36611 code = gen_int(n_code, 0);
36612
36613 ret_val = xmlUCSIsCatSo(code);
36614 desret_int(ret_val);
36615 call_tests++;
36616 des_int(n_code, code, 0);
36617 xmlResetLastError();
36618 if (mem_base != xmlMemBlocks()) {
36619 printf("Leak of %d blocks found in xmlUCSIsCatSo",
36620 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036621 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036622 printf(" %d", n_code);
36623 printf("\n");
36624 }
36625 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036626 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036627#endif
36628
Daniel Veillard42595322004-11-08 10:52:06 +000036629 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036630}
36631
36632
36633static int
36634test_xmlUCSIsCatZ(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036635 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036636
William M. Brack21e4ef22005-01-02 09:53:13 +000036637#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036638 int mem_base;
36639 int ret_val;
36640 int code; /* UCS code point */
36641 int n_code;
36642
36643 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36644 mem_base = xmlMemBlocks();
36645 code = gen_int(n_code, 0);
36646
36647 ret_val = xmlUCSIsCatZ(code);
36648 desret_int(ret_val);
36649 call_tests++;
36650 des_int(n_code, code, 0);
36651 xmlResetLastError();
36652 if (mem_base != xmlMemBlocks()) {
36653 printf("Leak of %d blocks found in xmlUCSIsCatZ",
36654 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036655 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036656 printf(" %d", n_code);
36657 printf("\n");
36658 }
36659 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036660 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036661#endif
36662
Daniel Veillard42595322004-11-08 10:52:06 +000036663 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036664}
36665
36666
36667static int
36668test_xmlUCSIsCatZl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036669 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036670
William M. Brack21e4ef22005-01-02 09:53:13 +000036671#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036672 int mem_base;
36673 int ret_val;
36674 int code; /* UCS code point */
36675 int n_code;
36676
36677 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36678 mem_base = xmlMemBlocks();
36679 code = gen_int(n_code, 0);
36680
36681 ret_val = xmlUCSIsCatZl(code);
36682 desret_int(ret_val);
36683 call_tests++;
36684 des_int(n_code, code, 0);
36685 xmlResetLastError();
36686 if (mem_base != xmlMemBlocks()) {
36687 printf("Leak of %d blocks found in xmlUCSIsCatZl",
36688 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036689 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036690 printf(" %d", n_code);
36691 printf("\n");
36692 }
36693 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036694 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036695#endif
36696
Daniel Veillard42595322004-11-08 10:52:06 +000036697 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036698}
36699
36700
36701static int
36702test_xmlUCSIsCatZp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036703 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036704
William M. Brack21e4ef22005-01-02 09:53:13 +000036705#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036706 int mem_base;
36707 int ret_val;
36708 int code; /* UCS code point */
36709 int n_code;
36710
36711 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36712 mem_base = xmlMemBlocks();
36713 code = gen_int(n_code, 0);
36714
36715 ret_val = xmlUCSIsCatZp(code);
36716 desret_int(ret_val);
36717 call_tests++;
36718 des_int(n_code, code, 0);
36719 xmlResetLastError();
36720 if (mem_base != xmlMemBlocks()) {
36721 printf("Leak of %d blocks found in xmlUCSIsCatZp",
36722 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036723 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036724 printf(" %d", n_code);
36725 printf("\n");
36726 }
36727 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036728 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036729#endif
36730
Daniel Veillard42595322004-11-08 10:52:06 +000036731 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036732}
36733
36734
36735static int
36736test_xmlUCSIsCatZs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036737 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036738
William M. Brack21e4ef22005-01-02 09:53:13 +000036739#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036740 int mem_base;
36741 int ret_val;
36742 int code; /* UCS code point */
36743 int n_code;
36744
36745 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36746 mem_base = xmlMemBlocks();
36747 code = gen_int(n_code, 0);
36748
36749 ret_val = xmlUCSIsCatZs(code);
36750 desret_int(ret_val);
36751 call_tests++;
36752 des_int(n_code, code, 0);
36753 xmlResetLastError();
36754 if (mem_base != xmlMemBlocks()) {
36755 printf("Leak of %d blocks found in xmlUCSIsCatZs",
36756 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036757 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036758 printf(" %d", n_code);
36759 printf("\n");
36760 }
36761 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036762 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036763#endif
36764
Daniel Veillard42595322004-11-08 10:52:06 +000036765 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036766}
36767
36768
36769static int
36770test_xmlUCSIsCherokee(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036771 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036772
William M. Brack21e4ef22005-01-02 09:53:13 +000036773#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036774 int mem_base;
36775 int ret_val;
36776 int code; /* UCS code point */
36777 int n_code;
36778
36779 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36780 mem_base = xmlMemBlocks();
36781 code = gen_int(n_code, 0);
36782
36783 ret_val = xmlUCSIsCherokee(code);
36784 desret_int(ret_val);
36785 call_tests++;
36786 des_int(n_code, code, 0);
36787 xmlResetLastError();
36788 if (mem_base != xmlMemBlocks()) {
36789 printf("Leak of %d blocks found in xmlUCSIsCherokee",
36790 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036791 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036792 printf(" %d", n_code);
36793 printf("\n");
36794 }
36795 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036796 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036797#endif
36798
Daniel Veillard42595322004-11-08 10:52:06 +000036799 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036800}
36801
36802
36803static int
36804test_xmlUCSIsCombiningDiacriticalMarks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036805 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036806
William M. Brack21e4ef22005-01-02 09:53:13 +000036807#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036808 int mem_base;
36809 int ret_val;
36810 int code; /* UCS code point */
36811 int n_code;
36812
36813 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36814 mem_base = xmlMemBlocks();
36815 code = gen_int(n_code, 0);
36816
36817 ret_val = xmlUCSIsCombiningDiacriticalMarks(code);
36818 desret_int(ret_val);
36819 call_tests++;
36820 des_int(n_code, code, 0);
36821 xmlResetLastError();
36822 if (mem_base != xmlMemBlocks()) {
36823 printf("Leak of %d blocks found in xmlUCSIsCombiningDiacriticalMarks",
36824 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036825 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036826 printf(" %d", n_code);
36827 printf("\n");
36828 }
36829 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036830 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036831#endif
36832
Daniel Veillard42595322004-11-08 10:52:06 +000036833 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036834}
36835
36836
36837static int
36838test_xmlUCSIsCombiningDiacriticalMarksforSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036839 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036840
William M. Brack21e4ef22005-01-02 09:53:13 +000036841#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036842 int mem_base;
36843 int ret_val;
36844 int code; /* UCS code point */
36845 int n_code;
36846
36847 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36848 mem_base = xmlMemBlocks();
36849 code = gen_int(n_code, 0);
36850
36851 ret_val = xmlUCSIsCombiningDiacriticalMarksforSymbols(code);
36852 desret_int(ret_val);
36853 call_tests++;
36854 des_int(n_code, code, 0);
36855 xmlResetLastError();
36856 if (mem_base != xmlMemBlocks()) {
36857 printf("Leak of %d blocks found in xmlUCSIsCombiningDiacriticalMarksforSymbols",
36858 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036859 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036860 printf(" %d", n_code);
36861 printf("\n");
36862 }
36863 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036864 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036865#endif
36866
Daniel Veillard42595322004-11-08 10:52:06 +000036867 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036868}
36869
36870
36871static int
36872test_xmlUCSIsCombiningHalfMarks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036873 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036874
William M. Brack21e4ef22005-01-02 09:53:13 +000036875#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036876 int mem_base;
36877 int ret_val;
36878 int code; /* UCS code point */
36879 int n_code;
36880
36881 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36882 mem_base = xmlMemBlocks();
36883 code = gen_int(n_code, 0);
36884
36885 ret_val = xmlUCSIsCombiningHalfMarks(code);
36886 desret_int(ret_val);
36887 call_tests++;
36888 des_int(n_code, code, 0);
36889 xmlResetLastError();
36890 if (mem_base != xmlMemBlocks()) {
36891 printf("Leak of %d blocks found in xmlUCSIsCombiningHalfMarks",
36892 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036893 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036894 printf(" %d", n_code);
36895 printf("\n");
36896 }
36897 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036898 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036899#endif
36900
Daniel Veillard42595322004-11-08 10:52:06 +000036901 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036902}
36903
36904
36905static int
36906test_xmlUCSIsCombiningMarksforSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036907 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036908
William M. Brack21e4ef22005-01-02 09:53:13 +000036909#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036910 int mem_base;
36911 int ret_val;
36912 int code; /* UCS code point */
36913 int n_code;
36914
36915 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36916 mem_base = xmlMemBlocks();
36917 code = gen_int(n_code, 0);
36918
36919 ret_val = xmlUCSIsCombiningMarksforSymbols(code);
36920 desret_int(ret_val);
36921 call_tests++;
36922 des_int(n_code, code, 0);
36923 xmlResetLastError();
36924 if (mem_base != xmlMemBlocks()) {
36925 printf("Leak of %d blocks found in xmlUCSIsCombiningMarksforSymbols",
36926 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036927 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036928 printf(" %d", n_code);
36929 printf("\n");
36930 }
36931 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036932 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036933#endif
36934
Daniel Veillard42595322004-11-08 10:52:06 +000036935 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036936}
36937
36938
36939static int
36940test_xmlUCSIsControlPictures(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036941 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036942
William M. Brack21e4ef22005-01-02 09:53:13 +000036943#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036944 int mem_base;
36945 int ret_val;
36946 int code; /* UCS code point */
36947 int n_code;
36948
36949 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36950 mem_base = xmlMemBlocks();
36951 code = gen_int(n_code, 0);
36952
36953 ret_val = xmlUCSIsControlPictures(code);
36954 desret_int(ret_val);
36955 call_tests++;
36956 des_int(n_code, code, 0);
36957 xmlResetLastError();
36958 if (mem_base != xmlMemBlocks()) {
36959 printf("Leak of %d blocks found in xmlUCSIsControlPictures",
36960 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036961 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036962 printf(" %d", n_code);
36963 printf("\n");
36964 }
36965 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036966 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036967#endif
36968
Daniel Veillard42595322004-11-08 10:52:06 +000036969 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036970}
36971
36972
36973static int
36974test_xmlUCSIsCurrencySymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036975 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036976
William M. Brack21e4ef22005-01-02 09:53:13 +000036977#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036978 int mem_base;
36979 int ret_val;
36980 int code; /* UCS code point */
36981 int n_code;
36982
36983 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36984 mem_base = xmlMemBlocks();
36985 code = gen_int(n_code, 0);
36986
36987 ret_val = xmlUCSIsCurrencySymbols(code);
36988 desret_int(ret_val);
36989 call_tests++;
36990 des_int(n_code, code, 0);
36991 xmlResetLastError();
36992 if (mem_base != xmlMemBlocks()) {
36993 printf("Leak of %d blocks found in xmlUCSIsCurrencySymbols",
36994 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036995 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036996 printf(" %d", n_code);
36997 printf("\n");
36998 }
36999 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037000 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037001#endif
37002
Daniel Veillard42595322004-11-08 10:52:06 +000037003 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037004}
37005
37006
37007static int
37008test_xmlUCSIsCypriotSyllabary(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037009 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037010
William M. Brack21e4ef22005-01-02 09:53:13 +000037011#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037012 int mem_base;
37013 int ret_val;
37014 int code; /* UCS code point */
37015 int n_code;
37016
37017 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37018 mem_base = xmlMemBlocks();
37019 code = gen_int(n_code, 0);
37020
37021 ret_val = xmlUCSIsCypriotSyllabary(code);
37022 desret_int(ret_val);
37023 call_tests++;
37024 des_int(n_code, code, 0);
37025 xmlResetLastError();
37026 if (mem_base != xmlMemBlocks()) {
37027 printf("Leak of %d blocks found in xmlUCSIsCypriotSyllabary",
37028 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037029 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037030 printf(" %d", n_code);
37031 printf("\n");
37032 }
37033 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037034 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037035#endif
37036
Daniel Veillard42595322004-11-08 10:52:06 +000037037 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037038}
37039
37040
37041static int
37042test_xmlUCSIsCyrillic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037043 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037044
William M. Brack21e4ef22005-01-02 09:53:13 +000037045#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037046 int mem_base;
37047 int ret_val;
37048 int code; /* UCS code point */
37049 int n_code;
37050
37051 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37052 mem_base = xmlMemBlocks();
37053 code = gen_int(n_code, 0);
37054
37055 ret_val = xmlUCSIsCyrillic(code);
37056 desret_int(ret_val);
37057 call_tests++;
37058 des_int(n_code, code, 0);
37059 xmlResetLastError();
37060 if (mem_base != xmlMemBlocks()) {
37061 printf("Leak of %d blocks found in xmlUCSIsCyrillic",
37062 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037063 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037064 printf(" %d", n_code);
37065 printf("\n");
37066 }
37067 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037068 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037069#endif
37070
Daniel Veillard42595322004-11-08 10:52:06 +000037071 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037072}
37073
37074
37075static int
37076test_xmlUCSIsCyrillicSupplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037077 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037078
William M. Brack21e4ef22005-01-02 09:53:13 +000037079#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037080 int mem_base;
37081 int ret_val;
37082 int code; /* UCS code point */
37083 int n_code;
37084
37085 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37086 mem_base = xmlMemBlocks();
37087 code = gen_int(n_code, 0);
37088
37089 ret_val = xmlUCSIsCyrillicSupplement(code);
37090 desret_int(ret_val);
37091 call_tests++;
37092 des_int(n_code, code, 0);
37093 xmlResetLastError();
37094 if (mem_base != xmlMemBlocks()) {
37095 printf("Leak of %d blocks found in xmlUCSIsCyrillicSupplement",
37096 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037097 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037098 printf(" %d", n_code);
37099 printf("\n");
37100 }
37101 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037102 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037103#endif
37104
Daniel Veillard42595322004-11-08 10:52:06 +000037105 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037106}
37107
37108
37109static int
37110test_xmlUCSIsDeseret(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037111 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037112
William M. Brack21e4ef22005-01-02 09:53:13 +000037113#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037114 int mem_base;
37115 int ret_val;
37116 int code; /* UCS code point */
37117 int n_code;
37118
37119 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37120 mem_base = xmlMemBlocks();
37121 code = gen_int(n_code, 0);
37122
37123 ret_val = xmlUCSIsDeseret(code);
37124 desret_int(ret_val);
37125 call_tests++;
37126 des_int(n_code, code, 0);
37127 xmlResetLastError();
37128 if (mem_base != xmlMemBlocks()) {
37129 printf("Leak of %d blocks found in xmlUCSIsDeseret",
37130 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037131 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037132 printf(" %d", n_code);
37133 printf("\n");
37134 }
37135 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037136 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037137#endif
37138
Daniel Veillard42595322004-11-08 10:52:06 +000037139 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037140}
37141
37142
37143static int
37144test_xmlUCSIsDevanagari(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037145 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037146
William M. Brack21e4ef22005-01-02 09:53:13 +000037147#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037148 int mem_base;
37149 int ret_val;
37150 int code; /* UCS code point */
37151 int n_code;
37152
37153 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37154 mem_base = xmlMemBlocks();
37155 code = gen_int(n_code, 0);
37156
37157 ret_val = xmlUCSIsDevanagari(code);
37158 desret_int(ret_val);
37159 call_tests++;
37160 des_int(n_code, code, 0);
37161 xmlResetLastError();
37162 if (mem_base != xmlMemBlocks()) {
37163 printf("Leak of %d blocks found in xmlUCSIsDevanagari",
37164 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037165 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037166 printf(" %d", n_code);
37167 printf("\n");
37168 }
37169 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037170 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037171#endif
37172
Daniel Veillard42595322004-11-08 10:52:06 +000037173 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037174}
37175
37176
37177static int
37178test_xmlUCSIsDingbats(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037179 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037180
William M. Brack21e4ef22005-01-02 09:53:13 +000037181#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037182 int mem_base;
37183 int ret_val;
37184 int code; /* UCS code point */
37185 int n_code;
37186
37187 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37188 mem_base = xmlMemBlocks();
37189 code = gen_int(n_code, 0);
37190
37191 ret_val = xmlUCSIsDingbats(code);
37192 desret_int(ret_val);
37193 call_tests++;
37194 des_int(n_code, code, 0);
37195 xmlResetLastError();
37196 if (mem_base != xmlMemBlocks()) {
37197 printf("Leak of %d blocks found in xmlUCSIsDingbats",
37198 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037199 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037200 printf(" %d", n_code);
37201 printf("\n");
37202 }
37203 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037204 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037205#endif
37206
Daniel Veillard42595322004-11-08 10:52:06 +000037207 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037208}
37209
37210
37211static int
37212test_xmlUCSIsEnclosedAlphanumerics(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037213 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037214
William M. Brack21e4ef22005-01-02 09:53:13 +000037215#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037216 int mem_base;
37217 int ret_val;
37218 int code; /* UCS code point */
37219 int n_code;
37220
37221 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37222 mem_base = xmlMemBlocks();
37223 code = gen_int(n_code, 0);
37224
37225 ret_val = xmlUCSIsEnclosedAlphanumerics(code);
37226 desret_int(ret_val);
37227 call_tests++;
37228 des_int(n_code, code, 0);
37229 xmlResetLastError();
37230 if (mem_base != xmlMemBlocks()) {
37231 printf("Leak of %d blocks found in xmlUCSIsEnclosedAlphanumerics",
37232 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037233 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037234 printf(" %d", n_code);
37235 printf("\n");
37236 }
37237 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037238 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037239#endif
37240
Daniel Veillard42595322004-11-08 10:52:06 +000037241 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037242}
37243
37244
37245static int
37246test_xmlUCSIsEnclosedCJKLettersandMonths(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037247 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037248
William M. Brack21e4ef22005-01-02 09:53:13 +000037249#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037250 int mem_base;
37251 int ret_val;
37252 int code; /* UCS code point */
37253 int n_code;
37254
37255 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37256 mem_base = xmlMemBlocks();
37257 code = gen_int(n_code, 0);
37258
37259 ret_val = xmlUCSIsEnclosedCJKLettersandMonths(code);
37260 desret_int(ret_val);
37261 call_tests++;
37262 des_int(n_code, code, 0);
37263 xmlResetLastError();
37264 if (mem_base != xmlMemBlocks()) {
37265 printf("Leak of %d blocks found in xmlUCSIsEnclosedCJKLettersandMonths",
37266 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037267 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037268 printf(" %d", n_code);
37269 printf("\n");
37270 }
37271 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037272 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037273#endif
37274
Daniel Veillard42595322004-11-08 10:52:06 +000037275 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037276}
37277
37278
37279static int
37280test_xmlUCSIsEthiopic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037281 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037282
William M. Brack21e4ef22005-01-02 09:53:13 +000037283#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037284 int mem_base;
37285 int ret_val;
37286 int code; /* UCS code point */
37287 int n_code;
37288
37289 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37290 mem_base = xmlMemBlocks();
37291 code = gen_int(n_code, 0);
37292
37293 ret_val = xmlUCSIsEthiopic(code);
37294 desret_int(ret_val);
37295 call_tests++;
37296 des_int(n_code, code, 0);
37297 xmlResetLastError();
37298 if (mem_base != xmlMemBlocks()) {
37299 printf("Leak of %d blocks found in xmlUCSIsEthiopic",
37300 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037301 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037302 printf(" %d", n_code);
37303 printf("\n");
37304 }
37305 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037306 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037307#endif
37308
Daniel Veillard42595322004-11-08 10:52:06 +000037309 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037310}
37311
37312
37313static int
37314test_xmlUCSIsGeneralPunctuation(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037315 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037316
William M. Brack21e4ef22005-01-02 09:53:13 +000037317#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037318 int mem_base;
37319 int ret_val;
37320 int code; /* UCS code point */
37321 int n_code;
37322
37323 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37324 mem_base = xmlMemBlocks();
37325 code = gen_int(n_code, 0);
37326
37327 ret_val = xmlUCSIsGeneralPunctuation(code);
37328 desret_int(ret_val);
37329 call_tests++;
37330 des_int(n_code, code, 0);
37331 xmlResetLastError();
37332 if (mem_base != xmlMemBlocks()) {
37333 printf("Leak of %d blocks found in xmlUCSIsGeneralPunctuation",
37334 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037335 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037336 printf(" %d", n_code);
37337 printf("\n");
37338 }
37339 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037340 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037341#endif
37342
Daniel Veillard42595322004-11-08 10:52:06 +000037343 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037344}
37345
37346
37347static int
37348test_xmlUCSIsGeometricShapes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037349 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037350
William M. Brack21e4ef22005-01-02 09:53:13 +000037351#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037352 int mem_base;
37353 int ret_val;
37354 int code; /* UCS code point */
37355 int n_code;
37356
37357 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37358 mem_base = xmlMemBlocks();
37359 code = gen_int(n_code, 0);
37360
37361 ret_val = xmlUCSIsGeometricShapes(code);
37362 desret_int(ret_val);
37363 call_tests++;
37364 des_int(n_code, code, 0);
37365 xmlResetLastError();
37366 if (mem_base != xmlMemBlocks()) {
37367 printf("Leak of %d blocks found in xmlUCSIsGeometricShapes",
37368 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037369 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037370 printf(" %d", n_code);
37371 printf("\n");
37372 }
37373 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037374 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037375#endif
37376
Daniel Veillard42595322004-11-08 10:52:06 +000037377 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037378}
37379
37380
37381static int
37382test_xmlUCSIsGeorgian(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037383 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037384
William M. Brack21e4ef22005-01-02 09:53:13 +000037385#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037386 int mem_base;
37387 int ret_val;
37388 int code; /* UCS code point */
37389 int n_code;
37390
37391 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37392 mem_base = xmlMemBlocks();
37393 code = gen_int(n_code, 0);
37394
37395 ret_val = xmlUCSIsGeorgian(code);
37396 desret_int(ret_val);
37397 call_tests++;
37398 des_int(n_code, code, 0);
37399 xmlResetLastError();
37400 if (mem_base != xmlMemBlocks()) {
37401 printf("Leak of %d blocks found in xmlUCSIsGeorgian",
37402 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037403 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037404 printf(" %d", n_code);
37405 printf("\n");
37406 }
37407 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037408 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037409#endif
37410
Daniel Veillard42595322004-11-08 10:52:06 +000037411 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037412}
37413
37414
37415static int
37416test_xmlUCSIsGothic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037417 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037418
William M. Brack21e4ef22005-01-02 09:53:13 +000037419#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037420 int mem_base;
37421 int ret_val;
37422 int code; /* UCS code point */
37423 int n_code;
37424
37425 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37426 mem_base = xmlMemBlocks();
37427 code = gen_int(n_code, 0);
37428
37429 ret_val = xmlUCSIsGothic(code);
37430 desret_int(ret_val);
37431 call_tests++;
37432 des_int(n_code, code, 0);
37433 xmlResetLastError();
37434 if (mem_base != xmlMemBlocks()) {
37435 printf("Leak of %d blocks found in xmlUCSIsGothic",
37436 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037437 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037438 printf(" %d", n_code);
37439 printf("\n");
37440 }
37441 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037442 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037443#endif
37444
Daniel Veillard42595322004-11-08 10:52:06 +000037445 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037446}
37447
37448
37449static int
37450test_xmlUCSIsGreek(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037451 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037452
William M. Brack21e4ef22005-01-02 09:53:13 +000037453#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037454 int mem_base;
37455 int ret_val;
37456 int code; /* UCS code point */
37457 int n_code;
37458
37459 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37460 mem_base = xmlMemBlocks();
37461 code = gen_int(n_code, 0);
37462
37463 ret_val = xmlUCSIsGreek(code);
37464 desret_int(ret_val);
37465 call_tests++;
37466 des_int(n_code, code, 0);
37467 xmlResetLastError();
37468 if (mem_base != xmlMemBlocks()) {
37469 printf("Leak of %d blocks found in xmlUCSIsGreek",
37470 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037471 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037472 printf(" %d", n_code);
37473 printf("\n");
37474 }
37475 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037476 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037477#endif
37478
Daniel Veillard42595322004-11-08 10:52:06 +000037479 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037480}
37481
37482
37483static int
37484test_xmlUCSIsGreekExtended(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037485 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037486
William M. Brack21e4ef22005-01-02 09:53:13 +000037487#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037488 int mem_base;
37489 int ret_val;
37490 int code; /* UCS code point */
37491 int n_code;
37492
37493 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37494 mem_base = xmlMemBlocks();
37495 code = gen_int(n_code, 0);
37496
37497 ret_val = xmlUCSIsGreekExtended(code);
37498 desret_int(ret_val);
37499 call_tests++;
37500 des_int(n_code, code, 0);
37501 xmlResetLastError();
37502 if (mem_base != xmlMemBlocks()) {
37503 printf("Leak of %d blocks found in xmlUCSIsGreekExtended",
37504 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037505 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037506 printf(" %d", n_code);
37507 printf("\n");
37508 }
37509 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037510 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037511#endif
37512
Daniel Veillard42595322004-11-08 10:52:06 +000037513 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037514}
37515
37516
37517static int
37518test_xmlUCSIsGreekandCoptic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037519 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037520
William M. Brack21e4ef22005-01-02 09:53:13 +000037521#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037522 int mem_base;
37523 int ret_val;
37524 int code; /* UCS code point */
37525 int n_code;
37526
37527 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37528 mem_base = xmlMemBlocks();
37529 code = gen_int(n_code, 0);
37530
37531 ret_val = xmlUCSIsGreekandCoptic(code);
37532 desret_int(ret_val);
37533 call_tests++;
37534 des_int(n_code, code, 0);
37535 xmlResetLastError();
37536 if (mem_base != xmlMemBlocks()) {
37537 printf("Leak of %d blocks found in xmlUCSIsGreekandCoptic",
37538 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037539 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037540 printf(" %d", n_code);
37541 printf("\n");
37542 }
37543 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037544 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037545#endif
37546
Daniel Veillard42595322004-11-08 10:52:06 +000037547 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037548}
37549
37550
37551static int
37552test_xmlUCSIsGujarati(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037553 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037554
William M. Brack21e4ef22005-01-02 09:53:13 +000037555#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037556 int mem_base;
37557 int ret_val;
37558 int code; /* UCS code point */
37559 int n_code;
37560
37561 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37562 mem_base = xmlMemBlocks();
37563 code = gen_int(n_code, 0);
37564
37565 ret_val = xmlUCSIsGujarati(code);
37566 desret_int(ret_val);
37567 call_tests++;
37568 des_int(n_code, code, 0);
37569 xmlResetLastError();
37570 if (mem_base != xmlMemBlocks()) {
37571 printf("Leak of %d blocks found in xmlUCSIsGujarati",
37572 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037573 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037574 printf(" %d", n_code);
37575 printf("\n");
37576 }
37577 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037578 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037579#endif
37580
Daniel Veillard42595322004-11-08 10:52:06 +000037581 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037582}
37583
37584
37585static int
37586test_xmlUCSIsGurmukhi(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037587 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037588
William M. Brack21e4ef22005-01-02 09:53:13 +000037589#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037590 int mem_base;
37591 int ret_val;
37592 int code; /* UCS code point */
37593 int n_code;
37594
37595 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37596 mem_base = xmlMemBlocks();
37597 code = gen_int(n_code, 0);
37598
37599 ret_val = xmlUCSIsGurmukhi(code);
37600 desret_int(ret_val);
37601 call_tests++;
37602 des_int(n_code, code, 0);
37603 xmlResetLastError();
37604 if (mem_base != xmlMemBlocks()) {
37605 printf("Leak of %d blocks found in xmlUCSIsGurmukhi",
37606 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037607 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037608 printf(" %d", n_code);
37609 printf("\n");
37610 }
37611 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037612 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037613#endif
37614
Daniel Veillard42595322004-11-08 10:52:06 +000037615 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037616}
37617
37618
37619static int
37620test_xmlUCSIsHalfwidthandFullwidthForms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037621 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037622
William M. Brack21e4ef22005-01-02 09:53:13 +000037623#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037624 int mem_base;
37625 int ret_val;
37626 int code; /* UCS code point */
37627 int n_code;
37628
37629 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37630 mem_base = xmlMemBlocks();
37631 code = gen_int(n_code, 0);
37632
37633 ret_val = xmlUCSIsHalfwidthandFullwidthForms(code);
37634 desret_int(ret_val);
37635 call_tests++;
37636 des_int(n_code, code, 0);
37637 xmlResetLastError();
37638 if (mem_base != xmlMemBlocks()) {
37639 printf("Leak of %d blocks found in xmlUCSIsHalfwidthandFullwidthForms",
37640 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037641 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037642 printf(" %d", n_code);
37643 printf("\n");
37644 }
37645 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037646 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037647#endif
37648
Daniel Veillard42595322004-11-08 10:52:06 +000037649 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037650}
37651
37652
37653static int
37654test_xmlUCSIsHangulCompatibilityJamo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037655 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037656
William M. Brack21e4ef22005-01-02 09:53:13 +000037657#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037658 int mem_base;
37659 int ret_val;
37660 int code; /* UCS code point */
37661 int n_code;
37662
37663 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37664 mem_base = xmlMemBlocks();
37665 code = gen_int(n_code, 0);
37666
37667 ret_val = xmlUCSIsHangulCompatibilityJamo(code);
37668 desret_int(ret_val);
37669 call_tests++;
37670 des_int(n_code, code, 0);
37671 xmlResetLastError();
37672 if (mem_base != xmlMemBlocks()) {
37673 printf("Leak of %d blocks found in xmlUCSIsHangulCompatibilityJamo",
37674 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037675 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037676 printf(" %d", n_code);
37677 printf("\n");
37678 }
37679 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037680 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037681#endif
37682
Daniel Veillard42595322004-11-08 10:52:06 +000037683 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037684}
37685
37686
37687static int
37688test_xmlUCSIsHangulJamo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037689 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037690
William M. Brack21e4ef22005-01-02 09:53:13 +000037691#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037692 int mem_base;
37693 int ret_val;
37694 int code; /* UCS code point */
37695 int n_code;
37696
37697 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37698 mem_base = xmlMemBlocks();
37699 code = gen_int(n_code, 0);
37700
37701 ret_val = xmlUCSIsHangulJamo(code);
37702 desret_int(ret_val);
37703 call_tests++;
37704 des_int(n_code, code, 0);
37705 xmlResetLastError();
37706 if (mem_base != xmlMemBlocks()) {
37707 printf("Leak of %d blocks found in xmlUCSIsHangulJamo",
37708 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037709 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037710 printf(" %d", n_code);
37711 printf("\n");
37712 }
37713 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037714 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037715#endif
37716
Daniel Veillard42595322004-11-08 10:52:06 +000037717 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037718}
37719
37720
37721static int
37722test_xmlUCSIsHangulSyllables(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037723 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037724
William M. Brack21e4ef22005-01-02 09:53:13 +000037725#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037726 int mem_base;
37727 int ret_val;
37728 int code; /* UCS code point */
37729 int n_code;
37730
37731 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37732 mem_base = xmlMemBlocks();
37733 code = gen_int(n_code, 0);
37734
37735 ret_val = xmlUCSIsHangulSyllables(code);
37736 desret_int(ret_val);
37737 call_tests++;
37738 des_int(n_code, code, 0);
37739 xmlResetLastError();
37740 if (mem_base != xmlMemBlocks()) {
37741 printf("Leak of %d blocks found in xmlUCSIsHangulSyllables",
37742 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037743 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037744 printf(" %d", n_code);
37745 printf("\n");
37746 }
37747 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037748 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037749#endif
37750
Daniel Veillard42595322004-11-08 10:52:06 +000037751 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037752}
37753
37754
37755static int
37756test_xmlUCSIsHanunoo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037757 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037758
William M. Brack21e4ef22005-01-02 09:53:13 +000037759#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037760 int mem_base;
37761 int ret_val;
37762 int code; /* UCS code point */
37763 int n_code;
37764
37765 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37766 mem_base = xmlMemBlocks();
37767 code = gen_int(n_code, 0);
37768
37769 ret_val = xmlUCSIsHanunoo(code);
37770 desret_int(ret_val);
37771 call_tests++;
37772 des_int(n_code, code, 0);
37773 xmlResetLastError();
37774 if (mem_base != xmlMemBlocks()) {
37775 printf("Leak of %d blocks found in xmlUCSIsHanunoo",
37776 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037777 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037778 printf(" %d", n_code);
37779 printf("\n");
37780 }
37781 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037782 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037783#endif
37784
Daniel Veillard42595322004-11-08 10:52:06 +000037785 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037786}
37787
37788
37789static int
37790test_xmlUCSIsHebrew(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037791 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037792
William M. Brack21e4ef22005-01-02 09:53:13 +000037793#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037794 int mem_base;
37795 int ret_val;
37796 int code; /* UCS code point */
37797 int n_code;
37798
37799 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37800 mem_base = xmlMemBlocks();
37801 code = gen_int(n_code, 0);
37802
37803 ret_val = xmlUCSIsHebrew(code);
37804 desret_int(ret_val);
37805 call_tests++;
37806 des_int(n_code, code, 0);
37807 xmlResetLastError();
37808 if (mem_base != xmlMemBlocks()) {
37809 printf("Leak of %d blocks found in xmlUCSIsHebrew",
37810 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037811 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037812 printf(" %d", n_code);
37813 printf("\n");
37814 }
37815 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037816 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037817#endif
37818
Daniel Veillard42595322004-11-08 10:52:06 +000037819 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037820}
37821
37822
37823static int
37824test_xmlUCSIsHighPrivateUseSurrogates(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037825 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037826
William M. Brack21e4ef22005-01-02 09:53:13 +000037827#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037828 int mem_base;
37829 int ret_val;
37830 int code; /* UCS code point */
37831 int n_code;
37832
37833 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37834 mem_base = xmlMemBlocks();
37835 code = gen_int(n_code, 0);
37836
37837 ret_val = xmlUCSIsHighPrivateUseSurrogates(code);
37838 desret_int(ret_val);
37839 call_tests++;
37840 des_int(n_code, code, 0);
37841 xmlResetLastError();
37842 if (mem_base != xmlMemBlocks()) {
37843 printf("Leak of %d blocks found in xmlUCSIsHighPrivateUseSurrogates",
37844 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037845 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037846 printf(" %d", n_code);
37847 printf("\n");
37848 }
37849 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037850 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037851#endif
37852
Daniel Veillard42595322004-11-08 10:52:06 +000037853 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037854}
37855
37856
37857static int
37858test_xmlUCSIsHighSurrogates(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037859 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037860
William M. Brack21e4ef22005-01-02 09:53:13 +000037861#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037862 int mem_base;
37863 int ret_val;
37864 int code; /* UCS code point */
37865 int n_code;
37866
37867 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37868 mem_base = xmlMemBlocks();
37869 code = gen_int(n_code, 0);
37870
37871 ret_val = xmlUCSIsHighSurrogates(code);
37872 desret_int(ret_val);
37873 call_tests++;
37874 des_int(n_code, code, 0);
37875 xmlResetLastError();
37876 if (mem_base != xmlMemBlocks()) {
37877 printf("Leak of %d blocks found in xmlUCSIsHighSurrogates",
37878 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037879 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037880 printf(" %d", n_code);
37881 printf("\n");
37882 }
37883 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037884 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037885#endif
37886
Daniel Veillard42595322004-11-08 10:52:06 +000037887 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037888}
37889
37890
37891static int
37892test_xmlUCSIsHiragana(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037893 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037894
William M. Brack21e4ef22005-01-02 09:53:13 +000037895#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037896 int mem_base;
37897 int ret_val;
37898 int code; /* UCS code point */
37899 int n_code;
37900
37901 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37902 mem_base = xmlMemBlocks();
37903 code = gen_int(n_code, 0);
37904
37905 ret_val = xmlUCSIsHiragana(code);
37906 desret_int(ret_val);
37907 call_tests++;
37908 des_int(n_code, code, 0);
37909 xmlResetLastError();
37910 if (mem_base != xmlMemBlocks()) {
37911 printf("Leak of %d blocks found in xmlUCSIsHiragana",
37912 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037913 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037914 printf(" %d", n_code);
37915 printf("\n");
37916 }
37917 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037918 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037919#endif
37920
Daniel Veillard42595322004-11-08 10:52:06 +000037921 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037922}
37923
37924
37925static int
37926test_xmlUCSIsIPAExtensions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037927 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037928
William M. Brack21e4ef22005-01-02 09:53:13 +000037929#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037930 int mem_base;
37931 int ret_val;
37932 int code; /* UCS code point */
37933 int n_code;
37934
37935 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37936 mem_base = xmlMemBlocks();
37937 code = gen_int(n_code, 0);
37938
37939 ret_val = xmlUCSIsIPAExtensions(code);
37940 desret_int(ret_val);
37941 call_tests++;
37942 des_int(n_code, code, 0);
37943 xmlResetLastError();
37944 if (mem_base != xmlMemBlocks()) {
37945 printf("Leak of %d blocks found in xmlUCSIsIPAExtensions",
37946 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037947 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037948 printf(" %d", n_code);
37949 printf("\n");
37950 }
37951 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037952 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037953#endif
37954
Daniel Veillard42595322004-11-08 10:52:06 +000037955 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037956}
37957
37958
37959static int
37960test_xmlUCSIsIdeographicDescriptionCharacters(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037961 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037962
William M. Brack21e4ef22005-01-02 09:53:13 +000037963#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037964 int mem_base;
37965 int ret_val;
37966 int code; /* UCS code point */
37967 int n_code;
37968
37969 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37970 mem_base = xmlMemBlocks();
37971 code = gen_int(n_code, 0);
37972
37973 ret_val = xmlUCSIsIdeographicDescriptionCharacters(code);
37974 desret_int(ret_val);
37975 call_tests++;
37976 des_int(n_code, code, 0);
37977 xmlResetLastError();
37978 if (mem_base != xmlMemBlocks()) {
37979 printf("Leak of %d blocks found in xmlUCSIsIdeographicDescriptionCharacters",
37980 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037981 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037982 printf(" %d", n_code);
37983 printf("\n");
37984 }
37985 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037986 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037987#endif
37988
Daniel Veillard42595322004-11-08 10:52:06 +000037989 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037990}
37991
37992
37993static int
37994test_xmlUCSIsKanbun(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037995 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037996
William M. Brack21e4ef22005-01-02 09:53:13 +000037997#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037998 int mem_base;
37999 int ret_val;
38000 int code; /* UCS code point */
38001 int n_code;
38002
38003 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38004 mem_base = xmlMemBlocks();
38005 code = gen_int(n_code, 0);
38006
38007 ret_val = xmlUCSIsKanbun(code);
38008 desret_int(ret_val);
38009 call_tests++;
38010 des_int(n_code, code, 0);
38011 xmlResetLastError();
38012 if (mem_base != xmlMemBlocks()) {
38013 printf("Leak of %d blocks found in xmlUCSIsKanbun",
38014 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038015 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038016 printf(" %d", n_code);
38017 printf("\n");
38018 }
38019 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038020 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038021#endif
38022
Daniel Veillard42595322004-11-08 10:52:06 +000038023 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038024}
38025
38026
38027static int
38028test_xmlUCSIsKangxiRadicals(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038029 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038030
William M. Brack21e4ef22005-01-02 09:53:13 +000038031#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038032 int mem_base;
38033 int ret_val;
38034 int code; /* UCS code point */
38035 int n_code;
38036
38037 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38038 mem_base = xmlMemBlocks();
38039 code = gen_int(n_code, 0);
38040
38041 ret_val = xmlUCSIsKangxiRadicals(code);
38042 desret_int(ret_val);
38043 call_tests++;
38044 des_int(n_code, code, 0);
38045 xmlResetLastError();
38046 if (mem_base != xmlMemBlocks()) {
38047 printf("Leak of %d blocks found in xmlUCSIsKangxiRadicals",
38048 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038049 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038050 printf(" %d", n_code);
38051 printf("\n");
38052 }
38053 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038054 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038055#endif
38056
Daniel Veillard42595322004-11-08 10:52:06 +000038057 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038058}
38059
38060
38061static int
38062test_xmlUCSIsKannada(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038063 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038064
William M. Brack21e4ef22005-01-02 09:53:13 +000038065#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038066 int mem_base;
38067 int ret_val;
38068 int code; /* UCS code point */
38069 int n_code;
38070
38071 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38072 mem_base = xmlMemBlocks();
38073 code = gen_int(n_code, 0);
38074
38075 ret_val = xmlUCSIsKannada(code);
38076 desret_int(ret_val);
38077 call_tests++;
38078 des_int(n_code, code, 0);
38079 xmlResetLastError();
38080 if (mem_base != xmlMemBlocks()) {
38081 printf("Leak of %d blocks found in xmlUCSIsKannada",
38082 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038083 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038084 printf(" %d", n_code);
38085 printf("\n");
38086 }
38087 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038088 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038089#endif
38090
Daniel Veillard42595322004-11-08 10:52:06 +000038091 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038092}
38093
38094
38095static int
38096test_xmlUCSIsKatakana(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038097 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038098
William M. Brack21e4ef22005-01-02 09:53:13 +000038099#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038100 int mem_base;
38101 int ret_val;
38102 int code; /* UCS code point */
38103 int n_code;
38104
38105 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38106 mem_base = xmlMemBlocks();
38107 code = gen_int(n_code, 0);
38108
38109 ret_val = xmlUCSIsKatakana(code);
38110 desret_int(ret_val);
38111 call_tests++;
38112 des_int(n_code, code, 0);
38113 xmlResetLastError();
38114 if (mem_base != xmlMemBlocks()) {
38115 printf("Leak of %d blocks found in xmlUCSIsKatakana",
38116 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038117 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038118 printf(" %d", n_code);
38119 printf("\n");
38120 }
38121 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038122 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038123#endif
38124
Daniel Veillard42595322004-11-08 10:52:06 +000038125 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038126}
38127
38128
38129static int
38130test_xmlUCSIsKatakanaPhoneticExtensions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038131 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038132
William M. Brack21e4ef22005-01-02 09:53:13 +000038133#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038134 int mem_base;
38135 int ret_val;
38136 int code; /* UCS code point */
38137 int n_code;
38138
38139 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38140 mem_base = xmlMemBlocks();
38141 code = gen_int(n_code, 0);
38142
38143 ret_val = xmlUCSIsKatakanaPhoneticExtensions(code);
38144 desret_int(ret_val);
38145 call_tests++;
38146 des_int(n_code, code, 0);
38147 xmlResetLastError();
38148 if (mem_base != xmlMemBlocks()) {
38149 printf("Leak of %d blocks found in xmlUCSIsKatakanaPhoneticExtensions",
38150 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038151 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038152 printf(" %d", n_code);
38153 printf("\n");
38154 }
38155 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038156 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038157#endif
38158
Daniel Veillard42595322004-11-08 10:52:06 +000038159 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038160}
38161
38162
38163static int
38164test_xmlUCSIsKhmer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038165 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038166
William M. Brack21e4ef22005-01-02 09:53:13 +000038167#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038168 int mem_base;
38169 int ret_val;
38170 int code; /* UCS code point */
38171 int n_code;
38172
38173 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38174 mem_base = xmlMemBlocks();
38175 code = gen_int(n_code, 0);
38176
38177 ret_val = xmlUCSIsKhmer(code);
38178 desret_int(ret_val);
38179 call_tests++;
38180 des_int(n_code, code, 0);
38181 xmlResetLastError();
38182 if (mem_base != xmlMemBlocks()) {
38183 printf("Leak of %d blocks found in xmlUCSIsKhmer",
38184 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038185 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038186 printf(" %d", n_code);
38187 printf("\n");
38188 }
38189 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038190 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038191#endif
38192
Daniel Veillard42595322004-11-08 10:52:06 +000038193 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038194}
38195
38196
38197static int
38198test_xmlUCSIsKhmerSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038199 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038200
William M. Brack21e4ef22005-01-02 09:53:13 +000038201#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038202 int mem_base;
38203 int ret_val;
38204 int code; /* UCS code point */
38205 int n_code;
38206
38207 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38208 mem_base = xmlMemBlocks();
38209 code = gen_int(n_code, 0);
38210
38211 ret_val = xmlUCSIsKhmerSymbols(code);
38212 desret_int(ret_val);
38213 call_tests++;
38214 des_int(n_code, code, 0);
38215 xmlResetLastError();
38216 if (mem_base != xmlMemBlocks()) {
38217 printf("Leak of %d blocks found in xmlUCSIsKhmerSymbols",
38218 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038219 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038220 printf(" %d", n_code);
38221 printf("\n");
38222 }
38223 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038224 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038225#endif
38226
Daniel Veillard42595322004-11-08 10:52:06 +000038227 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038228}
38229
38230
38231static int
38232test_xmlUCSIsLao(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038233 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038234
William M. Brack21e4ef22005-01-02 09:53:13 +000038235#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038236 int mem_base;
38237 int ret_val;
38238 int code; /* UCS code point */
38239 int n_code;
38240
38241 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38242 mem_base = xmlMemBlocks();
38243 code = gen_int(n_code, 0);
38244
38245 ret_val = xmlUCSIsLao(code);
38246 desret_int(ret_val);
38247 call_tests++;
38248 des_int(n_code, code, 0);
38249 xmlResetLastError();
38250 if (mem_base != xmlMemBlocks()) {
38251 printf("Leak of %d blocks found in xmlUCSIsLao",
38252 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038253 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038254 printf(" %d", n_code);
38255 printf("\n");
38256 }
38257 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038258 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038259#endif
38260
Daniel Veillard42595322004-11-08 10:52:06 +000038261 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038262}
38263
38264
38265static int
38266test_xmlUCSIsLatin1Supplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038267 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038268
William M. Brack21e4ef22005-01-02 09:53:13 +000038269#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038270 int mem_base;
38271 int ret_val;
38272 int code; /* UCS code point */
38273 int n_code;
38274
38275 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38276 mem_base = xmlMemBlocks();
38277 code = gen_int(n_code, 0);
38278
38279 ret_val = xmlUCSIsLatin1Supplement(code);
38280 desret_int(ret_val);
38281 call_tests++;
38282 des_int(n_code, code, 0);
38283 xmlResetLastError();
38284 if (mem_base != xmlMemBlocks()) {
38285 printf("Leak of %d blocks found in xmlUCSIsLatin1Supplement",
38286 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038287 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038288 printf(" %d", n_code);
38289 printf("\n");
38290 }
38291 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038292 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038293#endif
38294
Daniel Veillard42595322004-11-08 10:52:06 +000038295 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038296}
38297
38298
38299static int
38300test_xmlUCSIsLatinExtendedA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038301 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038302
William M. Brack21e4ef22005-01-02 09:53:13 +000038303#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038304 int mem_base;
38305 int ret_val;
38306 int code; /* UCS code point */
38307 int n_code;
38308
38309 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38310 mem_base = xmlMemBlocks();
38311 code = gen_int(n_code, 0);
38312
38313 ret_val = xmlUCSIsLatinExtendedA(code);
38314 desret_int(ret_val);
38315 call_tests++;
38316 des_int(n_code, code, 0);
38317 xmlResetLastError();
38318 if (mem_base != xmlMemBlocks()) {
38319 printf("Leak of %d blocks found in xmlUCSIsLatinExtendedA",
38320 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038321 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038322 printf(" %d", n_code);
38323 printf("\n");
38324 }
38325 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038326 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038327#endif
38328
Daniel Veillard42595322004-11-08 10:52:06 +000038329 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038330}
38331
38332
38333static int
38334test_xmlUCSIsLatinExtendedAdditional(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038335 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038336
William M. Brack21e4ef22005-01-02 09:53:13 +000038337#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038338 int mem_base;
38339 int ret_val;
38340 int code; /* UCS code point */
38341 int n_code;
38342
38343 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38344 mem_base = xmlMemBlocks();
38345 code = gen_int(n_code, 0);
38346
38347 ret_val = xmlUCSIsLatinExtendedAdditional(code);
38348 desret_int(ret_val);
38349 call_tests++;
38350 des_int(n_code, code, 0);
38351 xmlResetLastError();
38352 if (mem_base != xmlMemBlocks()) {
38353 printf("Leak of %d blocks found in xmlUCSIsLatinExtendedAdditional",
38354 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038355 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038356 printf(" %d", n_code);
38357 printf("\n");
38358 }
38359 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038360 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038361#endif
38362
Daniel Veillard42595322004-11-08 10:52:06 +000038363 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038364}
38365
38366
38367static int
38368test_xmlUCSIsLatinExtendedB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038369 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038370
William M. Brack21e4ef22005-01-02 09:53:13 +000038371#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038372 int mem_base;
38373 int ret_val;
38374 int code; /* UCS code point */
38375 int n_code;
38376
38377 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38378 mem_base = xmlMemBlocks();
38379 code = gen_int(n_code, 0);
38380
38381 ret_val = xmlUCSIsLatinExtendedB(code);
38382 desret_int(ret_val);
38383 call_tests++;
38384 des_int(n_code, code, 0);
38385 xmlResetLastError();
38386 if (mem_base != xmlMemBlocks()) {
38387 printf("Leak of %d blocks found in xmlUCSIsLatinExtendedB",
38388 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038389 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038390 printf(" %d", n_code);
38391 printf("\n");
38392 }
38393 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038394 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038395#endif
38396
Daniel Veillard42595322004-11-08 10:52:06 +000038397 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038398}
38399
38400
38401static int
38402test_xmlUCSIsLetterlikeSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038403 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038404
William M. Brack21e4ef22005-01-02 09:53:13 +000038405#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038406 int mem_base;
38407 int ret_val;
38408 int code; /* UCS code point */
38409 int n_code;
38410
38411 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38412 mem_base = xmlMemBlocks();
38413 code = gen_int(n_code, 0);
38414
38415 ret_val = xmlUCSIsLetterlikeSymbols(code);
38416 desret_int(ret_val);
38417 call_tests++;
38418 des_int(n_code, code, 0);
38419 xmlResetLastError();
38420 if (mem_base != xmlMemBlocks()) {
38421 printf("Leak of %d blocks found in xmlUCSIsLetterlikeSymbols",
38422 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038423 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038424 printf(" %d", n_code);
38425 printf("\n");
38426 }
38427 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038428 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038429#endif
38430
Daniel Veillard42595322004-11-08 10:52:06 +000038431 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038432}
38433
38434
38435static int
38436test_xmlUCSIsLimbu(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038437 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038438
William M. Brack21e4ef22005-01-02 09:53:13 +000038439#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038440 int mem_base;
38441 int ret_val;
38442 int code; /* UCS code point */
38443 int n_code;
38444
38445 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38446 mem_base = xmlMemBlocks();
38447 code = gen_int(n_code, 0);
38448
38449 ret_val = xmlUCSIsLimbu(code);
38450 desret_int(ret_val);
38451 call_tests++;
38452 des_int(n_code, code, 0);
38453 xmlResetLastError();
38454 if (mem_base != xmlMemBlocks()) {
38455 printf("Leak of %d blocks found in xmlUCSIsLimbu",
38456 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038457 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038458 printf(" %d", n_code);
38459 printf("\n");
38460 }
38461 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038462 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038463#endif
38464
Daniel Veillard42595322004-11-08 10:52:06 +000038465 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038466}
38467
38468
38469static int
38470test_xmlUCSIsLinearBIdeograms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038471 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038472
William M. Brack21e4ef22005-01-02 09:53:13 +000038473#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038474 int mem_base;
38475 int ret_val;
38476 int code; /* UCS code point */
38477 int n_code;
38478
38479 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38480 mem_base = xmlMemBlocks();
38481 code = gen_int(n_code, 0);
38482
38483 ret_val = xmlUCSIsLinearBIdeograms(code);
38484 desret_int(ret_val);
38485 call_tests++;
38486 des_int(n_code, code, 0);
38487 xmlResetLastError();
38488 if (mem_base != xmlMemBlocks()) {
38489 printf("Leak of %d blocks found in xmlUCSIsLinearBIdeograms",
38490 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038491 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038492 printf(" %d", n_code);
38493 printf("\n");
38494 }
38495 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038496 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038497#endif
38498
Daniel Veillard42595322004-11-08 10:52:06 +000038499 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038500}
38501
38502
38503static int
38504test_xmlUCSIsLinearBSyllabary(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038505 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038506
William M. Brack21e4ef22005-01-02 09:53:13 +000038507#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038508 int mem_base;
38509 int ret_val;
38510 int code; /* UCS code point */
38511 int n_code;
38512
38513 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38514 mem_base = xmlMemBlocks();
38515 code = gen_int(n_code, 0);
38516
38517 ret_val = xmlUCSIsLinearBSyllabary(code);
38518 desret_int(ret_val);
38519 call_tests++;
38520 des_int(n_code, code, 0);
38521 xmlResetLastError();
38522 if (mem_base != xmlMemBlocks()) {
38523 printf("Leak of %d blocks found in xmlUCSIsLinearBSyllabary",
38524 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038525 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038526 printf(" %d", n_code);
38527 printf("\n");
38528 }
38529 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038530 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038531#endif
38532
Daniel Veillard42595322004-11-08 10:52:06 +000038533 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038534}
38535
38536
38537static int
38538test_xmlUCSIsLowSurrogates(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038539 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038540
William M. Brack21e4ef22005-01-02 09:53:13 +000038541#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038542 int mem_base;
38543 int ret_val;
38544 int code; /* UCS code point */
38545 int n_code;
38546
38547 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38548 mem_base = xmlMemBlocks();
38549 code = gen_int(n_code, 0);
38550
38551 ret_val = xmlUCSIsLowSurrogates(code);
38552 desret_int(ret_val);
38553 call_tests++;
38554 des_int(n_code, code, 0);
38555 xmlResetLastError();
38556 if (mem_base != xmlMemBlocks()) {
38557 printf("Leak of %d blocks found in xmlUCSIsLowSurrogates",
38558 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038559 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038560 printf(" %d", n_code);
38561 printf("\n");
38562 }
38563 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038564 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038565#endif
38566
Daniel Veillard42595322004-11-08 10:52:06 +000038567 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038568}
38569
38570
38571static int
38572test_xmlUCSIsMalayalam(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038573 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038574
William M. Brack21e4ef22005-01-02 09:53:13 +000038575#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038576 int mem_base;
38577 int ret_val;
38578 int code; /* UCS code point */
38579 int n_code;
38580
38581 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38582 mem_base = xmlMemBlocks();
38583 code = gen_int(n_code, 0);
38584
38585 ret_val = xmlUCSIsMalayalam(code);
38586 desret_int(ret_val);
38587 call_tests++;
38588 des_int(n_code, code, 0);
38589 xmlResetLastError();
38590 if (mem_base != xmlMemBlocks()) {
38591 printf("Leak of %d blocks found in xmlUCSIsMalayalam",
38592 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038593 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038594 printf(" %d", n_code);
38595 printf("\n");
38596 }
38597 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038598 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038599#endif
38600
Daniel Veillard42595322004-11-08 10:52:06 +000038601 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038602}
38603
38604
38605static int
38606test_xmlUCSIsMathematicalAlphanumericSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038607 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038608
William M. Brack21e4ef22005-01-02 09:53:13 +000038609#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038610 int mem_base;
38611 int ret_val;
38612 int code; /* UCS code point */
38613 int n_code;
38614
38615 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38616 mem_base = xmlMemBlocks();
38617 code = gen_int(n_code, 0);
38618
38619 ret_val = xmlUCSIsMathematicalAlphanumericSymbols(code);
38620 desret_int(ret_val);
38621 call_tests++;
38622 des_int(n_code, code, 0);
38623 xmlResetLastError();
38624 if (mem_base != xmlMemBlocks()) {
38625 printf("Leak of %d blocks found in xmlUCSIsMathematicalAlphanumericSymbols",
38626 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038627 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038628 printf(" %d", n_code);
38629 printf("\n");
38630 }
38631 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038632 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038633#endif
38634
Daniel Veillard42595322004-11-08 10:52:06 +000038635 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038636}
38637
38638
38639static int
38640test_xmlUCSIsMathematicalOperators(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038641 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038642
William M. Brack21e4ef22005-01-02 09:53:13 +000038643#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038644 int mem_base;
38645 int ret_val;
38646 int code; /* UCS code point */
38647 int n_code;
38648
38649 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38650 mem_base = xmlMemBlocks();
38651 code = gen_int(n_code, 0);
38652
38653 ret_val = xmlUCSIsMathematicalOperators(code);
38654 desret_int(ret_val);
38655 call_tests++;
38656 des_int(n_code, code, 0);
38657 xmlResetLastError();
38658 if (mem_base != xmlMemBlocks()) {
38659 printf("Leak of %d blocks found in xmlUCSIsMathematicalOperators",
38660 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038661 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038662 printf(" %d", n_code);
38663 printf("\n");
38664 }
38665 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038666 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038667#endif
38668
Daniel Veillard42595322004-11-08 10:52:06 +000038669 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038670}
38671
38672
38673static int
38674test_xmlUCSIsMiscellaneousMathematicalSymbolsA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038675 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038676
William M. Brack21e4ef22005-01-02 09:53:13 +000038677#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038678 int mem_base;
38679 int ret_val;
38680 int code; /* UCS code point */
38681 int n_code;
38682
38683 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38684 mem_base = xmlMemBlocks();
38685 code = gen_int(n_code, 0);
38686
38687 ret_val = xmlUCSIsMiscellaneousMathematicalSymbolsA(code);
38688 desret_int(ret_val);
38689 call_tests++;
38690 des_int(n_code, code, 0);
38691 xmlResetLastError();
38692 if (mem_base != xmlMemBlocks()) {
38693 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousMathematicalSymbolsA",
38694 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038695 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038696 printf(" %d", n_code);
38697 printf("\n");
38698 }
38699 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038700 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038701#endif
38702
Daniel Veillard42595322004-11-08 10:52:06 +000038703 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038704}
38705
38706
38707static int
38708test_xmlUCSIsMiscellaneousMathematicalSymbolsB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038709 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038710
William M. Brack21e4ef22005-01-02 09:53:13 +000038711#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038712 int mem_base;
38713 int ret_val;
38714 int code; /* UCS code point */
38715 int n_code;
38716
38717 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38718 mem_base = xmlMemBlocks();
38719 code = gen_int(n_code, 0);
38720
38721 ret_val = xmlUCSIsMiscellaneousMathematicalSymbolsB(code);
38722 desret_int(ret_val);
38723 call_tests++;
38724 des_int(n_code, code, 0);
38725 xmlResetLastError();
38726 if (mem_base != xmlMemBlocks()) {
38727 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousMathematicalSymbolsB",
38728 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038729 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038730 printf(" %d", n_code);
38731 printf("\n");
38732 }
38733 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038734 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038735#endif
38736
Daniel Veillard42595322004-11-08 10:52:06 +000038737 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038738}
38739
38740
38741static int
38742test_xmlUCSIsMiscellaneousSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038743 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038744
William M. Brack21e4ef22005-01-02 09:53:13 +000038745#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038746 int mem_base;
38747 int ret_val;
38748 int code; /* UCS code point */
38749 int n_code;
38750
38751 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38752 mem_base = xmlMemBlocks();
38753 code = gen_int(n_code, 0);
38754
38755 ret_val = xmlUCSIsMiscellaneousSymbols(code);
38756 desret_int(ret_val);
38757 call_tests++;
38758 des_int(n_code, code, 0);
38759 xmlResetLastError();
38760 if (mem_base != xmlMemBlocks()) {
38761 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousSymbols",
38762 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038763 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038764 printf(" %d", n_code);
38765 printf("\n");
38766 }
38767 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038768 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038769#endif
38770
Daniel Veillard42595322004-11-08 10:52:06 +000038771 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038772}
38773
38774
38775static int
38776test_xmlUCSIsMiscellaneousSymbolsandArrows(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038777 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038778
William M. Brack21e4ef22005-01-02 09:53:13 +000038779#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038780 int mem_base;
38781 int ret_val;
38782 int code; /* UCS code point */
38783 int n_code;
38784
38785 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38786 mem_base = xmlMemBlocks();
38787 code = gen_int(n_code, 0);
38788
38789 ret_val = xmlUCSIsMiscellaneousSymbolsandArrows(code);
38790 desret_int(ret_val);
38791 call_tests++;
38792 des_int(n_code, code, 0);
38793 xmlResetLastError();
38794 if (mem_base != xmlMemBlocks()) {
38795 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousSymbolsandArrows",
38796 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038797 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038798 printf(" %d", n_code);
38799 printf("\n");
38800 }
38801 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038802 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038803#endif
38804
Daniel Veillard42595322004-11-08 10:52:06 +000038805 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038806}
38807
38808
38809static int
38810test_xmlUCSIsMiscellaneousTechnical(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038811 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038812
William M. Brack21e4ef22005-01-02 09:53:13 +000038813#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038814 int mem_base;
38815 int ret_val;
38816 int code; /* UCS code point */
38817 int n_code;
38818
38819 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38820 mem_base = xmlMemBlocks();
38821 code = gen_int(n_code, 0);
38822
38823 ret_val = xmlUCSIsMiscellaneousTechnical(code);
38824 desret_int(ret_val);
38825 call_tests++;
38826 des_int(n_code, code, 0);
38827 xmlResetLastError();
38828 if (mem_base != xmlMemBlocks()) {
38829 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousTechnical",
38830 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038831 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038832 printf(" %d", n_code);
38833 printf("\n");
38834 }
38835 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038836 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038837#endif
38838
Daniel Veillard42595322004-11-08 10:52:06 +000038839 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038840}
38841
38842
38843static int
38844test_xmlUCSIsMongolian(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038845 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038846
William M. Brack21e4ef22005-01-02 09:53:13 +000038847#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038848 int mem_base;
38849 int ret_val;
38850 int code; /* UCS code point */
38851 int n_code;
38852
38853 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38854 mem_base = xmlMemBlocks();
38855 code = gen_int(n_code, 0);
38856
38857 ret_val = xmlUCSIsMongolian(code);
38858 desret_int(ret_val);
38859 call_tests++;
38860 des_int(n_code, code, 0);
38861 xmlResetLastError();
38862 if (mem_base != xmlMemBlocks()) {
38863 printf("Leak of %d blocks found in xmlUCSIsMongolian",
38864 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038865 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038866 printf(" %d", n_code);
38867 printf("\n");
38868 }
38869 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038870 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038871#endif
38872
Daniel Veillard42595322004-11-08 10:52:06 +000038873 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038874}
38875
38876
38877static int
38878test_xmlUCSIsMusicalSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038879 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038880
William M. Brack21e4ef22005-01-02 09:53:13 +000038881#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038882 int mem_base;
38883 int ret_val;
38884 int code; /* UCS code point */
38885 int n_code;
38886
38887 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38888 mem_base = xmlMemBlocks();
38889 code = gen_int(n_code, 0);
38890
38891 ret_val = xmlUCSIsMusicalSymbols(code);
38892 desret_int(ret_val);
38893 call_tests++;
38894 des_int(n_code, code, 0);
38895 xmlResetLastError();
38896 if (mem_base != xmlMemBlocks()) {
38897 printf("Leak of %d blocks found in xmlUCSIsMusicalSymbols",
38898 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038899 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038900 printf(" %d", n_code);
38901 printf("\n");
38902 }
38903 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038904 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038905#endif
38906
Daniel Veillard42595322004-11-08 10:52:06 +000038907 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038908}
38909
38910
38911static int
38912test_xmlUCSIsMyanmar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038913 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038914
William M. Brack21e4ef22005-01-02 09:53:13 +000038915#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038916 int mem_base;
38917 int ret_val;
38918 int code; /* UCS code point */
38919 int n_code;
38920
38921 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38922 mem_base = xmlMemBlocks();
38923 code = gen_int(n_code, 0);
38924
38925 ret_val = xmlUCSIsMyanmar(code);
38926 desret_int(ret_val);
38927 call_tests++;
38928 des_int(n_code, code, 0);
38929 xmlResetLastError();
38930 if (mem_base != xmlMemBlocks()) {
38931 printf("Leak of %d blocks found in xmlUCSIsMyanmar",
38932 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038933 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038934 printf(" %d", n_code);
38935 printf("\n");
38936 }
38937 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038938 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038939#endif
38940
Daniel Veillard42595322004-11-08 10:52:06 +000038941 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038942}
38943
38944
38945static int
38946test_xmlUCSIsNumberForms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038947 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038948
William M. Brack21e4ef22005-01-02 09:53:13 +000038949#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038950 int mem_base;
38951 int ret_val;
38952 int code; /* UCS code point */
38953 int n_code;
38954
38955 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38956 mem_base = xmlMemBlocks();
38957 code = gen_int(n_code, 0);
38958
38959 ret_val = xmlUCSIsNumberForms(code);
38960 desret_int(ret_val);
38961 call_tests++;
38962 des_int(n_code, code, 0);
38963 xmlResetLastError();
38964 if (mem_base != xmlMemBlocks()) {
38965 printf("Leak of %d blocks found in xmlUCSIsNumberForms",
38966 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038967 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038968 printf(" %d", n_code);
38969 printf("\n");
38970 }
38971 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038972 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038973#endif
38974
Daniel Veillard42595322004-11-08 10:52:06 +000038975 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038976}
38977
38978
38979static int
38980test_xmlUCSIsOgham(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038981 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038982
William M. Brack21e4ef22005-01-02 09:53:13 +000038983#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038984 int mem_base;
38985 int ret_val;
38986 int code; /* UCS code point */
38987 int n_code;
38988
38989 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38990 mem_base = xmlMemBlocks();
38991 code = gen_int(n_code, 0);
38992
38993 ret_val = xmlUCSIsOgham(code);
38994 desret_int(ret_val);
38995 call_tests++;
38996 des_int(n_code, code, 0);
38997 xmlResetLastError();
38998 if (mem_base != xmlMemBlocks()) {
38999 printf("Leak of %d blocks found in xmlUCSIsOgham",
39000 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039001 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039002 printf(" %d", n_code);
39003 printf("\n");
39004 }
39005 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039006 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039007#endif
39008
Daniel Veillard42595322004-11-08 10:52:06 +000039009 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039010}
39011
39012
39013static int
39014test_xmlUCSIsOldItalic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039015 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039016
William M. Brack21e4ef22005-01-02 09:53:13 +000039017#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039018 int mem_base;
39019 int ret_val;
39020 int code; /* UCS code point */
39021 int n_code;
39022
39023 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39024 mem_base = xmlMemBlocks();
39025 code = gen_int(n_code, 0);
39026
39027 ret_val = xmlUCSIsOldItalic(code);
39028 desret_int(ret_val);
39029 call_tests++;
39030 des_int(n_code, code, 0);
39031 xmlResetLastError();
39032 if (mem_base != xmlMemBlocks()) {
39033 printf("Leak of %d blocks found in xmlUCSIsOldItalic",
39034 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039035 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039036 printf(" %d", n_code);
39037 printf("\n");
39038 }
39039 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039040 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039041#endif
39042
Daniel Veillard42595322004-11-08 10:52:06 +000039043 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039044}
39045
39046
39047static int
39048test_xmlUCSIsOpticalCharacterRecognition(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039049 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039050
William M. Brack21e4ef22005-01-02 09:53:13 +000039051#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039052 int mem_base;
39053 int ret_val;
39054 int code; /* UCS code point */
39055 int n_code;
39056
39057 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39058 mem_base = xmlMemBlocks();
39059 code = gen_int(n_code, 0);
39060
39061 ret_val = xmlUCSIsOpticalCharacterRecognition(code);
39062 desret_int(ret_val);
39063 call_tests++;
39064 des_int(n_code, code, 0);
39065 xmlResetLastError();
39066 if (mem_base != xmlMemBlocks()) {
39067 printf("Leak of %d blocks found in xmlUCSIsOpticalCharacterRecognition",
39068 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039069 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039070 printf(" %d", n_code);
39071 printf("\n");
39072 }
39073 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039074 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039075#endif
39076
Daniel Veillard42595322004-11-08 10:52:06 +000039077 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039078}
39079
39080
39081static int
39082test_xmlUCSIsOriya(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039083 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039084
William M. Brack21e4ef22005-01-02 09:53:13 +000039085#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039086 int mem_base;
39087 int ret_val;
39088 int code; /* UCS code point */
39089 int n_code;
39090
39091 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39092 mem_base = xmlMemBlocks();
39093 code = gen_int(n_code, 0);
39094
39095 ret_val = xmlUCSIsOriya(code);
39096 desret_int(ret_val);
39097 call_tests++;
39098 des_int(n_code, code, 0);
39099 xmlResetLastError();
39100 if (mem_base != xmlMemBlocks()) {
39101 printf("Leak of %d blocks found in xmlUCSIsOriya",
39102 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039103 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039104 printf(" %d", n_code);
39105 printf("\n");
39106 }
39107 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039108 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039109#endif
39110
Daniel Veillard42595322004-11-08 10:52:06 +000039111 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039112}
39113
39114
39115static int
39116test_xmlUCSIsOsmanya(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039117 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039118
William M. Brack21e4ef22005-01-02 09:53:13 +000039119#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039120 int mem_base;
39121 int ret_val;
39122 int code; /* UCS code point */
39123 int n_code;
39124
39125 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39126 mem_base = xmlMemBlocks();
39127 code = gen_int(n_code, 0);
39128
39129 ret_val = xmlUCSIsOsmanya(code);
39130 desret_int(ret_val);
39131 call_tests++;
39132 des_int(n_code, code, 0);
39133 xmlResetLastError();
39134 if (mem_base != xmlMemBlocks()) {
39135 printf("Leak of %d blocks found in xmlUCSIsOsmanya",
39136 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039137 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039138 printf(" %d", n_code);
39139 printf("\n");
39140 }
39141 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039142 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039143#endif
39144
Daniel Veillard42595322004-11-08 10:52:06 +000039145 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039146}
39147
39148
39149static int
39150test_xmlUCSIsPhoneticExtensions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039151 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039152
William M. Brack21e4ef22005-01-02 09:53:13 +000039153#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039154 int mem_base;
39155 int ret_val;
39156 int code; /* UCS code point */
39157 int n_code;
39158
39159 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39160 mem_base = xmlMemBlocks();
39161 code = gen_int(n_code, 0);
39162
39163 ret_val = xmlUCSIsPhoneticExtensions(code);
39164 desret_int(ret_val);
39165 call_tests++;
39166 des_int(n_code, code, 0);
39167 xmlResetLastError();
39168 if (mem_base != xmlMemBlocks()) {
39169 printf("Leak of %d blocks found in xmlUCSIsPhoneticExtensions",
39170 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039171 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039172 printf(" %d", n_code);
39173 printf("\n");
39174 }
39175 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039176 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039177#endif
39178
Daniel Veillard42595322004-11-08 10:52:06 +000039179 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039180}
39181
39182
39183static int
39184test_xmlUCSIsPrivateUse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039185 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039186
William M. Brack21e4ef22005-01-02 09:53:13 +000039187#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039188 int mem_base;
39189 int ret_val;
39190 int code; /* UCS code point */
39191 int n_code;
39192
39193 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39194 mem_base = xmlMemBlocks();
39195 code = gen_int(n_code, 0);
39196
39197 ret_val = xmlUCSIsPrivateUse(code);
39198 desret_int(ret_val);
39199 call_tests++;
39200 des_int(n_code, code, 0);
39201 xmlResetLastError();
39202 if (mem_base != xmlMemBlocks()) {
39203 printf("Leak of %d blocks found in xmlUCSIsPrivateUse",
39204 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039205 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039206 printf(" %d", n_code);
39207 printf("\n");
39208 }
39209 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039210 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039211#endif
39212
Daniel Veillard42595322004-11-08 10:52:06 +000039213 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039214}
39215
39216
39217static int
39218test_xmlUCSIsPrivateUseArea(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039219 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039220
William M. Brack21e4ef22005-01-02 09:53:13 +000039221#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039222 int mem_base;
39223 int ret_val;
39224 int code; /* UCS code point */
39225 int n_code;
39226
39227 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39228 mem_base = xmlMemBlocks();
39229 code = gen_int(n_code, 0);
39230
39231 ret_val = xmlUCSIsPrivateUseArea(code);
39232 desret_int(ret_val);
39233 call_tests++;
39234 des_int(n_code, code, 0);
39235 xmlResetLastError();
39236 if (mem_base != xmlMemBlocks()) {
39237 printf("Leak of %d blocks found in xmlUCSIsPrivateUseArea",
39238 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039239 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039240 printf(" %d", n_code);
39241 printf("\n");
39242 }
39243 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039244 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039245#endif
39246
Daniel Veillard42595322004-11-08 10:52:06 +000039247 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039248}
39249
39250
39251static int
39252test_xmlUCSIsRunic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039253 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039254
William M. Brack21e4ef22005-01-02 09:53:13 +000039255#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039256 int mem_base;
39257 int ret_val;
39258 int code; /* UCS code point */
39259 int n_code;
39260
39261 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39262 mem_base = xmlMemBlocks();
39263 code = gen_int(n_code, 0);
39264
39265 ret_val = xmlUCSIsRunic(code);
39266 desret_int(ret_val);
39267 call_tests++;
39268 des_int(n_code, code, 0);
39269 xmlResetLastError();
39270 if (mem_base != xmlMemBlocks()) {
39271 printf("Leak of %d blocks found in xmlUCSIsRunic",
39272 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039273 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039274 printf(" %d", n_code);
39275 printf("\n");
39276 }
39277 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039278 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039279#endif
39280
Daniel Veillard42595322004-11-08 10:52:06 +000039281 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039282}
39283
39284
39285static int
39286test_xmlUCSIsShavian(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039287 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039288
William M. Brack21e4ef22005-01-02 09:53:13 +000039289#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039290 int mem_base;
39291 int ret_val;
39292 int code; /* UCS code point */
39293 int n_code;
39294
39295 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39296 mem_base = xmlMemBlocks();
39297 code = gen_int(n_code, 0);
39298
39299 ret_val = xmlUCSIsShavian(code);
39300 desret_int(ret_val);
39301 call_tests++;
39302 des_int(n_code, code, 0);
39303 xmlResetLastError();
39304 if (mem_base != xmlMemBlocks()) {
39305 printf("Leak of %d blocks found in xmlUCSIsShavian",
39306 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039307 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039308 printf(" %d", n_code);
39309 printf("\n");
39310 }
39311 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039312 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039313#endif
39314
Daniel Veillard42595322004-11-08 10:52:06 +000039315 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039316}
39317
39318
39319static int
39320test_xmlUCSIsSinhala(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039321 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039322
William M. Brack21e4ef22005-01-02 09:53:13 +000039323#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039324 int mem_base;
39325 int ret_val;
39326 int code; /* UCS code point */
39327 int n_code;
39328
39329 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39330 mem_base = xmlMemBlocks();
39331 code = gen_int(n_code, 0);
39332
39333 ret_val = xmlUCSIsSinhala(code);
39334 desret_int(ret_val);
39335 call_tests++;
39336 des_int(n_code, code, 0);
39337 xmlResetLastError();
39338 if (mem_base != xmlMemBlocks()) {
39339 printf("Leak of %d blocks found in xmlUCSIsSinhala",
39340 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039341 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039342 printf(" %d", n_code);
39343 printf("\n");
39344 }
39345 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039346 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039347#endif
39348
Daniel Veillard42595322004-11-08 10:52:06 +000039349 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039350}
39351
39352
39353static int
39354test_xmlUCSIsSmallFormVariants(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039355 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039356
William M. Brack21e4ef22005-01-02 09:53:13 +000039357#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039358 int mem_base;
39359 int ret_val;
39360 int code; /* UCS code point */
39361 int n_code;
39362
39363 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39364 mem_base = xmlMemBlocks();
39365 code = gen_int(n_code, 0);
39366
39367 ret_val = xmlUCSIsSmallFormVariants(code);
39368 desret_int(ret_val);
39369 call_tests++;
39370 des_int(n_code, code, 0);
39371 xmlResetLastError();
39372 if (mem_base != xmlMemBlocks()) {
39373 printf("Leak of %d blocks found in xmlUCSIsSmallFormVariants",
39374 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039375 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039376 printf(" %d", n_code);
39377 printf("\n");
39378 }
39379 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039380 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039381#endif
39382
Daniel Veillard42595322004-11-08 10:52:06 +000039383 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039384}
39385
39386
39387static int
39388test_xmlUCSIsSpacingModifierLetters(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039389 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039390
William M. Brack21e4ef22005-01-02 09:53:13 +000039391#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039392 int mem_base;
39393 int ret_val;
39394 int code; /* UCS code point */
39395 int n_code;
39396
39397 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39398 mem_base = xmlMemBlocks();
39399 code = gen_int(n_code, 0);
39400
39401 ret_val = xmlUCSIsSpacingModifierLetters(code);
39402 desret_int(ret_val);
39403 call_tests++;
39404 des_int(n_code, code, 0);
39405 xmlResetLastError();
39406 if (mem_base != xmlMemBlocks()) {
39407 printf("Leak of %d blocks found in xmlUCSIsSpacingModifierLetters",
39408 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039409 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039410 printf(" %d", n_code);
39411 printf("\n");
39412 }
39413 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039414 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039415#endif
39416
Daniel Veillard42595322004-11-08 10:52:06 +000039417 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039418}
39419
39420
39421static int
39422test_xmlUCSIsSpecials(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039423 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039424
William M. Brack21e4ef22005-01-02 09:53:13 +000039425#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039426 int mem_base;
39427 int ret_val;
39428 int code; /* UCS code point */
39429 int n_code;
39430
39431 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39432 mem_base = xmlMemBlocks();
39433 code = gen_int(n_code, 0);
39434
39435 ret_val = xmlUCSIsSpecials(code);
39436 desret_int(ret_val);
39437 call_tests++;
39438 des_int(n_code, code, 0);
39439 xmlResetLastError();
39440 if (mem_base != xmlMemBlocks()) {
39441 printf("Leak of %d blocks found in xmlUCSIsSpecials",
39442 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039443 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039444 printf(" %d", n_code);
39445 printf("\n");
39446 }
39447 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039448 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039449#endif
39450
Daniel Veillard42595322004-11-08 10:52:06 +000039451 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039452}
39453
39454
39455static int
39456test_xmlUCSIsSuperscriptsandSubscripts(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039457 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039458
William M. Brack21e4ef22005-01-02 09:53:13 +000039459#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039460 int mem_base;
39461 int ret_val;
39462 int code; /* UCS code point */
39463 int n_code;
39464
39465 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39466 mem_base = xmlMemBlocks();
39467 code = gen_int(n_code, 0);
39468
39469 ret_val = xmlUCSIsSuperscriptsandSubscripts(code);
39470 desret_int(ret_val);
39471 call_tests++;
39472 des_int(n_code, code, 0);
39473 xmlResetLastError();
39474 if (mem_base != xmlMemBlocks()) {
39475 printf("Leak of %d blocks found in xmlUCSIsSuperscriptsandSubscripts",
39476 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039477 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039478 printf(" %d", n_code);
39479 printf("\n");
39480 }
39481 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039482 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039483#endif
39484
Daniel Veillard42595322004-11-08 10:52:06 +000039485 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039486}
39487
39488
39489static int
39490test_xmlUCSIsSupplementalArrowsA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039491 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039492
William M. Brack21e4ef22005-01-02 09:53:13 +000039493#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039494 int mem_base;
39495 int ret_val;
39496 int code; /* UCS code point */
39497 int n_code;
39498
39499 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39500 mem_base = xmlMemBlocks();
39501 code = gen_int(n_code, 0);
39502
39503 ret_val = xmlUCSIsSupplementalArrowsA(code);
39504 desret_int(ret_val);
39505 call_tests++;
39506 des_int(n_code, code, 0);
39507 xmlResetLastError();
39508 if (mem_base != xmlMemBlocks()) {
39509 printf("Leak of %d blocks found in xmlUCSIsSupplementalArrowsA",
39510 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039511 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039512 printf(" %d", n_code);
39513 printf("\n");
39514 }
39515 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039516 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039517#endif
39518
Daniel Veillard42595322004-11-08 10:52:06 +000039519 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039520}
39521
39522
39523static int
39524test_xmlUCSIsSupplementalArrowsB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039525 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039526
William M. Brack21e4ef22005-01-02 09:53:13 +000039527#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039528 int mem_base;
39529 int ret_val;
39530 int code; /* UCS code point */
39531 int n_code;
39532
39533 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39534 mem_base = xmlMemBlocks();
39535 code = gen_int(n_code, 0);
39536
39537 ret_val = xmlUCSIsSupplementalArrowsB(code);
39538 desret_int(ret_val);
39539 call_tests++;
39540 des_int(n_code, code, 0);
39541 xmlResetLastError();
39542 if (mem_base != xmlMemBlocks()) {
39543 printf("Leak of %d blocks found in xmlUCSIsSupplementalArrowsB",
39544 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039545 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039546 printf(" %d", n_code);
39547 printf("\n");
39548 }
39549 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039550 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039551#endif
39552
Daniel Veillard42595322004-11-08 10:52:06 +000039553 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039554}
39555
39556
39557static int
39558test_xmlUCSIsSupplementalMathematicalOperators(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039559 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039560
William M. Brack21e4ef22005-01-02 09:53:13 +000039561#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039562 int mem_base;
39563 int ret_val;
39564 int code; /* UCS code point */
39565 int n_code;
39566
39567 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39568 mem_base = xmlMemBlocks();
39569 code = gen_int(n_code, 0);
39570
39571 ret_val = xmlUCSIsSupplementalMathematicalOperators(code);
39572 desret_int(ret_val);
39573 call_tests++;
39574 des_int(n_code, code, 0);
39575 xmlResetLastError();
39576 if (mem_base != xmlMemBlocks()) {
39577 printf("Leak of %d blocks found in xmlUCSIsSupplementalMathematicalOperators",
39578 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039579 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039580 printf(" %d", n_code);
39581 printf("\n");
39582 }
39583 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039584 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039585#endif
39586
Daniel Veillard42595322004-11-08 10:52:06 +000039587 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039588}
39589
39590
39591static int
39592test_xmlUCSIsSupplementaryPrivateUseAreaA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039593 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039594
William M. Brack21e4ef22005-01-02 09:53:13 +000039595#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039596 int mem_base;
39597 int ret_val;
39598 int code; /* UCS code point */
39599 int n_code;
39600
39601 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39602 mem_base = xmlMemBlocks();
39603 code = gen_int(n_code, 0);
39604
39605 ret_val = xmlUCSIsSupplementaryPrivateUseAreaA(code);
39606 desret_int(ret_val);
39607 call_tests++;
39608 des_int(n_code, code, 0);
39609 xmlResetLastError();
39610 if (mem_base != xmlMemBlocks()) {
39611 printf("Leak of %d blocks found in xmlUCSIsSupplementaryPrivateUseAreaA",
39612 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039613 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039614 printf(" %d", n_code);
39615 printf("\n");
39616 }
39617 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039618 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039619#endif
39620
Daniel Veillard42595322004-11-08 10:52:06 +000039621 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039622}
39623
39624
39625static int
39626test_xmlUCSIsSupplementaryPrivateUseAreaB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039627 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039628
William M. Brack21e4ef22005-01-02 09:53:13 +000039629#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039630 int mem_base;
39631 int ret_val;
39632 int code; /* UCS code point */
39633 int n_code;
39634
39635 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39636 mem_base = xmlMemBlocks();
39637 code = gen_int(n_code, 0);
39638
39639 ret_val = xmlUCSIsSupplementaryPrivateUseAreaB(code);
39640 desret_int(ret_val);
39641 call_tests++;
39642 des_int(n_code, code, 0);
39643 xmlResetLastError();
39644 if (mem_base != xmlMemBlocks()) {
39645 printf("Leak of %d blocks found in xmlUCSIsSupplementaryPrivateUseAreaB",
39646 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039647 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039648 printf(" %d", n_code);
39649 printf("\n");
39650 }
39651 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039652 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039653#endif
39654
Daniel Veillard42595322004-11-08 10:52:06 +000039655 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039656}
39657
39658
39659static int
39660test_xmlUCSIsSyriac(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039661 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039662
William M. Brack21e4ef22005-01-02 09:53:13 +000039663#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039664 int mem_base;
39665 int ret_val;
39666 int code; /* UCS code point */
39667 int n_code;
39668
39669 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39670 mem_base = xmlMemBlocks();
39671 code = gen_int(n_code, 0);
39672
39673 ret_val = xmlUCSIsSyriac(code);
39674 desret_int(ret_val);
39675 call_tests++;
39676 des_int(n_code, code, 0);
39677 xmlResetLastError();
39678 if (mem_base != xmlMemBlocks()) {
39679 printf("Leak of %d blocks found in xmlUCSIsSyriac",
39680 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039681 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039682 printf(" %d", n_code);
39683 printf("\n");
39684 }
39685 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039686 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039687#endif
39688
Daniel Veillard42595322004-11-08 10:52:06 +000039689 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039690}
39691
39692
39693static int
39694test_xmlUCSIsTagalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039695 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039696
William M. Brack21e4ef22005-01-02 09:53:13 +000039697#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039698 int mem_base;
39699 int ret_val;
39700 int code; /* UCS code point */
39701 int n_code;
39702
39703 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39704 mem_base = xmlMemBlocks();
39705 code = gen_int(n_code, 0);
39706
39707 ret_val = xmlUCSIsTagalog(code);
39708 desret_int(ret_val);
39709 call_tests++;
39710 des_int(n_code, code, 0);
39711 xmlResetLastError();
39712 if (mem_base != xmlMemBlocks()) {
39713 printf("Leak of %d blocks found in xmlUCSIsTagalog",
39714 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039715 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039716 printf(" %d", n_code);
39717 printf("\n");
39718 }
39719 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039720 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039721#endif
39722
Daniel Veillard42595322004-11-08 10:52:06 +000039723 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039724}
39725
39726
39727static int
39728test_xmlUCSIsTagbanwa(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039729 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039730
William M. Brack21e4ef22005-01-02 09:53:13 +000039731#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039732 int mem_base;
39733 int ret_val;
39734 int code; /* UCS code point */
39735 int n_code;
39736
39737 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39738 mem_base = xmlMemBlocks();
39739 code = gen_int(n_code, 0);
39740
39741 ret_val = xmlUCSIsTagbanwa(code);
39742 desret_int(ret_val);
39743 call_tests++;
39744 des_int(n_code, code, 0);
39745 xmlResetLastError();
39746 if (mem_base != xmlMemBlocks()) {
39747 printf("Leak of %d blocks found in xmlUCSIsTagbanwa",
39748 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039749 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039750 printf(" %d", n_code);
39751 printf("\n");
39752 }
39753 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039754 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039755#endif
39756
Daniel Veillard42595322004-11-08 10:52:06 +000039757 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039758}
39759
39760
39761static int
39762test_xmlUCSIsTags(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039763 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039764
William M. Brack21e4ef22005-01-02 09:53:13 +000039765#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039766 int mem_base;
39767 int ret_val;
39768 int code; /* UCS code point */
39769 int n_code;
39770
39771 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39772 mem_base = xmlMemBlocks();
39773 code = gen_int(n_code, 0);
39774
39775 ret_val = xmlUCSIsTags(code);
39776 desret_int(ret_val);
39777 call_tests++;
39778 des_int(n_code, code, 0);
39779 xmlResetLastError();
39780 if (mem_base != xmlMemBlocks()) {
39781 printf("Leak of %d blocks found in xmlUCSIsTags",
39782 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039783 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039784 printf(" %d", n_code);
39785 printf("\n");
39786 }
39787 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039788 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039789#endif
39790
Daniel Veillard42595322004-11-08 10:52:06 +000039791 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039792}
39793
39794
39795static int
39796test_xmlUCSIsTaiLe(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039797 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039798
William M. Brack21e4ef22005-01-02 09:53:13 +000039799#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039800 int mem_base;
39801 int ret_val;
39802 int code; /* UCS code point */
39803 int n_code;
39804
39805 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39806 mem_base = xmlMemBlocks();
39807 code = gen_int(n_code, 0);
39808
39809 ret_val = xmlUCSIsTaiLe(code);
39810 desret_int(ret_val);
39811 call_tests++;
39812 des_int(n_code, code, 0);
39813 xmlResetLastError();
39814 if (mem_base != xmlMemBlocks()) {
39815 printf("Leak of %d blocks found in xmlUCSIsTaiLe",
39816 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039817 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039818 printf(" %d", n_code);
39819 printf("\n");
39820 }
39821 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039822 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039823#endif
39824
Daniel Veillard42595322004-11-08 10:52:06 +000039825 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039826}
39827
39828
39829static int
39830test_xmlUCSIsTaiXuanJingSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039831 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039832
William M. Brack21e4ef22005-01-02 09:53:13 +000039833#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039834 int mem_base;
39835 int ret_val;
39836 int code; /* UCS code point */
39837 int n_code;
39838
39839 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39840 mem_base = xmlMemBlocks();
39841 code = gen_int(n_code, 0);
39842
39843 ret_val = xmlUCSIsTaiXuanJingSymbols(code);
39844 desret_int(ret_val);
39845 call_tests++;
39846 des_int(n_code, code, 0);
39847 xmlResetLastError();
39848 if (mem_base != xmlMemBlocks()) {
39849 printf("Leak of %d blocks found in xmlUCSIsTaiXuanJingSymbols",
39850 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039851 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039852 printf(" %d", n_code);
39853 printf("\n");
39854 }
39855 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039856 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039857#endif
39858
Daniel Veillard42595322004-11-08 10:52:06 +000039859 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039860}
39861
39862
39863static int
39864test_xmlUCSIsTamil(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039865 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039866
William M. Brack21e4ef22005-01-02 09:53:13 +000039867#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039868 int mem_base;
39869 int ret_val;
39870 int code; /* UCS code point */
39871 int n_code;
39872
39873 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39874 mem_base = xmlMemBlocks();
39875 code = gen_int(n_code, 0);
39876
39877 ret_val = xmlUCSIsTamil(code);
39878 desret_int(ret_val);
39879 call_tests++;
39880 des_int(n_code, code, 0);
39881 xmlResetLastError();
39882 if (mem_base != xmlMemBlocks()) {
39883 printf("Leak of %d blocks found in xmlUCSIsTamil",
39884 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039885 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039886 printf(" %d", n_code);
39887 printf("\n");
39888 }
39889 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039890 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039891#endif
39892
Daniel Veillard42595322004-11-08 10:52:06 +000039893 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039894}
39895
39896
39897static int
39898test_xmlUCSIsTelugu(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039899 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039900
William M. Brack21e4ef22005-01-02 09:53:13 +000039901#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039902 int mem_base;
39903 int ret_val;
39904 int code; /* UCS code point */
39905 int n_code;
39906
39907 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39908 mem_base = xmlMemBlocks();
39909 code = gen_int(n_code, 0);
39910
39911 ret_val = xmlUCSIsTelugu(code);
39912 desret_int(ret_val);
39913 call_tests++;
39914 des_int(n_code, code, 0);
39915 xmlResetLastError();
39916 if (mem_base != xmlMemBlocks()) {
39917 printf("Leak of %d blocks found in xmlUCSIsTelugu",
39918 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039919 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039920 printf(" %d", n_code);
39921 printf("\n");
39922 }
39923 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039924 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039925#endif
39926
Daniel Veillard42595322004-11-08 10:52:06 +000039927 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039928}
39929
39930
39931static int
39932test_xmlUCSIsThaana(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039933 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039934
William M. Brack21e4ef22005-01-02 09:53:13 +000039935#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039936 int mem_base;
39937 int ret_val;
39938 int code; /* UCS code point */
39939 int n_code;
39940
39941 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39942 mem_base = xmlMemBlocks();
39943 code = gen_int(n_code, 0);
39944
39945 ret_val = xmlUCSIsThaana(code);
39946 desret_int(ret_val);
39947 call_tests++;
39948 des_int(n_code, code, 0);
39949 xmlResetLastError();
39950 if (mem_base != xmlMemBlocks()) {
39951 printf("Leak of %d blocks found in xmlUCSIsThaana",
39952 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039953 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039954 printf(" %d", n_code);
39955 printf("\n");
39956 }
39957 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039958 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039959#endif
39960
Daniel Veillard42595322004-11-08 10:52:06 +000039961 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039962}
39963
39964
39965static int
39966test_xmlUCSIsThai(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039967 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039968
William M. Brack21e4ef22005-01-02 09:53:13 +000039969#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039970 int mem_base;
39971 int ret_val;
39972 int code; /* UCS code point */
39973 int n_code;
39974
39975 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39976 mem_base = xmlMemBlocks();
39977 code = gen_int(n_code, 0);
39978
39979 ret_val = xmlUCSIsThai(code);
39980 desret_int(ret_val);
39981 call_tests++;
39982 des_int(n_code, code, 0);
39983 xmlResetLastError();
39984 if (mem_base != xmlMemBlocks()) {
39985 printf("Leak of %d blocks found in xmlUCSIsThai",
39986 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039987 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039988 printf(" %d", n_code);
39989 printf("\n");
39990 }
39991 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039992 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039993#endif
39994
Daniel Veillard42595322004-11-08 10:52:06 +000039995 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039996}
39997
39998
39999static int
40000test_xmlUCSIsTibetan(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040001 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040002
William M. Brack21e4ef22005-01-02 09:53:13 +000040003#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040004 int mem_base;
40005 int ret_val;
40006 int code; /* UCS code point */
40007 int n_code;
40008
40009 for (n_code = 0;n_code < gen_nb_int;n_code++) {
40010 mem_base = xmlMemBlocks();
40011 code = gen_int(n_code, 0);
40012
40013 ret_val = xmlUCSIsTibetan(code);
40014 desret_int(ret_val);
40015 call_tests++;
40016 des_int(n_code, code, 0);
40017 xmlResetLastError();
40018 if (mem_base != xmlMemBlocks()) {
40019 printf("Leak of %d blocks found in xmlUCSIsTibetan",
40020 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040021 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040022 printf(" %d", n_code);
40023 printf("\n");
40024 }
40025 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040026 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040027#endif
40028
Daniel Veillard42595322004-11-08 10:52:06 +000040029 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040030}
40031
40032
40033static int
40034test_xmlUCSIsUgaritic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040035 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040036
William M. Brack21e4ef22005-01-02 09:53:13 +000040037#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040038 int mem_base;
40039 int ret_val;
40040 int code; /* UCS code point */
40041 int n_code;
40042
40043 for (n_code = 0;n_code < gen_nb_int;n_code++) {
40044 mem_base = xmlMemBlocks();
40045 code = gen_int(n_code, 0);
40046
40047 ret_val = xmlUCSIsUgaritic(code);
40048 desret_int(ret_val);
40049 call_tests++;
40050 des_int(n_code, code, 0);
40051 xmlResetLastError();
40052 if (mem_base != xmlMemBlocks()) {
40053 printf("Leak of %d blocks found in xmlUCSIsUgaritic",
40054 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040055 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040056 printf(" %d", n_code);
40057 printf("\n");
40058 }
40059 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040060 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040061#endif
40062
Daniel Veillard42595322004-11-08 10:52:06 +000040063 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040064}
40065
40066
40067static int
40068test_xmlUCSIsUnifiedCanadianAboriginalSyllabics(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040069 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040070
William M. Brack21e4ef22005-01-02 09:53:13 +000040071#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040072 int mem_base;
40073 int ret_val;
40074 int code; /* UCS code point */
40075 int n_code;
40076
40077 for (n_code = 0;n_code < gen_nb_int;n_code++) {
40078 mem_base = xmlMemBlocks();
40079 code = gen_int(n_code, 0);
40080
40081 ret_val = xmlUCSIsUnifiedCanadianAboriginalSyllabics(code);
40082 desret_int(ret_val);
40083 call_tests++;
40084 des_int(n_code, code, 0);
40085 xmlResetLastError();
40086 if (mem_base != xmlMemBlocks()) {
40087 printf("Leak of %d blocks found in xmlUCSIsUnifiedCanadianAboriginalSyllabics",
40088 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040089 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040090 printf(" %d", n_code);
40091 printf("\n");
40092 }
40093 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040094 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040095#endif
40096
Daniel Veillard42595322004-11-08 10:52:06 +000040097 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040098}
40099
40100
40101static int
40102test_xmlUCSIsVariationSelectors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040103 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040104
William M. Brack21e4ef22005-01-02 09:53:13 +000040105#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040106 int mem_base;
40107 int ret_val;
40108 int code; /* UCS code point */
40109 int n_code;
40110
40111 for (n_code = 0;n_code < gen_nb_int;n_code++) {
40112 mem_base = xmlMemBlocks();
40113 code = gen_int(n_code, 0);
40114
40115 ret_val = xmlUCSIsVariationSelectors(code);
40116 desret_int(ret_val);
40117 call_tests++;
40118 des_int(n_code, code, 0);
40119 xmlResetLastError();
40120 if (mem_base != xmlMemBlocks()) {
40121 printf("Leak of %d blocks found in xmlUCSIsVariationSelectors",
40122 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040123 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040124 printf(" %d", n_code);
40125 printf("\n");
40126 }
40127 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040128 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040129#endif
40130
Daniel Veillard42595322004-11-08 10:52:06 +000040131 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040132}
40133
40134
40135static int
40136test_xmlUCSIsVariationSelectorsSupplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040137 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040138
William M. Brack21e4ef22005-01-02 09:53:13 +000040139#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040140 int mem_base;
40141 int ret_val;
40142 int code; /* UCS code point */
40143 int n_code;
40144
40145 for (n_code = 0;n_code < gen_nb_int;n_code++) {
40146 mem_base = xmlMemBlocks();
40147 code = gen_int(n_code, 0);
40148
40149 ret_val = xmlUCSIsVariationSelectorsSupplement(code);
40150 desret_int(ret_val);
40151 call_tests++;
40152 des_int(n_code, code, 0);
40153 xmlResetLastError();
40154 if (mem_base != xmlMemBlocks()) {
40155 printf("Leak of %d blocks found in xmlUCSIsVariationSelectorsSupplement",
40156 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040157 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040158 printf(" %d", n_code);
40159 printf("\n");
40160 }
40161 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040162 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040163#endif
40164
Daniel Veillard42595322004-11-08 10:52:06 +000040165 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040166}
40167
40168
40169static int
40170test_xmlUCSIsYiRadicals(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040171 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040172
William M. Brack21e4ef22005-01-02 09:53:13 +000040173#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040174 int mem_base;
40175 int ret_val;
40176 int code; /* UCS code point */
40177 int n_code;
40178
40179 for (n_code = 0;n_code < gen_nb_int;n_code++) {
40180 mem_base = xmlMemBlocks();
40181 code = gen_int(n_code, 0);
40182
40183 ret_val = xmlUCSIsYiRadicals(code);
40184 desret_int(ret_val);
40185 call_tests++;
40186 des_int(n_code, code, 0);
40187 xmlResetLastError();
40188 if (mem_base != xmlMemBlocks()) {
40189 printf("Leak of %d blocks found in xmlUCSIsYiRadicals",
40190 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040191 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040192 printf(" %d", n_code);
40193 printf("\n");
40194 }
40195 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040196 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040197#endif
40198
Daniel Veillard42595322004-11-08 10:52:06 +000040199 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040200}
40201
40202
40203static int
40204test_xmlUCSIsYiSyllables(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040205 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040206
William M. Brack21e4ef22005-01-02 09:53:13 +000040207#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040208 int mem_base;
40209 int ret_val;
40210 int code; /* UCS code point */
40211 int n_code;
40212
40213 for (n_code = 0;n_code < gen_nb_int;n_code++) {
40214 mem_base = xmlMemBlocks();
40215 code = gen_int(n_code, 0);
40216
40217 ret_val = xmlUCSIsYiSyllables(code);
40218 desret_int(ret_val);
40219 call_tests++;
40220 des_int(n_code, code, 0);
40221 xmlResetLastError();
40222 if (mem_base != xmlMemBlocks()) {
40223 printf("Leak of %d blocks found in xmlUCSIsYiSyllables",
40224 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040225 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040226 printf(" %d", n_code);
40227 printf("\n");
40228 }
40229 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040230 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040231#endif
40232
Daniel Veillard42595322004-11-08 10:52:06 +000040233 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040234}
40235
40236
40237static int
40238test_xmlUCSIsYijingHexagramSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040239 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040240
William M. Brack21e4ef22005-01-02 09:53:13 +000040241#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040242 int mem_base;
40243 int ret_val;
40244 int code; /* UCS code point */
40245 int n_code;
40246
40247 for (n_code = 0;n_code < gen_nb_int;n_code++) {
40248 mem_base = xmlMemBlocks();
40249 code = gen_int(n_code, 0);
40250
40251 ret_val = xmlUCSIsYijingHexagramSymbols(code);
40252 desret_int(ret_val);
40253 call_tests++;
40254 des_int(n_code, code, 0);
40255 xmlResetLastError();
40256 if (mem_base != xmlMemBlocks()) {
40257 printf("Leak of %d blocks found in xmlUCSIsYijingHexagramSymbols",
40258 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040259 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040260 printf(" %d", n_code);
40261 printf("\n");
40262 }
40263 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040264 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040265#endif
40266
Daniel Veillard42595322004-11-08 10:52:06 +000040267 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040268}
40269
40270static int
40271test_xmlunicode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040272 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040273
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040274 if (quiet == 0) printf("Testing xmlunicode : 166 of 166 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000040275 test_ret += test_xmlUCSIsAegeanNumbers();
40276 test_ret += test_xmlUCSIsAlphabeticPresentationForms();
40277 test_ret += test_xmlUCSIsArabic();
40278 test_ret += test_xmlUCSIsArabicPresentationFormsA();
40279 test_ret += test_xmlUCSIsArabicPresentationFormsB();
40280 test_ret += test_xmlUCSIsArmenian();
40281 test_ret += test_xmlUCSIsArrows();
40282 test_ret += test_xmlUCSIsBasicLatin();
40283 test_ret += test_xmlUCSIsBengali();
40284 test_ret += test_xmlUCSIsBlock();
40285 test_ret += test_xmlUCSIsBlockElements();
40286 test_ret += test_xmlUCSIsBopomofo();
40287 test_ret += test_xmlUCSIsBopomofoExtended();
40288 test_ret += test_xmlUCSIsBoxDrawing();
40289 test_ret += test_xmlUCSIsBraillePatterns();
40290 test_ret += test_xmlUCSIsBuhid();
40291 test_ret += test_xmlUCSIsByzantineMusicalSymbols();
40292 test_ret += test_xmlUCSIsCJKCompatibility();
40293 test_ret += test_xmlUCSIsCJKCompatibilityForms();
40294 test_ret += test_xmlUCSIsCJKCompatibilityIdeographs();
40295 test_ret += test_xmlUCSIsCJKCompatibilityIdeographsSupplement();
40296 test_ret += test_xmlUCSIsCJKRadicalsSupplement();
40297 test_ret += test_xmlUCSIsCJKSymbolsandPunctuation();
40298 test_ret += test_xmlUCSIsCJKUnifiedIdeographs();
40299 test_ret += test_xmlUCSIsCJKUnifiedIdeographsExtensionA();
40300 test_ret += test_xmlUCSIsCJKUnifiedIdeographsExtensionB();
40301 test_ret += test_xmlUCSIsCat();
40302 test_ret += test_xmlUCSIsCatC();
40303 test_ret += test_xmlUCSIsCatCc();
40304 test_ret += test_xmlUCSIsCatCf();
40305 test_ret += test_xmlUCSIsCatCo();
40306 test_ret += test_xmlUCSIsCatCs();
40307 test_ret += test_xmlUCSIsCatL();
40308 test_ret += test_xmlUCSIsCatLl();
40309 test_ret += test_xmlUCSIsCatLm();
40310 test_ret += test_xmlUCSIsCatLo();
40311 test_ret += test_xmlUCSIsCatLt();
40312 test_ret += test_xmlUCSIsCatLu();
40313 test_ret += test_xmlUCSIsCatM();
40314 test_ret += test_xmlUCSIsCatMc();
40315 test_ret += test_xmlUCSIsCatMe();
40316 test_ret += test_xmlUCSIsCatMn();
40317 test_ret += test_xmlUCSIsCatN();
40318 test_ret += test_xmlUCSIsCatNd();
40319 test_ret += test_xmlUCSIsCatNl();
40320 test_ret += test_xmlUCSIsCatNo();
40321 test_ret += test_xmlUCSIsCatP();
40322 test_ret += test_xmlUCSIsCatPc();
40323 test_ret += test_xmlUCSIsCatPd();
40324 test_ret += test_xmlUCSIsCatPe();
40325 test_ret += test_xmlUCSIsCatPf();
40326 test_ret += test_xmlUCSIsCatPi();
40327 test_ret += test_xmlUCSIsCatPo();
40328 test_ret += test_xmlUCSIsCatPs();
40329 test_ret += test_xmlUCSIsCatS();
40330 test_ret += test_xmlUCSIsCatSc();
40331 test_ret += test_xmlUCSIsCatSk();
40332 test_ret += test_xmlUCSIsCatSm();
40333 test_ret += test_xmlUCSIsCatSo();
40334 test_ret += test_xmlUCSIsCatZ();
40335 test_ret += test_xmlUCSIsCatZl();
40336 test_ret += test_xmlUCSIsCatZp();
40337 test_ret += test_xmlUCSIsCatZs();
40338 test_ret += test_xmlUCSIsCherokee();
40339 test_ret += test_xmlUCSIsCombiningDiacriticalMarks();
40340 test_ret += test_xmlUCSIsCombiningDiacriticalMarksforSymbols();
40341 test_ret += test_xmlUCSIsCombiningHalfMarks();
40342 test_ret += test_xmlUCSIsCombiningMarksforSymbols();
40343 test_ret += test_xmlUCSIsControlPictures();
40344 test_ret += test_xmlUCSIsCurrencySymbols();
40345 test_ret += test_xmlUCSIsCypriotSyllabary();
40346 test_ret += test_xmlUCSIsCyrillic();
40347 test_ret += test_xmlUCSIsCyrillicSupplement();
40348 test_ret += test_xmlUCSIsDeseret();
40349 test_ret += test_xmlUCSIsDevanagari();
40350 test_ret += test_xmlUCSIsDingbats();
40351 test_ret += test_xmlUCSIsEnclosedAlphanumerics();
40352 test_ret += test_xmlUCSIsEnclosedCJKLettersandMonths();
40353 test_ret += test_xmlUCSIsEthiopic();
40354 test_ret += test_xmlUCSIsGeneralPunctuation();
40355 test_ret += test_xmlUCSIsGeometricShapes();
40356 test_ret += test_xmlUCSIsGeorgian();
40357 test_ret += test_xmlUCSIsGothic();
40358 test_ret += test_xmlUCSIsGreek();
40359 test_ret += test_xmlUCSIsGreekExtended();
40360 test_ret += test_xmlUCSIsGreekandCoptic();
40361 test_ret += test_xmlUCSIsGujarati();
40362 test_ret += test_xmlUCSIsGurmukhi();
40363 test_ret += test_xmlUCSIsHalfwidthandFullwidthForms();
40364 test_ret += test_xmlUCSIsHangulCompatibilityJamo();
40365 test_ret += test_xmlUCSIsHangulJamo();
40366 test_ret += test_xmlUCSIsHangulSyllables();
40367 test_ret += test_xmlUCSIsHanunoo();
40368 test_ret += test_xmlUCSIsHebrew();
40369 test_ret += test_xmlUCSIsHighPrivateUseSurrogates();
40370 test_ret += test_xmlUCSIsHighSurrogates();
40371 test_ret += test_xmlUCSIsHiragana();
40372 test_ret += test_xmlUCSIsIPAExtensions();
40373 test_ret += test_xmlUCSIsIdeographicDescriptionCharacters();
40374 test_ret += test_xmlUCSIsKanbun();
40375 test_ret += test_xmlUCSIsKangxiRadicals();
40376 test_ret += test_xmlUCSIsKannada();
40377 test_ret += test_xmlUCSIsKatakana();
40378 test_ret += test_xmlUCSIsKatakanaPhoneticExtensions();
40379 test_ret += test_xmlUCSIsKhmer();
40380 test_ret += test_xmlUCSIsKhmerSymbols();
40381 test_ret += test_xmlUCSIsLao();
40382 test_ret += test_xmlUCSIsLatin1Supplement();
40383 test_ret += test_xmlUCSIsLatinExtendedA();
40384 test_ret += test_xmlUCSIsLatinExtendedAdditional();
40385 test_ret += test_xmlUCSIsLatinExtendedB();
40386 test_ret += test_xmlUCSIsLetterlikeSymbols();
40387 test_ret += test_xmlUCSIsLimbu();
40388 test_ret += test_xmlUCSIsLinearBIdeograms();
40389 test_ret += test_xmlUCSIsLinearBSyllabary();
40390 test_ret += test_xmlUCSIsLowSurrogates();
40391 test_ret += test_xmlUCSIsMalayalam();
40392 test_ret += test_xmlUCSIsMathematicalAlphanumericSymbols();
40393 test_ret += test_xmlUCSIsMathematicalOperators();
40394 test_ret += test_xmlUCSIsMiscellaneousMathematicalSymbolsA();
40395 test_ret += test_xmlUCSIsMiscellaneousMathematicalSymbolsB();
40396 test_ret += test_xmlUCSIsMiscellaneousSymbols();
40397 test_ret += test_xmlUCSIsMiscellaneousSymbolsandArrows();
40398 test_ret += test_xmlUCSIsMiscellaneousTechnical();
40399 test_ret += test_xmlUCSIsMongolian();
40400 test_ret += test_xmlUCSIsMusicalSymbols();
40401 test_ret += test_xmlUCSIsMyanmar();
40402 test_ret += test_xmlUCSIsNumberForms();
40403 test_ret += test_xmlUCSIsOgham();
40404 test_ret += test_xmlUCSIsOldItalic();
40405 test_ret += test_xmlUCSIsOpticalCharacterRecognition();
40406 test_ret += test_xmlUCSIsOriya();
40407 test_ret += test_xmlUCSIsOsmanya();
40408 test_ret += test_xmlUCSIsPhoneticExtensions();
40409 test_ret += test_xmlUCSIsPrivateUse();
40410 test_ret += test_xmlUCSIsPrivateUseArea();
40411 test_ret += test_xmlUCSIsRunic();
40412 test_ret += test_xmlUCSIsShavian();
40413 test_ret += test_xmlUCSIsSinhala();
40414 test_ret += test_xmlUCSIsSmallFormVariants();
40415 test_ret += test_xmlUCSIsSpacingModifierLetters();
40416 test_ret += test_xmlUCSIsSpecials();
40417 test_ret += test_xmlUCSIsSuperscriptsandSubscripts();
40418 test_ret += test_xmlUCSIsSupplementalArrowsA();
40419 test_ret += test_xmlUCSIsSupplementalArrowsB();
40420 test_ret += test_xmlUCSIsSupplementalMathematicalOperators();
40421 test_ret += test_xmlUCSIsSupplementaryPrivateUseAreaA();
40422 test_ret += test_xmlUCSIsSupplementaryPrivateUseAreaB();
40423 test_ret += test_xmlUCSIsSyriac();
40424 test_ret += test_xmlUCSIsTagalog();
40425 test_ret += test_xmlUCSIsTagbanwa();
40426 test_ret += test_xmlUCSIsTags();
40427 test_ret += test_xmlUCSIsTaiLe();
40428 test_ret += test_xmlUCSIsTaiXuanJingSymbols();
40429 test_ret += test_xmlUCSIsTamil();
40430 test_ret += test_xmlUCSIsTelugu();
40431 test_ret += test_xmlUCSIsThaana();
40432 test_ret += test_xmlUCSIsThai();
40433 test_ret += test_xmlUCSIsTibetan();
40434 test_ret += test_xmlUCSIsUgaritic();
40435 test_ret += test_xmlUCSIsUnifiedCanadianAboriginalSyllabics();
40436 test_ret += test_xmlUCSIsVariationSelectors();
40437 test_ret += test_xmlUCSIsVariationSelectorsSupplement();
40438 test_ret += test_xmlUCSIsYiRadicals();
40439 test_ret += test_xmlUCSIsYiSyllables();
40440 test_ret += test_xmlUCSIsYijingHexagramSymbols();
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040441
Daniel Veillard42595322004-11-08 10:52:06 +000040442 if (test_ret != 0)
40443 printf("Module xmlunicode: %d errors\n", test_ret);
40444 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000040445}
40446
40447static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000040448test_xmlNewTextWriter(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040449 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040450
William M. Brack21e4ef22005-01-02 09:53:13 +000040451#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040452 int mem_base;
40453 xmlTextWriterPtr ret_val;
40454 xmlOutputBufferPtr out; /* an xmlOutputBufferPtr */
40455 int n_out;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040456
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040457 for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) {
40458 mem_base = xmlMemBlocks();
40459 out = gen_xmlOutputBufferPtr(n_out, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040460
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040461 ret_val = xmlNewTextWriter(out);
40462 if (ret_val != NULL) out = NULL;
40463 desret_xmlTextWriterPtr(ret_val);
40464 call_tests++;
40465 des_xmlOutputBufferPtr(n_out, out, 0);
40466 xmlResetLastError();
40467 if (mem_base != xmlMemBlocks()) {
40468 printf("Leak of %d blocks found in xmlNewTextWriter",
40469 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040470 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040471 printf(" %d", n_out);
40472 printf("\n");
40473 }
40474 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040475 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040476#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000040477
Daniel Veillard42595322004-11-08 10:52:06 +000040478 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040479}
40480
40481
40482static int
40483test_xmlNewTextWriterFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040484 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040485
William M. Brack21e4ef22005-01-02 09:53:13 +000040486#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040487 int mem_base;
40488 xmlTextWriterPtr ret_val;
40489 const char * uri; /* the URI of the resource for the output */
40490 int n_uri;
40491 int compression; /* compress the output? */
40492 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040493
Daniel Veillard42595322004-11-08 10:52:06 +000040494 for (n_uri = 0;n_uri < gen_nb_fileoutput;n_uri++) {
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040495 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
40496 mem_base = xmlMemBlocks();
Daniel Veillard42595322004-11-08 10:52:06 +000040497 uri = gen_fileoutput(n_uri, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040498 compression = gen_int(n_compression, 1);
40499
40500 ret_val = xmlNewTextWriterFilename(uri, compression);
40501 desret_xmlTextWriterPtr(ret_val);
40502 call_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000040503 des_fileoutput(n_uri, uri, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040504 des_int(n_compression, compression, 1);
40505 xmlResetLastError();
40506 if (mem_base != xmlMemBlocks()) {
40507 printf("Leak of %d blocks found in xmlNewTextWriterFilename",
40508 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040509 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040510 printf(" %d", n_uri);
40511 printf(" %d", n_compression);
40512 printf("\n");
40513 }
40514 }
40515 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040516 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040517#endif
40518
Daniel Veillard42595322004-11-08 10:52:06 +000040519 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040520}
40521
40522
40523static int
40524test_xmlNewTextWriterMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040525 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040526
William M. Brack21e4ef22005-01-02 09:53:13 +000040527#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040528 int mem_base;
40529 xmlTextWriterPtr ret_val;
40530 xmlBufferPtr buf; /* xmlBufferPtr */
40531 int n_buf;
40532 int compression; /* compress the output? */
40533 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040534
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040535 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
40536 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
40537 mem_base = xmlMemBlocks();
40538 buf = gen_xmlBufferPtr(n_buf, 0);
40539 compression = gen_int(n_compression, 1);
40540
40541 ret_val = xmlNewTextWriterMemory(buf, compression);
40542 desret_xmlTextWriterPtr(ret_val);
40543 call_tests++;
40544 des_xmlBufferPtr(n_buf, buf, 0);
40545 des_int(n_compression, compression, 1);
40546 xmlResetLastError();
40547 if (mem_base != xmlMemBlocks()) {
40548 printf("Leak of %d blocks found in xmlNewTextWriterMemory",
40549 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040550 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040551 printf(" %d", n_buf);
40552 printf(" %d", n_compression);
40553 printf("\n");
40554 }
40555 }
40556 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040557 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040558#endif
40559
Daniel Veillard42595322004-11-08 10:52:06 +000040560 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040561}
40562
40563
40564static int
40565test_xmlNewTextWriterPushParser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040566 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040567
William M. Brack21e4ef22005-01-02 09:53:13 +000040568#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040569 int mem_base;
40570 xmlTextWriterPtr ret_val;
40571 xmlParserCtxtPtr ctxt; /* xmlParserCtxtPtr to hold the new XML document tree */
40572 int n_ctxt;
40573 int compression; /* compress the output? */
40574 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040575
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040576 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
40577 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
40578 mem_base = xmlMemBlocks();
40579 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
40580 compression = gen_int(n_compression, 1);
40581
40582 ret_val = xmlNewTextWriterPushParser(ctxt, compression);
Daniel Veillarda521d282004-11-09 14:59:59 +000040583 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;} if (ret_val != NULL) ctxt = NULL;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040584 desret_xmlTextWriterPtr(ret_val);
40585 call_tests++;
40586 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
40587 des_int(n_compression, compression, 1);
40588 xmlResetLastError();
40589 if (mem_base != xmlMemBlocks()) {
40590 printf("Leak of %d blocks found in xmlNewTextWriterPushParser",
40591 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040592 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040593 printf(" %d", n_ctxt);
40594 printf(" %d", n_compression);
40595 printf("\n");
40596 }
40597 }
40598 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040599 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040600#endif
40601
Daniel Veillard42595322004-11-08 10:52:06 +000040602 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040603}
40604
40605
40606static int
40607test_xmlNewTextWriterTree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040608 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040609
William M. Brack21e4ef22005-01-02 09:53:13 +000040610#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040611 int mem_base;
40612 xmlTextWriterPtr ret_val;
40613 xmlDocPtr doc; /* xmlDocPtr */
40614 int n_doc;
40615 xmlNodePtr node; /* xmlNodePtr or NULL for doc->children */
40616 int n_node;
40617 int compression; /* compress the output? */
40618 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040619
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040620 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
40621 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
40622 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
40623 mem_base = xmlMemBlocks();
40624 doc = gen_xmlDocPtr(n_doc, 0);
40625 node = gen_xmlNodePtr(n_node, 1);
40626 compression = gen_int(n_compression, 2);
40627
40628 ret_val = xmlNewTextWriterTree(doc, node, compression);
40629 desret_xmlTextWriterPtr(ret_val);
40630 call_tests++;
40631 des_xmlDocPtr(n_doc, doc, 0);
40632 des_xmlNodePtr(n_node, node, 1);
40633 des_int(n_compression, compression, 2);
40634 xmlResetLastError();
40635 if (mem_base != xmlMemBlocks()) {
40636 printf("Leak of %d blocks found in xmlNewTextWriterTree",
40637 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040638 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040639 printf(" %d", n_doc);
40640 printf(" %d", n_node);
40641 printf(" %d", n_compression);
40642 printf("\n");
40643 }
40644 }
40645 }
40646 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040647 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040648#endif
40649
Daniel Veillard42595322004-11-08 10:52:06 +000040650 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040651}
40652
40653
40654static int
40655test_xmlTextWriterEndAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040656 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040657
William M. Brack21e4ef22005-01-02 09:53:13 +000040658#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040659 int mem_base;
40660 int ret_val;
40661 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40662 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040663
Daniel Veillarde43cc572004-11-03 11:50:29 +000040664 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40665 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040666 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040667
40668 ret_val = xmlTextWriterEndAttribute(writer);
40669 desret_int(ret_val);
40670 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040671 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040672 xmlResetLastError();
40673 if (mem_base != xmlMemBlocks()) {
40674 printf("Leak of %d blocks found in xmlTextWriterEndAttribute",
40675 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040676 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040677 printf(" %d", n_writer);
40678 printf("\n");
40679 }
40680 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040681 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040682#endif
40683
Daniel Veillard42595322004-11-08 10:52:06 +000040684 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040685}
40686
40687
40688static int
40689test_xmlTextWriterEndCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040690 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040691
William M. Brack21e4ef22005-01-02 09:53:13 +000040692#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040693 int mem_base;
40694 int ret_val;
40695 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40696 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040697
Daniel Veillarde43cc572004-11-03 11:50:29 +000040698 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40699 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040700 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040701
40702 ret_val = xmlTextWriterEndCDATA(writer);
40703 desret_int(ret_val);
40704 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040705 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040706 xmlResetLastError();
40707 if (mem_base != xmlMemBlocks()) {
40708 printf("Leak of %d blocks found in xmlTextWriterEndCDATA",
40709 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040710 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040711 printf(" %d", n_writer);
40712 printf("\n");
40713 }
40714 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040715 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040716#endif
40717
Daniel Veillard42595322004-11-08 10:52:06 +000040718 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040719}
40720
40721
40722static int
40723test_xmlTextWriterEndComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040724 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040725
William M. Brack21e4ef22005-01-02 09:53:13 +000040726#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040727 int mem_base;
40728 int ret_val;
40729 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40730 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040731
Daniel Veillarde43cc572004-11-03 11:50:29 +000040732 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40733 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040734 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040735
40736 ret_val = xmlTextWriterEndComment(writer);
40737 desret_int(ret_val);
40738 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040739 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040740 xmlResetLastError();
40741 if (mem_base != xmlMemBlocks()) {
40742 printf("Leak of %d blocks found in xmlTextWriterEndComment",
40743 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040744 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040745 printf(" %d", n_writer);
40746 printf("\n");
40747 }
40748 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040749 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040750#endif
40751
Daniel Veillard42595322004-11-08 10:52:06 +000040752 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040753}
40754
40755
40756static int
40757test_xmlTextWriterEndDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040758 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040759
William M. Brack21e4ef22005-01-02 09:53:13 +000040760#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040761 int mem_base;
40762 int ret_val;
40763 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40764 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040765
Daniel Veillarde43cc572004-11-03 11:50:29 +000040766 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40767 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040768 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040769
40770 ret_val = xmlTextWriterEndDTD(writer);
40771 desret_int(ret_val);
40772 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040773 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040774 xmlResetLastError();
40775 if (mem_base != xmlMemBlocks()) {
40776 printf("Leak of %d blocks found in xmlTextWriterEndDTD",
40777 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040778 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040779 printf(" %d", n_writer);
40780 printf("\n");
40781 }
40782 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040783 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040784#endif
40785
Daniel Veillard42595322004-11-08 10:52:06 +000040786 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040787}
40788
40789
40790static int
40791test_xmlTextWriterEndDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040792 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040793
William M. Brack21e4ef22005-01-02 09:53:13 +000040794#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040795 int mem_base;
40796 int ret_val;
40797 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40798 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040799
Daniel Veillarde43cc572004-11-03 11:50:29 +000040800 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40801 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040802 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040803
40804 ret_val = xmlTextWriterEndDTDAttlist(writer);
40805 desret_int(ret_val);
40806 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040807 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040808 xmlResetLastError();
40809 if (mem_base != xmlMemBlocks()) {
40810 printf("Leak of %d blocks found in xmlTextWriterEndDTDAttlist",
40811 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040812 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040813 printf(" %d", n_writer);
40814 printf("\n");
40815 }
40816 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040817 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040818#endif
40819
Daniel Veillard42595322004-11-08 10:52:06 +000040820 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040821}
40822
40823
40824static int
40825test_xmlTextWriterEndDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040826 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040827
William M. Brack21e4ef22005-01-02 09:53:13 +000040828#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040829 int mem_base;
40830 int ret_val;
40831 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40832 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040833
Daniel Veillarde43cc572004-11-03 11:50:29 +000040834 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40835 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040836 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040837
40838 ret_val = xmlTextWriterEndDTDElement(writer);
40839 desret_int(ret_val);
40840 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040841 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040842 xmlResetLastError();
40843 if (mem_base != xmlMemBlocks()) {
40844 printf("Leak of %d blocks found in xmlTextWriterEndDTDElement",
40845 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040846 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040847 printf(" %d", n_writer);
40848 printf("\n");
40849 }
40850 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040851 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040852#endif
40853
Daniel Veillard42595322004-11-08 10:52:06 +000040854 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040855}
40856
40857
40858static int
40859test_xmlTextWriterEndDTDEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040860 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040861
William M. Brack21e4ef22005-01-02 09:53:13 +000040862#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040863 int mem_base;
40864 int ret_val;
40865 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40866 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040867
Daniel Veillarde43cc572004-11-03 11:50:29 +000040868 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40869 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040870 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040871
40872 ret_val = xmlTextWriterEndDTDEntity(writer);
40873 desret_int(ret_val);
40874 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040875 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040876 xmlResetLastError();
40877 if (mem_base != xmlMemBlocks()) {
40878 printf("Leak of %d blocks found in xmlTextWriterEndDTDEntity",
40879 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040880 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040881 printf(" %d", n_writer);
40882 printf("\n");
40883 }
40884 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040885 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040886#endif
40887
Daniel Veillard42595322004-11-08 10:52:06 +000040888 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040889}
40890
40891
40892static int
40893test_xmlTextWriterEndDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040894 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040895
William M. Brack21e4ef22005-01-02 09:53:13 +000040896#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040897 int mem_base;
40898 int ret_val;
40899 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40900 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040901
Daniel Veillarde43cc572004-11-03 11:50:29 +000040902 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40903 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040904 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040905
40906 ret_val = xmlTextWriterEndDocument(writer);
40907 desret_int(ret_val);
40908 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040909 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040910 xmlResetLastError();
40911 if (mem_base != xmlMemBlocks()) {
40912 printf("Leak of %d blocks found in xmlTextWriterEndDocument",
40913 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040914 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040915 printf(" %d", n_writer);
40916 printf("\n");
40917 }
40918 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040919 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040920#endif
40921
Daniel Veillard42595322004-11-08 10:52:06 +000040922 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040923}
40924
40925
40926static int
40927test_xmlTextWriterEndElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040928 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040929
William M. Brack21e4ef22005-01-02 09:53:13 +000040930#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040931 int mem_base;
40932 int ret_val;
40933 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40934 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040935
Daniel Veillarde43cc572004-11-03 11:50:29 +000040936 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40937 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040938 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040939
40940 ret_val = xmlTextWriterEndElement(writer);
40941 desret_int(ret_val);
40942 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040943 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040944 xmlResetLastError();
40945 if (mem_base != xmlMemBlocks()) {
40946 printf("Leak of %d blocks found in xmlTextWriterEndElement",
40947 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040948 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040949 printf(" %d", n_writer);
40950 printf("\n");
40951 }
40952 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040953 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040954#endif
40955
Daniel Veillard42595322004-11-08 10:52:06 +000040956 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040957}
40958
40959
40960static int
40961test_xmlTextWriterEndPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040962 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040963
William M. Brack21e4ef22005-01-02 09:53:13 +000040964#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040965 int mem_base;
40966 int ret_val;
40967 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40968 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040969
Daniel Veillarde43cc572004-11-03 11:50:29 +000040970 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40971 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040972 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040973
40974 ret_val = xmlTextWriterEndPI(writer);
40975 desret_int(ret_val);
40976 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040977 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040978 xmlResetLastError();
40979 if (mem_base != xmlMemBlocks()) {
40980 printf("Leak of %d blocks found in xmlTextWriterEndPI",
40981 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040982 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040983 printf(" %d", n_writer);
40984 printf("\n");
40985 }
40986 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040987 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040988#endif
40989
Daniel Veillard42595322004-11-08 10:52:06 +000040990 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040991}
40992
40993
40994static int
40995test_xmlTextWriterFlush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040996 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040997
William M. Brack21e4ef22005-01-02 09:53:13 +000040998#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040999 int mem_base;
41000 int ret_val;
41001 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41002 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041003
Daniel Veillarde43cc572004-11-03 11:50:29 +000041004 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41005 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041006 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041007
41008 ret_val = xmlTextWriterFlush(writer);
41009 desret_int(ret_val);
41010 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041011 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041012 xmlResetLastError();
41013 if (mem_base != xmlMemBlocks()) {
41014 printf("Leak of %d blocks found in xmlTextWriterFlush",
41015 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041016 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041017 printf(" %d", n_writer);
41018 printf("\n");
41019 }
41020 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041021 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041022#endif
41023
Daniel Veillard42595322004-11-08 10:52:06 +000041024 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041025}
41026
41027
41028static int
41029test_xmlTextWriterFullEndElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041030 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041031
William M. Brack21e4ef22005-01-02 09:53:13 +000041032#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041033 int mem_base;
41034 int ret_val;
41035 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41036 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041037
Daniel Veillarde43cc572004-11-03 11:50:29 +000041038 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41039 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041040 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041041
41042 ret_val = xmlTextWriterFullEndElement(writer);
41043 desret_int(ret_val);
41044 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041045 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041046 xmlResetLastError();
41047 if (mem_base != xmlMemBlocks()) {
41048 printf("Leak of %d blocks found in xmlTextWriterFullEndElement",
41049 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041050 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041051 printf(" %d", n_writer);
41052 printf("\n");
41053 }
41054 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041055 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041056#endif
41057
Daniel Veillard42595322004-11-08 10:52:06 +000041058 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041059}
41060
41061
41062static int
41063test_xmlTextWriterSetIndent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041064 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041065
William M. Brack21e4ef22005-01-02 09:53:13 +000041066#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041067 int mem_base;
41068 int ret_val;
41069 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41070 int n_writer;
41071 int indent; /* do indentation? */
41072 int n_indent;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041073
Daniel Veillarde43cc572004-11-03 11:50:29 +000041074 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41075 for (n_indent = 0;n_indent < gen_nb_int;n_indent++) {
41076 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041077 writer = gen_xmlTextWriterPtr(n_writer, 0);
41078 indent = gen_int(n_indent, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041079
41080 ret_val = xmlTextWriterSetIndent(writer, indent);
41081 desret_int(ret_val);
41082 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041083 des_xmlTextWriterPtr(n_writer, writer, 0);
41084 des_int(n_indent, indent, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041085 xmlResetLastError();
41086 if (mem_base != xmlMemBlocks()) {
41087 printf("Leak of %d blocks found in xmlTextWriterSetIndent",
41088 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041089 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041090 printf(" %d", n_writer);
41091 printf(" %d", n_indent);
41092 printf("\n");
41093 }
41094 }
41095 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041096 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041097#endif
41098
Daniel Veillard42595322004-11-08 10:52:06 +000041099 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041100}
41101
41102
41103static int
41104test_xmlTextWriterSetIndentString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041105 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041106
William M. Brack21e4ef22005-01-02 09:53:13 +000041107#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041108 int mem_base;
41109 int ret_val;
41110 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41111 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041112 xmlChar * str; /* the xmlChar string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041113 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041114
Daniel Veillarde43cc572004-11-03 11:50:29 +000041115 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41116 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
41117 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041118 writer = gen_xmlTextWriterPtr(n_writer, 0);
41119 str = gen_const_xmlChar_ptr(n_str, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041120
William M. Brackf13f77f2004-11-12 16:03:48 +000041121 ret_val = xmlTextWriterSetIndentString(writer, (const xmlChar *)str);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041122 desret_int(ret_val);
41123 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041124 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041125 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041126 xmlResetLastError();
41127 if (mem_base != xmlMemBlocks()) {
41128 printf("Leak of %d blocks found in xmlTextWriterSetIndentString",
41129 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041130 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041131 printf(" %d", n_writer);
41132 printf(" %d", n_str);
41133 printf("\n");
41134 }
41135 }
41136 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041137 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041138#endif
41139
Daniel Veillard42595322004-11-08 10:52:06 +000041140 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041141}
41142
41143
41144static int
41145test_xmlTextWriterStartAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041146 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041147
William M. Brack21e4ef22005-01-02 09:53:13 +000041148#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041149 int mem_base;
41150 int ret_val;
41151 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41152 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041153 xmlChar * name; /* element name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041154 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041155
Daniel Veillarde43cc572004-11-03 11:50:29 +000041156 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41157 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41158 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041159 writer = gen_xmlTextWriterPtr(n_writer, 0);
41160 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041161
William M. Brackf13f77f2004-11-12 16:03:48 +000041162 ret_val = xmlTextWriterStartAttribute(writer, (const xmlChar *)name);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041163 desret_int(ret_val);
41164 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041165 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041166 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041167 xmlResetLastError();
41168 if (mem_base != xmlMemBlocks()) {
41169 printf("Leak of %d blocks found in xmlTextWriterStartAttribute",
41170 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041171 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041172 printf(" %d", n_writer);
41173 printf(" %d", n_name);
41174 printf("\n");
41175 }
41176 }
41177 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041178 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041179#endif
41180
Daniel Veillard42595322004-11-08 10:52:06 +000041181 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041182}
41183
41184
41185static int
41186test_xmlTextWriterStartAttributeNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041187 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041188
William M. Brack21e4ef22005-01-02 09:53:13 +000041189#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041190 int mem_base;
41191 int ret_val;
41192 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41193 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041194 xmlChar * prefix; /* namespace prefix or NULL */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041195 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041196 xmlChar * name; /* element local name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041197 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041198 xmlChar * namespaceURI; /* namespace URI or NULL */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041199 int n_namespaceURI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041200
Daniel Veillarde43cc572004-11-03 11:50:29 +000041201 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41202 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
41203 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41204 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
41205 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041206 writer = gen_xmlTextWriterPtr(n_writer, 0);
41207 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
41208 name = gen_const_xmlChar_ptr(n_name, 2);
41209 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041210
William M. Brackf13f77f2004-11-12 16:03:48 +000041211 ret_val = xmlTextWriterStartAttributeNS(writer, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)namespaceURI);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041212 desret_int(ret_val);
41213 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041214 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041215 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
41216 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
41217 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041218 xmlResetLastError();
41219 if (mem_base != xmlMemBlocks()) {
41220 printf("Leak of %d blocks found in xmlTextWriterStartAttributeNS",
41221 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041222 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041223 printf(" %d", n_writer);
41224 printf(" %d", n_prefix);
41225 printf(" %d", n_name);
41226 printf(" %d", n_namespaceURI);
41227 printf("\n");
41228 }
41229 }
41230 }
41231 }
41232 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041233 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041234#endif
41235
Daniel Veillard42595322004-11-08 10:52:06 +000041236 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041237}
41238
41239
41240static int
41241test_xmlTextWriterStartCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041242 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041243
William M. Brack21e4ef22005-01-02 09:53:13 +000041244#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041245 int mem_base;
41246 int ret_val;
41247 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41248 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041249
Daniel Veillarde43cc572004-11-03 11:50:29 +000041250 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41251 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041252 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041253
41254 ret_val = xmlTextWriterStartCDATA(writer);
41255 desret_int(ret_val);
41256 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041257 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041258 xmlResetLastError();
41259 if (mem_base != xmlMemBlocks()) {
41260 printf("Leak of %d blocks found in xmlTextWriterStartCDATA",
41261 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041262 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041263 printf(" %d", n_writer);
41264 printf("\n");
41265 }
41266 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041267 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041268#endif
41269
Daniel Veillard42595322004-11-08 10:52:06 +000041270 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041271}
41272
41273
41274static int
41275test_xmlTextWriterStartComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041276 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041277
William M. Brack21e4ef22005-01-02 09:53:13 +000041278#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041279 int mem_base;
41280 int ret_val;
41281 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41282 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041283
Daniel Veillarde43cc572004-11-03 11:50:29 +000041284 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41285 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041286 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041287
41288 ret_val = xmlTextWriterStartComment(writer);
41289 desret_int(ret_val);
41290 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041291 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041292 xmlResetLastError();
41293 if (mem_base != xmlMemBlocks()) {
41294 printf("Leak of %d blocks found in xmlTextWriterStartComment",
41295 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041296 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041297 printf(" %d", n_writer);
41298 printf("\n");
41299 }
41300 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041301 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041302#endif
41303
Daniel Veillard42595322004-11-08 10:52:06 +000041304 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041305}
41306
41307
41308static int
41309test_xmlTextWriterStartDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041310 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041311
William M. Brack21e4ef22005-01-02 09:53:13 +000041312#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041313 int mem_base;
41314 int ret_val;
41315 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41316 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041317 xmlChar * name; /* the name of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041318 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041319 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041320 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041321 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041322 int n_sysid;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041323
Daniel Veillarde43cc572004-11-03 11:50:29 +000041324 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41325 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41326 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
41327 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
41328 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041329 writer = gen_xmlTextWriterPtr(n_writer, 0);
41330 name = gen_const_xmlChar_ptr(n_name, 1);
41331 pubid = gen_const_xmlChar_ptr(n_pubid, 2);
41332 sysid = gen_const_xmlChar_ptr(n_sysid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041333
William M. Brackf13f77f2004-11-12 16:03:48 +000041334 ret_val = xmlTextWriterStartDTD(writer, (const xmlChar *)name, (const xmlChar *)pubid, (const xmlChar *)sysid);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041335 desret_int(ret_val);
41336 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041337 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041338 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
41339 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 2);
41340 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041341 xmlResetLastError();
41342 if (mem_base != xmlMemBlocks()) {
41343 printf("Leak of %d blocks found in xmlTextWriterStartDTD",
41344 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041345 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041346 printf(" %d", n_writer);
41347 printf(" %d", n_name);
41348 printf(" %d", n_pubid);
41349 printf(" %d", n_sysid);
41350 printf("\n");
41351 }
41352 }
41353 }
41354 }
41355 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041356 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041357#endif
41358
Daniel Veillard42595322004-11-08 10:52:06 +000041359 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041360}
41361
41362
41363static int
41364test_xmlTextWriterStartDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041365 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041366
William M. Brack21e4ef22005-01-02 09:53:13 +000041367#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041368 int mem_base;
41369 int ret_val;
41370 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41371 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041372 xmlChar * name; /* the name of the DTD ATTLIST */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041373 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041374
Daniel Veillarde43cc572004-11-03 11:50:29 +000041375 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41376 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41377 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041378 writer = gen_xmlTextWriterPtr(n_writer, 0);
41379 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041380
William M. Brackf13f77f2004-11-12 16:03:48 +000041381 ret_val = xmlTextWriterStartDTDAttlist(writer, (const xmlChar *)name);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041382 desret_int(ret_val);
41383 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041384 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041385 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041386 xmlResetLastError();
41387 if (mem_base != xmlMemBlocks()) {
41388 printf("Leak of %d blocks found in xmlTextWriterStartDTDAttlist",
41389 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041390 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041391 printf(" %d", n_writer);
41392 printf(" %d", n_name);
41393 printf("\n");
41394 }
41395 }
41396 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041397 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041398#endif
41399
Daniel Veillard42595322004-11-08 10:52:06 +000041400 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041401}
41402
41403
41404static int
41405test_xmlTextWriterStartDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041406 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041407
William M. Brack21e4ef22005-01-02 09:53:13 +000041408#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041409 int mem_base;
41410 int ret_val;
41411 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41412 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041413 xmlChar * name; /* the name of the DTD element */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041414 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041415
Daniel Veillarde43cc572004-11-03 11:50:29 +000041416 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41417 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41418 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041419 writer = gen_xmlTextWriterPtr(n_writer, 0);
41420 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041421
William M. Brackf13f77f2004-11-12 16:03:48 +000041422 ret_val = xmlTextWriterStartDTDElement(writer, (const xmlChar *)name);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041423 desret_int(ret_val);
41424 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041425 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041426 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041427 xmlResetLastError();
41428 if (mem_base != xmlMemBlocks()) {
41429 printf("Leak of %d blocks found in xmlTextWriterStartDTDElement",
41430 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041431 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041432 printf(" %d", n_writer);
41433 printf(" %d", n_name);
41434 printf("\n");
41435 }
41436 }
41437 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041438 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041439#endif
41440
Daniel Veillard42595322004-11-08 10:52:06 +000041441 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041442}
41443
41444
41445static int
41446test_xmlTextWriterStartDTDEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041447 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041448
William M. Brack21e4ef22005-01-02 09:53:13 +000041449#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041450 int mem_base;
41451 int ret_val;
41452 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41453 int n_writer;
41454 int pe; /* TRUE if this is a parameter entity, FALSE if not */
41455 int n_pe;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041456 xmlChar * name; /* the name of the DTD ATTLIST */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041457 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041458
Daniel Veillarde43cc572004-11-03 11:50:29 +000041459 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41460 for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
41461 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41462 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041463 writer = gen_xmlTextWriterPtr(n_writer, 0);
41464 pe = gen_int(n_pe, 1);
41465 name = gen_const_xmlChar_ptr(n_name, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041466
William M. Brackf13f77f2004-11-12 16:03:48 +000041467 ret_val = xmlTextWriterStartDTDEntity(writer, pe, (const xmlChar *)name);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041468 desret_int(ret_val);
41469 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041470 des_xmlTextWriterPtr(n_writer, writer, 0);
41471 des_int(n_pe, pe, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000041472 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041473 xmlResetLastError();
41474 if (mem_base != xmlMemBlocks()) {
41475 printf("Leak of %d blocks found in xmlTextWriterStartDTDEntity",
41476 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041477 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041478 printf(" %d", n_writer);
41479 printf(" %d", n_pe);
41480 printf(" %d", n_name);
41481 printf("\n");
41482 }
41483 }
41484 }
41485 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041486 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041487#endif
41488
Daniel Veillard42595322004-11-08 10:52:06 +000041489 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041490}
41491
41492
41493static int
41494test_xmlTextWriterStartDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041495 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041496
William M. Brack21e4ef22005-01-02 09:53:13 +000041497#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041498 int mem_base;
41499 int ret_val;
41500 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41501 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041502 char * version; /* the xml version ("1.0") or NULL for default ("1.0") */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041503 int n_version;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041504 char * encoding; /* the encoding or NULL for default */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041505 int n_encoding;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041506 char * standalone; /* "yes" or "no" or NULL for default */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041507 int n_standalone;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041508
Daniel Veillarde43cc572004-11-03 11:50:29 +000041509 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41510 for (n_version = 0;n_version < gen_nb_const_char_ptr;n_version++) {
41511 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
41512 for (n_standalone = 0;n_standalone < gen_nb_const_char_ptr;n_standalone++) {
41513 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041514 writer = gen_xmlTextWriterPtr(n_writer, 0);
41515 version = gen_const_char_ptr(n_version, 1);
41516 encoding = gen_const_char_ptr(n_encoding, 2);
41517 standalone = gen_const_char_ptr(n_standalone, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041518
William M. Brackf13f77f2004-11-12 16:03:48 +000041519 ret_val = xmlTextWriterStartDocument(writer, (const char *)version, (const char *)encoding, (const char *)standalone);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041520 desret_int(ret_val);
41521 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041522 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041523 des_const_char_ptr(n_version, (const char *)version, 1);
41524 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
41525 des_const_char_ptr(n_standalone, (const char *)standalone, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041526 xmlResetLastError();
41527 if (mem_base != xmlMemBlocks()) {
41528 printf("Leak of %d blocks found in xmlTextWriterStartDocument",
41529 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041530 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041531 printf(" %d", n_writer);
41532 printf(" %d", n_version);
41533 printf(" %d", n_encoding);
41534 printf(" %d", n_standalone);
41535 printf("\n");
41536 }
41537 }
41538 }
41539 }
41540 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041541 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041542#endif
41543
Daniel Veillard42595322004-11-08 10:52:06 +000041544 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041545}
41546
41547
41548static int
41549test_xmlTextWriterStartElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041550 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041551
William M. Brack21e4ef22005-01-02 09:53:13 +000041552#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041553 int mem_base;
41554 int ret_val;
41555 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41556 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041557 xmlChar * name; /* element name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041558 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041559
Daniel Veillarde43cc572004-11-03 11:50:29 +000041560 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41561 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41562 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041563 writer = gen_xmlTextWriterPtr(n_writer, 0);
41564 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041565
William M. Brackf13f77f2004-11-12 16:03:48 +000041566 ret_val = xmlTextWriterStartElement(writer, (const xmlChar *)name);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041567 desret_int(ret_val);
41568 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041569 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041570 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041571 xmlResetLastError();
41572 if (mem_base != xmlMemBlocks()) {
41573 printf("Leak of %d blocks found in xmlTextWriterStartElement",
41574 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041575 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041576 printf(" %d", n_writer);
41577 printf(" %d", n_name);
41578 printf("\n");
41579 }
41580 }
41581 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041582 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041583#endif
41584
Daniel Veillard42595322004-11-08 10:52:06 +000041585 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041586}
41587
41588
41589static int
41590test_xmlTextWriterStartElementNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041591 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041592
William M. Brack21e4ef22005-01-02 09:53:13 +000041593#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041594 int mem_base;
41595 int ret_val;
41596 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41597 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041598 xmlChar * prefix; /* namespace prefix or NULL */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041599 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041600 xmlChar * name; /* element local name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041601 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041602 xmlChar * namespaceURI; /* namespace URI or NULL */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041603 int n_namespaceURI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041604
Daniel Veillarde43cc572004-11-03 11:50:29 +000041605 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41606 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
41607 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41608 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
41609 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041610 writer = gen_xmlTextWriterPtr(n_writer, 0);
41611 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
41612 name = gen_const_xmlChar_ptr(n_name, 2);
41613 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041614
William M. Brackf13f77f2004-11-12 16:03:48 +000041615 ret_val = xmlTextWriterStartElementNS(writer, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)namespaceURI);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041616 desret_int(ret_val);
41617 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041618 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041619 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
41620 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
41621 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041622 xmlResetLastError();
41623 if (mem_base != xmlMemBlocks()) {
41624 printf("Leak of %d blocks found in xmlTextWriterStartElementNS",
41625 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041626 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041627 printf(" %d", n_writer);
41628 printf(" %d", n_prefix);
41629 printf(" %d", n_name);
41630 printf(" %d", n_namespaceURI);
41631 printf("\n");
41632 }
41633 }
41634 }
41635 }
41636 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041637 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041638#endif
41639
Daniel Veillard42595322004-11-08 10:52:06 +000041640 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041641}
41642
41643
41644static int
41645test_xmlTextWriterStartPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041646 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041647
William M. Brack21e4ef22005-01-02 09:53:13 +000041648#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041649 int mem_base;
41650 int ret_val;
41651 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41652 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041653 xmlChar * target; /* PI target */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041654 int n_target;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041655
Daniel Veillarde43cc572004-11-03 11:50:29 +000041656 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41657 for (n_target = 0;n_target < gen_nb_const_xmlChar_ptr;n_target++) {
41658 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041659 writer = gen_xmlTextWriterPtr(n_writer, 0);
41660 target = gen_const_xmlChar_ptr(n_target, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041661
William M. Brackf13f77f2004-11-12 16:03:48 +000041662 ret_val = xmlTextWriterStartPI(writer, (const xmlChar *)target);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041663 desret_int(ret_val);
41664 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041665 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041666 des_const_xmlChar_ptr(n_target, (const xmlChar *)target, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041667 xmlResetLastError();
41668 if (mem_base != xmlMemBlocks()) {
41669 printf("Leak of %d blocks found in xmlTextWriterStartPI",
41670 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041671 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041672 printf(" %d", n_writer);
41673 printf(" %d", n_target);
41674 printf("\n");
41675 }
41676 }
41677 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041678 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041679#endif
41680
Daniel Veillard42595322004-11-08 10:52:06 +000041681 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041682}
41683
41684
41685static int
41686test_xmlTextWriterWriteAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041687 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041688
William M. Brack21e4ef22005-01-02 09:53:13 +000041689#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041690 int mem_base;
41691 int ret_val;
41692 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41693 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041694 xmlChar * name; /* attribute name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041695 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041696 xmlChar * content; /* attribute content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041697 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041698
Daniel Veillarde43cc572004-11-03 11:50:29 +000041699 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41700 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41701 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41702 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041703 writer = gen_xmlTextWriterPtr(n_writer, 0);
41704 name = gen_const_xmlChar_ptr(n_name, 1);
41705 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041706
William M. Brackf13f77f2004-11-12 16:03:48 +000041707 ret_val = xmlTextWriterWriteAttribute(writer, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041708 desret_int(ret_val);
41709 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041710 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041711 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
41712 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041713 xmlResetLastError();
41714 if (mem_base != xmlMemBlocks()) {
41715 printf("Leak of %d blocks found in xmlTextWriterWriteAttribute",
41716 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041717 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041718 printf(" %d", n_writer);
41719 printf(" %d", n_name);
41720 printf(" %d", n_content);
41721 printf("\n");
41722 }
41723 }
41724 }
41725 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041726 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041727#endif
41728
Daniel Veillard42595322004-11-08 10:52:06 +000041729 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041730}
41731
41732
41733static int
41734test_xmlTextWriterWriteAttributeNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041735 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041736
William M. Brack21e4ef22005-01-02 09:53:13 +000041737#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041738 int mem_base;
41739 int ret_val;
41740 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41741 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041742 xmlChar * prefix; /* namespace prefix */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041743 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041744 xmlChar * name; /* attribute local name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041745 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041746 xmlChar * namespaceURI; /* namespace URI */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041747 int n_namespaceURI;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041748 xmlChar * content; /* attribute content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041749 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041750
Daniel Veillarde43cc572004-11-03 11:50:29 +000041751 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41752 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
41753 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41754 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
41755 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41756 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041757 writer = gen_xmlTextWriterPtr(n_writer, 0);
41758 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
41759 name = gen_const_xmlChar_ptr(n_name, 2);
41760 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
41761 content = gen_const_xmlChar_ptr(n_content, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041762
William M. Brackf13f77f2004-11-12 16:03:48 +000041763 ret_val = xmlTextWriterWriteAttributeNS(writer, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)namespaceURI, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041764 desret_int(ret_val);
41765 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041766 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041767 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
41768 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
41769 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 3);
41770 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041771 xmlResetLastError();
41772 if (mem_base != xmlMemBlocks()) {
41773 printf("Leak of %d blocks found in xmlTextWriterWriteAttributeNS",
41774 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041775 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041776 printf(" %d", n_writer);
41777 printf(" %d", n_prefix);
41778 printf(" %d", n_name);
41779 printf(" %d", n_namespaceURI);
41780 printf(" %d", n_content);
41781 printf("\n");
41782 }
41783 }
41784 }
41785 }
41786 }
41787 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041788 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041789#endif
41790
Daniel Veillard42595322004-11-08 10:52:06 +000041791 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041792}
41793
41794
41795static int
41796test_xmlTextWriterWriteBase64(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041797 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041798
William M. Brack21e4ef22005-01-02 09:53:13 +000041799#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041800 int mem_base;
41801 int ret_val;
41802 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41803 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041804 char * data; /* binary data */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041805 int n_data;
41806 int start; /* the position within the data of the first byte to encode */
41807 int n_start;
41808 int len; /* the number of bytes to encode */
41809 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041810
Daniel Veillarde43cc572004-11-03 11:50:29 +000041811 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41812 for (n_data = 0;n_data < gen_nb_const_char_ptr;n_data++) {
41813 for (n_start = 0;n_start < gen_nb_int;n_start++) {
41814 for (n_len = 0;n_len < gen_nb_int;n_len++) {
41815 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041816 writer = gen_xmlTextWriterPtr(n_writer, 0);
41817 data = gen_const_char_ptr(n_data, 1);
41818 start = gen_int(n_start, 2);
41819 len = gen_int(n_len, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041820
William M. Brackf13f77f2004-11-12 16:03:48 +000041821 ret_val = xmlTextWriterWriteBase64(writer, (const char *)data, start, len);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041822 desret_int(ret_val);
41823 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041824 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041825 des_const_char_ptr(n_data, (const char *)data, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000041826 des_int(n_start, start, 2);
41827 des_int(n_len, len, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041828 xmlResetLastError();
41829 if (mem_base != xmlMemBlocks()) {
41830 printf("Leak of %d blocks found in xmlTextWriterWriteBase64",
41831 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041832 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041833 printf(" %d", n_writer);
41834 printf(" %d", n_data);
41835 printf(" %d", n_start);
41836 printf(" %d", n_len);
41837 printf("\n");
41838 }
41839 }
41840 }
41841 }
41842 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041843 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041844#endif
41845
Daniel Veillard42595322004-11-08 10:52:06 +000041846 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041847}
41848
41849
41850static int
41851test_xmlTextWriterWriteBinHex(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041852 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041853
William M. Brack21e4ef22005-01-02 09:53:13 +000041854#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041855 int mem_base;
41856 int ret_val;
41857 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41858 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041859 char * data; /* binary data */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041860 int n_data;
41861 int start; /* the position within the data of the first byte to encode */
41862 int n_start;
41863 int len; /* the number of bytes to encode */
41864 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041865
Daniel Veillarde43cc572004-11-03 11:50:29 +000041866 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41867 for (n_data = 0;n_data < gen_nb_const_char_ptr;n_data++) {
41868 for (n_start = 0;n_start < gen_nb_int;n_start++) {
41869 for (n_len = 0;n_len < gen_nb_int;n_len++) {
41870 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041871 writer = gen_xmlTextWriterPtr(n_writer, 0);
41872 data = gen_const_char_ptr(n_data, 1);
41873 start = gen_int(n_start, 2);
41874 len = gen_int(n_len, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041875
William M. Brackf13f77f2004-11-12 16:03:48 +000041876 ret_val = xmlTextWriterWriteBinHex(writer, (const char *)data, start, len);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041877 desret_int(ret_val);
41878 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041879 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041880 des_const_char_ptr(n_data, (const char *)data, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000041881 des_int(n_start, start, 2);
41882 des_int(n_len, len, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041883 xmlResetLastError();
41884 if (mem_base != xmlMemBlocks()) {
41885 printf("Leak of %d blocks found in xmlTextWriterWriteBinHex",
41886 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041887 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041888 printf(" %d", n_writer);
41889 printf(" %d", n_data);
41890 printf(" %d", n_start);
41891 printf(" %d", n_len);
41892 printf("\n");
41893 }
41894 }
41895 }
41896 }
41897 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041898 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041899#endif
41900
Daniel Veillard42595322004-11-08 10:52:06 +000041901 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041902}
41903
41904
41905static int
41906test_xmlTextWriterWriteCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041907 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041908
William M. Brack21e4ef22005-01-02 09:53:13 +000041909#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041910 int mem_base;
41911 int ret_val;
41912 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41913 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041914 xmlChar * content; /* CDATA content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041915 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041916
Daniel Veillarde43cc572004-11-03 11:50:29 +000041917 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41918 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41919 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041920 writer = gen_xmlTextWriterPtr(n_writer, 0);
41921 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041922
William M. Brackf13f77f2004-11-12 16:03:48 +000041923 ret_val = xmlTextWriterWriteCDATA(writer, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041924 desret_int(ret_val);
41925 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041926 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041927 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041928 xmlResetLastError();
41929 if (mem_base != xmlMemBlocks()) {
41930 printf("Leak of %d blocks found in xmlTextWriterWriteCDATA",
41931 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041932 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041933 printf(" %d", n_writer);
41934 printf(" %d", n_content);
41935 printf("\n");
41936 }
41937 }
41938 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041939 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041940#endif
41941
Daniel Veillard42595322004-11-08 10:52:06 +000041942 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041943}
41944
41945
41946static int
41947test_xmlTextWriterWriteComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041948 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041949
William M. Brack21e4ef22005-01-02 09:53:13 +000041950#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041951 int mem_base;
41952 int ret_val;
41953 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41954 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041955 xmlChar * content; /* comment string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041956 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041957
Daniel Veillarde43cc572004-11-03 11:50:29 +000041958 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41959 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41960 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041961 writer = gen_xmlTextWriterPtr(n_writer, 0);
41962 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041963
William M. Brackf13f77f2004-11-12 16:03:48 +000041964 ret_val = xmlTextWriterWriteComment(writer, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041965 desret_int(ret_val);
41966 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041967 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041968 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041969 xmlResetLastError();
41970 if (mem_base != xmlMemBlocks()) {
41971 printf("Leak of %d blocks found in xmlTextWriterWriteComment",
41972 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041973 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041974 printf(" %d", n_writer);
41975 printf(" %d", n_content);
41976 printf("\n");
41977 }
41978 }
41979 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041980 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041981#endif
41982
Daniel Veillard42595322004-11-08 10:52:06 +000041983 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041984}
41985
41986
41987static int
41988test_xmlTextWriterWriteDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041989 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041990
William M. Brack21e4ef22005-01-02 09:53:13 +000041991#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041992 int mem_base;
41993 int ret_val;
41994 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41995 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041996 xmlChar * name; /* the name of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041997 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041998 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041999 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042000 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042001 int n_sysid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042002 xmlChar * subset; /* string content of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042003 int n_subset;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042004
Daniel Veillarde43cc572004-11-03 11:50:29 +000042005 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42006 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
42007 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
42008 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
42009 for (n_subset = 0;n_subset < gen_nb_const_xmlChar_ptr;n_subset++) {
42010 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042011 writer = gen_xmlTextWriterPtr(n_writer, 0);
42012 name = gen_const_xmlChar_ptr(n_name, 1);
42013 pubid = gen_const_xmlChar_ptr(n_pubid, 2);
42014 sysid = gen_const_xmlChar_ptr(n_sysid, 3);
42015 subset = gen_const_xmlChar_ptr(n_subset, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042016
William M. Brackf13f77f2004-11-12 16:03:48 +000042017 ret_val = xmlTextWriterWriteDTD(writer, (const xmlChar *)name, (const xmlChar *)pubid, (const xmlChar *)sysid, (const xmlChar *)subset);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042018 desret_int(ret_val);
42019 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042020 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042021 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
42022 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 2);
42023 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 3);
42024 des_const_xmlChar_ptr(n_subset, (const xmlChar *)subset, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042025 xmlResetLastError();
42026 if (mem_base != xmlMemBlocks()) {
42027 printf("Leak of %d blocks found in xmlTextWriterWriteDTD",
42028 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042029 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042030 printf(" %d", n_writer);
42031 printf(" %d", n_name);
42032 printf(" %d", n_pubid);
42033 printf(" %d", n_sysid);
42034 printf(" %d", n_subset);
42035 printf("\n");
42036 }
42037 }
42038 }
42039 }
42040 }
42041 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042042 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042043#endif
42044
Daniel Veillard42595322004-11-08 10:52:06 +000042045 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042046}
42047
42048
42049static int
42050test_xmlTextWriterWriteDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042051 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042052
William M. Brack21e4ef22005-01-02 09:53:13 +000042053#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042054 int mem_base;
42055 int ret_val;
42056 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42057 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042058 xmlChar * name; /* the name of the DTD ATTLIST */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042059 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042060 xmlChar * content; /* content of the ATTLIST */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042061 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042062
Daniel Veillarde43cc572004-11-03 11:50:29 +000042063 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42064 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
42065 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42066 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042067 writer = gen_xmlTextWriterPtr(n_writer, 0);
42068 name = gen_const_xmlChar_ptr(n_name, 1);
42069 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042070
William M. Brackf13f77f2004-11-12 16:03:48 +000042071 ret_val = xmlTextWriterWriteDTDAttlist(writer, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042072 desret_int(ret_val);
42073 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042074 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042075 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
42076 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042077 xmlResetLastError();
42078 if (mem_base != xmlMemBlocks()) {
42079 printf("Leak of %d blocks found in xmlTextWriterWriteDTDAttlist",
42080 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042081 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042082 printf(" %d", n_writer);
42083 printf(" %d", n_name);
42084 printf(" %d", n_content);
42085 printf("\n");
42086 }
42087 }
42088 }
42089 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042090 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042091#endif
42092
Daniel Veillard42595322004-11-08 10:52:06 +000042093 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042094}
42095
42096
42097static int
42098test_xmlTextWriterWriteDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042099 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042100
William M. Brack21e4ef22005-01-02 09:53:13 +000042101#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042102 int mem_base;
42103 int ret_val;
42104 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42105 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042106 xmlChar * name; /* the name of the DTD element */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042107 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042108 xmlChar * content; /* content of the element */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042109 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042110
Daniel Veillarde43cc572004-11-03 11:50:29 +000042111 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42112 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
42113 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42114 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042115 writer = gen_xmlTextWriterPtr(n_writer, 0);
42116 name = gen_const_xmlChar_ptr(n_name, 1);
42117 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042118
William M. Brackf13f77f2004-11-12 16:03:48 +000042119 ret_val = xmlTextWriterWriteDTDElement(writer, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042120 desret_int(ret_val);
42121 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042122 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042123 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
42124 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042125 xmlResetLastError();
42126 if (mem_base != xmlMemBlocks()) {
42127 printf("Leak of %d blocks found in xmlTextWriterWriteDTDElement",
42128 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042129 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042130 printf(" %d", n_writer);
42131 printf(" %d", n_name);
42132 printf(" %d", n_content);
42133 printf("\n");
42134 }
42135 }
42136 }
42137 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042138 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042139#endif
42140
Daniel Veillard42595322004-11-08 10:52:06 +000042141 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042142}
42143
42144
42145static int
42146test_xmlTextWriterWriteDTDEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042147 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042148
William M. Brack21e4ef22005-01-02 09:53:13 +000042149#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042150 int mem_base;
42151 int ret_val;
42152 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42153 int n_writer;
42154 int pe; /* TRUE if this is a parameter entity, FALSE if not */
42155 int n_pe;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042156 xmlChar * name; /* the name of the DTD entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042157 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042158 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042159 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042160 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042161 int n_sysid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042162 xmlChar * ndataid; /* the xml notation name. */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042163 int n_ndataid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042164 xmlChar * content; /* content of the entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042165 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042166
Daniel Veillarde43cc572004-11-03 11:50:29 +000042167 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42168 for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
42169 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
42170 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
42171 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
42172 for (n_ndataid = 0;n_ndataid < gen_nb_const_xmlChar_ptr;n_ndataid++) {
42173 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42174 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042175 writer = gen_xmlTextWriterPtr(n_writer, 0);
42176 pe = gen_int(n_pe, 1);
42177 name = gen_const_xmlChar_ptr(n_name, 2);
42178 pubid = gen_const_xmlChar_ptr(n_pubid, 3);
42179 sysid = gen_const_xmlChar_ptr(n_sysid, 4);
42180 ndataid = gen_const_xmlChar_ptr(n_ndataid, 5);
42181 content = gen_const_xmlChar_ptr(n_content, 6);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042182
William M. Brackf13f77f2004-11-12 16:03:48 +000042183 ret_val = xmlTextWriterWriteDTDEntity(writer, pe, (const xmlChar *)name, (const xmlChar *)pubid, (const xmlChar *)sysid, (const xmlChar *)ndataid, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042184 desret_int(ret_val);
42185 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042186 des_xmlTextWriterPtr(n_writer, writer, 0);
42187 des_int(n_pe, pe, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000042188 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
42189 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 3);
42190 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 4);
42191 des_const_xmlChar_ptr(n_ndataid, (const xmlChar *)ndataid, 5);
42192 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 6);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042193 xmlResetLastError();
42194 if (mem_base != xmlMemBlocks()) {
42195 printf("Leak of %d blocks found in xmlTextWriterWriteDTDEntity",
42196 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042197 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042198 printf(" %d", n_writer);
42199 printf(" %d", n_pe);
42200 printf(" %d", n_name);
42201 printf(" %d", n_pubid);
42202 printf(" %d", n_sysid);
42203 printf(" %d", n_ndataid);
42204 printf(" %d", n_content);
42205 printf("\n");
42206 }
42207 }
42208 }
42209 }
42210 }
42211 }
42212 }
42213 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042214 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042215#endif
42216
Daniel Veillard42595322004-11-08 10:52:06 +000042217 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042218}
42219
42220
42221static int
42222test_xmlTextWriterWriteDTDExternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042223 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042224
William M. Brack21e4ef22005-01-02 09:53:13 +000042225#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042226 int mem_base;
42227 int ret_val;
42228 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42229 int n_writer;
42230 int pe; /* TRUE if this is a parameter entity, FALSE if not */
42231 int n_pe;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042232 xmlChar * name; /* the name of the DTD entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042233 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042234 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042235 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042236 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042237 int n_sysid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042238 xmlChar * ndataid; /* the xml notation name. */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042239 int n_ndataid;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042240
Daniel Veillarde43cc572004-11-03 11:50:29 +000042241 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42242 for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
42243 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
42244 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
42245 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
42246 for (n_ndataid = 0;n_ndataid < gen_nb_const_xmlChar_ptr;n_ndataid++) {
42247 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042248 writer = gen_xmlTextWriterPtr(n_writer, 0);
42249 pe = gen_int(n_pe, 1);
42250 name = gen_const_xmlChar_ptr(n_name, 2);
42251 pubid = gen_const_xmlChar_ptr(n_pubid, 3);
42252 sysid = gen_const_xmlChar_ptr(n_sysid, 4);
42253 ndataid = gen_const_xmlChar_ptr(n_ndataid, 5);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042254
William M. Brackf13f77f2004-11-12 16:03:48 +000042255 ret_val = xmlTextWriterWriteDTDExternalEntity(writer, pe, (const xmlChar *)name, (const xmlChar *)pubid, (const xmlChar *)sysid, (const xmlChar *)ndataid);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042256 desret_int(ret_val);
42257 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042258 des_xmlTextWriterPtr(n_writer, writer, 0);
42259 des_int(n_pe, pe, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000042260 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
42261 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 3);
42262 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 4);
42263 des_const_xmlChar_ptr(n_ndataid, (const xmlChar *)ndataid, 5);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042264 xmlResetLastError();
42265 if (mem_base != xmlMemBlocks()) {
42266 printf("Leak of %d blocks found in xmlTextWriterWriteDTDExternalEntity",
42267 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042268 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042269 printf(" %d", n_writer);
42270 printf(" %d", n_pe);
42271 printf(" %d", n_name);
42272 printf(" %d", n_pubid);
42273 printf(" %d", n_sysid);
42274 printf(" %d", n_ndataid);
42275 printf("\n");
42276 }
42277 }
42278 }
42279 }
42280 }
42281 }
42282 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042283 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042284#endif
42285
Daniel Veillard42595322004-11-08 10:52:06 +000042286 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042287}
42288
42289
42290static int
42291test_xmlTextWriterWriteDTDExternalEntityContents(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042292 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042293
William M. Brack21e4ef22005-01-02 09:53:13 +000042294#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042295 int mem_base;
42296 int ret_val;
42297 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42298 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042299 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042300 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042301 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042302 int n_sysid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042303 xmlChar * ndataid; /* the xml notation name. */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042304 int n_ndataid;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042305
Daniel Veillarde43cc572004-11-03 11:50:29 +000042306 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42307 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
42308 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
42309 for (n_ndataid = 0;n_ndataid < gen_nb_const_xmlChar_ptr;n_ndataid++) {
42310 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042311 writer = gen_xmlTextWriterPtr(n_writer, 0);
42312 pubid = gen_const_xmlChar_ptr(n_pubid, 1);
42313 sysid = gen_const_xmlChar_ptr(n_sysid, 2);
42314 ndataid = gen_const_xmlChar_ptr(n_ndataid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042315
William M. Brackf13f77f2004-11-12 16:03:48 +000042316 ret_val = xmlTextWriterWriteDTDExternalEntityContents(writer, (const xmlChar *)pubid, (const xmlChar *)sysid, (const xmlChar *)ndataid);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042317 desret_int(ret_val);
42318 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042319 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042320 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 1);
42321 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 2);
42322 des_const_xmlChar_ptr(n_ndataid, (const xmlChar *)ndataid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042323 xmlResetLastError();
42324 if (mem_base != xmlMemBlocks()) {
42325 printf("Leak of %d blocks found in xmlTextWriterWriteDTDExternalEntityContents",
42326 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042327 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042328 printf(" %d", n_writer);
42329 printf(" %d", n_pubid);
42330 printf(" %d", n_sysid);
42331 printf(" %d", n_ndataid);
42332 printf("\n");
42333 }
42334 }
42335 }
42336 }
42337 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042338 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042339#endif
42340
Daniel Veillard42595322004-11-08 10:52:06 +000042341 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042342}
42343
42344
42345static int
42346test_xmlTextWriterWriteDTDInternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042347 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042348
William M. Brack21e4ef22005-01-02 09:53:13 +000042349#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042350 int mem_base;
42351 int ret_val;
42352 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42353 int n_writer;
42354 int pe; /* TRUE if this is a parameter entity, FALSE if not */
42355 int n_pe;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042356 xmlChar * name; /* the name of the DTD entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042357 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042358 xmlChar * content; /* content of the entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042359 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042360
Daniel Veillarde43cc572004-11-03 11:50:29 +000042361 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42362 for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
42363 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
42364 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42365 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042366 writer = gen_xmlTextWriterPtr(n_writer, 0);
42367 pe = gen_int(n_pe, 1);
42368 name = gen_const_xmlChar_ptr(n_name, 2);
42369 content = gen_const_xmlChar_ptr(n_content, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042370
William M. Brackf13f77f2004-11-12 16:03:48 +000042371 ret_val = xmlTextWriterWriteDTDInternalEntity(writer, pe, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042372 desret_int(ret_val);
42373 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042374 des_xmlTextWriterPtr(n_writer, writer, 0);
42375 des_int(n_pe, pe, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000042376 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
42377 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042378 xmlResetLastError();
42379 if (mem_base != xmlMemBlocks()) {
42380 printf("Leak of %d blocks found in xmlTextWriterWriteDTDInternalEntity",
42381 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042382 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042383 printf(" %d", n_writer);
42384 printf(" %d", n_pe);
42385 printf(" %d", n_name);
42386 printf(" %d", n_content);
42387 printf("\n");
42388 }
42389 }
42390 }
42391 }
42392 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042393 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042394#endif
42395
Daniel Veillard42595322004-11-08 10:52:06 +000042396 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042397}
42398
42399
42400static int
42401test_xmlTextWriterWriteDTDNotation(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042402 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042403
William M. Brack21e4ef22005-01-02 09:53:13 +000042404#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042405 int mem_base;
42406 int ret_val;
42407 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42408 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042409 xmlChar * name; /* the name of the xml notation */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042410 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042411 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042412 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042413 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042414 int n_sysid;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042415
Daniel Veillarde43cc572004-11-03 11:50:29 +000042416 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42417 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
42418 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
42419 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
42420 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042421 writer = gen_xmlTextWriterPtr(n_writer, 0);
42422 name = gen_const_xmlChar_ptr(n_name, 1);
42423 pubid = gen_const_xmlChar_ptr(n_pubid, 2);
42424 sysid = gen_const_xmlChar_ptr(n_sysid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042425
William M. Brackf13f77f2004-11-12 16:03:48 +000042426 ret_val = xmlTextWriterWriteDTDNotation(writer, (const xmlChar *)name, (const xmlChar *)pubid, (const xmlChar *)sysid);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042427 desret_int(ret_val);
42428 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042429 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042430 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
42431 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 2);
42432 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042433 xmlResetLastError();
42434 if (mem_base != xmlMemBlocks()) {
42435 printf("Leak of %d blocks found in xmlTextWriterWriteDTDNotation",
42436 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042437 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042438 printf(" %d", n_writer);
42439 printf(" %d", n_name);
42440 printf(" %d", n_pubid);
42441 printf(" %d", n_sysid);
42442 printf("\n");
42443 }
42444 }
42445 }
42446 }
42447 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042448 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042449#endif
42450
Daniel Veillard42595322004-11-08 10:52:06 +000042451 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042452}
42453
42454
42455static int
42456test_xmlTextWriterWriteElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042457 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042458
William M. Brack21e4ef22005-01-02 09:53:13 +000042459#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042460 int mem_base;
42461 int ret_val;
42462 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42463 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042464 xmlChar * name; /* element name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042465 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042466 xmlChar * content; /* element content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042467 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042468
Daniel Veillarde43cc572004-11-03 11:50:29 +000042469 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42470 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
42471 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42472 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042473 writer = gen_xmlTextWriterPtr(n_writer, 0);
42474 name = gen_const_xmlChar_ptr(n_name, 1);
42475 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042476
William M. Brackf13f77f2004-11-12 16:03:48 +000042477 ret_val = xmlTextWriterWriteElement(writer, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042478 desret_int(ret_val);
42479 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042480 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042481 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
42482 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042483 xmlResetLastError();
42484 if (mem_base != xmlMemBlocks()) {
42485 printf("Leak of %d blocks found in xmlTextWriterWriteElement",
42486 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042487 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042488 printf(" %d", n_writer);
42489 printf(" %d", n_name);
42490 printf(" %d", n_content);
42491 printf("\n");
42492 }
42493 }
42494 }
42495 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042496 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042497#endif
42498
Daniel Veillard42595322004-11-08 10:52:06 +000042499 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042500}
42501
42502
42503static int
42504test_xmlTextWriterWriteElementNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042505 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042506
William M. Brack21e4ef22005-01-02 09:53:13 +000042507#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042508 int mem_base;
42509 int ret_val;
42510 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42511 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042512 xmlChar * prefix; /* namespace prefix */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042513 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042514 xmlChar * name; /* element local name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042515 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042516 xmlChar * namespaceURI; /* namespace URI */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042517 int n_namespaceURI;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042518 xmlChar * content; /* element content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042519 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042520
Daniel Veillarde43cc572004-11-03 11:50:29 +000042521 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42522 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
42523 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
42524 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
42525 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42526 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042527 writer = gen_xmlTextWriterPtr(n_writer, 0);
42528 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
42529 name = gen_const_xmlChar_ptr(n_name, 2);
42530 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
42531 content = gen_const_xmlChar_ptr(n_content, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042532
William M. Brackf13f77f2004-11-12 16:03:48 +000042533 ret_val = xmlTextWriterWriteElementNS(writer, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)namespaceURI, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042534 desret_int(ret_val);
42535 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042536 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042537 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
42538 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
42539 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 3);
42540 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042541 xmlResetLastError();
42542 if (mem_base != xmlMemBlocks()) {
42543 printf("Leak of %d blocks found in xmlTextWriterWriteElementNS",
42544 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042545 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042546 printf(" %d", n_writer);
42547 printf(" %d", n_prefix);
42548 printf(" %d", n_name);
42549 printf(" %d", n_namespaceURI);
42550 printf(" %d", n_content);
42551 printf("\n");
42552 }
42553 }
42554 }
42555 }
42556 }
42557 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042558 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042559#endif
42560
Daniel Veillard42595322004-11-08 10:52:06 +000042561 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042562}
42563
42564
42565static int
42566test_xmlTextWriterWriteFormatAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042567 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042568
42569
42570 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042571 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042572}
42573
42574
42575static int
42576test_xmlTextWriterWriteFormatAttributeNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042577 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042578
42579
42580 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042581 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042582}
42583
42584
42585static int
42586test_xmlTextWriterWriteFormatCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042587 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042588
42589
42590 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042591 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042592}
42593
42594
42595static int
42596test_xmlTextWriterWriteFormatComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042597 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042598
42599
42600 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042601 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042602}
42603
42604
42605static int
42606test_xmlTextWriterWriteFormatDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042607 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042608
42609
42610 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042611 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042612}
42613
42614
42615static int
42616test_xmlTextWriterWriteFormatDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042617 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042618
42619
42620 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042621 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042622}
42623
42624
42625static int
42626test_xmlTextWriterWriteFormatDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042627 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042628
42629
42630 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042631 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042632}
42633
42634
42635static int
42636test_xmlTextWriterWriteFormatDTDInternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042637 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042638
42639
42640 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042641 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042642}
42643
42644
42645static int
42646test_xmlTextWriterWriteFormatElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042647 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042648
42649
42650 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042651 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042652}
42653
42654
42655static int
42656test_xmlTextWriterWriteFormatElementNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042657 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042658
42659
42660 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042661 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042662}
42663
42664
42665static int
42666test_xmlTextWriterWriteFormatPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042667 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042668
42669
42670 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042671 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042672}
42673
42674
42675static int
42676test_xmlTextWriterWriteFormatRaw(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042677 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042678
42679
42680 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042681 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042682}
42683
42684
42685static int
42686test_xmlTextWriterWriteFormatString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042687 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042688
42689
42690 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042691 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042692}
42693
42694
42695static int
42696test_xmlTextWriterWritePI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042697 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042698
William M. Brack21e4ef22005-01-02 09:53:13 +000042699#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042700 int mem_base;
42701 int ret_val;
42702 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42703 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042704 xmlChar * target; /* PI target */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042705 int n_target;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042706 xmlChar * content; /* PI content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042707 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042708
Daniel Veillarde43cc572004-11-03 11:50:29 +000042709 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42710 for (n_target = 0;n_target < gen_nb_const_xmlChar_ptr;n_target++) {
42711 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42712 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042713 writer = gen_xmlTextWriterPtr(n_writer, 0);
42714 target = gen_const_xmlChar_ptr(n_target, 1);
42715 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042716
William M. Brackf13f77f2004-11-12 16:03:48 +000042717 ret_val = xmlTextWriterWritePI(writer, (const xmlChar *)target, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042718 desret_int(ret_val);
42719 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042720 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042721 des_const_xmlChar_ptr(n_target, (const xmlChar *)target, 1);
42722 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042723 xmlResetLastError();
42724 if (mem_base != xmlMemBlocks()) {
42725 printf("Leak of %d blocks found in xmlTextWriterWritePI",
42726 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042727 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042728 printf(" %d", n_writer);
42729 printf(" %d", n_target);
42730 printf(" %d", n_content);
42731 printf("\n");
42732 }
42733 }
42734 }
42735 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042736 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042737#endif
42738
Daniel Veillard42595322004-11-08 10:52:06 +000042739 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042740}
42741
42742
42743static int
42744test_xmlTextWriterWriteRaw(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042745 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042746
William M. Brack21e4ef22005-01-02 09:53:13 +000042747#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042748 int mem_base;
42749 int ret_val;
42750 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42751 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042752 xmlChar * content; /* text string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042753 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042754
Daniel Veillarde43cc572004-11-03 11:50:29 +000042755 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42756 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42757 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042758 writer = gen_xmlTextWriterPtr(n_writer, 0);
42759 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042760
William M. Brackf13f77f2004-11-12 16:03:48 +000042761 ret_val = xmlTextWriterWriteRaw(writer, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042762 desret_int(ret_val);
42763 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042764 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042765 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042766 xmlResetLastError();
42767 if (mem_base != xmlMemBlocks()) {
42768 printf("Leak of %d blocks found in xmlTextWriterWriteRaw",
42769 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042770 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042771 printf(" %d", n_writer);
42772 printf(" %d", n_content);
42773 printf("\n");
42774 }
42775 }
42776 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042777 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042778#endif
42779
Daniel Veillard42595322004-11-08 10:52:06 +000042780 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042781}
42782
42783
42784static int
42785test_xmlTextWriterWriteRawLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042786 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042787
William M. Brack21e4ef22005-01-02 09:53:13 +000042788#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042789 int mem_base;
42790 int ret_val;
42791 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42792 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042793 xmlChar * content; /* text string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042794 int n_content;
42795 int len; /* length of the text string */
42796 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042797
Daniel Veillarde43cc572004-11-03 11:50:29 +000042798 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42799 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42800 for (n_len = 0;n_len < gen_nb_int;n_len++) {
42801 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042802 writer = gen_xmlTextWriterPtr(n_writer, 0);
42803 content = gen_const_xmlChar_ptr(n_content, 1);
42804 len = gen_int(n_len, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042805
William M. Brackf13f77f2004-11-12 16:03:48 +000042806 ret_val = xmlTextWriterWriteRawLen(writer, (const xmlChar *)content, len);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042807 desret_int(ret_val);
42808 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042809 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042810 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000042811 des_int(n_len, len, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042812 xmlResetLastError();
42813 if (mem_base != xmlMemBlocks()) {
42814 printf("Leak of %d blocks found in xmlTextWriterWriteRawLen",
42815 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042816 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042817 printf(" %d", n_writer);
42818 printf(" %d", n_content);
42819 printf(" %d", n_len);
42820 printf("\n");
42821 }
42822 }
42823 }
42824 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042825 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042826#endif
42827
Daniel Veillard42595322004-11-08 10:52:06 +000042828 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042829}
42830
42831
42832static int
42833test_xmlTextWriterWriteString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042834 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042835
William M. Brack21e4ef22005-01-02 09:53:13 +000042836#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042837 int mem_base;
42838 int ret_val;
42839 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42840 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042841 xmlChar * content; /* text string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042842 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042843
Daniel Veillarde43cc572004-11-03 11:50:29 +000042844 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42845 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42846 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042847 writer = gen_xmlTextWriterPtr(n_writer, 0);
42848 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042849
William M. Brackf13f77f2004-11-12 16:03:48 +000042850 ret_val = xmlTextWriterWriteString(writer, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042851 desret_int(ret_val);
42852 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042853 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042854 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042855 xmlResetLastError();
42856 if (mem_base != xmlMemBlocks()) {
42857 printf("Leak of %d blocks found in xmlTextWriterWriteString",
42858 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042859 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042860 printf(" %d", n_writer);
42861 printf(" %d", n_content);
42862 printf("\n");
42863 }
42864 }
42865 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042866 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042867#endif
42868
Daniel Veillard42595322004-11-08 10:52:06 +000042869 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042870}
42871
42872
42873static int
42874test_xmlTextWriterWriteVFormatAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042875 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042876
42877
42878 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042879 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042880}
42881
42882
42883static int
42884test_xmlTextWriterWriteVFormatAttributeNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042885 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042886
42887
42888 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042889 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042890}
42891
42892
42893static int
42894test_xmlTextWriterWriteVFormatCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042895 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042896
42897
42898 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042899 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042900}
42901
42902
42903static int
42904test_xmlTextWriterWriteVFormatComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042905 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042906
42907
42908 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042909 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042910}
42911
42912
42913static int
42914test_xmlTextWriterWriteVFormatDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042915 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042916
42917
42918 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042919 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042920}
42921
42922
42923static int
42924test_xmlTextWriterWriteVFormatDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042925 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042926
42927
42928 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042929 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042930}
42931
42932
42933static int
42934test_xmlTextWriterWriteVFormatDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042935 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042936
42937
42938 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042939 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042940}
42941
42942
42943static int
42944test_xmlTextWriterWriteVFormatDTDInternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042945 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042946
42947
42948 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042949 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042950}
42951
42952
42953static int
42954test_xmlTextWriterWriteVFormatElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042955 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042956
42957
42958 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042959 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042960}
42961
42962
42963static int
42964test_xmlTextWriterWriteVFormatElementNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042965 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042966
42967
42968 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042969 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042970}
42971
42972
42973static int
42974test_xmlTextWriterWriteVFormatPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042975 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042976
42977
42978 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042979 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042980}
42981
42982
42983static int
42984test_xmlTextWriterWriteVFormatRaw(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042985 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042986
42987
42988 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042989 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042990}
42991
42992
42993static int
42994test_xmlTextWriterWriteVFormatString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042995 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042996
42997
42998 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042999 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043000}
43001
43002static int
43003test_xmlwriter(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043004 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043005
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043006 if (quiet == 0) printf("Testing xmlwriter : 51 of 79 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000043007 test_ret += test_xmlNewTextWriter();
43008 test_ret += test_xmlNewTextWriterFilename();
43009 test_ret += test_xmlNewTextWriterMemory();
43010 test_ret += test_xmlNewTextWriterPushParser();
43011 test_ret += test_xmlNewTextWriterTree();
43012 test_ret += test_xmlTextWriterEndAttribute();
43013 test_ret += test_xmlTextWriterEndCDATA();
43014 test_ret += test_xmlTextWriterEndComment();
43015 test_ret += test_xmlTextWriterEndDTD();
43016 test_ret += test_xmlTextWriterEndDTDAttlist();
43017 test_ret += test_xmlTextWriterEndDTDElement();
43018 test_ret += test_xmlTextWriterEndDTDEntity();
43019 test_ret += test_xmlTextWriterEndDocument();
43020 test_ret += test_xmlTextWriterEndElement();
43021 test_ret += test_xmlTextWriterEndPI();
43022 test_ret += test_xmlTextWriterFlush();
43023 test_ret += test_xmlTextWriterFullEndElement();
43024 test_ret += test_xmlTextWriterSetIndent();
43025 test_ret += test_xmlTextWriterSetIndentString();
43026 test_ret += test_xmlTextWriterStartAttribute();
43027 test_ret += test_xmlTextWriterStartAttributeNS();
43028 test_ret += test_xmlTextWriterStartCDATA();
43029 test_ret += test_xmlTextWriterStartComment();
43030 test_ret += test_xmlTextWriterStartDTD();
43031 test_ret += test_xmlTextWriterStartDTDAttlist();
43032 test_ret += test_xmlTextWriterStartDTDElement();
43033 test_ret += test_xmlTextWriterStartDTDEntity();
43034 test_ret += test_xmlTextWriterStartDocument();
43035 test_ret += test_xmlTextWriterStartElement();
43036 test_ret += test_xmlTextWriterStartElementNS();
43037 test_ret += test_xmlTextWriterStartPI();
43038 test_ret += test_xmlTextWriterWriteAttribute();
43039 test_ret += test_xmlTextWriterWriteAttributeNS();
43040 test_ret += test_xmlTextWriterWriteBase64();
43041 test_ret += test_xmlTextWriterWriteBinHex();
43042 test_ret += test_xmlTextWriterWriteCDATA();
43043 test_ret += test_xmlTextWriterWriteComment();
43044 test_ret += test_xmlTextWriterWriteDTD();
43045 test_ret += test_xmlTextWriterWriteDTDAttlist();
43046 test_ret += test_xmlTextWriterWriteDTDElement();
43047 test_ret += test_xmlTextWriterWriteDTDEntity();
43048 test_ret += test_xmlTextWriterWriteDTDExternalEntity();
43049 test_ret += test_xmlTextWriterWriteDTDExternalEntityContents();
43050 test_ret += test_xmlTextWriterWriteDTDInternalEntity();
43051 test_ret += test_xmlTextWriterWriteDTDNotation();
43052 test_ret += test_xmlTextWriterWriteElement();
43053 test_ret += test_xmlTextWriterWriteElementNS();
43054 test_ret += test_xmlTextWriterWriteFormatAttribute();
43055 test_ret += test_xmlTextWriterWriteFormatAttributeNS();
43056 test_ret += test_xmlTextWriterWriteFormatCDATA();
43057 test_ret += test_xmlTextWriterWriteFormatComment();
43058 test_ret += test_xmlTextWriterWriteFormatDTD();
43059 test_ret += test_xmlTextWriterWriteFormatDTDAttlist();
43060 test_ret += test_xmlTextWriterWriteFormatDTDElement();
43061 test_ret += test_xmlTextWriterWriteFormatDTDInternalEntity();
43062 test_ret += test_xmlTextWriterWriteFormatElement();
43063 test_ret += test_xmlTextWriterWriteFormatElementNS();
43064 test_ret += test_xmlTextWriterWriteFormatPI();
43065 test_ret += test_xmlTextWriterWriteFormatRaw();
43066 test_ret += test_xmlTextWriterWriteFormatString();
43067 test_ret += test_xmlTextWriterWritePI();
43068 test_ret += test_xmlTextWriterWriteRaw();
43069 test_ret += test_xmlTextWriterWriteRawLen();
43070 test_ret += test_xmlTextWriterWriteString();
43071 test_ret += test_xmlTextWriterWriteVFormatAttribute();
43072 test_ret += test_xmlTextWriterWriteVFormatAttributeNS();
43073 test_ret += test_xmlTextWriterWriteVFormatCDATA();
43074 test_ret += test_xmlTextWriterWriteVFormatComment();
43075 test_ret += test_xmlTextWriterWriteVFormatDTD();
43076 test_ret += test_xmlTextWriterWriteVFormatDTDAttlist();
43077 test_ret += test_xmlTextWriterWriteVFormatDTDElement();
43078 test_ret += test_xmlTextWriterWriteVFormatDTDInternalEntity();
43079 test_ret += test_xmlTextWriterWriteVFormatElement();
43080 test_ret += test_xmlTextWriterWriteVFormatElementNS();
43081 test_ret += test_xmlTextWriterWriteVFormatPI();
43082 test_ret += test_xmlTextWriterWriteVFormatRaw();
43083 test_ret += test_xmlTextWriterWriteVFormatString();
Daniel Veillardd93f6252004-11-02 15:53:51 +000043084
Daniel Veillard42595322004-11-08 10:52:06 +000043085 if (test_ret != 0)
43086 printf("Module xmlwriter: %d errors\n", test_ret);
43087 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043088}
43089
43090static int
43091test_xmlXPathCastBooleanToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043092 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043093
William M. Brack21e4ef22005-01-02 09:53:13 +000043094#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043095 int mem_base;
43096 double ret_val;
43097 int val; /* a boolean */
43098 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043099
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043100 for (n_val = 0;n_val < gen_nb_int;n_val++) {
43101 mem_base = xmlMemBlocks();
43102 val = gen_int(n_val, 0);
43103
43104 ret_val = xmlXPathCastBooleanToNumber(val);
43105 desret_double(ret_val);
43106 call_tests++;
43107 des_int(n_val, val, 0);
43108 xmlResetLastError();
43109 if (mem_base != xmlMemBlocks()) {
43110 printf("Leak of %d blocks found in xmlXPathCastBooleanToNumber",
43111 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043112 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043113 printf(" %d", n_val);
43114 printf("\n");
43115 }
43116 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043117 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043118#endif
43119
Daniel Veillard42595322004-11-08 10:52:06 +000043120 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043121}
43122
43123
43124static int
43125test_xmlXPathCastBooleanToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043126 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043127
William M. Brack21e4ef22005-01-02 09:53:13 +000043128#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +000043129 int mem_base;
43130 xmlChar * ret_val;
43131 int val; /* a boolean */
43132 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043133
Daniel Veillard8a32fe42004-11-02 22:10:16 +000043134 for (n_val = 0;n_val < gen_nb_int;n_val++) {
43135 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000043136 val = gen_int(n_val, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000043137
43138 ret_val = xmlXPathCastBooleanToString(val);
43139 desret_xmlChar_ptr(ret_val);
43140 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043141 des_int(n_val, val, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000043142 xmlResetLastError();
43143 if (mem_base != xmlMemBlocks()) {
43144 printf("Leak of %d blocks found in xmlXPathCastBooleanToString",
43145 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043146 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000043147 printf(" %d", n_val);
43148 printf("\n");
43149 }
43150 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043151 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000043152#endif
43153
Daniel Veillard42595322004-11-08 10:52:06 +000043154 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043155}
43156
43157
43158static int
43159test_xmlXPathCastNodeSetToBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043160 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043161
William M. Brack21e4ef22005-01-02 09:53:13 +000043162#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000043163 int mem_base;
43164 int ret_val;
43165 xmlNodeSetPtr ns; /* a node-set */
43166 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043167
Daniel Veillardce682bc2004-11-05 17:22:25 +000043168 for (n_ns = 0;n_ns < gen_nb_xmlNodeSetPtr;n_ns++) {
43169 mem_base = xmlMemBlocks();
43170 ns = gen_xmlNodeSetPtr(n_ns, 0);
43171
43172 ret_val = xmlXPathCastNodeSetToBoolean(ns);
43173 desret_int(ret_val);
43174 call_tests++;
43175 des_xmlNodeSetPtr(n_ns, ns, 0);
43176 xmlResetLastError();
43177 if (mem_base != xmlMemBlocks()) {
43178 printf("Leak of %d blocks found in xmlXPathCastNodeSetToBoolean",
43179 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043180 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043181 printf(" %d", n_ns);
43182 printf("\n");
43183 }
43184 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043185 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043186#endif
43187
Daniel Veillard42595322004-11-08 10:52:06 +000043188 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043189}
43190
43191
43192static int
43193test_xmlXPathCastNodeSetToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043194 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043195
William M. Brack21e4ef22005-01-02 09:53:13 +000043196#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000043197 int mem_base;
43198 double ret_val;
43199 xmlNodeSetPtr ns; /* a node-set */
43200 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043201
Daniel Veillardce682bc2004-11-05 17:22:25 +000043202 for (n_ns = 0;n_ns < gen_nb_xmlNodeSetPtr;n_ns++) {
43203 mem_base = xmlMemBlocks();
43204 ns = gen_xmlNodeSetPtr(n_ns, 0);
43205
43206 ret_val = xmlXPathCastNodeSetToNumber(ns);
43207 desret_double(ret_val);
43208 call_tests++;
43209 des_xmlNodeSetPtr(n_ns, ns, 0);
43210 xmlResetLastError();
43211 if (mem_base != xmlMemBlocks()) {
43212 printf("Leak of %d blocks found in xmlXPathCastNodeSetToNumber",
43213 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043214 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043215 printf(" %d", n_ns);
43216 printf("\n");
43217 }
43218 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043219 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043220#endif
43221
Daniel Veillard42595322004-11-08 10:52:06 +000043222 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043223}
43224
43225
43226static int
43227test_xmlXPathCastNodeSetToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043228 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043229
William M. Brack21e4ef22005-01-02 09:53:13 +000043230#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000043231 int mem_base;
43232 xmlChar * ret_val;
43233 xmlNodeSetPtr ns; /* a node-set */
43234 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043235
Daniel Veillardce682bc2004-11-05 17:22:25 +000043236 for (n_ns = 0;n_ns < gen_nb_xmlNodeSetPtr;n_ns++) {
43237 mem_base = xmlMemBlocks();
43238 ns = gen_xmlNodeSetPtr(n_ns, 0);
43239
43240 ret_val = xmlXPathCastNodeSetToString(ns);
43241 desret_xmlChar_ptr(ret_val);
43242 call_tests++;
43243 des_xmlNodeSetPtr(n_ns, ns, 0);
43244 xmlResetLastError();
43245 if (mem_base != xmlMemBlocks()) {
43246 printf("Leak of %d blocks found in xmlXPathCastNodeSetToString",
43247 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043248 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043249 printf(" %d", n_ns);
43250 printf("\n");
43251 }
43252 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043253 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043254#endif
43255
Daniel Veillard42595322004-11-08 10:52:06 +000043256 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043257}
43258
43259
43260static int
43261test_xmlXPathCastNodeToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043262 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043263
William M. Brack21e4ef22005-01-02 09:53:13 +000043264#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043265 int mem_base;
43266 double ret_val;
43267 xmlNodePtr node; /* a node */
43268 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043269
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043270 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
43271 mem_base = xmlMemBlocks();
43272 node = gen_xmlNodePtr(n_node, 0);
43273
43274 ret_val = xmlXPathCastNodeToNumber(node);
43275 desret_double(ret_val);
43276 call_tests++;
43277 des_xmlNodePtr(n_node, node, 0);
43278 xmlResetLastError();
43279 if (mem_base != xmlMemBlocks()) {
43280 printf("Leak of %d blocks found in xmlXPathCastNodeToNumber",
43281 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043282 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043283 printf(" %d", n_node);
43284 printf("\n");
43285 }
43286 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043287 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043288#endif
43289
Daniel Veillard42595322004-11-08 10:52:06 +000043290 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043291}
43292
43293
43294static int
43295test_xmlXPathCastNodeToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043296 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043297
William M. Brack21e4ef22005-01-02 09:53:13 +000043298#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +000043299 int mem_base;
43300 xmlChar * ret_val;
43301 xmlNodePtr node; /* a node */
43302 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043303
Daniel Veillard8a32fe42004-11-02 22:10:16 +000043304 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
43305 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000043306 node = gen_xmlNodePtr(n_node, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000043307
43308 ret_val = xmlXPathCastNodeToString(node);
43309 desret_xmlChar_ptr(ret_val);
43310 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043311 des_xmlNodePtr(n_node, node, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000043312 xmlResetLastError();
43313 if (mem_base != xmlMemBlocks()) {
43314 printf("Leak of %d blocks found in xmlXPathCastNodeToString",
43315 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043316 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000043317 printf(" %d", n_node);
43318 printf("\n");
43319 }
43320 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043321 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000043322#endif
43323
Daniel Veillard42595322004-11-08 10:52:06 +000043324 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043325}
43326
43327
43328static int
43329test_xmlXPathCastNumberToBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043330 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043331
William M. Brack21e4ef22005-01-02 09:53:13 +000043332#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000043333 int mem_base;
43334 int ret_val;
43335 double val; /* a number */
43336 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043337
Daniel Veillard3d95c732004-11-06 22:25:14 +000043338 for (n_val = 0;n_val < gen_nb_double;n_val++) {
43339 mem_base = xmlMemBlocks();
43340 val = gen_double(n_val, 0);
43341
43342 ret_val = xmlXPathCastNumberToBoolean(val);
43343 desret_int(ret_val);
43344 call_tests++;
43345 des_double(n_val, val, 0);
43346 xmlResetLastError();
43347 if (mem_base != xmlMemBlocks()) {
43348 printf("Leak of %d blocks found in xmlXPathCastNumberToBoolean",
43349 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043350 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043351 printf(" %d", n_val);
43352 printf("\n");
43353 }
43354 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043355 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043356#endif
43357
Daniel Veillard42595322004-11-08 10:52:06 +000043358 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043359}
43360
43361
43362static int
43363test_xmlXPathCastNumberToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043364 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043365
William M. Brack21e4ef22005-01-02 09:53:13 +000043366#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000043367 int mem_base;
43368 xmlChar * ret_val;
43369 double val; /* a number */
43370 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043371
Daniel Veillard3d95c732004-11-06 22:25:14 +000043372 for (n_val = 0;n_val < gen_nb_double;n_val++) {
43373 mem_base = xmlMemBlocks();
43374 val = gen_double(n_val, 0);
43375
43376 ret_val = xmlXPathCastNumberToString(val);
43377 desret_xmlChar_ptr(ret_val);
43378 call_tests++;
43379 des_double(n_val, val, 0);
43380 xmlResetLastError();
43381 if (mem_base != xmlMemBlocks()) {
43382 printf("Leak of %d blocks found in xmlXPathCastNumberToString",
43383 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043384 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043385 printf(" %d", n_val);
43386 printf("\n");
43387 }
43388 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043389 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043390#endif
43391
Daniel Veillard42595322004-11-08 10:52:06 +000043392 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043393}
43394
43395
43396static int
43397test_xmlXPathCastStringToBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043398 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043399
William M. Brack21e4ef22005-01-02 09:53:13 +000043400#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000043401 int mem_base;
43402 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043403 xmlChar * val; /* a string */
Daniel Veillardd93f6252004-11-02 15:53:51 +000043404 int n_val;
43405
43406 for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
43407 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000043408 val = gen_const_xmlChar_ptr(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043409
William M. Brackf13f77f2004-11-12 16:03:48 +000043410 ret_val = xmlXPathCastStringToBoolean((const xmlChar *)val);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043411 desret_int(ret_val);
43412 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000043413 des_const_xmlChar_ptr(n_val, (const xmlChar *)val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043414 xmlResetLastError();
43415 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000043416 printf("Leak of %d blocks found in xmlXPathCastStringToBoolean",
Daniel Veillardd93f6252004-11-02 15:53:51 +000043417 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043418 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000043419 printf(" %d", n_val);
43420 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000043421 }
43422 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043423 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043424#endif
43425
Daniel Veillard42595322004-11-08 10:52:06 +000043426 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043427}
43428
43429
43430static int
43431test_xmlXPathCastStringToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043432 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043433
William M. Brack21e4ef22005-01-02 09:53:13 +000043434#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043435 int mem_base;
43436 double ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043437 xmlChar * val; /* a string */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043438 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043439
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043440 for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
43441 mem_base = xmlMemBlocks();
43442 val = gen_const_xmlChar_ptr(n_val, 0);
43443
William M. Brackf13f77f2004-11-12 16:03:48 +000043444 ret_val = xmlXPathCastStringToNumber((const xmlChar *)val);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043445 desret_double(ret_val);
43446 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000043447 des_const_xmlChar_ptr(n_val, (const xmlChar *)val, 0);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043448 xmlResetLastError();
43449 if (mem_base != xmlMemBlocks()) {
43450 printf("Leak of %d blocks found in xmlXPathCastStringToNumber",
43451 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043452 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043453 printf(" %d", n_val);
43454 printf("\n");
43455 }
43456 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043457 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043458#endif
43459
Daniel Veillard42595322004-11-08 10:52:06 +000043460 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043461}
43462
43463
43464static int
43465test_xmlXPathCastToBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043466 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043467
William M. Brack21e4ef22005-01-02 09:53:13 +000043468#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043469 int mem_base;
43470 int ret_val;
43471 xmlXPathObjectPtr val; /* an XPath object */
43472 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043473
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043474 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
43475 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000043476 val = gen_xmlXPathObjectPtr(n_val, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043477
43478 ret_val = xmlXPathCastToBoolean(val);
43479 desret_int(ret_val);
43480 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043481 des_xmlXPathObjectPtr(n_val, val, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043482 xmlResetLastError();
43483 if (mem_base != xmlMemBlocks()) {
43484 printf("Leak of %d blocks found in xmlXPathCastToBoolean",
43485 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043486 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043487 printf(" %d", n_val);
43488 printf("\n");
43489 }
43490 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043491 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043492#endif
43493
Daniel Veillard42595322004-11-08 10:52:06 +000043494 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043495}
43496
43497
43498static int
43499test_xmlXPathCastToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043500 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043501
William M. Brack21e4ef22005-01-02 09:53:13 +000043502#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043503 int mem_base;
43504 double ret_val;
43505 xmlXPathObjectPtr val; /* an XPath object */
43506 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043507
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043508 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
43509 mem_base = xmlMemBlocks();
43510 val = gen_xmlXPathObjectPtr(n_val, 0);
43511
43512 ret_val = xmlXPathCastToNumber(val);
43513 desret_double(ret_val);
43514 call_tests++;
43515 des_xmlXPathObjectPtr(n_val, val, 0);
43516 xmlResetLastError();
43517 if (mem_base != xmlMemBlocks()) {
43518 printf("Leak of %d blocks found in xmlXPathCastToNumber",
43519 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043520 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043521 printf(" %d", n_val);
43522 printf("\n");
43523 }
43524 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043525 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043526#endif
43527
Daniel Veillard42595322004-11-08 10:52:06 +000043528 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043529}
43530
43531
43532static int
43533test_xmlXPathCastToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043534 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043535
William M. Brack21e4ef22005-01-02 09:53:13 +000043536#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043537 int mem_base;
43538 xmlChar * ret_val;
43539 xmlXPathObjectPtr val; /* an XPath object */
43540 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043541
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043542 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
43543 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000043544 val = gen_xmlXPathObjectPtr(n_val, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043545
43546 ret_val = xmlXPathCastToString(val);
43547 desret_xmlChar_ptr(ret_val);
43548 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043549 des_xmlXPathObjectPtr(n_val, val, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043550 xmlResetLastError();
43551 if (mem_base != xmlMemBlocks()) {
43552 printf("Leak of %d blocks found in xmlXPathCastToString",
43553 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043554 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043555 printf(" %d", n_val);
43556 printf("\n");
43557 }
43558 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043559 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043560#endif
43561
Daniel Veillard42595322004-11-08 10:52:06 +000043562 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043563}
43564
43565
43566static int
43567test_xmlXPathCmpNodes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043568 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043569
William M. Brack21e4ef22005-01-02 09:53:13 +000043570#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000043571 int mem_base;
43572 int ret_val;
43573 xmlNodePtr node1; /* the first node */
43574 int n_node1;
43575 xmlNodePtr node2; /* the second node */
43576 int n_node2;
43577
43578 for (n_node1 = 0;n_node1 < gen_nb_xmlNodePtr;n_node1++) {
43579 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
43580 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000043581 node1 = gen_xmlNodePtr(n_node1, 0);
43582 node2 = gen_xmlNodePtr(n_node2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043583
43584 ret_val = xmlXPathCmpNodes(node1, node2);
43585 desret_int(ret_val);
43586 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043587 des_xmlNodePtr(n_node1, node1, 0);
43588 des_xmlNodePtr(n_node2, node2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043589 xmlResetLastError();
43590 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000043591 printf("Leak of %d blocks found in xmlXPathCmpNodes",
Daniel Veillardd93f6252004-11-02 15:53:51 +000043592 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043593 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000043594 printf(" %d", n_node1);
43595 printf(" %d", n_node2);
43596 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000043597 }
43598 }
43599 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043600 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043601#endif
43602
Daniel Veillard42595322004-11-08 10:52:06 +000043603 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043604}
43605
43606
43607static int
43608test_xmlXPathCompile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043609 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043610
43611
43612 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043613 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043614}
43615
Daniel Veillarda521d282004-11-09 14:59:59 +000043616#ifdef LIBXML_XPATH_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000043617
Daniel Veillardce682bc2004-11-05 17:22:25 +000043618#define gen_nb_xmlXPathCompExprPtr 1
43619static xmlXPathCompExprPtr gen_xmlXPathCompExprPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
43620 return(NULL);
43621}
43622static void des_xmlXPathCompExprPtr(int no ATTRIBUTE_UNUSED, xmlXPathCompExprPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
43623}
Daniel Veillarda521d282004-11-09 14:59:59 +000043624#endif
43625
43626#ifdef LIBXML_XPATH_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000043627
43628#define gen_nb_xmlXPathContextPtr 1
43629static xmlXPathContextPtr gen_xmlXPathContextPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
43630 return(NULL);
43631}
43632static void des_xmlXPathContextPtr(int no ATTRIBUTE_UNUSED, xmlXPathContextPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
43633}
Daniel Veillarda521d282004-11-09 14:59:59 +000043634#endif
43635
Daniel Veillardce682bc2004-11-05 17:22:25 +000043636
Daniel Veillardd93f6252004-11-02 15:53:51 +000043637static int
43638test_xmlXPathCompiledEval(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043639 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043640
William M. Brack21e4ef22005-01-02 09:53:13 +000043641#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000043642 int mem_base;
43643 xmlXPathObjectPtr ret_val;
43644 xmlXPathCompExprPtr comp; /* the compiled XPath expression */
43645 int n_comp;
43646 xmlXPathContextPtr ctx; /* the XPath context */
43647 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043648
Daniel Veillardce682bc2004-11-05 17:22:25 +000043649 for (n_comp = 0;n_comp < gen_nb_xmlXPathCompExprPtr;n_comp++) {
43650 for (n_ctx = 0;n_ctx < gen_nb_xmlXPathContextPtr;n_ctx++) {
43651 mem_base = xmlMemBlocks();
43652 comp = gen_xmlXPathCompExprPtr(n_comp, 0);
43653 ctx = gen_xmlXPathContextPtr(n_ctx, 1);
43654
43655 ret_val = xmlXPathCompiledEval(comp, ctx);
43656 desret_xmlXPathObjectPtr(ret_val);
43657 call_tests++;
43658 des_xmlXPathCompExprPtr(n_comp, comp, 0);
43659 des_xmlXPathContextPtr(n_ctx, ctx, 1);
43660 xmlResetLastError();
43661 if (mem_base != xmlMemBlocks()) {
43662 printf("Leak of %d blocks found in xmlXPathCompiledEval",
43663 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043664 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043665 printf(" %d", n_comp);
43666 printf(" %d", n_ctx);
43667 printf("\n");
43668 }
43669 }
43670 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043671 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043672#endif
43673
Daniel Veillard42595322004-11-08 10:52:06 +000043674 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043675}
43676
43677
43678static int
43679test_xmlXPathConvertBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043680 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043681
William M. Brack21e4ef22005-01-02 09:53:13 +000043682#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000043683 int mem_base;
43684 xmlXPathObjectPtr ret_val;
43685 xmlXPathObjectPtr val; /* an XPath object */
43686 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043687
Daniel Veillard3d97e662004-11-04 10:49:00 +000043688 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
43689 mem_base = xmlMemBlocks();
43690 val = gen_xmlXPathObjectPtr(n_val, 0);
43691
43692 ret_val = xmlXPathConvertBoolean(val);
43693 val = NULL;
43694 desret_xmlXPathObjectPtr(ret_val);
43695 call_tests++;
43696 des_xmlXPathObjectPtr(n_val, val, 0);
43697 xmlResetLastError();
43698 if (mem_base != xmlMemBlocks()) {
43699 printf("Leak of %d blocks found in xmlXPathConvertBoolean",
43700 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043701 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043702 printf(" %d", n_val);
43703 printf("\n");
43704 }
43705 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043706 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043707#endif
43708
Daniel Veillard42595322004-11-08 10:52:06 +000043709 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043710}
43711
43712
43713static int
43714test_xmlXPathConvertNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043715 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043716
William M. Brack21e4ef22005-01-02 09:53:13 +000043717#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000043718 int mem_base;
43719 xmlXPathObjectPtr ret_val;
43720 xmlXPathObjectPtr val; /* an XPath object */
43721 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043722
Daniel Veillard3d97e662004-11-04 10:49:00 +000043723 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
43724 mem_base = xmlMemBlocks();
43725 val = gen_xmlXPathObjectPtr(n_val, 0);
43726
43727 ret_val = xmlXPathConvertNumber(val);
43728 val = NULL;
43729 desret_xmlXPathObjectPtr(ret_val);
43730 call_tests++;
43731 des_xmlXPathObjectPtr(n_val, val, 0);
43732 xmlResetLastError();
43733 if (mem_base != xmlMemBlocks()) {
43734 printf("Leak of %d blocks found in xmlXPathConvertNumber",
43735 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043736 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043737 printf(" %d", n_val);
43738 printf("\n");
43739 }
43740 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043741 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043742#endif
43743
Daniel Veillard42595322004-11-08 10:52:06 +000043744 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043745}
43746
43747
43748static int
43749test_xmlXPathConvertString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043750 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043751
William M. Brack21e4ef22005-01-02 09:53:13 +000043752#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000043753 int mem_base;
43754 xmlXPathObjectPtr ret_val;
43755 xmlXPathObjectPtr val; /* an XPath object */
43756 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043757
Daniel Veillard3d97e662004-11-04 10:49:00 +000043758 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
43759 mem_base = xmlMemBlocks();
43760 val = gen_xmlXPathObjectPtr(n_val, 0);
43761
43762 ret_val = xmlXPathConvertString(val);
43763 val = NULL;
43764 desret_xmlXPathObjectPtr(ret_val);
43765 call_tests++;
43766 des_xmlXPathObjectPtr(n_val, val, 0);
43767 xmlResetLastError();
43768 if (mem_base != xmlMemBlocks()) {
43769 printf("Leak of %d blocks found in xmlXPathConvertString",
43770 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043771 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043772 printf(" %d", n_val);
43773 printf("\n");
43774 }
43775 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043776 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043777#endif
43778
Daniel Veillard42595322004-11-08 10:52:06 +000043779 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043780}
43781
43782
43783static int
43784test_xmlXPathCtxtCompile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043785 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043786
43787
43788 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043789 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043790}
43791
43792
43793static int
43794test_xmlXPathEval(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043795 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043796
William M. Brack21e4ef22005-01-02 09:53:13 +000043797#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000043798 int mem_base;
43799 xmlXPathObjectPtr ret_val;
43800 xmlChar * str; /* the XPath expression */
43801 int n_str;
43802 xmlXPathContextPtr ctx; /* the XPath context */
43803 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043804
Daniel Veillardce682bc2004-11-05 17:22:25 +000043805 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
43806 for (n_ctx = 0;n_ctx < gen_nb_xmlXPathContextPtr;n_ctx++) {
43807 mem_base = xmlMemBlocks();
43808 str = gen_const_xmlChar_ptr(n_str, 0);
43809 ctx = gen_xmlXPathContextPtr(n_ctx, 1);
43810
William M. Brackf13f77f2004-11-12 16:03:48 +000043811 ret_val = xmlXPathEval((const xmlChar *)str, ctx);
Daniel Veillardce682bc2004-11-05 17:22:25 +000043812 desret_xmlXPathObjectPtr(ret_val);
43813 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000043814 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000043815 des_xmlXPathContextPtr(n_ctx, ctx, 1);
43816 xmlResetLastError();
43817 if (mem_base != xmlMemBlocks()) {
43818 printf("Leak of %d blocks found in xmlXPathEval",
43819 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043820 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043821 printf(" %d", n_str);
43822 printf(" %d", n_ctx);
43823 printf("\n");
43824 }
43825 }
43826 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043827 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043828#endif
43829
Daniel Veillard42595322004-11-08 10:52:06 +000043830 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043831}
43832
43833
43834static int
43835test_xmlXPathEvalExpression(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043836 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043837
William M. Brack21e4ef22005-01-02 09:53:13 +000043838#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000043839 int mem_base;
43840 xmlXPathObjectPtr ret_val;
43841 xmlChar * str; /* the XPath expression */
43842 int n_str;
43843 xmlXPathContextPtr ctxt; /* the XPath context */
43844 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043845
Daniel Veillardce682bc2004-11-05 17:22:25 +000043846 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
43847 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
43848 mem_base = xmlMemBlocks();
43849 str = gen_const_xmlChar_ptr(n_str, 0);
43850 ctxt = gen_xmlXPathContextPtr(n_ctxt, 1);
43851
William M. Brackf13f77f2004-11-12 16:03:48 +000043852 ret_val = xmlXPathEvalExpression((const xmlChar *)str, ctxt);
Daniel Veillardce682bc2004-11-05 17:22:25 +000043853 desret_xmlXPathObjectPtr(ret_val);
43854 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000043855 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000043856 des_xmlXPathContextPtr(n_ctxt, ctxt, 1);
43857 xmlResetLastError();
43858 if (mem_base != xmlMemBlocks()) {
43859 printf("Leak of %d blocks found in xmlXPathEvalExpression",
43860 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043861 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043862 printf(" %d", n_str);
43863 printf(" %d", n_ctxt);
43864 printf("\n");
43865 }
43866 }
43867 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043868 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043869#endif
43870
Daniel Veillard42595322004-11-08 10:52:06 +000043871 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043872}
43873
43874
43875static int
43876test_xmlXPathEvalPredicate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043877 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043878
William M. Brack21e4ef22005-01-02 09:53:13 +000043879#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000043880 int mem_base;
43881 int ret_val;
43882 xmlXPathContextPtr ctxt; /* the XPath context */
43883 int n_ctxt;
43884 xmlXPathObjectPtr res; /* the Predicate Expression evaluation result */
43885 int n_res;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043886
Daniel Veillardce682bc2004-11-05 17:22:25 +000043887 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
43888 for (n_res = 0;n_res < gen_nb_xmlXPathObjectPtr;n_res++) {
43889 mem_base = xmlMemBlocks();
43890 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
43891 res = gen_xmlXPathObjectPtr(n_res, 1);
43892
43893 ret_val = xmlXPathEvalPredicate(ctxt, res);
43894 desret_int(ret_val);
43895 call_tests++;
43896 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
43897 des_xmlXPathObjectPtr(n_res, res, 1);
43898 xmlResetLastError();
43899 if (mem_base != xmlMemBlocks()) {
43900 printf("Leak of %d blocks found in xmlXPathEvalPredicate",
43901 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043902 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043903 printf(" %d", n_ctxt);
43904 printf(" %d", n_res);
43905 printf("\n");
43906 }
43907 }
43908 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043909 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043910#endif
43911
Daniel Veillard42595322004-11-08 10:52:06 +000043912 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043913}
43914
43915
43916static int
43917test_xmlXPathInit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043918 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043919
William M. Brack21e4ef22005-01-02 09:53:13 +000043920#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000043921 int mem_base;
43922
43923 mem_base = xmlMemBlocks();
43924
43925 xmlXPathInit();
43926 call_tests++;
43927 xmlResetLastError();
43928 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000043929 printf("Leak of %d blocks found in xmlXPathInit",
Daniel Veillardd93f6252004-11-02 15:53:51 +000043930 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043931 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000043932 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000043933 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043934 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043935#endif
43936
Daniel Veillard42595322004-11-08 10:52:06 +000043937 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043938}
43939
43940
43941static int
43942test_xmlXPathIsInf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043943 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043944
William M. Brack21e4ef22005-01-02 09:53:13 +000043945#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000043946 int mem_base;
43947 int ret_val;
43948 double val; /* a double value */
43949 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043950
Daniel Veillard3d95c732004-11-06 22:25:14 +000043951 for (n_val = 0;n_val < gen_nb_double;n_val++) {
43952 mem_base = xmlMemBlocks();
43953 val = gen_double(n_val, 0);
43954
43955 ret_val = xmlXPathIsInf(val);
43956 desret_int(ret_val);
43957 call_tests++;
43958 des_double(n_val, val, 0);
43959 xmlResetLastError();
43960 if (mem_base != xmlMemBlocks()) {
43961 printf("Leak of %d blocks found in xmlXPathIsInf",
43962 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043963 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043964 printf(" %d", n_val);
43965 printf("\n");
43966 }
43967 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043968 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043969#endif
43970
Daniel Veillard42595322004-11-08 10:52:06 +000043971 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043972}
43973
43974
43975static int
43976test_xmlXPathIsNaN(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043977 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043978
William M. Brack21e4ef22005-01-02 09:53:13 +000043979#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000043980 int mem_base;
43981 int ret_val;
43982 double val; /* a double value */
43983 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043984
Daniel Veillard3d95c732004-11-06 22:25:14 +000043985 for (n_val = 0;n_val < gen_nb_double;n_val++) {
43986 mem_base = xmlMemBlocks();
43987 val = gen_double(n_val, 0);
43988
43989 ret_val = xmlXPathIsNaN(val);
43990 desret_int(ret_val);
43991 call_tests++;
43992 des_double(n_val, val, 0);
43993 xmlResetLastError();
43994 if (mem_base != xmlMemBlocks()) {
43995 printf("Leak of %d blocks found in xmlXPathIsNaN",
43996 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043997 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043998 printf(" %d", n_val);
43999 printf("\n");
44000 }
44001 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044002 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000044003#endif
44004
Daniel Veillard42595322004-11-08 10:52:06 +000044005 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000044006}
44007
44008
44009static int
44010test_xmlXPathNewContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000044011 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044012
44013
44014 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000044015 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000044016}
44017
44018
44019static int
44020test_xmlXPathNodeSetCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000044021 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044022
William M. Brack21e4ef22005-01-02 09:53:13 +000044023#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044024 int mem_base;
44025 xmlNodeSetPtr ret_val;
44026 xmlNodePtr val; /* an initial xmlNodePtr, or NULL */
44027 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044028
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044029 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
44030 mem_base = xmlMemBlocks();
44031 val = gen_xmlNodePtr(n_val, 0);
44032
44033 ret_val = xmlXPathNodeSetCreate(val);
44034 desret_xmlNodeSetPtr(ret_val);
44035 call_tests++;
44036 des_xmlNodePtr(n_val, val, 0);
44037 xmlResetLastError();
44038 if (mem_base != xmlMemBlocks()) {
44039 printf("Leak of %d blocks found in xmlXPathNodeSetCreate",
44040 xmlMemBlocks() - mem_base);
44041 test_ret++;
44042 printf(" %d", n_val);
44043 printf("\n");
44044 }
44045 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044046 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044047#endif
44048
Daniel Veillard42595322004-11-08 10:52:06 +000044049 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000044050}
44051
44052
44053static int
44054test_xmlXPathObjectCopy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000044055 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044056
William M. Brack21e4ef22005-01-02 09:53:13 +000044057#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000044058 int mem_base;
44059 xmlXPathObjectPtr ret_val;
44060 xmlXPathObjectPtr val; /* the original object */
44061 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044062
Daniel Veillard3d97e662004-11-04 10:49:00 +000044063 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
44064 mem_base = xmlMemBlocks();
44065 val = gen_xmlXPathObjectPtr(n_val, 0);
44066
44067 ret_val = xmlXPathObjectCopy(val);
44068 desret_xmlXPathObjectPtr(ret_val);
44069 call_tests++;
44070 des_xmlXPathObjectPtr(n_val, val, 0);
44071 xmlResetLastError();
44072 if (mem_base != xmlMemBlocks()) {
44073 printf("Leak of %d blocks found in xmlXPathObjectCopy",
44074 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000044075 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000044076 printf(" %d", n_val);
44077 printf("\n");
44078 }
44079 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044080 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000044081#endif
44082
Daniel Veillard42595322004-11-08 10:52:06 +000044083 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000044084}
44085
44086
44087static int
44088test_xmlXPathOrderDocElems(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000044089 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044090
William M. Brack21e4ef22005-01-02 09:53:13 +000044091#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000044092 int mem_base;
44093 long ret_val;
44094 xmlDocPtr doc; /* an input document */
44095 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044096
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000044097 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
44098 mem_base = xmlMemBlocks();
44099 doc = gen_xmlDocPtr(n_doc, 0);
44100
44101 ret_val = xmlXPathOrderDocElems(doc);
44102 desret_long(ret_val);
44103 call_tests++;
44104 des_xmlDocPtr(n_doc, doc, 0);
44105 xmlResetLastError();
44106 if (mem_base != xmlMemBlocks()) {
44107 printf("Leak of %d blocks found in xmlXPathOrderDocElems",
44108 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000044109 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000044110 printf(" %d", n_doc);
44111 printf("\n");
44112 }
44113 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044114 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000044115#endif
44116
Daniel Veillard42595322004-11-08 10:52:06 +000044117 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000044118}
44119
44120static int
44121test_xpath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000044122 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000044123
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044124 if (quiet == 0) printf("Testing xpath : 28 of 36 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000044125 test_ret += test_xmlXPathCastBooleanToNumber();
44126 test_ret += test_xmlXPathCastBooleanToString();
44127 test_ret += test_xmlXPathCastNodeSetToBoolean();
44128 test_ret += test_xmlXPathCastNodeSetToNumber();
44129 test_ret += test_xmlXPathCastNodeSetToString();
44130 test_ret += test_xmlXPathCastNodeToNumber();
44131 test_ret += test_xmlXPathCastNodeToString();
44132 test_ret += test_xmlXPathCastNumberToBoolean();
44133 test_ret += test_xmlXPathCastNumberToString();
44134 test_ret += test_xmlXPathCastStringToBoolean();
44135 test_ret += test_xmlXPathCastStringToNumber();
44136 test_ret += test_xmlXPathCastToBoolean();
44137 test_ret += test_xmlXPathCastToNumber();
44138 test_ret += test_xmlXPathCastToString();
44139 test_ret += test_xmlXPathCmpNodes();
44140 test_ret += test_xmlXPathCompile();
44141 test_ret += test_xmlXPathCompiledEval();
44142 test_ret += test_xmlXPathConvertBoolean();
44143 test_ret += test_xmlXPathConvertNumber();
44144 test_ret += test_xmlXPathConvertString();
44145 test_ret += test_xmlXPathCtxtCompile();
44146 test_ret += test_xmlXPathEval();
44147 test_ret += test_xmlXPathEvalExpression();
44148 test_ret += test_xmlXPathEvalPredicate();
44149 test_ret += test_xmlXPathInit();
44150 test_ret += test_xmlXPathIsInf();
44151 test_ret += test_xmlXPathIsNaN();
44152 test_ret += test_xmlXPathNewContext();
44153 test_ret += test_xmlXPathNodeSetCreate();
44154 test_ret += test_xmlXPathObjectCopy();
44155 test_ret += test_xmlXPathOrderDocElems();
Daniel Veillardd93f6252004-11-02 15:53:51 +000044156
Daniel Veillard42595322004-11-08 10:52:06 +000044157 if (test_ret != 0)
44158 printf("Module xpath: %d errors\n", test_ret);
44159 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000044160}
Daniel Veillarda521d282004-11-09 14:59:59 +000044161#ifdef LIBXML_XPATH_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000044162
Daniel Veillarda82b1822004-11-08 16:24:57 +000044163#define gen_nb_xmlXPathParserContextPtr 1
44164static xmlXPathParserContextPtr gen_xmlXPathParserContextPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
44165 return(NULL);
44166}
44167static void des_xmlXPathParserContextPtr(int no ATTRIBUTE_UNUSED, xmlXPathParserContextPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
44168}
Daniel Veillarda521d282004-11-09 14:59:59 +000044169#endif
44170
Daniel Veillarda82b1822004-11-08 16:24:57 +000044171
44172static int
44173test_valuePop(void) {
44174 int test_ret = 0;
44175
William M. Brack21e4ef22005-01-02 09:53:13 +000044176#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044177 int mem_base;
44178 xmlXPathObjectPtr ret_val;
44179 xmlXPathParserContextPtr ctxt; /* an XPath evaluation context */
44180 int n_ctxt;
44181
44182 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44183 mem_base = xmlMemBlocks();
44184 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44185
44186 ret_val = valuePop(ctxt);
44187 desret_xmlXPathObjectPtr(ret_val);
44188 call_tests++;
44189 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44190 xmlResetLastError();
44191 if (mem_base != xmlMemBlocks()) {
44192 printf("Leak of %d blocks found in valuePop",
44193 xmlMemBlocks() - mem_base);
44194 test_ret++;
44195 printf(" %d", n_ctxt);
44196 printf("\n");
44197 }
44198 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044199 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044200#endif
44201
Daniel Veillarda82b1822004-11-08 16:24:57 +000044202 return(test_ret);
44203}
44204
44205
44206static int
44207test_valuePush(void) {
44208 int test_ret = 0;
44209
William M. Brack21e4ef22005-01-02 09:53:13 +000044210#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044211 int mem_base;
44212 int ret_val;
44213 xmlXPathParserContextPtr ctxt; /* an XPath evaluation context */
44214 int n_ctxt;
44215 xmlXPathObjectPtr value; /* the XPath object */
44216 int n_value;
44217
44218 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44219 for (n_value = 0;n_value < gen_nb_xmlXPathObjectPtr;n_value++) {
44220 mem_base = xmlMemBlocks();
44221 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44222 value = gen_xmlXPathObjectPtr(n_value, 1);
44223
44224 ret_val = valuePush(ctxt, value);
44225 desret_int(ret_val);
44226 call_tests++;
44227 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44228 des_xmlXPathObjectPtr(n_value, value, 1);
44229 xmlResetLastError();
44230 if (mem_base != xmlMemBlocks()) {
44231 printf("Leak of %d blocks found in valuePush",
44232 xmlMemBlocks() - mem_base);
44233 test_ret++;
44234 printf(" %d", n_ctxt);
44235 printf(" %d", n_value);
44236 printf("\n");
44237 }
44238 }
44239 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044240 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044241#endif
44242
Daniel Veillarda82b1822004-11-08 16:24:57 +000044243 return(test_ret);
44244}
44245
44246
44247static int
44248test_xmlXPathAddValues(void) {
44249 int test_ret = 0;
44250
William M. Brack21e4ef22005-01-02 09:53:13 +000044251#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044252 int mem_base;
44253 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44254 int n_ctxt;
44255
44256 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44257 mem_base = xmlMemBlocks();
44258 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44259
44260 xmlXPathAddValues(ctxt);
44261 call_tests++;
44262 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44263 xmlResetLastError();
44264 if (mem_base != xmlMemBlocks()) {
44265 printf("Leak of %d blocks found in xmlXPathAddValues",
44266 xmlMemBlocks() - mem_base);
44267 test_ret++;
44268 printf(" %d", n_ctxt);
44269 printf("\n");
44270 }
44271 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044272 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044273#endif
44274
Daniel Veillarda82b1822004-11-08 16:24:57 +000044275 return(test_ret);
44276}
44277
44278
44279static int
44280test_xmlXPathBooleanFunction(void) {
44281 int test_ret = 0;
44282
William M. Brack21e4ef22005-01-02 09:53:13 +000044283#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044284 int mem_base;
44285 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44286 int n_ctxt;
44287 int nargs; /* the number of arguments */
44288 int n_nargs;
44289
44290 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44291 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44292 mem_base = xmlMemBlocks();
44293 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44294 nargs = gen_int(n_nargs, 1);
44295
44296 xmlXPathBooleanFunction(ctxt, nargs);
44297 call_tests++;
44298 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44299 des_int(n_nargs, nargs, 1);
44300 xmlResetLastError();
44301 if (mem_base != xmlMemBlocks()) {
44302 printf("Leak of %d blocks found in xmlXPathBooleanFunction",
44303 xmlMemBlocks() - mem_base);
44304 test_ret++;
44305 printf(" %d", n_ctxt);
44306 printf(" %d", n_nargs);
44307 printf("\n");
44308 }
44309 }
44310 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044311 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044312#endif
44313
Daniel Veillarda82b1822004-11-08 16:24:57 +000044314 return(test_ret);
44315}
44316
44317
44318static int
44319test_xmlXPathCeilingFunction(void) {
44320 int test_ret = 0;
44321
William M. Brack21e4ef22005-01-02 09:53:13 +000044322#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044323 int mem_base;
44324 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44325 int n_ctxt;
44326 int nargs; /* the number of arguments */
44327 int n_nargs;
44328
44329 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44330 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44331 mem_base = xmlMemBlocks();
44332 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44333 nargs = gen_int(n_nargs, 1);
44334
44335 xmlXPathCeilingFunction(ctxt, nargs);
44336 call_tests++;
44337 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44338 des_int(n_nargs, nargs, 1);
44339 xmlResetLastError();
44340 if (mem_base != xmlMemBlocks()) {
44341 printf("Leak of %d blocks found in xmlXPathCeilingFunction",
44342 xmlMemBlocks() - mem_base);
44343 test_ret++;
44344 printf(" %d", n_ctxt);
44345 printf(" %d", n_nargs);
44346 printf("\n");
44347 }
44348 }
44349 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044350 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044351#endif
44352
Daniel Veillarda82b1822004-11-08 16:24:57 +000044353 return(test_ret);
44354}
44355
44356
44357static int
44358test_xmlXPathCompareValues(void) {
44359 int test_ret = 0;
44360
William M. Brack21e4ef22005-01-02 09:53:13 +000044361#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044362 int mem_base;
44363 int ret_val;
44364 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44365 int n_ctxt;
44366 int inf; /* less than (1) or greater than (0) */
44367 int n_inf;
44368 int strict; /* is the comparison strict */
44369 int n_strict;
44370
44371 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44372 for (n_inf = 0;n_inf < gen_nb_int;n_inf++) {
44373 for (n_strict = 0;n_strict < gen_nb_int;n_strict++) {
44374 mem_base = xmlMemBlocks();
44375 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44376 inf = gen_int(n_inf, 1);
44377 strict = gen_int(n_strict, 2);
44378
44379 ret_val = xmlXPathCompareValues(ctxt, inf, strict);
44380 desret_int(ret_val);
44381 call_tests++;
44382 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44383 des_int(n_inf, inf, 1);
44384 des_int(n_strict, strict, 2);
44385 xmlResetLastError();
44386 if (mem_base != xmlMemBlocks()) {
44387 printf("Leak of %d blocks found in xmlXPathCompareValues",
44388 xmlMemBlocks() - mem_base);
44389 test_ret++;
44390 printf(" %d", n_ctxt);
44391 printf(" %d", n_inf);
44392 printf(" %d", n_strict);
44393 printf("\n");
44394 }
44395 }
44396 }
44397 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044398 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044399#endif
44400
Daniel Veillarda82b1822004-11-08 16:24:57 +000044401 return(test_ret);
44402}
44403
44404
44405static int
44406test_xmlXPathConcatFunction(void) {
44407 int test_ret = 0;
44408
William M. Brack21e4ef22005-01-02 09:53:13 +000044409#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044410 int mem_base;
44411 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44412 int n_ctxt;
44413 int nargs; /* the number of arguments */
44414 int n_nargs;
44415
44416 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44417 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44418 mem_base = xmlMemBlocks();
44419 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44420 nargs = gen_int(n_nargs, 1);
44421
44422 xmlXPathConcatFunction(ctxt, nargs);
44423 call_tests++;
44424 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44425 des_int(n_nargs, nargs, 1);
44426 xmlResetLastError();
44427 if (mem_base != xmlMemBlocks()) {
44428 printf("Leak of %d blocks found in xmlXPathConcatFunction",
44429 xmlMemBlocks() - mem_base);
44430 test_ret++;
44431 printf(" %d", n_ctxt);
44432 printf(" %d", n_nargs);
44433 printf("\n");
44434 }
44435 }
44436 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044437 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044438#endif
44439
Daniel Veillarda82b1822004-11-08 16:24:57 +000044440 return(test_ret);
44441}
44442
44443
44444static int
44445test_xmlXPathContainsFunction(void) {
44446 int test_ret = 0;
44447
William M. Brack21e4ef22005-01-02 09:53:13 +000044448#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044449 int mem_base;
44450 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44451 int n_ctxt;
44452 int nargs; /* the number of arguments */
44453 int n_nargs;
44454
44455 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44456 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44457 mem_base = xmlMemBlocks();
44458 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44459 nargs = gen_int(n_nargs, 1);
44460
44461 xmlXPathContainsFunction(ctxt, nargs);
44462 call_tests++;
44463 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44464 des_int(n_nargs, nargs, 1);
44465 xmlResetLastError();
44466 if (mem_base != xmlMemBlocks()) {
44467 printf("Leak of %d blocks found in xmlXPathContainsFunction",
44468 xmlMemBlocks() - mem_base);
44469 test_ret++;
44470 printf(" %d", n_ctxt);
44471 printf(" %d", n_nargs);
44472 printf("\n");
44473 }
44474 }
44475 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044476 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044477#endif
44478
Daniel Veillarda82b1822004-11-08 16:24:57 +000044479 return(test_ret);
44480}
44481
44482
44483static int
44484test_xmlXPathCountFunction(void) {
44485 int test_ret = 0;
44486
William M. Brack21e4ef22005-01-02 09:53:13 +000044487#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044488 int mem_base;
44489 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44490 int n_ctxt;
44491 int nargs; /* the number of arguments */
44492 int n_nargs;
44493
44494 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44495 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44496 mem_base = xmlMemBlocks();
44497 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44498 nargs = gen_int(n_nargs, 1);
44499
44500 xmlXPathCountFunction(ctxt, nargs);
44501 call_tests++;
44502 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44503 des_int(n_nargs, nargs, 1);
44504 xmlResetLastError();
44505 if (mem_base != xmlMemBlocks()) {
44506 printf("Leak of %d blocks found in xmlXPathCountFunction",
44507 xmlMemBlocks() - mem_base);
44508 test_ret++;
44509 printf(" %d", n_ctxt);
44510 printf(" %d", n_nargs);
44511 printf("\n");
44512 }
44513 }
44514 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044515 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044516#endif
44517
Daniel Veillarda82b1822004-11-08 16:24:57 +000044518 return(test_ret);
44519}
44520
44521
44522static int
44523test_xmlXPathDebugDumpCompExpr(void) {
44524 int test_ret = 0;
44525
William M. Brack21e4ef22005-01-02 09:53:13 +000044526#if defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044527 int mem_base;
44528 FILE * output; /* the FILE * for the output */
44529 int n_output;
44530 xmlXPathCompExprPtr comp; /* the precompiled XPath expression */
44531 int n_comp;
44532 int depth; /* the indentation level. */
44533 int n_depth;
44534
44535 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
44536 for (n_comp = 0;n_comp < gen_nb_xmlXPathCompExprPtr;n_comp++) {
44537 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
44538 mem_base = xmlMemBlocks();
44539 output = gen_FILE_ptr(n_output, 0);
44540 comp = gen_xmlXPathCompExprPtr(n_comp, 1);
44541 depth = gen_int(n_depth, 2);
44542
44543 xmlXPathDebugDumpCompExpr(output, comp, depth);
44544 call_tests++;
44545 des_FILE_ptr(n_output, output, 0);
44546 des_xmlXPathCompExprPtr(n_comp, comp, 1);
44547 des_int(n_depth, depth, 2);
44548 xmlResetLastError();
44549 if (mem_base != xmlMemBlocks()) {
44550 printf("Leak of %d blocks found in xmlXPathDebugDumpCompExpr",
44551 xmlMemBlocks() - mem_base);
44552 test_ret++;
44553 printf(" %d", n_output);
44554 printf(" %d", n_comp);
44555 printf(" %d", n_depth);
44556 printf("\n");
44557 }
44558 }
44559 }
44560 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044561 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044562#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +000044563
Daniel Veillarda82b1822004-11-08 16:24:57 +000044564 return(test_ret);
44565}
44566
44567
44568static int
44569test_xmlXPathDebugDumpObject(void) {
44570 int test_ret = 0;
44571
William M. Brack21e4ef22005-01-02 09:53:13 +000044572#if defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044573 int mem_base;
44574 FILE * output; /* the FILE * to dump the output */
44575 int n_output;
44576 xmlXPathObjectPtr cur; /* the object to inspect */
44577 int n_cur;
44578 int depth; /* indentation level */
44579 int n_depth;
44580
44581 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
44582 for (n_cur = 0;n_cur < gen_nb_xmlXPathObjectPtr;n_cur++) {
44583 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
44584 mem_base = xmlMemBlocks();
44585 output = gen_FILE_ptr(n_output, 0);
44586 cur = gen_xmlXPathObjectPtr(n_cur, 1);
44587 depth = gen_int(n_depth, 2);
44588
44589 xmlXPathDebugDumpObject(output, cur, depth);
44590 call_tests++;
44591 des_FILE_ptr(n_output, output, 0);
44592 des_xmlXPathObjectPtr(n_cur, cur, 1);
44593 des_int(n_depth, depth, 2);
44594 xmlResetLastError();
44595 if (mem_base != xmlMemBlocks()) {
44596 printf("Leak of %d blocks found in xmlXPathDebugDumpObject",
44597 xmlMemBlocks() - mem_base);
44598 test_ret++;
44599 printf(" %d", n_output);
44600 printf(" %d", n_cur);
44601 printf(" %d", n_depth);
44602 printf("\n");
44603 }
44604 }
44605 }
44606 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044607 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044608#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +000044609
Daniel Veillarda82b1822004-11-08 16:24:57 +000044610 return(test_ret);
44611}
44612
44613
44614static int
44615test_xmlXPathDifference(void) {
44616 int test_ret = 0;
44617
William M. Brack21e4ef22005-01-02 09:53:13 +000044618#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044619 int mem_base;
44620 xmlNodeSetPtr ret_val;
44621 xmlNodeSetPtr nodes1; /* a node-set */
44622 int n_nodes1;
44623 xmlNodeSetPtr nodes2; /* a node-set */
44624 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044625
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044626 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
44627 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
44628 mem_base = xmlMemBlocks();
44629 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
44630 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
44631
44632 ret_val = xmlXPathDifference(nodes1, nodes2);
44633 desret_xmlNodeSetPtr(ret_val);
44634 call_tests++;
44635 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
44636 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
44637 xmlResetLastError();
44638 if (mem_base != xmlMemBlocks()) {
44639 printf("Leak of %d blocks found in xmlXPathDifference",
44640 xmlMemBlocks() - mem_base);
44641 test_ret++;
44642 printf(" %d", n_nodes1);
44643 printf(" %d", n_nodes2);
44644 printf("\n");
44645 }
44646 }
44647 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044648 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044649#endif
44650
Daniel Veillarda82b1822004-11-08 16:24:57 +000044651 return(test_ret);
44652}
44653
44654
44655static int
44656test_xmlXPathDistinct(void) {
44657 int test_ret = 0;
44658
William M. Brack21e4ef22005-01-02 09:53:13 +000044659#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044660 int mem_base;
44661 xmlNodeSetPtr ret_val;
44662 xmlNodeSetPtr nodes; /* a node-set */
44663 int n_nodes;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044664
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044665 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
44666 mem_base = xmlMemBlocks();
44667 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
44668
44669 ret_val = xmlXPathDistinct(nodes);
44670 desret_xmlNodeSetPtr(ret_val);
44671 call_tests++;
44672 des_xmlNodeSetPtr(n_nodes, nodes, 0);
44673 xmlResetLastError();
44674 if (mem_base != xmlMemBlocks()) {
44675 printf("Leak of %d blocks found in xmlXPathDistinct",
44676 xmlMemBlocks() - mem_base);
44677 test_ret++;
44678 printf(" %d", n_nodes);
44679 printf("\n");
44680 }
44681 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044682 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044683#endif
44684
Daniel Veillarda82b1822004-11-08 16:24:57 +000044685 return(test_ret);
44686}
44687
44688
44689static int
44690test_xmlXPathDistinctSorted(void) {
44691 int test_ret = 0;
44692
William M. Brack21e4ef22005-01-02 09:53:13 +000044693#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044694 int mem_base;
44695 xmlNodeSetPtr ret_val;
44696 xmlNodeSetPtr nodes; /* a node-set, sorted by document order */
44697 int n_nodes;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044698
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044699 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
44700 mem_base = xmlMemBlocks();
44701 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
44702
44703 ret_val = xmlXPathDistinctSorted(nodes);
44704 desret_xmlNodeSetPtr(ret_val);
44705 call_tests++;
44706 des_xmlNodeSetPtr(n_nodes, nodes, 0);
44707 xmlResetLastError();
44708 if (mem_base != xmlMemBlocks()) {
44709 printf("Leak of %d blocks found in xmlXPathDistinctSorted",
44710 xmlMemBlocks() - mem_base);
44711 test_ret++;
44712 printf(" %d", n_nodes);
44713 printf("\n");
44714 }
44715 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044716 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044717#endif
44718
Daniel Veillarda82b1822004-11-08 16:24:57 +000044719 return(test_ret);
44720}
44721
44722
44723static int
44724test_xmlXPathDivValues(void) {
44725 int test_ret = 0;
44726
William M. Brack21e4ef22005-01-02 09:53:13 +000044727#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044728 int mem_base;
44729 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44730 int n_ctxt;
44731
44732 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44733 mem_base = xmlMemBlocks();
44734 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44735
44736 xmlXPathDivValues(ctxt);
44737 call_tests++;
44738 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44739 xmlResetLastError();
44740 if (mem_base != xmlMemBlocks()) {
44741 printf("Leak of %d blocks found in xmlXPathDivValues",
44742 xmlMemBlocks() - mem_base);
44743 test_ret++;
44744 printf(" %d", n_ctxt);
44745 printf("\n");
44746 }
44747 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044748 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044749#endif
44750
Daniel Veillarda82b1822004-11-08 16:24:57 +000044751 return(test_ret);
44752}
44753
44754
44755static int
44756test_xmlXPathEqualValues(void) {
44757 int test_ret = 0;
44758
William M. Brack21e4ef22005-01-02 09:53:13 +000044759#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044760 int mem_base;
44761 int ret_val;
44762 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44763 int n_ctxt;
44764
44765 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44766 mem_base = xmlMemBlocks();
44767 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44768
44769 ret_val = xmlXPathEqualValues(ctxt);
44770 desret_int(ret_val);
44771 call_tests++;
44772 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44773 xmlResetLastError();
44774 if (mem_base != xmlMemBlocks()) {
44775 printf("Leak of %d blocks found in xmlXPathEqualValues",
44776 xmlMemBlocks() - mem_base);
44777 test_ret++;
44778 printf(" %d", n_ctxt);
44779 printf("\n");
44780 }
44781 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044782 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044783#endif
44784
Daniel Veillarda82b1822004-11-08 16:24:57 +000044785 return(test_ret);
44786}
44787
44788
44789static int
44790test_xmlXPathErr(void) {
44791 int test_ret = 0;
44792
William M. Brack21e4ef22005-01-02 09:53:13 +000044793#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044794 int mem_base;
44795 xmlXPathParserContextPtr ctxt; /* a XPath parser context */
44796 int n_ctxt;
44797 int error; /* the error code */
44798 int n_error;
44799
44800 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44801 for (n_error = 0;n_error < gen_nb_int;n_error++) {
44802 mem_base = xmlMemBlocks();
44803 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44804 error = gen_int(n_error, 1);
44805
44806 xmlXPathErr(ctxt, error);
44807 call_tests++;
44808 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44809 des_int(n_error, error, 1);
44810 xmlResetLastError();
44811 if (mem_base != xmlMemBlocks()) {
44812 printf("Leak of %d blocks found in xmlXPathErr",
44813 xmlMemBlocks() - mem_base);
44814 test_ret++;
44815 printf(" %d", n_ctxt);
44816 printf(" %d", n_error);
44817 printf("\n");
44818 }
44819 }
44820 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044821 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044822#endif
44823
Daniel Veillarda82b1822004-11-08 16:24:57 +000044824 return(test_ret);
44825}
44826
44827
44828static int
44829test_xmlXPathEvalExpr(void) {
44830 int test_ret = 0;
44831
William M. Brack21e4ef22005-01-02 09:53:13 +000044832#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044833 int mem_base;
44834 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44835 int n_ctxt;
44836
44837 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44838 mem_base = xmlMemBlocks();
44839 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44840
44841 xmlXPathEvalExpr(ctxt);
44842 call_tests++;
44843 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44844 xmlResetLastError();
44845 if (mem_base != xmlMemBlocks()) {
44846 printf("Leak of %d blocks found in xmlXPathEvalExpr",
44847 xmlMemBlocks() - mem_base);
44848 test_ret++;
44849 printf(" %d", n_ctxt);
44850 printf("\n");
44851 }
44852 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044853 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044854#endif
44855
Daniel Veillarda82b1822004-11-08 16:24:57 +000044856 return(test_ret);
44857}
44858
44859
44860static int
44861test_xmlXPathEvaluatePredicateResult(void) {
44862 int test_ret = 0;
44863
William M. Brack21e4ef22005-01-02 09:53:13 +000044864#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044865 int mem_base;
44866 int ret_val;
44867 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44868 int n_ctxt;
44869 xmlXPathObjectPtr res; /* the Predicate Expression evaluation result */
44870 int n_res;
44871
44872 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44873 for (n_res = 0;n_res < gen_nb_xmlXPathObjectPtr;n_res++) {
44874 mem_base = xmlMemBlocks();
44875 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44876 res = gen_xmlXPathObjectPtr(n_res, 1);
44877
44878 ret_val = xmlXPathEvaluatePredicateResult(ctxt, res);
44879 desret_int(ret_val);
44880 call_tests++;
44881 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44882 des_xmlXPathObjectPtr(n_res, res, 1);
44883 xmlResetLastError();
44884 if (mem_base != xmlMemBlocks()) {
44885 printf("Leak of %d blocks found in xmlXPathEvaluatePredicateResult",
44886 xmlMemBlocks() - mem_base);
44887 test_ret++;
44888 printf(" %d", n_ctxt);
44889 printf(" %d", n_res);
44890 printf("\n");
44891 }
44892 }
44893 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044894 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044895#endif
44896
Daniel Veillarda82b1822004-11-08 16:24:57 +000044897 return(test_ret);
44898}
44899
44900
44901static int
44902test_xmlXPathFalseFunction(void) {
44903 int test_ret = 0;
44904
William M. Brack21e4ef22005-01-02 09:53:13 +000044905#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044906 int mem_base;
44907 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44908 int n_ctxt;
44909 int nargs; /* the number of arguments */
44910 int n_nargs;
44911
44912 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44913 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44914 mem_base = xmlMemBlocks();
44915 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44916 nargs = gen_int(n_nargs, 1);
44917
44918 xmlXPathFalseFunction(ctxt, nargs);
44919 call_tests++;
44920 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44921 des_int(n_nargs, nargs, 1);
44922 xmlResetLastError();
44923 if (mem_base != xmlMemBlocks()) {
44924 printf("Leak of %d blocks found in xmlXPathFalseFunction",
44925 xmlMemBlocks() - mem_base);
44926 test_ret++;
44927 printf(" %d", n_ctxt);
44928 printf(" %d", n_nargs);
44929 printf("\n");
44930 }
44931 }
44932 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044933 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044934#endif
44935
Daniel Veillarda82b1822004-11-08 16:24:57 +000044936 return(test_ret);
44937}
44938
44939
44940static int
44941test_xmlXPathFloorFunction(void) {
44942 int test_ret = 0;
44943
William M. Brack21e4ef22005-01-02 09:53:13 +000044944#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044945 int mem_base;
44946 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44947 int n_ctxt;
44948 int nargs; /* the number of arguments */
44949 int n_nargs;
44950
44951 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44952 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44953 mem_base = xmlMemBlocks();
44954 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44955 nargs = gen_int(n_nargs, 1);
44956
44957 xmlXPathFloorFunction(ctxt, nargs);
44958 call_tests++;
44959 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44960 des_int(n_nargs, nargs, 1);
44961 xmlResetLastError();
44962 if (mem_base != xmlMemBlocks()) {
44963 printf("Leak of %d blocks found in xmlXPathFloorFunction",
44964 xmlMemBlocks() - mem_base);
44965 test_ret++;
44966 printf(" %d", n_ctxt);
44967 printf(" %d", n_nargs);
44968 printf("\n");
44969 }
44970 }
44971 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044972 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044973#endif
44974
Daniel Veillarda82b1822004-11-08 16:24:57 +000044975 return(test_ret);
44976}
44977
44978
44979static int
44980test_xmlXPathFunctionLookup(void) {
44981 int test_ret = 0;
44982
44983
44984 /* missing type support */
44985 return(test_ret);
44986}
44987
44988
44989static int
44990test_xmlXPathFunctionLookupNS(void) {
44991 int test_ret = 0;
44992
44993
44994 /* missing type support */
44995 return(test_ret);
44996}
44997
44998
44999static int
45000test_xmlXPathHasSameNodes(void) {
45001 int test_ret = 0;
45002
William M. Brack21e4ef22005-01-02 09:53:13 +000045003#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045004 int mem_base;
45005 int ret_val;
45006 xmlNodeSetPtr nodes1; /* a node-set */
45007 int n_nodes1;
45008 xmlNodeSetPtr nodes2; /* a node-set */
45009 int n_nodes2;
45010
45011 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
45012 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
45013 mem_base = xmlMemBlocks();
45014 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
45015 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
45016
45017 ret_val = xmlXPathHasSameNodes(nodes1, nodes2);
45018 desret_int(ret_val);
45019 call_tests++;
45020 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
45021 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
45022 xmlResetLastError();
45023 if (mem_base != xmlMemBlocks()) {
45024 printf("Leak of %d blocks found in xmlXPathHasSameNodes",
45025 xmlMemBlocks() - mem_base);
45026 test_ret++;
45027 printf(" %d", n_nodes1);
45028 printf(" %d", n_nodes2);
45029 printf("\n");
45030 }
45031 }
45032 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045033 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045034#endif
45035
Daniel Veillarda82b1822004-11-08 16:24:57 +000045036 return(test_ret);
45037}
45038
45039
45040static int
45041test_xmlXPathIdFunction(void) {
45042 int test_ret = 0;
45043
William M. Brack21e4ef22005-01-02 09:53:13 +000045044#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045045 int mem_base;
45046 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45047 int n_ctxt;
45048 int nargs; /* the number of arguments */
45049 int n_nargs;
45050
45051 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45052 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
45053 mem_base = xmlMemBlocks();
45054 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45055 nargs = gen_int(n_nargs, 1);
45056
45057 xmlXPathIdFunction(ctxt, nargs);
45058 call_tests++;
45059 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45060 des_int(n_nargs, nargs, 1);
45061 xmlResetLastError();
45062 if (mem_base != xmlMemBlocks()) {
45063 printf("Leak of %d blocks found in xmlXPathIdFunction",
45064 xmlMemBlocks() - mem_base);
45065 test_ret++;
45066 printf(" %d", n_ctxt);
45067 printf(" %d", n_nargs);
45068 printf("\n");
45069 }
45070 }
45071 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045072 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045073#endif
45074
Daniel Veillarda82b1822004-11-08 16:24:57 +000045075 return(test_ret);
45076}
45077
45078
45079static int
45080test_xmlXPathIntersection(void) {
45081 int test_ret = 0;
45082
William M. Brack21e4ef22005-01-02 09:53:13 +000045083#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045084 int mem_base;
45085 xmlNodeSetPtr ret_val;
45086 xmlNodeSetPtr nodes1; /* a node-set */
45087 int n_nodes1;
45088 xmlNodeSetPtr nodes2; /* a node-set */
45089 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045090
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045091 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
45092 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
45093 mem_base = xmlMemBlocks();
45094 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
45095 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
45096
45097 ret_val = xmlXPathIntersection(nodes1, nodes2);
45098 desret_xmlNodeSetPtr(ret_val);
45099 call_tests++;
45100 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
45101 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
45102 xmlResetLastError();
45103 if (mem_base != xmlMemBlocks()) {
45104 printf("Leak of %d blocks found in xmlXPathIntersection",
45105 xmlMemBlocks() - mem_base);
45106 test_ret++;
45107 printf(" %d", n_nodes1);
45108 printf(" %d", n_nodes2);
45109 printf("\n");
45110 }
45111 }
45112 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045113 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045114#endif
45115
Daniel Veillarda82b1822004-11-08 16:24:57 +000045116 return(test_ret);
45117}
45118
45119
45120static int
45121test_xmlXPathIsNodeType(void) {
45122 int test_ret = 0;
45123
William M. Brack21e4ef22005-01-02 09:53:13 +000045124#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045125 int mem_base;
45126 int ret_val;
45127 xmlChar * name; /* a name string */
45128 int n_name;
45129
45130 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
45131 mem_base = xmlMemBlocks();
45132 name = gen_const_xmlChar_ptr(n_name, 0);
45133
William M. Brackf13f77f2004-11-12 16:03:48 +000045134 ret_val = xmlXPathIsNodeType((const xmlChar *)name);
Daniel Veillarda82b1822004-11-08 16:24:57 +000045135 desret_int(ret_val);
45136 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000045137 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillarda82b1822004-11-08 16:24:57 +000045138 xmlResetLastError();
45139 if (mem_base != xmlMemBlocks()) {
45140 printf("Leak of %d blocks found in xmlXPathIsNodeType",
45141 xmlMemBlocks() - mem_base);
45142 test_ret++;
45143 printf(" %d", n_name);
45144 printf("\n");
45145 }
45146 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045147 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045148#endif
45149
Daniel Veillarda82b1822004-11-08 16:24:57 +000045150 return(test_ret);
45151}
45152
45153
45154static int
45155test_xmlXPathLangFunction(void) {
45156 int test_ret = 0;
45157
William M. Brack21e4ef22005-01-02 09:53:13 +000045158#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045159 int mem_base;
45160 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45161 int n_ctxt;
45162 int nargs; /* the number of arguments */
45163 int n_nargs;
45164
45165 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45166 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
45167 mem_base = xmlMemBlocks();
45168 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45169 nargs = gen_int(n_nargs, 1);
45170
45171 xmlXPathLangFunction(ctxt, nargs);
45172 call_tests++;
45173 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45174 des_int(n_nargs, nargs, 1);
45175 xmlResetLastError();
45176 if (mem_base != xmlMemBlocks()) {
45177 printf("Leak of %d blocks found in xmlXPathLangFunction",
45178 xmlMemBlocks() - mem_base);
45179 test_ret++;
45180 printf(" %d", n_ctxt);
45181 printf(" %d", n_nargs);
45182 printf("\n");
45183 }
45184 }
45185 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045186 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045187#endif
45188
Daniel Veillarda82b1822004-11-08 16:24:57 +000045189 return(test_ret);
45190}
45191
45192
45193static int
45194test_xmlXPathLastFunction(void) {
45195 int test_ret = 0;
45196
William M. Brack21e4ef22005-01-02 09:53:13 +000045197#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045198 int mem_base;
45199 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45200 int n_ctxt;
45201 int nargs; /* the number of arguments */
45202 int n_nargs;
45203
45204 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45205 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
45206 mem_base = xmlMemBlocks();
45207 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45208 nargs = gen_int(n_nargs, 1);
45209
45210 xmlXPathLastFunction(ctxt, nargs);
45211 call_tests++;
45212 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45213 des_int(n_nargs, nargs, 1);
45214 xmlResetLastError();
45215 if (mem_base != xmlMemBlocks()) {
45216 printf("Leak of %d blocks found in xmlXPathLastFunction",
45217 xmlMemBlocks() - mem_base);
45218 test_ret++;
45219 printf(" %d", n_ctxt);
45220 printf(" %d", n_nargs);
45221 printf("\n");
45222 }
45223 }
45224 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045225 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045226#endif
45227
Daniel Veillarda82b1822004-11-08 16:24:57 +000045228 return(test_ret);
45229}
45230
45231
45232static int
45233test_xmlXPathLeading(void) {
45234 int test_ret = 0;
45235
William M. Brack21e4ef22005-01-02 09:53:13 +000045236#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045237 int mem_base;
45238 xmlNodeSetPtr ret_val;
45239 xmlNodeSetPtr nodes1; /* a node-set */
45240 int n_nodes1;
45241 xmlNodeSetPtr nodes2; /* a node-set */
45242 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045243
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045244 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
45245 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
45246 mem_base = xmlMemBlocks();
45247 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
45248 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
45249
45250 ret_val = xmlXPathLeading(nodes1, nodes2);
45251 desret_xmlNodeSetPtr(ret_val);
45252 call_tests++;
45253 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
45254 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
45255 xmlResetLastError();
45256 if (mem_base != xmlMemBlocks()) {
45257 printf("Leak of %d blocks found in xmlXPathLeading",
45258 xmlMemBlocks() - mem_base);
45259 test_ret++;
45260 printf(" %d", n_nodes1);
45261 printf(" %d", n_nodes2);
45262 printf("\n");
45263 }
45264 }
45265 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045266 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045267#endif
45268
Daniel Veillarda82b1822004-11-08 16:24:57 +000045269 return(test_ret);
45270}
45271
45272
45273static int
45274test_xmlXPathLeadingSorted(void) {
45275 int test_ret = 0;
45276
William M. Brack21e4ef22005-01-02 09:53:13 +000045277#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045278 int mem_base;
45279 xmlNodeSetPtr ret_val;
45280 xmlNodeSetPtr nodes1; /* a node-set, sorted by document order */
45281 int n_nodes1;
45282 xmlNodeSetPtr nodes2; /* a node-set, sorted by document order */
45283 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045284
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045285 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
45286 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
45287 mem_base = xmlMemBlocks();
45288 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
45289 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
45290
45291 ret_val = xmlXPathLeadingSorted(nodes1, nodes2);
45292 desret_xmlNodeSetPtr(ret_val);
45293 call_tests++;
45294 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
45295 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
45296 xmlResetLastError();
45297 if (mem_base != xmlMemBlocks()) {
45298 printf("Leak of %d blocks found in xmlXPathLeadingSorted",
45299 xmlMemBlocks() - mem_base);
45300 test_ret++;
45301 printf(" %d", n_nodes1);
45302 printf(" %d", n_nodes2);
45303 printf("\n");
45304 }
45305 }
45306 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045307 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045308#endif
45309
Daniel Veillarda82b1822004-11-08 16:24:57 +000045310 return(test_ret);
45311}
45312
45313
45314static int
45315test_xmlXPathLocalNameFunction(void) {
45316 int test_ret = 0;
45317
William M. Brack21e4ef22005-01-02 09:53:13 +000045318#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045319 int mem_base;
45320 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45321 int n_ctxt;
45322 int nargs; /* the number of arguments */
45323 int n_nargs;
45324
45325 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45326 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
45327 mem_base = xmlMemBlocks();
45328 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45329 nargs = gen_int(n_nargs, 1);
45330
45331 xmlXPathLocalNameFunction(ctxt, nargs);
45332 call_tests++;
45333 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45334 des_int(n_nargs, nargs, 1);
45335 xmlResetLastError();
45336 if (mem_base != xmlMemBlocks()) {
45337 printf("Leak of %d blocks found in xmlXPathLocalNameFunction",
45338 xmlMemBlocks() - mem_base);
45339 test_ret++;
45340 printf(" %d", n_ctxt);
45341 printf(" %d", n_nargs);
45342 printf("\n");
45343 }
45344 }
45345 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045346 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045347#endif
45348
Daniel Veillarda82b1822004-11-08 16:24:57 +000045349 return(test_ret);
45350}
45351
45352
45353static int
45354test_xmlXPathModValues(void) {
45355 int test_ret = 0;
45356
William M. Brack21e4ef22005-01-02 09:53:13 +000045357#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045358 int mem_base;
45359 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45360 int n_ctxt;
45361
45362 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45363 mem_base = xmlMemBlocks();
45364 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45365
45366 xmlXPathModValues(ctxt);
45367 call_tests++;
45368 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45369 xmlResetLastError();
45370 if (mem_base != xmlMemBlocks()) {
45371 printf("Leak of %d blocks found in xmlXPathModValues",
45372 xmlMemBlocks() - mem_base);
45373 test_ret++;
45374 printf(" %d", n_ctxt);
45375 printf("\n");
45376 }
45377 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045378 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045379#endif
45380
Daniel Veillarda82b1822004-11-08 16:24:57 +000045381 return(test_ret);
45382}
45383
45384
45385static int
45386test_xmlXPathMultValues(void) {
45387 int test_ret = 0;
45388
William M. Brack21e4ef22005-01-02 09:53:13 +000045389#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045390 int mem_base;
45391 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45392 int n_ctxt;
45393
45394 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45395 mem_base = xmlMemBlocks();
45396 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45397
45398 xmlXPathMultValues(ctxt);
45399 call_tests++;
45400 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45401 xmlResetLastError();
45402 if (mem_base != xmlMemBlocks()) {
45403 printf("Leak of %d blocks found in xmlXPathMultValues",
45404 xmlMemBlocks() - mem_base);
45405 test_ret++;
45406 printf(" %d", n_ctxt);
45407 printf("\n");
45408 }
45409 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045410 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045411#endif
45412
Daniel Veillarda82b1822004-11-08 16:24:57 +000045413 return(test_ret);
45414}
45415
45416
45417static int
45418test_xmlXPathNamespaceURIFunction(void) {
45419 int test_ret = 0;
45420
William M. Brack21e4ef22005-01-02 09:53:13 +000045421#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045422 int mem_base;
45423 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45424 int n_ctxt;
45425 int nargs; /* the number of arguments */
45426 int n_nargs;
45427
45428 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45429 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
45430 mem_base = xmlMemBlocks();
45431 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45432 nargs = gen_int(n_nargs, 1);
45433
45434 xmlXPathNamespaceURIFunction(ctxt, nargs);
45435 call_tests++;
45436 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45437 des_int(n_nargs, nargs, 1);
45438 xmlResetLastError();
45439 if (mem_base != xmlMemBlocks()) {
45440 printf("Leak of %d blocks found in xmlXPathNamespaceURIFunction",
45441 xmlMemBlocks() - mem_base);
45442 test_ret++;
45443 printf(" %d", n_ctxt);
45444 printf(" %d", n_nargs);
45445 printf("\n");
45446 }
45447 }
45448 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045449 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045450#endif
45451
Daniel Veillarda82b1822004-11-08 16:24:57 +000045452 return(test_ret);
45453}
45454
45455
45456static int
45457test_xmlXPathNewBoolean(void) {
45458 int test_ret = 0;
45459
William M. Brack21e4ef22005-01-02 09:53:13 +000045460#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045461 int mem_base;
45462 xmlXPathObjectPtr ret_val;
45463 int val; /* the boolean value */
45464 int n_val;
45465
45466 for (n_val = 0;n_val < gen_nb_int;n_val++) {
45467 mem_base = xmlMemBlocks();
45468 val = gen_int(n_val, 0);
45469
45470 ret_val = xmlXPathNewBoolean(val);
45471 desret_xmlXPathObjectPtr(ret_val);
45472 call_tests++;
45473 des_int(n_val, val, 0);
45474 xmlResetLastError();
45475 if (mem_base != xmlMemBlocks()) {
45476 printf("Leak of %d blocks found in xmlXPathNewBoolean",
45477 xmlMemBlocks() - mem_base);
45478 test_ret++;
45479 printf(" %d", n_val);
45480 printf("\n");
45481 }
45482 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045483 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045484#endif
45485
Daniel Veillarda82b1822004-11-08 16:24:57 +000045486 return(test_ret);
45487}
45488
45489
45490static int
45491test_xmlXPathNewCString(void) {
45492 int test_ret = 0;
45493
William M. Brack21e4ef22005-01-02 09:53:13 +000045494#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045495 int mem_base;
45496 xmlXPathObjectPtr ret_val;
45497 char * val; /* the char * value */
45498 int n_val;
45499
45500 for (n_val = 0;n_val < gen_nb_const_char_ptr;n_val++) {
45501 mem_base = xmlMemBlocks();
45502 val = gen_const_char_ptr(n_val, 0);
45503
William M. Brackf13f77f2004-11-12 16:03:48 +000045504 ret_val = xmlXPathNewCString((const char *)val);
Daniel Veillarda82b1822004-11-08 16:24:57 +000045505 desret_xmlXPathObjectPtr(ret_val);
45506 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000045507 des_const_char_ptr(n_val, (const char *)val, 0);
Daniel Veillarda82b1822004-11-08 16:24:57 +000045508 xmlResetLastError();
45509 if (mem_base != xmlMemBlocks()) {
45510 printf("Leak of %d blocks found in xmlXPathNewCString",
45511 xmlMemBlocks() - mem_base);
45512 test_ret++;
45513 printf(" %d", n_val);
45514 printf("\n");
45515 }
45516 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045517 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045518#endif
45519
Daniel Veillarda82b1822004-11-08 16:24:57 +000045520 return(test_ret);
45521}
45522
45523
45524static int
45525test_xmlXPathNewFloat(void) {
45526 int test_ret = 0;
45527
William M. Brack21e4ef22005-01-02 09:53:13 +000045528#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045529 int mem_base;
45530 xmlXPathObjectPtr ret_val;
45531 double val; /* the double value */
45532 int n_val;
45533
45534 for (n_val = 0;n_val < gen_nb_double;n_val++) {
45535 mem_base = xmlMemBlocks();
45536 val = gen_double(n_val, 0);
45537
45538 ret_val = xmlXPathNewFloat(val);
45539 desret_xmlXPathObjectPtr(ret_val);
45540 call_tests++;
45541 des_double(n_val, val, 0);
45542 xmlResetLastError();
45543 if (mem_base != xmlMemBlocks()) {
45544 printf("Leak of %d blocks found in xmlXPathNewFloat",
45545 xmlMemBlocks() - mem_base);
45546 test_ret++;
45547 printf(" %d", n_val);
45548 printf("\n");
45549 }
45550 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045551 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045552#endif
45553
Daniel Veillarda82b1822004-11-08 16:24:57 +000045554 return(test_ret);
45555}
45556
45557
45558static int
45559test_xmlXPathNewNodeSet(void) {
45560 int test_ret = 0;
45561
William M. Brack21e4ef22005-01-02 09:53:13 +000045562#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045563 int mem_base;
45564 xmlXPathObjectPtr ret_val;
45565 xmlNodePtr val; /* the NodePtr value */
45566 int n_val;
45567
45568 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
45569 mem_base = xmlMemBlocks();
45570 val = gen_xmlNodePtr(n_val, 0);
45571
45572 ret_val = xmlXPathNewNodeSet(val);
45573 desret_xmlXPathObjectPtr(ret_val);
45574 call_tests++;
45575 des_xmlNodePtr(n_val, val, 0);
45576 xmlResetLastError();
45577 if (mem_base != xmlMemBlocks()) {
45578 printf("Leak of %d blocks found in xmlXPathNewNodeSet",
45579 xmlMemBlocks() - mem_base);
45580 test_ret++;
45581 printf(" %d", n_val);
45582 printf("\n");
45583 }
45584 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045585 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045586#endif
45587
Daniel Veillarda82b1822004-11-08 16:24:57 +000045588 return(test_ret);
45589}
45590
45591
45592static int
45593test_xmlXPathNewNodeSetList(void) {
45594 int test_ret = 0;
45595
William M. Brack21e4ef22005-01-02 09:53:13 +000045596#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045597 int mem_base;
45598 xmlXPathObjectPtr ret_val;
45599 xmlNodeSetPtr val; /* an existing NodeSet */
45600 int n_val;
45601
45602 for (n_val = 0;n_val < gen_nb_xmlNodeSetPtr;n_val++) {
45603 mem_base = xmlMemBlocks();
45604 val = gen_xmlNodeSetPtr(n_val, 0);
45605
45606 ret_val = xmlXPathNewNodeSetList(val);
45607 desret_xmlXPathObjectPtr(ret_val);
45608 call_tests++;
45609 des_xmlNodeSetPtr(n_val, val, 0);
45610 xmlResetLastError();
45611 if (mem_base != xmlMemBlocks()) {
45612 printf("Leak of %d blocks found in xmlXPathNewNodeSetList",
45613 xmlMemBlocks() - mem_base);
45614 test_ret++;
45615 printf(" %d", n_val);
45616 printf("\n");
45617 }
45618 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045619 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045620#endif
45621
Daniel Veillarda82b1822004-11-08 16:24:57 +000045622 return(test_ret);
45623}
45624
45625
45626static int
45627test_xmlXPathNewParserContext(void) {
45628 int test_ret = 0;
45629
45630
45631 /* missing type support */
45632 return(test_ret);
45633}
45634
45635
45636static int
45637test_xmlXPathNewString(void) {
45638 int test_ret = 0;
45639
William M. Brack21e4ef22005-01-02 09:53:13 +000045640#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045641 int mem_base;
45642 xmlXPathObjectPtr ret_val;
45643 xmlChar * val; /* the xmlChar * value */
45644 int n_val;
45645
45646 for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
45647 mem_base = xmlMemBlocks();
45648 val = gen_const_xmlChar_ptr(n_val, 0);
45649
William M. Brackf13f77f2004-11-12 16:03:48 +000045650 ret_val = xmlXPathNewString((const xmlChar *)val);
Daniel Veillarda82b1822004-11-08 16:24:57 +000045651 desret_xmlXPathObjectPtr(ret_val);
45652 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000045653 des_const_xmlChar_ptr(n_val, (const xmlChar *)val, 0);
Daniel Veillarda82b1822004-11-08 16:24:57 +000045654 xmlResetLastError();
45655 if (mem_base != xmlMemBlocks()) {
45656 printf("Leak of %d blocks found in xmlXPathNewString",
45657 xmlMemBlocks() - mem_base);
45658 test_ret++;
45659 printf(" %d", n_val);
45660 printf("\n");
45661 }
45662 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045663 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045664#endif
45665
Daniel Veillarda82b1822004-11-08 16:24:57 +000045666 return(test_ret);
45667}
45668
45669
45670static int
45671test_xmlXPathNextAncestor(void) {
45672 int test_ret = 0;
45673
William M. Brack21e4ef22005-01-02 09:53:13 +000045674#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045675 int mem_base;
45676 xmlNodePtr ret_val;
45677 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45678 int n_ctxt;
45679 xmlNodePtr cur; /* the current node in the traversal */
45680 int n_cur;
45681
45682 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45683 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45684 mem_base = xmlMemBlocks();
45685 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45686 cur = gen_xmlNodePtr(n_cur, 1);
45687
45688 ret_val = xmlXPathNextAncestor(ctxt, cur);
45689 desret_xmlNodePtr(ret_val);
45690 call_tests++;
45691 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45692 des_xmlNodePtr(n_cur, cur, 1);
45693 xmlResetLastError();
45694 if (mem_base != xmlMemBlocks()) {
45695 printf("Leak of %d blocks found in xmlXPathNextAncestor",
45696 xmlMemBlocks() - mem_base);
45697 test_ret++;
45698 printf(" %d", n_ctxt);
45699 printf(" %d", n_cur);
45700 printf("\n");
45701 }
45702 }
45703 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045704 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045705#endif
45706
Daniel Veillarda82b1822004-11-08 16:24:57 +000045707 return(test_ret);
45708}
45709
45710
45711static int
45712test_xmlXPathNextAncestorOrSelf(void) {
45713 int test_ret = 0;
45714
William M. Brack21e4ef22005-01-02 09:53:13 +000045715#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045716 int mem_base;
45717 xmlNodePtr ret_val;
45718 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45719 int n_ctxt;
45720 xmlNodePtr cur; /* the current node in the traversal */
45721 int n_cur;
45722
45723 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45724 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45725 mem_base = xmlMemBlocks();
45726 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45727 cur = gen_xmlNodePtr(n_cur, 1);
45728
45729 ret_val = xmlXPathNextAncestorOrSelf(ctxt, cur);
45730 desret_xmlNodePtr(ret_val);
45731 call_tests++;
45732 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45733 des_xmlNodePtr(n_cur, cur, 1);
45734 xmlResetLastError();
45735 if (mem_base != xmlMemBlocks()) {
45736 printf("Leak of %d blocks found in xmlXPathNextAncestorOrSelf",
45737 xmlMemBlocks() - mem_base);
45738 test_ret++;
45739 printf(" %d", n_ctxt);
45740 printf(" %d", n_cur);
45741 printf("\n");
45742 }
45743 }
45744 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045745 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045746#endif
45747
Daniel Veillarda82b1822004-11-08 16:24:57 +000045748 return(test_ret);
45749}
45750
45751
45752static int
45753test_xmlXPathNextAttribute(void) {
45754 int test_ret = 0;
45755
William M. Brack21e4ef22005-01-02 09:53:13 +000045756#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045757 int mem_base;
45758 xmlNodePtr ret_val;
45759 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45760 int n_ctxt;
45761 xmlNodePtr cur; /* the current attribute in the traversal */
45762 int n_cur;
45763
45764 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45765 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45766 mem_base = xmlMemBlocks();
45767 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45768 cur = gen_xmlNodePtr(n_cur, 1);
45769
45770 ret_val = xmlXPathNextAttribute(ctxt, cur);
45771 desret_xmlNodePtr(ret_val);
45772 call_tests++;
45773 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45774 des_xmlNodePtr(n_cur, cur, 1);
45775 xmlResetLastError();
45776 if (mem_base != xmlMemBlocks()) {
45777 printf("Leak of %d blocks found in xmlXPathNextAttribute",
45778 xmlMemBlocks() - mem_base);
45779 test_ret++;
45780 printf(" %d", n_ctxt);
45781 printf(" %d", n_cur);
45782 printf("\n");
45783 }
45784 }
45785 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045786 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045787#endif
45788
Daniel Veillarda82b1822004-11-08 16:24:57 +000045789 return(test_ret);
45790}
45791
45792
45793static int
45794test_xmlXPathNextChild(void) {
45795 int test_ret = 0;
45796
William M. Brack21e4ef22005-01-02 09:53:13 +000045797#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045798 int mem_base;
45799 xmlNodePtr ret_val;
45800 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45801 int n_ctxt;
45802 xmlNodePtr cur; /* the current node in the traversal */
45803 int n_cur;
45804
45805 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45806 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45807 mem_base = xmlMemBlocks();
45808 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45809 cur = gen_xmlNodePtr(n_cur, 1);
45810
45811 ret_val = xmlXPathNextChild(ctxt, cur);
45812 desret_xmlNodePtr(ret_val);
45813 call_tests++;
45814 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45815 des_xmlNodePtr(n_cur, cur, 1);
45816 xmlResetLastError();
45817 if (mem_base != xmlMemBlocks()) {
45818 printf("Leak of %d blocks found in xmlXPathNextChild",
45819 xmlMemBlocks() - mem_base);
45820 test_ret++;
45821 printf(" %d", n_ctxt);
45822 printf(" %d", n_cur);
45823 printf("\n");
45824 }
45825 }
45826 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045827 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045828#endif
45829
Daniel Veillarda82b1822004-11-08 16:24:57 +000045830 return(test_ret);
45831}
45832
45833
45834static int
45835test_xmlXPathNextDescendant(void) {
45836 int test_ret = 0;
45837
William M. Brack21e4ef22005-01-02 09:53:13 +000045838#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045839 int mem_base;
45840 xmlNodePtr ret_val;
45841 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45842 int n_ctxt;
45843 xmlNodePtr cur; /* the current node in the traversal */
45844 int n_cur;
45845
45846 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45847 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45848 mem_base = xmlMemBlocks();
45849 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45850 cur = gen_xmlNodePtr(n_cur, 1);
45851
45852 ret_val = xmlXPathNextDescendant(ctxt, cur);
45853 desret_xmlNodePtr(ret_val);
45854 call_tests++;
45855 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45856 des_xmlNodePtr(n_cur, cur, 1);
45857 xmlResetLastError();
45858 if (mem_base != xmlMemBlocks()) {
45859 printf("Leak of %d blocks found in xmlXPathNextDescendant",
45860 xmlMemBlocks() - mem_base);
45861 test_ret++;
45862 printf(" %d", n_ctxt);
45863 printf(" %d", n_cur);
45864 printf("\n");
45865 }
45866 }
45867 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045868 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045869#endif
45870
Daniel Veillarda82b1822004-11-08 16:24:57 +000045871 return(test_ret);
45872}
45873
45874
45875static int
45876test_xmlXPathNextDescendantOrSelf(void) {
45877 int test_ret = 0;
45878
William M. Brack21e4ef22005-01-02 09:53:13 +000045879#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045880 int mem_base;
45881 xmlNodePtr ret_val;
45882 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45883 int n_ctxt;
45884 xmlNodePtr cur; /* the current node in the traversal */
45885 int n_cur;
45886
45887 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45888 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45889 mem_base = xmlMemBlocks();
45890 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45891 cur = gen_xmlNodePtr(n_cur, 1);
45892
45893 ret_val = xmlXPathNextDescendantOrSelf(ctxt, cur);
45894 desret_xmlNodePtr(ret_val);
45895 call_tests++;
45896 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45897 des_xmlNodePtr(n_cur, cur, 1);
45898 xmlResetLastError();
45899 if (mem_base != xmlMemBlocks()) {
45900 printf("Leak of %d blocks found in xmlXPathNextDescendantOrSelf",
45901 xmlMemBlocks() - mem_base);
45902 test_ret++;
45903 printf(" %d", n_ctxt);
45904 printf(" %d", n_cur);
45905 printf("\n");
45906 }
45907 }
45908 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045909 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045910#endif
45911
Daniel Veillarda82b1822004-11-08 16:24:57 +000045912 return(test_ret);
45913}
45914
45915
45916static int
45917test_xmlXPathNextFollowing(void) {
45918 int test_ret = 0;
45919
William M. Brack21e4ef22005-01-02 09:53:13 +000045920#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045921 int mem_base;
45922 xmlNodePtr ret_val;
45923 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45924 int n_ctxt;
45925 xmlNodePtr cur; /* the current node in the traversal */
45926 int n_cur;
45927
45928 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45929 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45930 mem_base = xmlMemBlocks();
45931 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45932 cur = gen_xmlNodePtr(n_cur, 1);
45933
45934 ret_val = xmlXPathNextFollowing(ctxt, cur);
45935 desret_xmlNodePtr(ret_val);
45936 call_tests++;
45937 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45938 des_xmlNodePtr(n_cur, cur, 1);
45939 xmlResetLastError();
45940 if (mem_base != xmlMemBlocks()) {
45941 printf("Leak of %d blocks found in xmlXPathNextFollowing",
45942 xmlMemBlocks() - mem_base);
45943 test_ret++;
45944 printf(" %d", n_ctxt);
45945 printf(" %d", n_cur);
45946 printf("\n");
45947 }
45948 }
45949 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045950 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045951#endif
45952
Daniel Veillarda82b1822004-11-08 16:24:57 +000045953 return(test_ret);
45954}
45955
45956
45957static int
45958test_xmlXPathNextFollowingSibling(void) {
45959 int test_ret = 0;
45960
William M. Brack21e4ef22005-01-02 09:53:13 +000045961#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045962 int mem_base;
45963 xmlNodePtr ret_val;
45964 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45965 int n_ctxt;
45966 xmlNodePtr cur; /* the current node in the traversal */
45967 int n_cur;
45968
45969 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45970 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45971 mem_base = xmlMemBlocks();
45972 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45973 cur = gen_xmlNodePtr(n_cur, 1);
45974
45975 ret_val = xmlXPathNextFollowingSibling(ctxt, cur);
45976 desret_xmlNodePtr(ret_val);
45977 call_tests++;
45978 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45979 des_xmlNodePtr(n_cur, cur, 1);
45980 xmlResetLastError();
45981 if (mem_base != xmlMemBlocks()) {
45982 printf("Leak of %d blocks found in xmlXPathNextFollowingSibling",
45983 xmlMemBlocks() - mem_base);
45984 test_ret++;
45985 printf(" %d", n_ctxt);
45986 printf(" %d", n_cur);
45987 printf("\n");
45988 }
45989 }
45990 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045991 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045992#endif
45993
Daniel Veillarda82b1822004-11-08 16:24:57 +000045994 return(test_ret);
45995}
45996
45997
45998static int
45999test_xmlXPathNextNamespace(void) {
46000 int test_ret = 0;
46001
William M. Brack21e4ef22005-01-02 09:53:13 +000046002#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046003 int mem_base;
46004 xmlNodePtr ret_val;
46005 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46006 int n_ctxt;
46007 xmlNodePtr cur; /* the current attribute in the traversal */
46008 int n_cur;
46009
46010 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46011 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
46012 mem_base = xmlMemBlocks();
46013 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46014 cur = gen_xmlNodePtr(n_cur, 1);
46015
46016 ret_val = xmlXPathNextNamespace(ctxt, cur);
46017 desret_xmlNodePtr(ret_val);
46018 call_tests++;
46019 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46020 des_xmlNodePtr(n_cur, cur, 1);
46021 xmlResetLastError();
46022 if (mem_base != xmlMemBlocks()) {
46023 printf("Leak of %d blocks found in xmlXPathNextNamespace",
46024 xmlMemBlocks() - mem_base);
46025 test_ret++;
46026 printf(" %d", n_ctxt);
46027 printf(" %d", n_cur);
46028 printf("\n");
46029 }
46030 }
46031 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046032 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046033#endif
46034
Daniel Veillarda82b1822004-11-08 16:24:57 +000046035 return(test_ret);
46036}
46037
46038
46039static int
46040test_xmlXPathNextParent(void) {
46041 int test_ret = 0;
46042
William M. Brack21e4ef22005-01-02 09:53:13 +000046043#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046044 int mem_base;
46045 xmlNodePtr ret_val;
46046 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46047 int n_ctxt;
46048 xmlNodePtr cur; /* the current node in the traversal */
46049 int n_cur;
46050
46051 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46052 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
46053 mem_base = xmlMemBlocks();
46054 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46055 cur = gen_xmlNodePtr(n_cur, 1);
46056
46057 ret_val = xmlXPathNextParent(ctxt, cur);
46058 desret_xmlNodePtr(ret_val);
46059 call_tests++;
46060 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46061 des_xmlNodePtr(n_cur, cur, 1);
46062 xmlResetLastError();
46063 if (mem_base != xmlMemBlocks()) {
46064 printf("Leak of %d blocks found in xmlXPathNextParent",
46065 xmlMemBlocks() - mem_base);
46066 test_ret++;
46067 printf(" %d", n_ctxt);
46068 printf(" %d", n_cur);
46069 printf("\n");
46070 }
46071 }
46072 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046073 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046074#endif
46075
Daniel Veillarda82b1822004-11-08 16:24:57 +000046076 return(test_ret);
46077}
46078
46079
46080static int
46081test_xmlXPathNextPreceding(void) {
46082 int test_ret = 0;
46083
William M. Brack21e4ef22005-01-02 09:53:13 +000046084#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046085 int mem_base;
46086 xmlNodePtr ret_val;
46087 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46088 int n_ctxt;
46089 xmlNodePtr cur; /* the current node in the traversal */
46090 int n_cur;
46091
46092 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46093 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
46094 mem_base = xmlMemBlocks();
46095 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46096 cur = gen_xmlNodePtr(n_cur, 1);
46097
46098 ret_val = xmlXPathNextPreceding(ctxt, cur);
46099 desret_xmlNodePtr(ret_val);
46100 call_tests++;
46101 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46102 des_xmlNodePtr(n_cur, cur, 1);
46103 xmlResetLastError();
46104 if (mem_base != xmlMemBlocks()) {
46105 printf("Leak of %d blocks found in xmlXPathNextPreceding",
46106 xmlMemBlocks() - mem_base);
46107 test_ret++;
46108 printf(" %d", n_ctxt);
46109 printf(" %d", n_cur);
46110 printf("\n");
46111 }
46112 }
46113 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046114 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046115#endif
46116
Daniel Veillarda82b1822004-11-08 16:24:57 +000046117 return(test_ret);
46118}
46119
46120
46121static int
46122test_xmlXPathNextPrecedingSibling(void) {
46123 int test_ret = 0;
46124
William M. Brack21e4ef22005-01-02 09:53:13 +000046125#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046126 int mem_base;
46127 xmlNodePtr ret_val;
46128 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46129 int n_ctxt;
46130 xmlNodePtr cur; /* the current node in the traversal */
46131 int n_cur;
46132
46133 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46134 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
46135 mem_base = xmlMemBlocks();
46136 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46137 cur = gen_xmlNodePtr(n_cur, 1);
46138
46139 ret_val = xmlXPathNextPrecedingSibling(ctxt, cur);
46140 desret_xmlNodePtr(ret_val);
46141 call_tests++;
46142 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46143 des_xmlNodePtr(n_cur, cur, 1);
46144 xmlResetLastError();
46145 if (mem_base != xmlMemBlocks()) {
46146 printf("Leak of %d blocks found in xmlXPathNextPrecedingSibling",
46147 xmlMemBlocks() - mem_base);
46148 test_ret++;
46149 printf(" %d", n_ctxt);
46150 printf(" %d", n_cur);
46151 printf("\n");
46152 }
46153 }
46154 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046155 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046156#endif
46157
Daniel Veillarda82b1822004-11-08 16:24:57 +000046158 return(test_ret);
46159}
46160
46161
46162static int
46163test_xmlXPathNextSelf(void) {
46164 int test_ret = 0;
46165
William M. Brack21e4ef22005-01-02 09:53:13 +000046166#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046167 int mem_base;
46168 xmlNodePtr ret_val;
46169 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46170 int n_ctxt;
46171 xmlNodePtr cur; /* the current node in the traversal */
46172 int n_cur;
46173
46174 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46175 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
46176 mem_base = xmlMemBlocks();
46177 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46178 cur = gen_xmlNodePtr(n_cur, 1);
46179
46180 ret_val = xmlXPathNextSelf(ctxt, cur);
46181 desret_xmlNodePtr(ret_val);
46182 call_tests++;
46183 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46184 des_xmlNodePtr(n_cur, cur, 1);
46185 xmlResetLastError();
46186 if (mem_base != xmlMemBlocks()) {
46187 printf("Leak of %d blocks found in xmlXPathNextSelf",
46188 xmlMemBlocks() - mem_base);
46189 test_ret++;
46190 printf(" %d", n_ctxt);
46191 printf(" %d", n_cur);
46192 printf("\n");
46193 }
46194 }
46195 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046196 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046197#endif
46198
Daniel Veillarda82b1822004-11-08 16:24:57 +000046199 return(test_ret);
46200}
46201
46202
46203static int
46204test_xmlXPathNodeLeading(void) {
46205 int test_ret = 0;
46206
William M. Brack21e4ef22005-01-02 09:53:13 +000046207#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046208 int mem_base;
46209 xmlNodeSetPtr ret_val;
46210 xmlNodeSetPtr nodes; /* a node-set */
46211 int n_nodes;
46212 xmlNodePtr node; /* a node */
46213 int n_node;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046214
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046215 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
46216 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
46217 mem_base = xmlMemBlocks();
46218 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
46219 node = gen_xmlNodePtr(n_node, 1);
46220
46221 ret_val = xmlXPathNodeLeading(nodes, node);
46222 desret_xmlNodeSetPtr(ret_val);
46223 call_tests++;
46224 des_xmlNodeSetPtr(n_nodes, nodes, 0);
46225 des_xmlNodePtr(n_node, node, 1);
46226 xmlResetLastError();
46227 if (mem_base != xmlMemBlocks()) {
46228 printf("Leak of %d blocks found in xmlXPathNodeLeading",
46229 xmlMemBlocks() - mem_base);
46230 test_ret++;
46231 printf(" %d", n_nodes);
46232 printf(" %d", n_node);
46233 printf("\n");
46234 }
46235 }
46236 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046237 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046238#endif
46239
Daniel Veillarda82b1822004-11-08 16:24:57 +000046240 return(test_ret);
46241}
46242
46243
46244static int
46245test_xmlXPathNodeLeadingSorted(void) {
46246 int test_ret = 0;
46247
William M. Brack21e4ef22005-01-02 09:53:13 +000046248#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046249 int mem_base;
46250 xmlNodeSetPtr ret_val;
46251 xmlNodeSetPtr nodes; /* a node-set, sorted by document order */
46252 int n_nodes;
46253 xmlNodePtr node; /* a node */
46254 int n_node;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046255
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046256 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
46257 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
46258 mem_base = xmlMemBlocks();
46259 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
46260 node = gen_xmlNodePtr(n_node, 1);
46261
46262 ret_val = xmlXPathNodeLeadingSorted(nodes, node);
46263 desret_xmlNodeSetPtr(ret_val);
46264 call_tests++;
46265 des_xmlNodeSetPtr(n_nodes, nodes, 0);
46266 des_xmlNodePtr(n_node, node, 1);
46267 xmlResetLastError();
46268 if (mem_base != xmlMemBlocks()) {
46269 printf("Leak of %d blocks found in xmlXPathNodeLeadingSorted",
46270 xmlMemBlocks() - mem_base);
46271 test_ret++;
46272 printf(" %d", n_nodes);
46273 printf(" %d", n_node);
46274 printf("\n");
46275 }
46276 }
46277 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046278 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046279#endif
46280
Daniel Veillarda82b1822004-11-08 16:24:57 +000046281 return(test_ret);
46282}
46283
46284
46285static int
46286test_xmlXPathNodeSetAdd(void) {
46287 int test_ret = 0;
46288
William M. Brack21e4ef22005-01-02 09:53:13 +000046289#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046290 int mem_base;
46291 xmlNodeSetPtr cur; /* the initial node set */
46292 int n_cur;
46293 xmlNodePtr val; /* a new xmlNodePtr */
46294 int n_val;
46295
46296 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
46297 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
46298 mem_base = xmlMemBlocks();
46299 cur = gen_xmlNodeSetPtr(n_cur, 0);
46300 val = gen_xmlNodePtr(n_val, 1);
46301
46302 xmlXPathNodeSetAdd(cur, val);
46303 call_tests++;
46304 des_xmlNodeSetPtr(n_cur, cur, 0);
46305 des_xmlNodePtr(n_val, val, 1);
46306 xmlResetLastError();
46307 if (mem_base != xmlMemBlocks()) {
46308 printf("Leak of %d blocks found in xmlXPathNodeSetAdd",
46309 xmlMemBlocks() - mem_base);
46310 test_ret++;
46311 printf(" %d", n_cur);
46312 printf(" %d", n_val);
46313 printf("\n");
46314 }
46315 }
46316 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046317 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046318#endif
46319
Daniel Veillarda82b1822004-11-08 16:24:57 +000046320 return(test_ret);
46321}
46322
46323
46324static int
46325test_xmlXPathNodeSetAddNs(void) {
46326 int test_ret = 0;
46327
William M. Brack21e4ef22005-01-02 09:53:13 +000046328#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046329 int mem_base;
46330 xmlNodeSetPtr cur; /* the initial node set */
46331 int n_cur;
46332 xmlNodePtr node; /* the hosting node */
46333 int n_node;
46334 xmlNsPtr ns; /* a the namespace node */
46335 int n_ns;
46336
46337 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
46338 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
46339 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
46340 mem_base = xmlMemBlocks();
46341 cur = gen_xmlNodeSetPtr(n_cur, 0);
46342 node = gen_xmlNodePtr(n_node, 1);
46343 ns = gen_xmlNsPtr(n_ns, 2);
46344
46345 xmlXPathNodeSetAddNs(cur, node, ns);
46346 call_tests++;
46347 des_xmlNodeSetPtr(n_cur, cur, 0);
46348 des_xmlNodePtr(n_node, node, 1);
46349 des_xmlNsPtr(n_ns, ns, 2);
46350 xmlResetLastError();
46351 if (mem_base != xmlMemBlocks()) {
46352 printf("Leak of %d blocks found in xmlXPathNodeSetAddNs",
46353 xmlMemBlocks() - mem_base);
46354 test_ret++;
46355 printf(" %d", n_cur);
46356 printf(" %d", n_node);
46357 printf(" %d", n_ns);
46358 printf("\n");
46359 }
46360 }
46361 }
46362 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046363 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046364#endif
46365
Daniel Veillarda82b1822004-11-08 16:24:57 +000046366 return(test_ret);
46367}
46368
46369
46370static int
46371test_xmlXPathNodeSetAddUnique(void) {
46372 int test_ret = 0;
46373
William M. Brack21e4ef22005-01-02 09:53:13 +000046374#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046375 int mem_base;
46376 xmlNodeSetPtr cur; /* the initial node set */
46377 int n_cur;
46378 xmlNodePtr val; /* a new xmlNodePtr */
46379 int n_val;
46380
46381 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
46382 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
46383 mem_base = xmlMemBlocks();
46384 cur = gen_xmlNodeSetPtr(n_cur, 0);
46385 val = gen_xmlNodePtr(n_val, 1);
46386
46387 xmlXPathNodeSetAddUnique(cur, val);
46388 call_tests++;
46389 des_xmlNodeSetPtr(n_cur, cur, 0);
46390 des_xmlNodePtr(n_val, val, 1);
46391 xmlResetLastError();
46392 if (mem_base != xmlMemBlocks()) {
46393 printf("Leak of %d blocks found in xmlXPathNodeSetAddUnique",
46394 xmlMemBlocks() - mem_base);
46395 test_ret++;
46396 printf(" %d", n_cur);
46397 printf(" %d", n_val);
46398 printf("\n");
46399 }
46400 }
46401 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046402 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046403#endif
46404
Daniel Veillarda82b1822004-11-08 16:24:57 +000046405 return(test_ret);
46406}
46407
46408
46409static int
46410test_xmlXPathNodeSetContains(void) {
46411 int test_ret = 0;
46412
William M. Brack21e4ef22005-01-02 09:53:13 +000046413#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046414 int mem_base;
46415 int ret_val;
46416 xmlNodeSetPtr cur; /* the node-set */
46417 int n_cur;
46418 xmlNodePtr val; /* the node */
46419 int n_val;
46420
46421 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
46422 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
46423 mem_base = xmlMemBlocks();
46424 cur = gen_xmlNodeSetPtr(n_cur, 0);
46425 val = gen_xmlNodePtr(n_val, 1);
46426
46427 ret_val = xmlXPathNodeSetContains(cur, val);
46428 desret_int(ret_val);
46429 call_tests++;
46430 des_xmlNodeSetPtr(n_cur, cur, 0);
46431 des_xmlNodePtr(n_val, val, 1);
46432 xmlResetLastError();
46433 if (mem_base != xmlMemBlocks()) {
46434 printf("Leak of %d blocks found in xmlXPathNodeSetContains",
46435 xmlMemBlocks() - mem_base);
46436 test_ret++;
46437 printf(" %d", n_cur);
46438 printf(" %d", n_val);
46439 printf("\n");
46440 }
46441 }
46442 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046443 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046444#endif
46445
Daniel Veillarda82b1822004-11-08 16:24:57 +000046446 return(test_ret);
46447}
46448
46449
46450static int
46451test_xmlXPathNodeSetDel(void) {
46452 int test_ret = 0;
46453
William M. Brack21e4ef22005-01-02 09:53:13 +000046454#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046455 int mem_base;
46456 xmlNodeSetPtr cur; /* the initial node set */
46457 int n_cur;
46458 xmlNodePtr val; /* an xmlNodePtr */
46459 int n_val;
46460
46461 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
46462 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
46463 mem_base = xmlMemBlocks();
46464 cur = gen_xmlNodeSetPtr(n_cur, 0);
46465 val = gen_xmlNodePtr(n_val, 1);
46466
46467 xmlXPathNodeSetDel(cur, val);
46468 call_tests++;
46469 des_xmlNodeSetPtr(n_cur, cur, 0);
46470 des_xmlNodePtr(n_val, val, 1);
46471 xmlResetLastError();
46472 if (mem_base != xmlMemBlocks()) {
46473 printf("Leak of %d blocks found in xmlXPathNodeSetDel",
46474 xmlMemBlocks() - mem_base);
46475 test_ret++;
46476 printf(" %d", n_cur);
46477 printf(" %d", n_val);
46478 printf("\n");
46479 }
46480 }
46481 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046482 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046483#endif
46484
Daniel Veillarda82b1822004-11-08 16:24:57 +000046485 return(test_ret);
46486}
46487
46488
46489static int
46490test_xmlXPathNodeSetMerge(void) {
46491 int test_ret = 0;
46492
William M. Brack21e4ef22005-01-02 09:53:13 +000046493#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046494 int mem_base;
46495 xmlNodeSetPtr ret_val;
46496 xmlNodeSetPtr val1; /* the first NodeSet or NULL */
46497 int n_val1;
46498 xmlNodeSetPtr val2; /* the second NodeSet */
46499 int n_val2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046500
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046501 for (n_val1 = 0;n_val1 < gen_nb_xmlNodeSetPtr;n_val1++) {
46502 for (n_val2 = 0;n_val2 < gen_nb_xmlNodeSetPtr;n_val2++) {
46503 mem_base = xmlMemBlocks();
46504 val1 = gen_xmlNodeSetPtr(n_val1, 0);
46505 val2 = gen_xmlNodeSetPtr(n_val2, 1);
46506
46507 ret_val = xmlXPathNodeSetMerge(val1, val2);
46508 desret_xmlNodeSetPtr(ret_val);
46509 call_tests++;
46510 des_xmlNodeSetPtr(n_val1, val1, 0);
46511 des_xmlNodeSetPtr(n_val2, val2, 1);
46512 xmlResetLastError();
46513 if (mem_base != xmlMemBlocks()) {
46514 printf("Leak of %d blocks found in xmlXPathNodeSetMerge",
46515 xmlMemBlocks() - mem_base);
46516 test_ret++;
46517 printf(" %d", n_val1);
46518 printf(" %d", n_val2);
46519 printf("\n");
46520 }
46521 }
46522 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046523 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046524#endif
46525
Daniel Veillarda82b1822004-11-08 16:24:57 +000046526 return(test_ret);
46527}
46528
46529
46530static int
46531test_xmlXPathNodeSetRemove(void) {
46532 int test_ret = 0;
46533
William M. Brack21e4ef22005-01-02 09:53:13 +000046534#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046535 int mem_base;
46536 xmlNodeSetPtr cur; /* the initial node set */
46537 int n_cur;
46538 int val; /* the index to remove */
46539 int n_val;
46540
46541 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
46542 for (n_val = 0;n_val < gen_nb_int;n_val++) {
46543 mem_base = xmlMemBlocks();
46544 cur = gen_xmlNodeSetPtr(n_cur, 0);
46545 val = gen_int(n_val, 1);
46546
46547 xmlXPathNodeSetRemove(cur, val);
46548 call_tests++;
46549 des_xmlNodeSetPtr(n_cur, cur, 0);
46550 des_int(n_val, val, 1);
46551 xmlResetLastError();
46552 if (mem_base != xmlMemBlocks()) {
46553 printf("Leak of %d blocks found in xmlXPathNodeSetRemove",
46554 xmlMemBlocks() - mem_base);
46555 test_ret++;
46556 printf(" %d", n_cur);
46557 printf(" %d", n_val);
46558 printf("\n");
46559 }
46560 }
46561 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046562 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046563#endif
46564
Daniel Veillarda82b1822004-11-08 16:24:57 +000046565 return(test_ret);
46566}
46567
46568
46569static int
46570test_xmlXPathNodeSetSort(void) {
46571 int test_ret = 0;
46572
William M. Brack21e4ef22005-01-02 09:53:13 +000046573#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046574 int mem_base;
46575 xmlNodeSetPtr set; /* the node set */
46576 int n_set;
46577
46578 for (n_set = 0;n_set < gen_nb_xmlNodeSetPtr;n_set++) {
46579 mem_base = xmlMemBlocks();
46580 set = gen_xmlNodeSetPtr(n_set, 0);
46581
46582 xmlXPathNodeSetSort(set);
46583 call_tests++;
46584 des_xmlNodeSetPtr(n_set, set, 0);
46585 xmlResetLastError();
46586 if (mem_base != xmlMemBlocks()) {
46587 printf("Leak of %d blocks found in xmlXPathNodeSetSort",
46588 xmlMemBlocks() - mem_base);
46589 test_ret++;
46590 printf(" %d", n_set);
46591 printf("\n");
46592 }
46593 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046594 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046595#endif
46596
Daniel Veillarda82b1822004-11-08 16:24:57 +000046597 return(test_ret);
46598}
46599
46600
46601static int
46602test_xmlXPathNodeTrailing(void) {
46603 int test_ret = 0;
46604
William M. Brack21e4ef22005-01-02 09:53:13 +000046605#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046606 int mem_base;
46607 xmlNodeSetPtr ret_val;
46608 xmlNodeSetPtr nodes; /* a node-set */
46609 int n_nodes;
46610 xmlNodePtr node; /* a node */
46611 int n_node;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046612
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046613 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
46614 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
46615 mem_base = xmlMemBlocks();
46616 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
46617 node = gen_xmlNodePtr(n_node, 1);
46618
46619 ret_val = xmlXPathNodeTrailing(nodes, node);
46620 desret_xmlNodeSetPtr(ret_val);
46621 call_tests++;
46622 des_xmlNodeSetPtr(n_nodes, nodes, 0);
46623 des_xmlNodePtr(n_node, node, 1);
46624 xmlResetLastError();
46625 if (mem_base != xmlMemBlocks()) {
46626 printf("Leak of %d blocks found in xmlXPathNodeTrailing",
46627 xmlMemBlocks() - mem_base);
46628 test_ret++;
46629 printf(" %d", n_nodes);
46630 printf(" %d", n_node);
46631 printf("\n");
46632 }
46633 }
46634 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046635 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046636#endif
46637
Daniel Veillarda82b1822004-11-08 16:24:57 +000046638 return(test_ret);
46639}
46640
46641
46642static int
46643test_xmlXPathNodeTrailingSorted(void) {
46644 int test_ret = 0;
46645
William M. Brack21e4ef22005-01-02 09:53:13 +000046646#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046647 int mem_base;
46648 xmlNodeSetPtr ret_val;
46649 xmlNodeSetPtr nodes; /* a node-set, sorted by document order */
46650 int n_nodes;
46651 xmlNodePtr node; /* a node */
46652 int n_node;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046653
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046654 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
46655 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
46656 mem_base = xmlMemBlocks();
46657 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
46658 node = gen_xmlNodePtr(n_node, 1);
46659
46660 ret_val = xmlXPathNodeTrailingSorted(nodes, node);
46661 desret_xmlNodeSetPtr(ret_val);
46662 call_tests++;
46663 des_xmlNodeSetPtr(n_nodes, nodes, 0);
46664 des_xmlNodePtr(n_node, node, 1);
46665 xmlResetLastError();
46666 if (mem_base != xmlMemBlocks()) {
46667 printf("Leak of %d blocks found in xmlXPathNodeTrailingSorted",
46668 xmlMemBlocks() - mem_base);
46669 test_ret++;
46670 printf(" %d", n_nodes);
46671 printf(" %d", n_node);
46672 printf("\n");
46673 }
46674 }
46675 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046676 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046677#endif
46678
Daniel Veillarda82b1822004-11-08 16:24:57 +000046679 return(test_ret);
46680}
46681
46682
46683static int
46684test_xmlXPathNormalizeFunction(void) {
46685 int test_ret = 0;
46686
William M. Brack21e4ef22005-01-02 09:53:13 +000046687#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046688 int mem_base;
46689 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46690 int n_ctxt;
46691 int nargs; /* the number of arguments */
46692 int n_nargs;
46693
46694 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46695 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46696 mem_base = xmlMemBlocks();
46697 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46698 nargs = gen_int(n_nargs, 1);
46699
46700 xmlXPathNormalizeFunction(ctxt, nargs);
46701 call_tests++;
46702 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46703 des_int(n_nargs, nargs, 1);
46704 xmlResetLastError();
46705 if (mem_base != xmlMemBlocks()) {
46706 printf("Leak of %d blocks found in xmlXPathNormalizeFunction",
46707 xmlMemBlocks() - mem_base);
46708 test_ret++;
46709 printf(" %d", n_ctxt);
46710 printf(" %d", n_nargs);
46711 printf("\n");
46712 }
46713 }
46714 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046715 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046716#endif
46717
Daniel Veillarda82b1822004-11-08 16:24:57 +000046718 return(test_ret);
46719}
46720
46721
46722static int
46723test_xmlXPathNotEqualValues(void) {
46724 int test_ret = 0;
46725
William M. Brack21e4ef22005-01-02 09:53:13 +000046726#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046727 int mem_base;
46728 int ret_val;
46729 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46730 int n_ctxt;
46731
46732 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46733 mem_base = xmlMemBlocks();
46734 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46735
46736 ret_val = xmlXPathNotEqualValues(ctxt);
46737 desret_int(ret_val);
46738 call_tests++;
46739 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46740 xmlResetLastError();
46741 if (mem_base != xmlMemBlocks()) {
46742 printf("Leak of %d blocks found in xmlXPathNotEqualValues",
46743 xmlMemBlocks() - mem_base);
46744 test_ret++;
46745 printf(" %d", n_ctxt);
46746 printf("\n");
46747 }
46748 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046749 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046750#endif
46751
Daniel Veillarda82b1822004-11-08 16:24:57 +000046752 return(test_ret);
46753}
46754
46755
46756static int
46757test_xmlXPathNotFunction(void) {
46758 int test_ret = 0;
46759
William M. Brack21e4ef22005-01-02 09:53:13 +000046760#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046761 int mem_base;
46762 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46763 int n_ctxt;
46764 int nargs; /* the number of arguments */
46765 int n_nargs;
46766
46767 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46768 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46769 mem_base = xmlMemBlocks();
46770 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46771 nargs = gen_int(n_nargs, 1);
46772
46773 xmlXPathNotFunction(ctxt, nargs);
46774 call_tests++;
46775 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46776 des_int(n_nargs, nargs, 1);
46777 xmlResetLastError();
46778 if (mem_base != xmlMemBlocks()) {
46779 printf("Leak of %d blocks found in xmlXPathNotFunction",
46780 xmlMemBlocks() - mem_base);
46781 test_ret++;
46782 printf(" %d", n_ctxt);
46783 printf(" %d", n_nargs);
46784 printf("\n");
46785 }
46786 }
46787 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046788 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046789#endif
46790
Daniel Veillarda82b1822004-11-08 16:24:57 +000046791 return(test_ret);
46792}
46793
46794
46795static int
46796test_xmlXPathNsLookup(void) {
46797 int test_ret = 0;
46798
William M. Brack21e4ef22005-01-02 09:53:13 +000046799#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046800 int mem_base;
46801 const xmlChar * ret_val;
46802 xmlXPathContextPtr ctxt; /* the XPath context */
46803 int n_ctxt;
46804 xmlChar * prefix; /* the namespace prefix value */
46805 int n_prefix;
46806
46807 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46808 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
46809 mem_base = xmlMemBlocks();
46810 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46811 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
46812
William M. Brackf13f77f2004-11-12 16:03:48 +000046813 ret_val = xmlXPathNsLookup(ctxt, (const xmlChar *)prefix);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046814 desret_const_xmlChar_ptr(ret_val);
46815 call_tests++;
46816 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000046817 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046818 xmlResetLastError();
46819 if (mem_base != xmlMemBlocks()) {
46820 printf("Leak of %d blocks found in xmlXPathNsLookup",
46821 xmlMemBlocks() - mem_base);
46822 test_ret++;
46823 printf(" %d", n_ctxt);
46824 printf(" %d", n_prefix);
46825 printf("\n");
46826 }
46827 }
46828 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046829 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046830#endif
46831
Daniel Veillarda82b1822004-11-08 16:24:57 +000046832 return(test_ret);
46833}
46834
46835
46836static int
46837test_xmlXPathNumberFunction(void) {
46838 int test_ret = 0;
46839
William M. Brack21e4ef22005-01-02 09:53:13 +000046840#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046841 int mem_base;
46842 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46843 int n_ctxt;
46844 int nargs; /* the number of arguments */
46845 int n_nargs;
46846
46847 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46848 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46849 mem_base = xmlMemBlocks();
46850 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46851 nargs = gen_int(n_nargs, 1);
46852
46853 xmlXPathNumberFunction(ctxt, nargs);
46854 call_tests++;
46855 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46856 des_int(n_nargs, nargs, 1);
46857 xmlResetLastError();
46858 if (mem_base != xmlMemBlocks()) {
46859 printf("Leak of %d blocks found in xmlXPathNumberFunction",
46860 xmlMemBlocks() - mem_base);
46861 test_ret++;
46862 printf(" %d", n_ctxt);
46863 printf(" %d", n_nargs);
46864 printf("\n");
46865 }
46866 }
46867 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046868 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046869#endif
46870
Daniel Veillarda82b1822004-11-08 16:24:57 +000046871 return(test_ret);
46872}
46873
46874
46875static int
46876test_xmlXPathParseNCName(void) {
46877 int test_ret = 0;
46878
William M. Brack21e4ef22005-01-02 09:53:13 +000046879#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046880 int mem_base;
46881 xmlChar * ret_val;
46882 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46883 int n_ctxt;
46884
46885 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46886 mem_base = xmlMemBlocks();
46887 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46888
46889 ret_val = xmlXPathParseNCName(ctxt);
46890 desret_xmlChar_ptr(ret_val);
46891 call_tests++;
46892 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46893 xmlResetLastError();
46894 if (mem_base != xmlMemBlocks()) {
46895 printf("Leak of %d blocks found in xmlXPathParseNCName",
46896 xmlMemBlocks() - mem_base);
46897 test_ret++;
46898 printf(" %d", n_ctxt);
46899 printf("\n");
46900 }
46901 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046902 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046903#endif
46904
Daniel Veillarda82b1822004-11-08 16:24:57 +000046905 return(test_ret);
46906}
46907
46908
46909static int
46910test_xmlXPathParseName(void) {
46911 int test_ret = 0;
46912
William M. Brack21e4ef22005-01-02 09:53:13 +000046913#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046914 int mem_base;
46915 xmlChar * ret_val;
46916 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46917 int n_ctxt;
46918
46919 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46920 mem_base = xmlMemBlocks();
46921 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46922
46923 ret_val = xmlXPathParseName(ctxt);
46924 desret_xmlChar_ptr(ret_val);
46925 call_tests++;
46926 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46927 xmlResetLastError();
46928 if (mem_base != xmlMemBlocks()) {
46929 printf("Leak of %d blocks found in xmlXPathParseName",
46930 xmlMemBlocks() - mem_base);
46931 test_ret++;
46932 printf(" %d", n_ctxt);
46933 printf("\n");
46934 }
46935 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046936 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046937#endif
46938
Daniel Veillarda82b1822004-11-08 16:24:57 +000046939 return(test_ret);
46940}
46941
46942
46943static int
46944test_xmlXPathPopBoolean(void) {
46945 int test_ret = 0;
46946
William M. Brack21e4ef22005-01-02 09:53:13 +000046947#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046948 int mem_base;
46949 int ret_val;
46950 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
46951 int n_ctxt;
46952
46953 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46954 mem_base = xmlMemBlocks();
46955 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46956
46957 ret_val = xmlXPathPopBoolean(ctxt);
46958 desret_int(ret_val);
46959 call_tests++;
46960 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46961 xmlResetLastError();
46962 if (mem_base != xmlMemBlocks()) {
46963 printf("Leak of %d blocks found in xmlXPathPopBoolean",
46964 xmlMemBlocks() - mem_base);
46965 test_ret++;
46966 printf(" %d", n_ctxt);
46967 printf("\n");
46968 }
46969 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046970 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046971#endif
46972
Daniel Veillarda82b1822004-11-08 16:24:57 +000046973 return(test_ret);
46974}
46975
46976
46977static int
46978test_xmlXPathPopExternal(void) {
46979 int test_ret = 0;
46980
William M. Brack21e4ef22005-01-02 09:53:13 +000046981#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046982 int mem_base;
46983 void * ret_val;
46984 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
46985 int n_ctxt;
46986
46987 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46988 mem_base = xmlMemBlocks();
46989 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46990
46991 ret_val = xmlXPathPopExternal(ctxt);
46992 desret_void_ptr(ret_val);
46993 call_tests++;
46994 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46995 xmlResetLastError();
46996 if (mem_base != xmlMemBlocks()) {
46997 printf("Leak of %d blocks found in xmlXPathPopExternal",
46998 xmlMemBlocks() - mem_base);
46999 test_ret++;
47000 printf(" %d", n_ctxt);
47001 printf("\n");
47002 }
47003 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047004 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047005#endif
47006
Daniel Veillarda82b1822004-11-08 16:24:57 +000047007 return(test_ret);
47008}
47009
47010
47011static int
47012test_xmlXPathPopNodeSet(void) {
47013 int test_ret = 0;
47014
William M. Brack21e4ef22005-01-02 09:53:13 +000047015#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047016 int mem_base;
47017 xmlNodeSetPtr ret_val;
47018 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
47019 int n_ctxt;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047020
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047021 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47022 mem_base = xmlMemBlocks();
47023 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47024
47025 ret_val = xmlXPathPopNodeSet(ctxt);
47026 desret_xmlNodeSetPtr(ret_val);
47027 call_tests++;
47028 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47029 xmlResetLastError();
47030 if (mem_base != xmlMemBlocks()) {
47031 printf("Leak of %d blocks found in xmlXPathPopNodeSet",
47032 xmlMemBlocks() - mem_base);
47033 test_ret++;
47034 printf(" %d", n_ctxt);
47035 printf("\n");
47036 }
47037 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047038 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047039#endif
47040
Daniel Veillarda82b1822004-11-08 16:24:57 +000047041 return(test_ret);
47042}
47043
47044
47045static int
47046test_xmlXPathPopNumber(void) {
47047 int test_ret = 0;
47048
William M. Brack21e4ef22005-01-02 09:53:13 +000047049#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047050 int mem_base;
47051 double ret_val;
47052 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
47053 int n_ctxt;
47054
47055 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47056 mem_base = xmlMemBlocks();
47057 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47058
47059 ret_val = xmlXPathPopNumber(ctxt);
47060 desret_double(ret_val);
47061 call_tests++;
47062 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47063 xmlResetLastError();
47064 if (mem_base != xmlMemBlocks()) {
47065 printf("Leak of %d blocks found in xmlXPathPopNumber",
47066 xmlMemBlocks() - mem_base);
47067 test_ret++;
47068 printf(" %d", n_ctxt);
47069 printf("\n");
47070 }
47071 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047072 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047073#endif
47074
Daniel Veillarda82b1822004-11-08 16:24:57 +000047075 return(test_ret);
47076}
47077
47078
47079static int
47080test_xmlXPathPopString(void) {
47081 int test_ret = 0;
47082
William M. Brack21e4ef22005-01-02 09:53:13 +000047083#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047084 int mem_base;
47085 xmlChar * ret_val;
47086 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
47087 int n_ctxt;
47088
47089 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47090 mem_base = xmlMemBlocks();
47091 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47092
47093 ret_val = xmlXPathPopString(ctxt);
47094 desret_xmlChar_ptr(ret_val);
47095 call_tests++;
47096 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47097 xmlResetLastError();
47098 if (mem_base != xmlMemBlocks()) {
47099 printf("Leak of %d blocks found in xmlXPathPopString",
47100 xmlMemBlocks() - mem_base);
47101 test_ret++;
47102 printf(" %d", n_ctxt);
47103 printf("\n");
47104 }
47105 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047106 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047107#endif
47108
Daniel Veillarda82b1822004-11-08 16:24:57 +000047109 return(test_ret);
47110}
47111
47112
47113static int
47114test_xmlXPathPositionFunction(void) {
47115 int test_ret = 0;
47116
William M. Brack21e4ef22005-01-02 09:53:13 +000047117#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047118 int mem_base;
47119 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47120 int n_ctxt;
47121 int nargs; /* the number of arguments */
47122 int n_nargs;
47123
47124 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47125 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47126 mem_base = xmlMemBlocks();
47127 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47128 nargs = gen_int(n_nargs, 1);
47129
47130 xmlXPathPositionFunction(ctxt, nargs);
47131 call_tests++;
47132 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47133 des_int(n_nargs, nargs, 1);
47134 xmlResetLastError();
47135 if (mem_base != xmlMemBlocks()) {
47136 printf("Leak of %d blocks found in xmlXPathPositionFunction",
47137 xmlMemBlocks() - mem_base);
47138 test_ret++;
47139 printf(" %d", n_ctxt);
47140 printf(" %d", n_nargs);
47141 printf("\n");
47142 }
47143 }
47144 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047145 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047146#endif
47147
Daniel Veillarda82b1822004-11-08 16:24:57 +000047148 return(test_ret);
47149}
47150
47151
47152static int
47153test_xmlXPathRegisterAllFunctions(void) {
47154 int test_ret = 0;
47155
William M. Brack21e4ef22005-01-02 09:53:13 +000047156#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047157 int mem_base;
47158 xmlXPathContextPtr ctxt; /* the XPath context */
47159 int n_ctxt;
47160
47161 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
47162 mem_base = xmlMemBlocks();
47163 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
47164
47165 xmlXPathRegisterAllFunctions(ctxt);
47166 call_tests++;
47167 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
47168 xmlResetLastError();
47169 if (mem_base != xmlMemBlocks()) {
47170 printf("Leak of %d blocks found in xmlXPathRegisterAllFunctions",
47171 xmlMemBlocks() - mem_base);
47172 test_ret++;
47173 printf(" %d", n_ctxt);
47174 printf("\n");
47175 }
47176 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047177 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047178#endif
47179
Daniel Veillarda82b1822004-11-08 16:24:57 +000047180 return(test_ret);
47181}
47182
47183
47184static int
47185test_xmlXPathRegisterFunc(void) {
47186 int test_ret = 0;
47187
47188
47189 /* missing type support */
47190 return(test_ret);
47191}
47192
47193
47194static int
47195test_xmlXPathRegisterFuncLookup(void) {
47196 int test_ret = 0;
47197
47198
47199 /* missing type support */
47200 return(test_ret);
47201}
47202
47203
47204static int
47205test_xmlXPathRegisterFuncNS(void) {
47206 int test_ret = 0;
47207
47208
47209 /* missing type support */
47210 return(test_ret);
47211}
47212
47213
47214static int
47215test_xmlXPathRegisterNs(void) {
47216 int test_ret = 0;
47217
William M. Brack21e4ef22005-01-02 09:53:13 +000047218#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047219 int mem_base;
47220 int ret_val;
47221 xmlXPathContextPtr ctxt; /* the XPath context */
47222 int n_ctxt;
47223 xmlChar * prefix; /* the namespace prefix */
47224 int n_prefix;
47225 xmlChar * ns_uri; /* the namespace name */
47226 int n_ns_uri;
47227
47228 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
47229 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
47230 for (n_ns_uri = 0;n_ns_uri < gen_nb_const_xmlChar_ptr;n_ns_uri++) {
47231 mem_base = xmlMemBlocks();
47232 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
47233 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
47234 ns_uri = gen_const_xmlChar_ptr(n_ns_uri, 2);
47235
William M. Brackf13f77f2004-11-12 16:03:48 +000047236 ret_val = xmlXPathRegisterNs(ctxt, (const xmlChar *)prefix, (const xmlChar *)ns_uri);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047237 desret_int(ret_val);
47238 call_tests++;
47239 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000047240 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
47241 des_const_xmlChar_ptr(n_ns_uri, (const xmlChar *)ns_uri, 2);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047242 xmlResetLastError();
47243 if (mem_base != xmlMemBlocks()) {
47244 printf("Leak of %d blocks found in xmlXPathRegisterNs",
47245 xmlMemBlocks() - mem_base);
47246 test_ret++;
47247 printf(" %d", n_ctxt);
47248 printf(" %d", n_prefix);
47249 printf(" %d", n_ns_uri);
47250 printf("\n");
47251 }
47252 }
47253 }
47254 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047255 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047256#endif
47257
Daniel Veillarda82b1822004-11-08 16:24:57 +000047258 return(test_ret);
47259}
47260
47261
47262static int
47263test_xmlXPathRegisterVariable(void) {
47264 int test_ret = 0;
47265
William M. Brack21e4ef22005-01-02 09:53:13 +000047266#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047267 int mem_base;
47268 int ret_val;
47269 xmlXPathContextPtr ctxt; /* the XPath context */
47270 int n_ctxt;
47271 xmlChar * name; /* the variable name */
47272 int n_name;
47273 xmlXPathObjectPtr value; /* the variable value or NULL */
47274 int n_value;
47275
47276 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
47277 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
47278 for (n_value = 0;n_value < gen_nb_xmlXPathObjectPtr;n_value++) {
47279 mem_base = xmlMemBlocks();
47280 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
47281 name = gen_const_xmlChar_ptr(n_name, 1);
47282 value = gen_xmlXPathObjectPtr(n_value, 2);
47283
William M. Brackf13f77f2004-11-12 16:03:48 +000047284 ret_val = xmlXPathRegisterVariable(ctxt, (const xmlChar *)name, value);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047285 desret_int(ret_val);
47286 call_tests++;
47287 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000047288 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047289 des_xmlXPathObjectPtr(n_value, value, 2);
47290 xmlResetLastError();
47291 if (mem_base != xmlMemBlocks()) {
47292 printf("Leak of %d blocks found in xmlXPathRegisterVariable",
47293 xmlMemBlocks() - mem_base);
47294 test_ret++;
47295 printf(" %d", n_ctxt);
47296 printf(" %d", n_name);
47297 printf(" %d", n_value);
47298 printf("\n");
47299 }
47300 }
47301 }
47302 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047303 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047304#endif
47305
Daniel Veillarda82b1822004-11-08 16:24:57 +000047306 return(test_ret);
47307}
47308
47309
47310static int
47311test_xmlXPathRegisterVariableLookup(void) {
47312 int test_ret = 0;
47313
47314
47315 /* missing type support */
47316 return(test_ret);
47317}
47318
47319
47320static int
47321test_xmlXPathRegisterVariableNS(void) {
47322 int test_ret = 0;
47323
William M. Brack21e4ef22005-01-02 09:53:13 +000047324#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047325 int mem_base;
47326 int ret_val;
47327 xmlXPathContextPtr ctxt; /* the XPath context */
47328 int n_ctxt;
47329 xmlChar * name; /* the variable name */
47330 int n_name;
47331 xmlChar * ns_uri; /* the variable namespace URI */
47332 int n_ns_uri;
47333 xmlXPathObjectPtr value; /* the variable value or NULL */
47334 int n_value;
47335
47336 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
47337 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
47338 for (n_ns_uri = 0;n_ns_uri < gen_nb_const_xmlChar_ptr;n_ns_uri++) {
47339 for (n_value = 0;n_value < gen_nb_xmlXPathObjectPtr;n_value++) {
47340 mem_base = xmlMemBlocks();
47341 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
47342 name = gen_const_xmlChar_ptr(n_name, 1);
47343 ns_uri = gen_const_xmlChar_ptr(n_ns_uri, 2);
47344 value = gen_xmlXPathObjectPtr(n_value, 3);
47345
William M. Brackf13f77f2004-11-12 16:03:48 +000047346 ret_val = xmlXPathRegisterVariableNS(ctxt, (const xmlChar *)name, (const xmlChar *)ns_uri, value);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047347 desret_int(ret_val);
47348 call_tests++;
47349 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000047350 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
47351 des_const_xmlChar_ptr(n_ns_uri, (const xmlChar *)ns_uri, 2);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047352 des_xmlXPathObjectPtr(n_value, value, 3);
47353 xmlResetLastError();
47354 if (mem_base != xmlMemBlocks()) {
47355 printf("Leak of %d blocks found in xmlXPathRegisterVariableNS",
47356 xmlMemBlocks() - mem_base);
47357 test_ret++;
47358 printf(" %d", n_ctxt);
47359 printf(" %d", n_name);
47360 printf(" %d", n_ns_uri);
47361 printf(" %d", n_value);
47362 printf("\n");
47363 }
47364 }
47365 }
47366 }
47367 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047368 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047369#endif
47370
Daniel Veillarda82b1822004-11-08 16:24:57 +000047371 return(test_ret);
47372}
47373
47374
47375static int
47376test_xmlXPathRegisteredFuncsCleanup(void) {
47377 int test_ret = 0;
47378
William M. Brack21e4ef22005-01-02 09:53:13 +000047379#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047380 int mem_base;
47381 xmlXPathContextPtr ctxt; /* the XPath context */
47382 int n_ctxt;
47383
47384 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
47385 mem_base = xmlMemBlocks();
47386 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
47387
47388 xmlXPathRegisteredFuncsCleanup(ctxt);
47389 call_tests++;
47390 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
47391 xmlResetLastError();
47392 if (mem_base != xmlMemBlocks()) {
47393 printf("Leak of %d blocks found in xmlXPathRegisteredFuncsCleanup",
47394 xmlMemBlocks() - mem_base);
47395 test_ret++;
47396 printf(" %d", n_ctxt);
47397 printf("\n");
47398 }
47399 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047400 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047401#endif
47402
Daniel Veillarda82b1822004-11-08 16:24:57 +000047403 return(test_ret);
47404}
47405
47406
47407static int
47408test_xmlXPathRegisteredNsCleanup(void) {
47409 int test_ret = 0;
47410
William M. Brack21e4ef22005-01-02 09:53:13 +000047411#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047412 int mem_base;
47413 xmlXPathContextPtr ctxt; /* the XPath context */
47414 int n_ctxt;
47415
47416 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
47417 mem_base = xmlMemBlocks();
47418 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
47419
47420 xmlXPathRegisteredNsCleanup(ctxt);
47421 call_tests++;
47422 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
47423 xmlResetLastError();
47424 if (mem_base != xmlMemBlocks()) {
47425 printf("Leak of %d blocks found in xmlXPathRegisteredNsCleanup",
47426 xmlMemBlocks() - mem_base);
47427 test_ret++;
47428 printf(" %d", n_ctxt);
47429 printf("\n");
47430 }
47431 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047432 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047433#endif
47434
Daniel Veillarda82b1822004-11-08 16:24:57 +000047435 return(test_ret);
47436}
47437
47438
47439static int
47440test_xmlXPathRegisteredVariablesCleanup(void) {
47441 int test_ret = 0;
47442
William M. Brack21e4ef22005-01-02 09:53:13 +000047443#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047444 int mem_base;
47445 xmlXPathContextPtr ctxt; /* the XPath context */
47446 int n_ctxt;
47447
47448 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
47449 mem_base = xmlMemBlocks();
47450 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
47451
47452 xmlXPathRegisteredVariablesCleanup(ctxt);
47453 call_tests++;
47454 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
47455 xmlResetLastError();
47456 if (mem_base != xmlMemBlocks()) {
47457 printf("Leak of %d blocks found in xmlXPathRegisteredVariablesCleanup",
47458 xmlMemBlocks() - mem_base);
47459 test_ret++;
47460 printf(" %d", n_ctxt);
47461 printf("\n");
47462 }
47463 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047464 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047465#endif
47466
Daniel Veillarda82b1822004-11-08 16:24:57 +000047467 return(test_ret);
47468}
47469
47470
47471static int
47472test_xmlXPathRoot(void) {
47473 int test_ret = 0;
47474
William M. Brack21e4ef22005-01-02 09:53:13 +000047475#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047476 int mem_base;
47477 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47478 int n_ctxt;
47479
47480 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47481 mem_base = xmlMemBlocks();
47482 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47483
47484 xmlXPathRoot(ctxt);
47485 call_tests++;
47486 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47487 xmlResetLastError();
47488 if (mem_base != xmlMemBlocks()) {
47489 printf("Leak of %d blocks found in xmlXPathRoot",
47490 xmlMemBlocks() - mem_base);
47491 test_ret++;
47492 printf(" %d", n_ctxt);
47493 printf("\n");
47494 }
47495 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047496 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047497#endif
47498
Daniel Veillarda82b1822004-11-08 16:24:57 +000047499 return(test_ret);
47500}
47501
47502
47503static int
47504test_xmlXPathRoundFunction(void) {
47505 int test_ret = 0;
47506
William M. Brack21e4ef22005-01-02 09:53:13 +000047507#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047508 int mem_base;
47509 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47510 int n_ctxt;
47511 int nargs; /* the number of arguments */
47512 int n_nargs;
47513
47514 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47515 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47516 mem_base = xmlMemBlocks();
47517 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47518 nargs = gen_int(n_nargs, 1);
47519
47520 xmlXPathRoundFunction(ctxt, nargs);
47521 call_tests++;
47522 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47523 des_int(n_nargs, nargs, 1);
47524 xmlResetLastError();
47525 if (mem_base != xmlMemBlocks()) {
47526 printf("Leak of %d blocks found in xmlXPathRoundFunction",
47527 xmlMemBlocks() - mem_base);
47528 test_ret++;
47529 printf(" %d", n_ctxt);
47530 printf(" %d", n_nargs);
47531 printf("\n");
47532 }
47533 }
47534 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047535 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047536#endif
47537
Daniel Veillarda82b1822004-11-08 16:24:57 +000047538 return(test_ret);
47539}
47540
47541
47542static int
47543test_xmlXPathStartsWithFunction(void) {
47544 int test_ret = 0;
47545
William M. Brack21e4ef22005-01-02 09:53:13 +000047546#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047547 int mem_base;
47548 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47549 int n_ctxt;
47550 int nargs; /* the number of arguments */
47551 int n_nargs;
47552
47553 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47554 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47555 mem_base = xmlMemBlocks();
47556 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47557 nargs = gen_int(n_nargs, 1);
47558
47559 xmlXPathStartsWithFunction(ctxt, nargs);
47560 call_tests++;
47561 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47562 des_int(n_nargs, nargs, 1);
47563 xmlResetLastError();
47564 if (mem_base != xmlMemBlocks()) {
47565 printf("Leak of %d blocks found in xmlXPathStartsWithFunction",
47566 xmlMemBlocks() - mem_base);
47567 test_ret++;
47568 printf(" %d", n_ctxt);
47569 printf(" %d", n_nargs);
47570 printf("\n");
47571 }
47572 }
47573 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047574 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047575#endif
47576
Daniel Veillarda82b1822004-11-08 16:24:57 +000047577 return(test_ret);
47578}
47579
47580
47581static int
47582test_xmlXPathStringEvalNumber(void) {
47583 int test_ret = 0;
47584
William M. Brack21e4ef22005-01-02 09:53:13 +000047585#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047586 int mem_base;
47587 double ret_val;
47588 xmlChar * str; /* A string to scan */
47589 int n_str;
47590
47591 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
47592 mem_base = xmlMemBlocks();
47593 str = gen_const_xmlChar_ptr(n_str, 0);
47594
William M. Brackf13f77f2004-11-12 16:03:48 +000047595 ret_val = xmlXPathStringEvalNumber((const xmlChar *)str);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047596 desret_double(ret_val);
47597 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000047598 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047599 xmlResetLastError();
47600 if (mem_base != xmlMemBlocks()) {
47601 printf("Leak of %d blocks found in xmlXPathStringEvalNumber",
47602 xmlMemBlocks() - mem_base);
47603 test_ret++;
47604 printf(" %d", n_str);
47605 printf("\n");
47606 }
47607 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047608 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047609#endif
47610
Daniel Veillarda82b1822004-11-08 16:24:57 +000047611 return(test_ret);
47612}
47613
47614
47615static int
47616test_xmlXPathStringFunction(void) {
47617 int test_ret = 0;
47618
William M. Brack21e4ef22005-01-02 09:53:13 +000047619#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047620 int mem_base;
47621 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47622 int n_ctxt;
47623 int nargs; /* the number of arguments */
47624 int n_nargs;
47625
47626 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47627 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47628 mem_base = xmlMemBlocks();
47629 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47630 nargs = gen_int(n_nargs, 1);
47631
47632 xmlXPathStringFunction(ctxt, nargs);
47633 call_tests++;
47634 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47635 des_int(n_nargs, nargs, 1);
47636 xmlResetLastError();
47637 if (mem_base != xmlMemBlocks()) {
47638 printf("Leak of %d blocks found in xmlXPathStringFunction",
47639 xmlMemBlocks() - mem_base);
47640 test_ret++;
47641 printf(" %d", n_ctxt);
47642 printf(" %d", n_nargs);
47643 printf("\n");
47644 }
47645 }
47646 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047647 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047648#endif
47649
Daniel Veillarda82b1822004-11-08 16:24:57 +000047650 return(test_ret);
47651}
47652
47653
47654static int
47655test_xmlXPathStringLengthFunction(void) {
47656 int test_ret = 0;
47657
William M. Brack21e4ef22005-01-02 09:53:13 +000047658#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047659 int mem_base;
47660 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47661 int n_ctxt;
47662 int nargs; /* the number of arguments */
47663 int n_nargs;
47664
47665 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47666 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47667 mem_base = xmlMemBlocks();
47668 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47669 nargs = gen_int(n_nargs, 1);
47670
47671 xmlXPathStringLengthFunction(ctxt, nargs);
47672 call_tests++;
47673 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47674 des_int(n_nargs, nargs, 1);
47675 xmlResetLastError();
47676 if (mem_base != xmlMemBlocks()) {
47677 printf("Leak of %d blocks found in xmlXPathStringLengthFunction",
47678 xmlMemBlocks() - mem_base);
47679 test_ret++;
47680 printf(" %d", n_ctxt);
47681 printf(" %d", n_nargs);
47682 printf("\n");
47683 }
47684 }
47685 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047686 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047687#endif
47688
Daniel Veillarda82b1822004-11-08 16:24:57 +000047689 return(test_ret);
47690}
47691
47692
47693static int
47694test_xmlXPathSubValues(void) {
47695 int test_ret = 0;
47696
William M. Brack21e4ef22005-01-02 09:53:13 +000047697#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047698 int mem_base;
47699 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47700 int n_ctxt;
47701
47702 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47703 mem_base = xmlMemBlocks();
47704 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47705
47706 xmlXPathSubValues(ctxt);
47707 call_tests++;
47708 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47709 xmlResetLastError();
47710 if (mem_base != xmlMemBlocks()) {
47711 printf("Leak of %d blocks found in xmlXPathSubValues",
47712 xmlMemBlocks() - mem_base);
47713 test_ret++;
47714 printf(" %d", n_ctxt);
47715 printf("\n");
47716 }
47717 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047718 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047719#endif
47720
Daniel Veillarda82b1822004-11-08 16:24:57 +000047721 return(test_ret);
47722}
47723
47724
47725static int
47726test_xmlXPathSubstringAfterFunction(void) {
47727 int test_ret = 0;
47728
William M. Brack21e4ef22005-01-02 09:53:13 +000047729#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047730 int mem_base;
47731 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47732 int n_ctxt;
47733 int nargs; /* the number of arguments */
47734 int n_nargs;
47735
47736 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47737 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47738 mem_base = xmlMemBlocks();
47739 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47740 nargs = gen_int(n_nargs, 1);
47741
47742 xmlXPathSubstringAfterFunction(ctxt, nargs);
47743 call_tests++;
47744 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47745 des_int(n_nargs, nargs, 1);
47746 xmlResetLastError();
47747 if (mem_base != xmlMemBlocks()) {
47748 printf("Leak of %d blocks found in xmlXPathSubstringAfterFunction",
47749 xmlMemBlocks() - mem_base);
47750 test_ret++;
47751 printf(" %d", n_ctxt);
47752 printf(" %d", n_nargs);
47753 printf("\n");
47754 }
47755 }
47756 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047757 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047758#endif
47759
Daniel Veillarda82b1822004-11-08 16:24:57 +000047760 return(test_ret);
47761}
47762
47763
47764static int
47765test_xmlXPathSubstringBeforeFunction(void) {
47766 int test_ret = 0;
47767
William M. Brack21e4ef22005-01-02 09:53:13 +000047768#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047769 int mem_base;
47770 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47771 int n_ctxt;
47772 int nargs; /* the number of arguments */
47773 int n_nargs;
47774
47775 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47776 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47777 mem_base = xmlMemBlocks();
47778 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47779 nargs = gen_int(n_nargs, 1);
47780
47781 xmlXPathSubstringBeforeFunction(ctxt, nargs);
47782 call_tests++;
47783 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47784 des_int(n_nargs, nargs, 1);
47785 xmlResetLastError();
47786 if (mem_base != xmlMemBlocks()) {
47787 printf("Leak of %d blocks found in xmlXPathSubstringBeforeFunction",
47788 xmlMemBlocks() - mem_base);
47789 test_ret++;
47790 printf(" %d", n_ctxt);
47791 printf(" %d", n_nargs);
47792 printf("\n");
47793 }
47794 }
47795 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047796 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047797#endif
47798
Daniel Veillarda82b1822004-11-08 16:24:57 +000047799 return(test_ret);
47800}
47801
47802
47803static int
47804test_xmlXPathSubstringFunction(void) {
47805 int test_ret = 0;
47806
William M. Brack21e4ef22005-01-02 09:53:13 +000047807#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047808 int mem_base;
47809 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47810 int n_ctxt;
47811 int nargs; /* the number of arguments */
47812 int n_nargs;
47813
47814 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47815 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47816 mem_base = xmlMemBlocks();
47817 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47818 nargs = gen_int(n_nargs, 1);
47819
47820 xmlXPathSubstringFunction(ctxt, nargs);
47821 call_tests++;
47822 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47823 des_int(n_nargs, nargs, 1);
47824 xmlResetLastError();
47825 if (mem_base != xmlMemBlocks()) {
47826 printf("Leak of %d blocks found in xmlXPathSubstringFunction",
47827 xmlMemBlocks() - mem_base);
47828 test_ret++;
47829 printf(" %d", n_ctxt);
47830 printf(" %d", n_nargs);
47831 printf("\n");
47832 }
47833 }
47834 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047835 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047836#endif
47837
Daniel Veillarda82b1822004-11-08 16:24:57 +000047838 return(test_ret);
47839}
47840
47841
47842static int
47843test_xmlXPathSumFunction(void) {
47844 int test_ret = 0;
47845
William M. Brack21e4ef22005-01-02 09:53:13 +000047846#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047847 int mem_base;
47848 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47849 int n_ctxt;
47850 int nargs; /* the number of arguments */
47851 int n_nargs;
47852
47853 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47854 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47855 mem_base = xmlMemBlocks();
47856 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47857 nargs = gen_int(n_nargs, 1);
47858
47859 xmlXPathSumFunction(ctxt, nargs);
47860 call_tests++;
47861 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47862 des_int(n_nargs, nargs, 1);
47863 xmlResetLastError();
47864 if (mem_base != xmlMemBlocks()) {
47865 printf("Leak of %d blocks found in xmlXPathSumFunction",
47866 xmlMemBlocks() - mem_base);
47867 test_ret++;
47868 printf(" %d", n_ctxt);
47869 printf(" %d", n_nargs);
47870 printf("\n");
47871 }
47872 }
47873 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047874 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047875#endif
47876
Daniel Veillarda82b1822004-11-08 16:24:57 +000047877 return(test_ret);
47878}
47879
47880
47881static int
47882test_xmlXPathTrailing(void) {
47883 int test_ret = 0;
47884
William M. Brack21e4ef22005-01-02 09:53:13 +000047885#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047886 int mem_base;
47887 xmlNodeSetPtr ret_val;
47888 xmlNodeSetPtr nodes1; /* a node-set */
47889 int n_nodes1;
47890 xmlNodeSetPtr nodes2; /* a node-set */
47891 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047892
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047893 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
47894 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
47895 mem_base = xmlMemBlocks();
47896 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
47897 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
47898
47899 ret_val = xmlXPathTrailing(nodes1, nodes2);
47900 desret_xmlNodeSetPtr(ret_val);
47901 call_tests++;
47902 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
47903 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
47904 xmlResetLastError();
47905 if (mem_base != xmlMemBlocks()) {
47906 printf("Leak of %d blocks found in xmlXPathTrailing",
47907 xmlMemBlocks() - mem_base);
47908 test_ret++;
47909 printf(" %d", n_nodes1);
47910 printf(" %d", n_nodes2);
47911 printf("\n");
47912 }
47913 }
47914 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047915 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047916#endif
47917
Daniel Veillarda82b1822004-11-08 16:24:57 +000047918 return(test_ret);
47919}
47920
47921
47922static int
47923test_xmlXPathTrailingSorted(void) {
47924 int test_ret = 0;
47925
William M. Brack21e4ef22005-01-02 09:53:13 +000047926#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047927 int mem_base;
47928 xmlNodeSetPtr ret_val;
47929 xmlNodeSetPtr nodes1; /* a node-set, sorted by document order */
47930 int n_nodes1;
47931 xmlNodeSetPtr nodes2; /* a node-set, sorted by document order */
47932 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047933
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047934 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
47935 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
47936 mem_base = xmlMemBlocks();
47937 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
47938 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
47939
47940 ret_val = xmlXPathTrailingSorted(nodes1, nodes2);
47941 desret_xmlNodeSetPtr(ret_val);
47942 call_tests++;
47943 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
47944 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
47945 xmlResetLastError();
47946 if (mem_base != xmlMemBlocks()) {
47947 printf("Leak of %d blocks found in xmlXPathTrailingSorted",
47948 xmlMemBlocks() - mem_base);
47949 test_ret++;
47950 printf(" %d", n_nodes1);
47951 printf(" %d", n_nodes2);
47952 printf("\n");
47953 }
47954 }
47955 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047956 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047957#endif
47958
Daniel Veillarda82b1822004-11-08 16:24:57 +000047959 return(test_ret);
47960}
47961
47962
47963static int
47964test_xmlXPathTranslateFunction(void) {
47965 int test_ret = 0;
47966
William M. Brack21e4ef22005-01-02 09:53:13 +000047967#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047968 int mem_base;
47969 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47970 int n_ctxt;
47971 int nargs; /* the number of arguments */
47972 int n_nargs;
47973
47974 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47975 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47976 mem_base = xmlMemBlocks();
47977 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47978 nargs = gen_int(n_nargs, 1);
47979
47980 xmlXPathTranslateFunction(ctxt, nargs);
47981 call_tests++;
47982 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47983 des_int(n_nargs, nargs, 1);
47984 xmlResetLastError();
47985 if (mem_base != xmlMemBlocks()) {
47986 printf("Leak of %d blocks found in xmlXPathTranslateFunction",
47987 xmlMemBlocks() - mem_base);
47988 test_ret++;
47989 printf(" %d", n_ctxt);
47990 printf(" %d", n_nargs);
47991 printf("\n");
47992 }
47993 }
47994 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047995 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047996#endif
47997
Daniel Veillarda82b1822004-11-08 16:24:57 +000047998 return(test_ret);
47999}
48000
48001
48002static int
48003test_xmlXPathTrueFunction(void) {
48004 int test_ret = 0;
48005
William M. Brack21e4ef22005-01-02 09:53:13 +000048006#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000048007 int mem_base;
48008 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
48009 int n_ctxt;
48010 int nargs; /* the number of arguments */
48011 int n_nargs;
48012
48013 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
48014 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
48015 mem_base = xmlMemBlocks();
48016 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
48017 nargs = gen_int(n_nargs, 1);
48018
48019 xmlXPathTrueFunction(ctxt, nargs);
48020 call_tests++;
48021 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
48022 des_int(n_nargs, nargs, 1);
48023 xmlResetLastError();
48024 if (mem_base != xmlMemBlocks()) {
48025 printf("Leak of %d blocks found in xmlXPathTrueFunction",
48026 xmlMemBlocks() - mem_base);
48027 test_ret++;
48028 printf(" %d", n_ctxt);
48029 printf(" %d", n_nargs);
48030 printf("\n");
48031 }
48032 }
48033 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048034 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000048035#endif
48036
Daniel Veillarda82b1822004-11-08 16:24:57 +000048037 return(test_ret);
48038}
48039
48040
48041static int
48042test_xmlXPathValueFlipSign(void) {
48043 int test_ret = 0;
48044
William M. Brack21e4ef22005-01-02 09:53:13 +000048045#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000048046 int mem_base;
48047 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
48048 int n_ctxt;
48049
48050 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
48051 mem_base = xmlMemBlocks();
48052 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
48053
48054 xmlXPathValueFlipSign(ctxt);
48055 call_tests++;
48056 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
48057 xmlResetLastError();
48058 if (mem_base != xmlMemBlocks()) {
48059 printf("Leak of %d blocks found in xmlXPathValueFlipSign",
48060 xmlMemBlocks() - mem_base);
48061 test_ret++;
48062 printf(" %d", n_ctxt);
48063 printf("\n");
48064 }
48065 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048066 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000048067#endif
48068
Daniel Veillarda82b1822004-11-08 16:24:57 +000048069 return(test_ret);
48070}
48071
48072
48073static int
48074test_xmlXPathVariableLookup(void) {
48075 int test_ret = 0;
48076
William M. Brack21e4ef22005-01-02 09:53:13 +000048077#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000048078 int mem_base;
48079 xmlXPathObjectPtr ret_val;
48080 xmlXPathContextPtr ctxt; /* the XPath context */
48081 int n_ctxt;
48082 xmlChar * name; /* the variable name */
48083 int n_name;
48084
48085 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
48086 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
48087 mem_base = xmlMemBlocks();
48088 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
48089 name = gen_const_xmlChar_ptr(n_name, 1);
48090
William M. Brackf13f77f2004-11-12 16:03:48 +000048091 ret_val = xmlXPathVariableLookup(ctxt, (const xmlChar *)name);
Daniel Veillarda82b1822004-11-08 16:24:57 +000048092 desret_xmlXPathObjectPtr(ret_val);
48093 call_tests++;
48094 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000048095 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +000048096 xmlResetLastError();
48097 if (mem_base != xmlMemBlocks()) {
48098 printf("Leak of %d blocks found in xmlXPathVariableLookup",
48099 xmlMemBlocks() - mem_base);
48100 test_ret++;
48101 printf(" %d", n_ctxt);
48102 printf(" %d", n_name);
48103 printf("\n");
48104 }
48105 }
48106 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048107 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000048108#endif
48109
Daniel Veillarda82b1822004-11-08 16:24:57 +000048110 return(test_ret);
48111}
48112
48113
48114static int
48115test_xmlXPathVariableLookupNS(void) {
48116 int test_ret = 0;
48117
William M. Brack21e4ef22005-01-02 09:53:13 +000048118#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000048119 int mem_base;
48120 xmlXPathObjectPtr ret_val;
48121 xmlXPathContextPtr ctxt; /* the XPath context */
48122 int n_ctxt;
48123 xmlChar * name; /* the variable name */
48124 int n_name;
48125 xmlChar * ns_uri; /* the variable namespace URI */
48126 int n_ns_uri;
48127
48128 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
48129 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
48130 for (n_ns_uri = 0;n_ns_uri < gen_nb_const_xmlChar_ptr;n_ns_uri++) {
48131 mem_base = xmlMemBlocks();
48132 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
48133 name = gen_const_xmlChar_ptr(n_name, 1);
48134 ns_uri = gen_const_xmlChar_ptr(n_ns_uri, 2);
48135
William M. Brackf13f77f2004-11-12 16:03:48 +000048136 ret_val = xmlXPathVariableLookupNS(ctxt, (const xmlChar *)name, (const xmlChar *)ns_uri);
Daniel Veillarda82b1822004-11-08 16:24:57 +000048137 desret_xmlXPathObjectPtr(ret_val);
48138 call_tests++;
48139 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000048140 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
48141 des_const_xmlChar_ptr(n_ns_uri, (const xmlChar *)ns_uri, 2);
Daniel Veillarda82b1822004-11-08 16:24:57 +000048142 xmlResetLastError();
48143 if (mem_base != xmlMemBlocks()) {
48144 printf("Leak of %d blocks found in xmlXPathVariableLookupNS",
48145 xmlMemBlocks() - mem_base);
48146 test_ret++;
48147 printf(" %d", n_ctxt);
48148 printf(" %d", n_name);
48149 printf(" %d", n_ns_uri);
48150 printf("\n");
48151 }
48152 }
48153 }
48154 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048155 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000048156#endif
48157
Daniel Veillarda82b1822004-11-08 16:24:57 +000048158 return(test_ret);
48159}
48160
48161
48162static int
48163test_xmlXPathWrapCString(void) {
48164 int test_ret = 0;
48165
William M. Brack21e4ef22005-01-02 09:53:13 +000048166#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000048167 int mem_base;
48168 xmlXPathObjectPtr ret_val;
48169 char * val; /* the char * value */
48170 int n_val;
48171
48172 for (n_val = 0;n_val < gen_nb_char_ptr;n_val++) {
48173 mem_base = xmlMemBlocks();
48174 val = gen_char_ptr(n_val, 0);
48175
48176 ret_val = xmlXPathWrapCString(val);
48177 desret_xmlXPathObjectPtr(ret_val);
48178 call_tests++;
48179 des_char_ptr(n_val, val, 0);
48180 xmlResetLastError();
48181 if (mem_base != xmlMemBlocks()) {
48182 printf("Leak of %d blocks found in xmlXPathWrapCString",
48183 xmlMemBlocks() - mem_base);
48184 test_ret++;
48185 printf(" %d", n_val);
48186 printf("\n");
48187 }
48188 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048189 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000048190#endif
48191
Daniel Veillarda82b1822004-11-08 16:24:57 +000048192 return(test_ret);
48193}
48194
48195
48196static int
48197test_xmlXPathWrapExternal(void) {
48198 int test_ret = 0;
48199
William M. Brack21e4ef22005-01-02 09:53:13 +000048200#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000048201 int mem_base;
48202 xmlXPathObjectPtr ret_val;
48203 void * val; /* the user data */
48204 int n_val;
48205
48206 for (n_val = 0;n_val < gen_nb_void_ptr;n_val++) {
48207 mem_base = xmlMemBlocks();
48208 val = gen_void_ptr(n_val, 0);
48209
48210 ret_val = xmlXPathWrapExternal(val);
48211 desret_xmlXPathObjectPtr(ret_val);
48212 call_tests++;
48213 des_void_ptr(n_val, val, 0);
48214 xmlResetLastError();
48215 if (mem_base != xmlMemBlocks()) {
48216 printf("Leak of %d blocks found in xmlXPathWrapExternal",
48217 xmlMemBlocks() - mem_base);
48218 test_ret++;
48219 printf(" %d", n_val);
48220 printf("\n");
48221 }
48222 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048223 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000048224#endif
48225
Daniel Veillarda82b1822004-11-08 16:24:57 +000048226 return(test_ret);
48227}
48228
48229
48230static int
48231test_xmlXPathWrapNodeSet(void) {
48232 int test_ret = 0;
48233
William M. Brack21e4ef22005-01-02 09:53:13 +000048234#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000048235 int mem_base;
48236 xmlXPathObjectPtr ret_val;
48237 xmlNodeSetPtr val; /* the NodePtr value */
48238 int n_val;
48239
48240 for (n_val = 0;n_val < gen_nb_xmlNodeSetPtr;n_val++) {
48241 mem_base = xmlMemBlocks();
48242 val = gen_xmlNodeSetPtr(n_val, 0);
48243
48244 ret_val = xmlXPathWrapNodeSet(val);
48245 desret_xmlXPathObjectPtr(ret_val);
48246 call_tests++;
48247 des_xmlNodeSetPtr(n_val, val, 0);
48248 xmlResetLastError();
48249 if (mem_base != xmlMemBlocks()) {
48250 printf("Leak of %d blocks found in xmlXPathWrapNodeSet",
48251 xmlMemBlocks() - mem_base);
48252 test_ret++;
48253 printf(" %d", n_val);
48254 printf("\n");
48255 }
48256 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048257 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000048258#endif
48259
Daniel Veillarda82b1822004-11-08 16:24:57 +000048260 return(test_ret);
48261}
48262
48263
48264static int
48265test_xmlXPatherror(void) {
48266 int test_ret = 0;
48267
William M. Brack21e4ef22005-01-02 09:53:13 +000048268#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000048269 int mem_base;
48270 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
48271 int n_ctxt;
48272 const char * file; /* the file name */
48273 int n_file;
48274 int line; /* the line number */
48275 int n_line;
48276 int no; /* the error number */
48277 int n_no;
48278
48279 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
48280 for (n_file = 0;n_file < gen_nb_filepath;n_file++) {
48281 for (n_line = 0;n_line < gen_nb_int;n_line++) {
48282 for (n_no = 0;n_no < gen_nb_int;n_no++) {
48283 mem_base = xmlMemBlocks();
48284 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
48285 file = gen_filepath(n_file, 1);
48286 line = gen_int(n_line, 2);
48287 no = gen_int(n_no, 3);
48288
48289 xmlXPatherror(ctxt, file, line, no);
48290 call_tests++;
48291 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
48292 des_filepath(n_file, file, 1);
48293 des_int(n_line, line, 2);
48294 des_int(n_no, no, 3);
48295 xmlResetLastError();
48296 if (mem_base != xmlMemBlocks()) {
48297 printf("Leak of %d blocks found in xmlXPatherror",
48298 xmlMemBlocks() - mem_base);
48299 test_ret++;
48300 printf(" %d", n_ctxt);
48301 printf(" %d", n_file);
48302 printf(" %d", n_line);
48303 printf(" %d", n_no);
48304 printf("\n");
48305 }
48306 }
48307 }
48308 }
48309 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048310 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000048311#endif
48312
Daniel Veillarda82b1822004-11-08 16:24:57 +000048313 return(test_ret);
48314}
48315
48316static int
48317test_xpathInternals(void) {
48318 int test_ret = 0;
48319
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048320 if (quiet == 0) printf("Testing xpathInternals : 106 of 117 functions ...\n");
Daniel Veillarda82b1822004-11-08 16:24:57 +000048321 test_ret += test_valuePop();
48322 test_ret += test_valuePush();
48323 test_ret += test_xmlXPathAddValues();
48324 test_ret += test_xmlXPathBooleanFunction();
48325 test_ret += test_xmlXPathCeilingFunction();
48326 test_ret += test_xmlXPathCompareValues();
48327 test_ret += test_xmlXPathConcatFunction();
48328 test_ret += test_xmlXPathContainsFunction();
48329 test_ret += test_xmlXPathCountFunction();
48330 test_ret += test_xmlXPathDebugDumpCompExpr();
48331 test_ret += test_xmlXPathDebugDumpObject();
48332 test_ret += test_xmlXPathDifference();
48333 test_ret += test_xmlXPathDistinct();
48334 test_ret += test_xmlXPathDistinctSorted();
48335 test_ret += test_xmlXPathDivValues();
48336 test_ret += test_xmlXPathEqualValues();
48337 test_ret += test_xmlXPathErr();
48338 test_ret += test_xmlXPathEvalExpr();
48339 test_ret += test_xmlXPathEvaluatePredicateResult();
48340 test_ret += test_xmlXPathFalseFunction();
48341 test_ret += test_xmlXPathFloorFunction();
48342 test_ret += test_xmlXPathFunctionLookup();
48343 test_ret += test_xmlXPathFunctionLookupNS();
48344 test_ret += test_xmlXPathHasSameNodes();
48345 test_ret += test_xmlXPathIdFunction();
48346 test_ret += test_xmlXPathIntersection();
48347 test_ret += test_xmlXPathIsNodeType();
48348 test_ret += test_xmlXPathLangFunction();
48349 test_ret += test_xmlXPathLastFunction();
48350 test_ret += test_xmlXPathLeading();
48351 test_ret += test_xmlXPathLeadingSorted();
48352 test_ret += test_xmlXPathLocalNameFunction();
48353 test_ret += test_xmlXPathModValues();
48354 test_ret += test_xmlXPathMultValues();
48355 test_ret += test_xmlXPathNamespaceURIFunction();
48356 test_ret += test_xmlXPathNewBoolean();
48357 test_ret += test_xmlXPathNewCString();
48358 test_ret += test_xmlXPathNewFloat();
48359 test_ret += test_xmlXPathNewNodeSet();
48360 test_ret += test_xmlXPathNewNodeSetList();
48361 test_ret += test_xmlXPathNewParserContext();
48362 test_ret += test_xmlXPathNewString();
48363 test_ret += test_xmlXPathNextAncestor();
48364 test_ret += test_xmlXPathNextAncestorOrSelf();
48365 test_ret += test_xmlXPathNextAttribute();
48366 test_ret += test_xmlXPathNextChild();
48367 test_ret += test_xmlXPathNextDescendant();
48368 test_ret += test_xmlXPathNextDescendantOrSelf();
48369 test_ret += test_xmlXPathNextFollowing();
48370 test_ret += test_xmlXPathNextFollowingSibling();
48371 test_ret += test_xmlXPathNextNamespace();
48372 test_ret += test_xmlXPathNextParent();
48373 test_ret += test_xmlXPathNextPreceding();
48374 test_ret += test_xmlXPathNextPrecedingSibling();
48375 test_ret += test_xmlXPathNextSelf();
48376 test_ret += test_xmlXPathNodeLeading();
48377 test_ret += test_xmlXPathNodeLeadingSorted();
48378 test_ret += test_xmlXPathNodeSetAdd();
48379 test_ret += test_xmlXPathNodeSetAddNs();
48380 test_ret += test_xmlXPathNodeSetAddUnique();
48381 test_ret += test_xmlXPathNodeSetContains();
48382 test_ret += test_xmlXPathNodeSetDel();
48383 test_ret += test_xmlXPathNodeSetMerge();
48384 test_ret += test_xmlXPathNodeSetRemove();
48385 test_ret += test_xmlXPathNodeSetSort();
48386 test_ret += test_xmlXPathNodeTrailing();
48387 test_ret += test_xmlXPathNodeTrailingSorted();
48388 test_ret += test_xmlXPathNormalizeFunction();
48389 test_ret += test_xmlXPathNotEqualValues();
48390 test_ret += test_xmlXPathNotFunction();
48391 test_ret += test_xmlXPathNsLookup();
48392 test_ret += test_xmlXPathNumberFunction();
48393 test_ret += test_xmlXPathParseNCName();
48394 test_ret += test_xmlXPathParseName();
48395 test_ret += test_xmlXPathPopBoolean();
48396 test_ret += test_xmlXPathPopExternal();
48397 test_ret += test_xmlXPathPopNodeSet();
48398 test_ret += test_xmlXPathPopNumber();
48399 test_ret += test_xmlXPathPopString();
48400 test_ret += test_xmlXPathPositionFunction();
48401 test_ret += test_xmlXPathRegisterAllFunctions();
48402 test_ret += test_xmlXPathRegisterFunc();
48403 test_ret += test_xmlXPathRegisterFuncLookup();
48404 test_ret += test_xmlXPathRegisterFuncNS();
48405 test_ret += test_xmlXPathRegisterNs();
48406 test_ret += test_xmlXPathRegisterVariable();
48407 test_ret += test_xmlXPathRegisterVariableLookup();
48408 test_ret += test_xmlXPathRegisterVariableNS();
48409 test_ret += test_xmlXPathRegisteredFuncsCleanup();
48410 test_ret += test_xmlXPathRegisteredNsCleanup();
48411 test_ret += test_xmlXPathRegisteredVariablesCleanup();
48412 test_ret += test_xmlXPathRoot();
48413 test_ret += test_xmlXPathRoundFunction();
48414 test_ret += test_xmlXPathStartsWithFunction();
48415 test_ret += test_xmlXPathStringEvalNumber();
48416 test_ret += test_xmlXPathStringFunction();
48417 test_ret += test_xmlXPathStringLengthFunction();
48418 test_ret += test_xmlXPathSubValues();
48419 test_ret += test_xmlXPathSubstringAfterFunction();
48420 test_ret += test_xmlXPathSubstringBeforeFunction();
48421 test_ret += test_xmlXPathSubstringFunction();
48422 test_ret += test_xmlXPathSumFunction();
48423 test_ret += test_xmlXPathTrailing();
48424 test_ret += test_xmlXPathTrailingSorted();
48425 test_ret += test_xmlXPathTranslateFunction();
48426 test_ret += test_xmlXPathTrueFunction();
48427 test_ret += test_xmlXPathValueFlipSign();
48428 test_ret += test_xmlXPathVariableLookup();
48429 test_ret += test_xmlXPathVariableLookupNS();
48430 test_ret += test_xmlXPathWrapCString();
48431 test_ret += test_xmlXPathWrapExternal();
48432 test_ret += test_xmlXPathWrapNodeSet();
48433 test_ret += test_xmlXPatherror();
48434
48435 if (test_ret != 0)
48436 printf("Module xpathInternals: %d errors\n", test_ret);
48437 return(test_ret);
48438}
48439
Daniel Veillardd93f6252004-11-02 15:53:51 +000048440static int
48441test_xmlXPtrBuildNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048442 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048443
William M. Brack21e4ef22005-01-02 09:53:13 +000048444#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000048445 int mem_base;
48446 xmlNodePtr ret_val;
48447 xmlXPathObjectPtr obj; /* the XPointer result from the evaluation. */
48448 int n_obj;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048449
Daniel Veillardd005b9e2004-11-03 17:07:05 +000048450 for (n_obj = 0;n_obj < gen_nb_xmlXPathObjectPtr;n_obj++) {
48451 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000048452 obj = gen_xmlXPathObjectPtr(n_obj, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000048453
48454 ret_val = xmlXPtrBuildNodeList(obj);
48455 desret_xmlNodePtr(ret_val);
48456 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048457 des_xmlXPathObjectPtr(n_obj, obj, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000048458 xmlResetLastError();
48459 if (mem_base != xmlMemBlocks()) {
48460 printf("Leak of %d blocks found in xmlXPtrBuildNodeList",
48461 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048462 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000048463 printf(" %d", n_obj);
48464 printf("\n");
48465 }
48466 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048467 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000048468#endif
48469
Daniel Veillard42595322004-11-08 10:52:06 +000048470 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048471}
48472
48473
48474static int
48475test_xmlXPtrEval(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048476 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048477
William M. Brack21e4ef22005-01-02 09:53:13 +000048478#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000048479 int mem_base;
48480 xmlXPathObjectPtr ret_val;
48481 xmlChar * str; /* the XPointer expression */
48482 int n_str;
48483 xmlXPathContextPtr ctx; /* the XPointer context */
48484 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048485
Daniel Veillardce682bc2004-11-05 17:22:25 +000048486 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
48487 for (n_ctx = 0;n_ctx < gen_nb_xmlXPathContextPtr;n_ctx++) {
48488 mem_base = xmlMemBlocks();
48489 str = gen_const_xmlChar_ptr(n_str, 0);
48490 ctx = gen_xmlXPathContextPtr(n_ctx, 1);
48491
William M. Brackf13f77f2004-11-12 16:03:48 +000048492 ret_val = xmlXPtrEval((const xmlChar *)str, ctx);
Daniel Veillardce682bc2004-11-05 17:22:25 +000048493 desret_xmlXPathObjectPtr(ret_val);
48494 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000048495 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000048496 des_xmlXPathContextPtr(n_ctx, ctx, 1);
48497 xmlResetLastError();
48498 if (mem_base != xmlMemBlocks()) {
48499 printf("Leak of %d blocks found in xmlXPtrEval",
48500 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048501 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048502 printf(" %d", n_str);
48503 printf(" %d", n_ctx);
48504 printf("\n");
48505 }
48506 }
48507 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048508 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048509#endif
48510
Daniel Veillard42595322004-11-08 10:52:06 +000048511 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048512}
48513
48514
48515static int
48516test_xmlXPtrEvalRangePredicate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048517 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048518
William M. Brack21e4ef22005-01-02 09:53:13 +000048519#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000048520 int mem_base;
48521 xmlXPathParserContextPtr ctxt; /* the XPointer Parser context */
48522 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048523
Daniel Veillardce682bc2004-11-05 17:22:25 +000048524 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
48525 mem_base = xmlMemBlocks();
48526 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
48527
48528 xmlXPtrEvalRangePredicate(ctxt);
48529 call_tests++;
48530 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
48531 xmlResetLastError();
48532 if (mem_base != xmlMemBlocks()) {
48533 printf("Leak of %d blocks found in xmlXPtrEvalRangePredicate",
48534 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048535 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048536 printf(" %d", n_ctxt);
48537 printf("\n");
48538 }
48539 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048540 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048541#endif
48542
Daniel Veillard42595322004-11-08 10:52:06 +000048543 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048544}
48545
Daniel Veillarda521d282004-11-09 14:59:59 +000048546#ifdef LIBXML_XPTR_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000048547
Daniel Veillardce682bc2004-11-05 17:22:25 +000048548#define gen_nb_xmlLocationSetPtr 1
48549static xmlLocationSetPtr gen_xmlLocationSetPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
48550 return(NULL);
48551}
48552static void des_xmlLocationSetPtr(int no ATTRIBUTE_UNUSED, xmlLocationSetPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
48553}
Daniel Veillarda521d282004-11-09 14:59:59 +000048554#endif
48555
Daniel Veillardce682bc2004-11-05 17:22:25 +000048556
Daniel Veillardd93f6252004-11-02 15:53:51 +000048557static int
48558test_xmlXPtrLocationSetAdd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048559 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048560
William M. Brack21e4ef22005-01-02 09:53:13 +000048561#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000048562 int mem_base;
48563 xmlLocationSetPtr cur; /* the initial range set */
48564 int n_cur;
48565 xmlXPathObjectPtr val; /* a new xmlXPathObjectPtr */
48566 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048567
Daniel Veillardce682bc2004-11-05 17:22:25 +000048568 for (n_cur = 0;n_cur < gen_nb_xmlLocationSetPtr;n_cur++) {
48569 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
48570 mem_base = xmlMemBlocks();
48571 cur = gen_xmlLocationSetPtr(n_cur, 0);
48572 val = gen_xmlXPathObjectPtr(n_val, 1);
48573
48574 xmlXPtrLocationSetAdd(cur, val);
48575 call_tests++;
48576 des_xmlLocationSetPtr(n_cur, cur, 0);
48577 des_xmlXPathObjectPtr(n_val, val, 1);
48578 xmlResetLastError();
48579 if (mem_base != xmlMemBlocks()) {
48580 printf("Leak of %d blocks found in xmlXPtrLocationSetAdd",
48581 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048582 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048583 printf(" %d", n_cur);
48584 printf(" %d", n_val);
48585 printf("\n");
48586 }
48587 }
48588 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048589 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048590#endif
48591
Daniel Veillard42595322004-11-08 10:52:06 +000048592 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048593}
48594
48595
48596static int
48597test_xmlXPtrLocationSetCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048598 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048599
48600
48601 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000048602 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048603}
48604
48605
48606static int
48607test_xmlXPtrLocationSetDel(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048608 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048609
William M. Brack21e4ef22005-01-02 09:53:13 +000048610#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000048611 int mem_base;
48612 xmlLocationSetPtr cur; /* the initial range set */
48613 int n_cur;
48614 xmlXPathObjectPtr val; /* an xmlXPathObjectPtr */
48615 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048616
Daniel Veillardce682bc2004-11-05 17:22:25 +000048617 for (n_cur = 0;n_cur < gen_nb_xmlLocationSetPtr;n_cur++) {
48618 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
48619 mem_base = xmlMemBlocks();
48620 cur = gen_xmlLocationSetPtr(n_cur, 0);
48621 val = gen_xmlXPathObjectPtr(n_val, 1);
48622
48623 xmlXPtrLocationSetDel(cur, val);
48624 call_tests++;
48625 des_xmlLocationSetPtr(n_cur, cur, 0);
48626 des_xmlXPathObjectPtr(n_val, val, 1);
48627 xmlResetLastError();
48628 if (mem_base != xmlMemBlocks()) {
48629 printf("Leak of %d blocks found in xmlXPtrLocationSetDel",
48630 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048631 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048632 printf(" %d", n_cur);
48633 printf(" %d", n_val);
48634 printf("\n");
48635 }
48636 }
48637 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048638 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048639#endif
48640
Daniel Veillard42595322004-11-08 10:52:06 +000048641 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048642}
48643
48644
48645static int
48646test_xmlXPtrLocationSetMerge(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048647 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048648
48649
48650 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000048651 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048652}
48653
48654
48655static int
48656test_xmlXPtrLocationSetRemove(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048657 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048658
William M. Brack21e4ef22005-01-02 09:53:13 +000048659#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000048660 int mem_base;
48661 xmlLocationSetPtr cur; /* the initial range set */
48662 int n_cur;
48663 int val; /* the index to remove */
48664 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048665
Daniel Veillardce682bc2004-11-05 17:22:25 +000048666 for (n_cur = 0;n_cur < gen_nb_xmlLocationSetPtr;n_cur++) {
48667 for (n_val = 0;n_val < gen_nb_int;n_val++) {
48668 mem_base = xmlMemBlocks();
48669 cur = gen_xmlLocationSetPtr(n_cur, 0);
48670 val = gen_int(n_val, 1);
48671
48672 xmlXPtrLocationSetRemove(cur, val);
48673 call_tests++;
48674 des_xmlLocationSetPtr(n_cur, cur, 0);
48675 des_int(n_val, val, 1);
48676 xmlResetLastError();
48677 if (mem_base != xmlMemBlocks()) {
48678 printf("Leak of %d blocks found in xmlXPtrLocationSetRemove",
48679 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048680 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048681 printf(" %d", n_cur);
48682 printf(" %d", n_val);
48683 printf("\n");
48684 }
48685 }
48686 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048687 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048688#endif
48689
Daniel Veillard42595322004-11-08 10:52:06 +000048690 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048691}
48692
48693
48694static int
48695test_xmlXPtrNewCollapsedRange(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048696 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048697
William M. Brack21e4ef22005-01-02 09:53:13 +000048698#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000048699 int mem_base;
48700 xmlXPathObjectPtr ret_val;
48701 xmlNodePtr start; /* the starting and ending node */
48702 int n_start;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048703
Daniel Veillard3d97e662004-11-04 10:49:00 +000048704 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48705 mem_base = xmlMemBlocks();
48706 start = gen_xmlNodePtr(n_start, 0);
48707
48708 ret_val = xmlXPtrNewCollapsedRange(start);
48709 desret_xmlXPathObjectPtr(ret_val);
48710 call_tests++;
48711 des_xmlNodePtr(n_start, start, 0);
48712 xmlResetLastError();
48713 if (mem_base != xmlMemBlocks()) {
48714 printf("Leak of %d blocks found in xmlXPtrNewCollapsedRange",
48715 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048716 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048717 printf(" %d", n_start);
48718 printf("\n");
48719 }
48720 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048721 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048722#endif
48723
Daniel Veillard42595322004-11-08 10:52:06 +000048724 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048725}
48726
48727
48728static int
48729test_xmlXPtrNewContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048730 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048731
48732
48733 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000048734 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048735}
48736
48737
48738static int
48739test_xmlXPtrNewLocationSetNodeSet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048740 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048741
William M. Brack21e4ef22005-01-02 09:53:13 +000048742#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000048743 int mem_base;
48744 xmlXPathObjectPtr ret_val;
48745 xmlNodeSetPtr set; /* a node set */
48746 int n_set;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048747
Daniel Veillardce682bc2004-11-05 17:22:25 +000048748 for (n_set = 0;n_set < gen_nb_xmlNodeSetPtr;n_set++) {
48749 mem_base = xmlMemBlocks();
48750 set = gen_xmlNodeSetPtr(n_set, 0);
48751
48752 ret_val = xmlXPtrNewLocationSetNodeSet(set);
48753 desret_xmlXPathObjectPtr(ret_val);
48754 call_tests++;
48755 des_xmlNodeSetPtr(n_set, set, 0);
48756 xmlResetLastError();
48757 if (mem_base != xmlMemBlocks()) {
48758 printf("Leak of %d blocks found in xmlXPtrNewLocationSetNodeSet",
48759 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048760 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048761 printf(" %d", n_set);
48762 printf("\n");
48763 }
48764 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048765 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048766#endif
48767
Daniel Veillard42595322004-11-08 10:52:06 +000048768 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048769}
48770
48771
48772static int
48773test_xmlXPtrNewLocationSetNodes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048774 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048775
William M. Brack21e4ef22005-01-02 09:53:13 +000048776#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000048777 int mem_base;
48778 xmlXPathObjectPtr ret_val;
48779 xmlNodePtr start; /* the start NodePtr value */
48780 int n_start;
48781 xmlNodePtr end; /* the end NodePtr value or NULL */
48782 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048783
Daniel Veillard3d97e662004-11-04 10:49:00 +000048784 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48785 for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) {
48786 mem_base = xmlMemBlocks();
48787 start = gen_xmlNodePtr(n_start, 0);
48788 end = gen_xmlNodePtr(n_end, 1);
48789
48790 ret_val = xmlXPtrNewLocationSetNodes(start, end);
48791 desret_xmlXPathObjectPtr(ret_val);
48792 call_tests++;
48793 des_xmlNodePtr(n_start, start, 0);
48794 des_xmlNodePtr(n_end, end, 1);
48795 xmlResetLastError();
48796 if (mem_base != xmlMemBlocks()) {
48797 printf("Leak of %d blocks found in xmlXPtrNewLocationSetNodes",
48798 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048799 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048800 printf(" %d", n_start);
48801 printf(" %d", n_end);
48802 printf("\n");
48803 }
48804 }
48805 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048806 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048807#endif
48808
Daniel Veillard42595322004-11-08 10:52:06 +000048809 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048810}
48811
48812
48813static int
48814test_xmlXPtrNewRange(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048815 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048816
William M. Brack21e4ef22005-01-02 09:53:13 +000048817#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000048818 int mem_base;
48819 xmlXPathObjectPtr ret_val;
48820 xmlNodePtr start; /* the starting node */
48821 int n_start;
48822 int startindex; /* the start index */
48823 int n_startindex;
48824 xmlNodePtr end; /* the ending point */
48825 int n_end;
48826 int endindex; /* the ending index */
48827 int n_endindex;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048828
Daniel Veillard3d97e662004-11-04 10:49:00 +000048829 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48830 for (n_startindex = 0;n_startindex < gen_nb_int;n_startindex++) {
48831 for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) {
48832 for (n_endindex = 0;n_endindex < gen_nb_int;n_endindex++) {
48833 mem_base = xmlMemBlocks();
48834 start = gen_xmlNodePtr(n_start, 0);
48835 startindex = gen_int(n_startindex, 1);
48836 end = gen_xmlNodePtr(n_end, 2);
48837 endindex = gen_int(n_endindex, 3);
48838
48839 ret_val = xmlXPtrNewRange(start, startindex, end, endindex);
48840 desret_xmlXPathObjectPtr(ret_val);
48841 call_tests++;
48842 des_xmlNodePtr(n_start, start, 0);
48843 des_int(n_startindex, startindex, 1);
48844 des_xmlNodePtr(n_end, end, 2);
48845 des_int(n_endindex, endindex, 3);
48846 xmlResetLastError();
48847 if (mem_base != xmlMemBlocks()) {
48848 printf("Leak of %d blocks found in xmlXPtrNewRange",
48849 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048850 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048851 printf(" %d", n_start);
48852 printf(" %d", n_startindex);
48853 printf(" %d", n_end);
48854 printf(" %d", n_endindex);
48855 printf("\n");
48856 }
48857 }
48858 }
48859 }
48860 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048861 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048862#endif
48863
Daniel Veillard42595322004-11-08 10:52:06 +000048864 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048865}
48866
48867
48868static int
48869test_xmlXPtrNewRangeNodeObject(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048870 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048871
William M. Brack21e4ef22005-01-02 09:53:13 +000048872#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000048873 int mem_base;
48874 xmlXPathObjectPtr ret_val;
48875 xmlNodePtr start; /* the starting node */
48876 int n_start;
48877 xmlXPathObjectPtr end; /* the ending object */
48878 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048879
Daniel Veillard3d97e662004-11-04 10:49:00 +000048880 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48881 for (n_end = 0;n_end < gen_nb_xmlXPathObjectPtr;n_end++) {
48882 mem_base = xmlMemBlocks();
48883 start = gen_xmlNodePtr(n_start, 0);
48884 end = gen_xmlXPathObjectPtr(n_end, 1);
48885
48886 ret_val = xmlXPtrNewRangeNodeObject(start, end);
48887 desret_xmlXPathObjectPtr(ret_val);
48888 call_tests++;
48889 des_xmlNodePtr(n_start, start, 0);
48890 des_xmlXPathObjectPtr(n_end, end, 1);
48891 xmlResetLastError();
48892 if (mem_base != xmlMemBlocks()) {
48893 printf("Leak of %d blocks found in xmlXPtrNewRangeNodeObject",
48894 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048895 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048896 printf(" %d", n_start);
48897 printf(" %d", n_end);
48898 printf("\n");
48899 }
48900 }
48901 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048902 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048903#endif
48904
Daniel Veillard42595322004-11-08 10:52:06 +000048905 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048906}
48907
48908
48909static int
48910test_xmlXPtrNewRangeNodePoint(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048911 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048912
William M. Brack21e4ef22005-01-02 09:53:13 +000048913#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000048914 int mem_base;
48915 xmlXPathObjectPtr ret_val;
48916 xmlNodePtr start; /* the starting node */
48917 int n_start;
48918 xmlXPathObjectPtr end; /* the ending point */
48919 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048920
Daniel Veillard3d97e662004-11-04 10:49:00 +000048921 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48922 for (n_end = 0;n_end < gen_nb_xmlXPathObjectPtr;n_end++) {
48923 mem_base = xmlMemBlocks();
48924 start = gen_xmlNodePtr(n_start, 0);
48925 end = gen_xmlXPathObjectPtr(n_end, 1);
48926
48927 ret_val = xmlXPtrNewRangeNodePoint(start, end);
48928 desret_xmlXPathObjectPtr(ret_val);
48929 call_tests++;
48930 des_xmlNodePtr(n_start, start, 0);
48931 des_xmlXPathObjectPtr(n_end, end, 1);
48932 xmlResetLastError();
48933 if (mem_base != xmlMemBlocks()) {
48934 printf("Leak of %d blocks found in xmlXPtrNewRangeNodePoint",
48935 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048936 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048937 printf(" %d", n_start);
48938 printf(" %d", n_end);
48939 printf("\n");
48940 }
48941 }
48942 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048943 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048944#endif
48945
Daniel Veillard42595322004-11-08 10:52:06 +000048946 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048947}
48948
48949
48950static int
48951test_xmlXPtrNewRangeNodes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048952 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048953
William M. Brack21e4ef22005-01-02 09:53:13 +000048954#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000048955 int mem_base;
48956 xmlXPathObjectPtr ret_val;
48957 xmlNodePtr start; /* the starting node */
48958 int n_start;
48959 xmlNodePtr end; /* the ending node */
48960 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048961
Daniel Veillard3d97e662004-11-04 10:49:00 +000048962 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48963 for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) {
48964 mem_base = xmlMemBlocks();
48965 start = gen_xmlNodePtr(n_start, 0);
48966 end = gen_xmlNodePtr(n_end, 1);
48967
48968 ret_val = xmlXPtrNewRangeNodes(start, end);
48969 desret_xmlXPathObjectPtr(ret_val);
48970 call_tests++;
48971 des_xmlNodePtr(n_start, start, 0);
48972 des_xmlNodePtr(n_end, end, 1);
48973 xmlResetLastError();
48974 if (mem_base != xmlMemBlocks()) {
48975 printf("Leak of %d blocks found in xmlXPtrNewRangeNodes",
48976 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048977 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048978 printf(" %d", n_start);
48979 printf(" %d", n_end);
48980 printf("\n");
48981 }
48982 }
48983 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048984 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048985#endif
48986
Daniel Veillard42595322004-11-08 10:52:06 +000048987 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048988}
48989
48990
48991static int
48992test_xmlXPtrNewRangePointNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048993 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048994
William M. Brack21e4ef22005-01-02 09:53:13 +000048995#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000048996 int mem_base;
48997 xmlXPathObjectPtr ret_val;
48998 xmlXPathObjectPtr start; /* the starting point */
48999 int n_start;
49000 xmlNodePtr end; /* the ending node */
49001 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049002
Daniel Veillard3d97e662004-11-04 10:49:00 +000049003 for (n_start = 0;n_start < gen_nb_xmlXPathObjectPtr;n_start++) {
49004 for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) {
49005 mem_base = xmlMemBlocks();
49006 start = gen_xmlXPathObjectPtr(n_start, 0);
49007 end = gen_xmlNodePtr(n_end, 1);
49008
49009 ret_val = xmlXPtrNewRangePointNode(start, end);
49010 desret_xmlXPathObjectPtr(ret_val);
49011 call_tests++;
49012 des_xmlXPathObjectPtr(n_start, start, 0);
49013 des_xmlNodePtr(n_end, end, 1);
49014 xmlResetLastError();
49015 if (mem_base != xmlMemBlocks()) {
49016 printf("Leak of %d blocks found in xmlXPtrNewRangePointNode",
49017 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000049018 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000049019 printf(" %d", n_start);
49020 printf(" %d", n_end);
49021 printf("\n");
49022 }
49023 }
49024 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000049025 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000049026#endif
49027
Daniel Veillard42595322004-11-08 10:52:06 +000049028 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000049029}
49030
49031
49032static int
49033test_xmlXPtrNewRangePoints(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000049034 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049035
William M. Brack21e4ef22005-01-02 09:53:13 +000049036#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000049037 int mem_base;
49038 xmlXPathObjectPtr ret_val;
49039 xmlXPathObjectPtr start; /* the starting point */
49040 int n_start;
49041 xmlXPathObjectPtr end; /* the ending point */
49042 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049043
Daniel Veillard3d97e662004-11-04 10:49:00 +000049044 for (n_start = 0;n_start < gen_nb_xmlXPathObjectPtr;n_start++) {
49045 for (n_end = 0;n_end < gen_nb_xmlXPathObjectPtr;n_end++) {
49046 mem_base = xmlMemBlocks();
49047 start = gen_xmlXPathObjectPtr(n_start, 0);
49048 end = gen_xmlXPathObjectPtr(n_end, 1);
49049
49050 ret_val = xmlXPtrNewRangePoints(start, end);
49051 desret_xmlXPathObjectPtr(ret_val);
49052 call_tests++;
49053 des_xmlXPathObjectPtr(n_start, start, 0);
49054 des_xmlXPathObjectPtr(n_end, end, 1);
49055 xmlResetLastError();
49056 if (mem_base != xmlMemBlocks()) {
49057 printf("Leak of %d blocks found in xmlXPtrNewRangePoints",
49058 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000049059 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000049060 printf(" %d", n_start);
49061 printf(" %d", n_end);
49062 printf("\n");
49063 }
49064 }
49065 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000049066 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000049067#endif
49068
Daniel Veillard42595322004-11-08 10:52:06 +000049069 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000049070}
49071
49072
49073static int
49074test_xmlXPtrRangeToFunction(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000049075 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049076
William M. Brack21e4ef22005-01-02 09:53:13 +000049077#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000049078 int mem_base;
49079 xmlXPathParserContextPtr ctxt; /* the XPointer Parser context */
49080 int n_ctxt;
49081 int nargs; /* the number of args */
49082 int n_nargs;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049083
Daniel Veillardce682bc2004-11-05 17:22:25 +000049084 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
49085 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
49086 mem_base = xmlMemBlocks();
49087 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
49088 nargs = gen_int(n_nargs, 1);
49089
49090 xmlXPtrRangeToFunction(ctxt, nargs);
49091 call_tests++;
49092 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
49093 des_int(n_nargs, nargs, 1);
49094 xmlResetLastError();
49095 if (mem_base != xmlMemBlocks()) {
49096 printf("Leak of %d blocks found in xmlXPtrRangeToFunction",
49097 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000049098 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000049099 printf(" %d", n_ctxt);
49100 printf(" %d", n_nargs);
49101 printf("\n");
49102 }
49103 }
49104 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000049105 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000049106#endif
49107
Daniel Veillard42595322004-11-08 10:52:06 +000049108 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000049109}
49110
49111
49112static int
49113test_xmlXPtrWrapLocationSet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000049114 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049115
William M. Brack21e4ef22005-01-02 09:53:13 +000049116#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000049117 int mem_base;
49118 xmlXPathObjectPtr ret_val;
49119 xmlLocationSetPtr val; /* the LocationSet value */
49120 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049121
Daniel Veillardce682bc2004-11-05 17:22:25 +000049122 for (n_val = 0;n_val < gen_nb_xmlLocationSetPtr;n_val++) {
49123 mem_base = xmlMemBlocks();
49124 val = gen_xmlLocationSetPtr(n_val, 0);
49125
49126 ret_val = xmlXPtrWrapLocationSet(val);
49127 desret_xmlXPathObjectPtr(ret_val);
49128 call_tests++;
49129 des_xmlLocationSetPtr(n_val, val, 0);
49130 xmlResetLastError();
49131 if (mem_base != xmlMemBlocks()) {
49132 printf("Leak of %d blocks found in xmlXPtrWrapLocationSet",
49133 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000049134 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000049135 printf(" %d", n_val);
49136 printf("\n");
49137 }
49138 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000049139 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000049140#endif
49141
Daniel Veillard42595322004-11-08 10:52:06 +000049142 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000049143}
49144
49145static int
49146test_xpointer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000049147 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000049148
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000049149 if (quiet == 0) printf("Testing xpointer : 17 of 21 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000049150 test_ret += test_xmlXPtrBuildNodeList();
49151 test_ret += test_xmlXPtrEval();
49152 test_ret += test_xmlXPtrEvalRangePredicate();
49153 test_ret += test_xmlXPtrLocationSetAdd();
49154 test_ret += test_xmlXPtrLocationSetCreate();
49155 test_ret += test_xmlXPtrLocationSetDel();
49156 test_ret += test_xmlXPtrLocationSetMerge();
49157 test_ret += test_xmlXPtrLocationSetRemove();
49158 test_ret += test_xmlXPtrNewCollapsedRange();
49159 test_ret += test_xmlXPtrNewContext();
49160 test_ret += test_xmlXPtrNewLocationSetNodeSet();
49161 test_ret += test_xmlXPtrNewLocationSetNodes();
49162 test_ret += test_xmlXPtrNewRange();
49163 test_ret += test_xmlXPtrNewRangeNodeObject();
49164 test_ret += test_xmlXPtrNewRangeNodePoint();
49165 test_ret += test_xmlXPtrNewRangeNodes();
49166 test_ret += test_xmlXPtrNewRangePointNode();
49167 test_ret += test_xmlXPtrNewRangePoints();
49168 test_ret += test_xmlXPtrRangeToFunction();
49169 test_ret += test_xmlXPtrWrapLocationSet();
Daniel Veillardd93f6252004-11-02 15:53:51 +000049170
Daniel Veillard42595322004-11-08 10:52:06 +000049171 if (test_ret != 0)
49172 printf("Module xpointer: %d errors\n", test_ret);
49173 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000049174}
Daniel Veillardce244ad2004-11-05 10:03:46 +000049175static int
49176test_module(const char *module) {
49177 if (!strcmp(module, "HTMLparser")) return(test_HTMLparser());
49178 if (!strcmp(module, "HTMLtree")) return(test_HTMLtree());
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000049179 if (!strcmp(module, "SAX2")) return(test_SAX2());
Daniel Veillarda82b1822004-11-08 16:24:57 +000049180 if (!strcmp(module, "c14n")) return(test_c14n());
Daniel Veillardce244ad2004-11-05 10:03:46 +000049181 if (!strcmp(module, "catalog")) return(test_catalog());
49182 if (!strcmp(module, "chvalid")) return(test_chvalid());
Daniel Veillarda82b1822004-11-08 16:24:57 +000049183 if (!strcmp(module, "debugXML")) return(test_debugXML());
Daniel Veillardce244ad2004-11-05 10:03:46 +000049184 if (!strcmp(module, "dict")) return(test_dict());
49185 if (!strcmp(module, "encoding")) return(test_encoding());
49186 if (!strcmp(module, "entities")) return(test_entities());
49187 if (!strcmp(module, "hash")) return(test_hash());
49188 if (!strcmp(module, "list")) return(test_list());
49189 if (!strcmp(module, "nanoftp")) return(test_nanoftp());
49190 if (!strcmp(module, "nanohttp")) return(test_nanohttp());
49191 if (!strcmp(module, "parser")) return(test_parser());
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000049192 if (!strcmp(module, "parserInternals")) return(test_parserInternals());
Daniel Veillardce244ad2004-11-05 10:03:46 +000049193 if (!strcmp(module, "pattern")) return(test_pattern());
49194 if (!strcmp(module, "relaxng")) return(test_relaxng());
49195 if (!strcmp(module, "schemasInternals")) return(test_schemasInternals());
49196 if (!strcmp(module, "tree")) return(test_tree());
49197 if (!strcmp(module, "uri")) return(test_uri());
49198 if (!strcmp(module, "valid")) return(test_valid());
49199 if (!strcmp(module, "xinclude")) return(test_xinclude());
49200 if (!strcmp(module, "xmlIO")) return(test_xmlIO());
Daniel Veillarda82b1822004-11-08 16:24:57 +000049201 if (!strcmp(module, "xmlautomata")) return(test_xmlautomata());
Daniel Veillardce244ad2004-11-05 10:03:46 +000049202 if (!strcmp(module, "xmlerror")) return(test_xmlerror());
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000049203 if (!strcmp(module, "xmlmodule")) return(test_xmlmodule());
Daniel Veillardce244ad2004-11-05 10:03:46 +000049204 if (!strcmp(module, "xmlreader")) return(test_xmlreader());
Daniel Veillarda82b1822004-11-08 16:24:57 +000049205 if (!strcmp(module, "xmlregexp")) return(test_xmlregexp());
Daniel Veillardce244ad2004-11-05 10:03:46 +000049206 if (!strcmp(module, "xmlsave")) return(test_xmlsave());
49207 if (!strcmp(module, "xmlschemas")) return(test_xmlschemas());
49208 if (!strcmp(module, "xmlschemastypes")) return(test_xmlschemastypes());
49209 if (!strcmp(module, "xmlstring")) return(test_xmlstring());
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000049210 if (!strcmp(module, "xmlunicode")) return(test_xmlunicode());
Daniel Veillardce244ad2004-11-05 10:03:46 +000049211 if (!strcmp(module, "xmlwriter")) return(test_xmlwriter());
49212 if (!strcmp(module, "xpath")) return(test_xpath());
Daniel Veillarda82b1822004-11-08 16:24:57 +000049213 if (!strcmp(module, "xpathInternals")) return(test_xpathInternals());
Daniel Veillardce244ad2004-11-05 10:03:46 +000049214 if (!strcmp(module, "xpointer")) return(test_xpointer());
49215 return(0);
49216}