xref: /aosp_15_r20/external/libxml2/testapi.c (revision 7c5688314b92172186c154356a6374bf7684c3ca)
1 /*
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  * [email protected]
9  */
10 
11 /* Disable deprecation warnings */
12 #define XML_DEPRECATED
13 
14 #include "libxml.h"
15 #include <stdio.h>
16 #include <stdlib.h>
17 #include <string.h>
18 #include <libxml/xmlerror.h>
19 #include <libxml/catalog.h>
20 #include <libxml/relaxng.h>
21 #include <libxml/parser.h>
22 
23 
24 static int testlibxml2(void);
25 static int test_module(const char *module);
26 
27 static int generic_errors = 0;
28 static int call_tests = 0;
29 static int function_tests = 0;
30 
31 static xmlChar chartab[1024];
32 static int inttab[1024];
33 static unsigned long longtab[1024];
34 
35 static xmlDocPtr api_doc = NULL;
36 static xmlDtdPtr api_dtd = NULL;
37 static xmlNodePtr api_root = NULL;
38 static xmlAttrPtr api_attr = NULL;
39 static xmlNsPtr api_ns = NULL;
40 
41 static void
structured_errors(void * userData ATTRIBUTE_UNUSED,const xmlError * error ATTRIBUTE_UNUSED)42 structured_errors(void *userData ATTRIBUTE_UNUSED,
43                   const xmlError *error ATTRIBUTE_UNUSED) {
44     generic_errors++;
45 }
46 
47 static void
free_api_doc(void)48 free_api_doc(void) {
49     xmlFreeDoc(api_doc);
50     api_doc = NULL;
51     api_dtd = NULL;
52     api_root = NULL;
53     api_attr = NULL;
54     api_ns = NULL;
55 }
56 
57 static xmlDocPtr
get_api_doc(void)58 get_api_doc(void) {
59     if (api_doc == NULL) {
60         api_doc = xmlReadMemory("<!DOCTYPE root [<!ELEMENT root EMPTY>]><root xmlns:h='http://example.com/' h:foo='bar'/>", 88, "root_test", NULL, 0);
61 	api_root = NULL;
62 	api_attr = NULL;
63     }
64     return(api_doc);
65 }
66 
67 static xmlDtdPtr
get_api_dtd(void)68 get_api_dtd(void) {
69     if ((api_dtd == NULL) || (api_dtd->type != XML_DTD_NODE)) {
70         get_api_doc();
71 	if ((api_doc != NULL) && (api_doc->children != NULL) &&
72 	    (api_doc->children->type == XML_DTD_NODE))
73 	    api_dtd = (xmlDtdPtr) api_doc->children;
74     }
75     return(api_dtd);
76 }
77 
78 static xmlNodePtr
get_api_root(void)79 get_api_root(void) {
80     if ((api_root == NULL) || (api_root->type != XML_ELEMENT_NODE)) {
81         get_api_doc();
82 	if ((api_doc != NULL) && (api_doc->children != NULL) &&
83 	    (api_doc->children->next != NULL) &&
84 	    (api_doc->children->next->type == XML_ELEMENT_NODE))
85 	    api_root = api_doc->children->next;
86     }
87     return(api_root);
88 }
89 
90 static xmlNsPtr
get_api_ns(void)91 get_api_ns(void) {
92     get_api_root();
93     if (api_root != NULL)
94         api_ns = api_root->nsDef;
95     return(api_ns);
96 }
97 
98 static xmlAttrPtr
get_api_attr(void)99 get_api_attr(void) {
100 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED)
101     static int nr = 0;
102     xmlChar name[20];
103 #endif
104 
105     if ((api_root == NULL) || (api_root->type != XML_ELEMENT_NODE)) {
106         get_api_root();
107     }
108     if (api_root == NULL)
109         return(NULL);
110     if (api_root->properties != NULL) {
111         api_attr = api_root->properties;
112         return(api_root->properties);
113     }
114     api_attr = NULL;
115 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED)
116     snprintf((char *) name, 20, "foo%d", nr++);
117     api_attr = xmlSetProp(api_root, name, (const xmlChar *) "bar");
118 #endif
119     return(api_attr);
120 }
121 
122 static int quiet = 0;
123 
main(int argc,char ** argv)124 int main(int argc, char **argv) {
125     int ret;
126     int blocks, mem;
127 
128 #if defined(_WIN32)
129     setvbuf(stdout, NULL, _IONBF, 0);
130     setvbuf(stderr, NULL, _IONBF, 0);
131 
132     printf("Skipping on Windows for now\n");
133     return(0);
134 #endif
135 
136     memset(chartab, 0, sizeof(chartab));
137     strncpy((char *) chartab, "  chartab\n", 20);
138     memset(inttab, 0, sizeof(inttab));
139     memset(longtab, 0, sizeof(longtab));
140 
141     xmlInitParser();
142 #ifdef LIBXML_CATALOG_ENABLED
143     xmlInitializeCatalog();
144 #endif
145 #ifdef LIBXML_SCHEMAS_ENABLED
146     xmlRelaxNGInitTypes();
147 #endif
148 
149     LIBXML_TEST_VERSION
150 
151     xmlSetStructuredErrorFunc(NULL, structured_errors);
152     xmlSetExternalEntityLoader(xmlNoNetExternalEntityLoader);
153 
154     if (argc >= 2) {
155         if (!strcmp(argv[1], "-q")) {
156 	    quiet = 1;
157 	    if (argc >= 3)
158 	        ret = test_module(argv[2]);
159 	    else
160 		ret = testlibxml2();
161         } else {
162 	   ret = test_module(argv[1]);
163 	}
164     } else
165 	ret = testlibxml2();
166 
167     xmlCleanupParser();
168     blocks = xmlMemBlocks();
169     mem = xmlMemUsed();
170     if ((blocks != 0) || (mem != 0)) {
171         printf("testapi leaked %d bytes in %d blocks\n", mem, blocks);
172         ret = 1;
173     }
174 
175     return (ret != 0);
176 }
177 
178 #include <libxml/HTMLparser.h>
179 #include <libxml/HTMLtree.h>
180 #include <libxml/chvalid.h>
181 #include <libxml/dict.h>
182 #include <libxml/encoding.h>
183 #include <libxml/entities.h>
184 #include <libxml/hash.h>
185 #include <libxml/list.h>
186 #include <libxml/nanohttp.h>
187 #include <libxml/parser.h>
188 #include <libxml/parserInternals.h>
189 #include <libxml/pattern.h>
190 #include <libxml/relaxng.h>
191 #include <libxml/schemasInternals.h>
192 #include <libxml/schematron.h>
193 #include <libxml/tree.h>
194 #include <libxml/uri.h>
195 #include <libxml/valid.h>
196 #include <libxml/xinclude.h>
197 #include <libxml/xmlIO.h>
198 #include <libxml/xmlerror.h>
199 #include <libxml/xmlreader.h>
200 #include <libxml/xmlsave.h>
201 #include <libxml/xmlschemas.h>
202 #include <libxml/xmlschemastypes.h>
203 #include <libxml/xmlstring.h>
204 #include <libxml/xmlwriter.h>
205 #include <libxml/xpath.h>
206 #include <libxml/xpointer.h>
207 #include <libxml/debugXML.h>
208 
209 /*
210  We need some "remote" addresses, but want to avoid getting into
211  name resolution delays, so we use these
212 */
213 #define	REMOTE1GOOD	"http://localhost/"
214 #define	REMOTE1BAD	"http:http://http"
215 #define	REMOTE2GOOD	"ftp://localhost/foo"
216 
217 #define gen_nb_void_ptr 2
218 
gen_void_ptr(int no ATTRIBUTE_UNUSED,int nr ATTRIBUTE_UNUSED)219 static void *gen_void_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
220     return(NULL);
221 }
des_void_ptr(int no ATTRIBUTE_UNUSED,void * val ATTRIBUTE_UNUSED,int nr ATTRIBUTE_UNUSED)222 static void des_void_ptr(int no ATTRIBUTE_UNUSED, void *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
223 }
224 
225 #define gen_nb_userdata 3
226 
gen_userdata(int no,int nr ATTRIBUTE_UNUSED)227 static void *gen_userdata(int no, int nr ATTRIBUTE_UNUSED) {
228     if (no == 0) return((void *) &call_tests);
229     if (no == 1) return((void *) -1);
230     return(NULL);
231 }
des_userdata(int no ATTRIBUTE_UNUSED,void * val ATTRIBUTE_UNUSED,int nr ATTRIBUTE_UNUSED)232 static void des_userdata(int no ATTRIBUTE_UNUSED, void *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
233 }
234 
235 
236 #define gen_nb_int 4
237 
gen_int(int no,int nr ATTRIBUTE_UNUSED)238 static int gen_int(int no, int nr ATTRIBUTE_UNUSED) {
239     if (no == 0) return(0);
240     if (no == 1) return(1);
241     if (no == 2) return(-1);
242     if (no == 3) return(122);
243     return(-1);
244 }
245 
des_int(int no ATTRIBUTE_UNUSED,int val ATTRIBUTE_UNUSED,int nr ATTRIBUTE_UNUSED)246 static void des_int(int no ATTRIBUTE_UNUSED, int val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
247 }
248 
249 #define gen_nb_parseroptions 5
250 
gen_parseroptions(int no,int nr ATTRIBUTE_UNUSED)251 static int gen_parseroptions(int no, int nr ATTRIBUTE_UNUSED) {
252     if (no == 0) return(XML_PARSE_NOBLANKS | XML_PARSE_RECOVER);
253     if (no == 1) return(XML_PARSE_NOENT | XML_PARSE_DTDLOAD | XML_PARSE_DTDATTR | XML_PARSE_DTDVALID | XML_PARSE_NOCDATA);
254     if (no == 2) return(XML_PARSE_XINCLUDE | XML_PARSE_NOXINCNODE | XML_PARSE_NSCLEAN);
255     if (no == 3) return(XML_PARSE_XINCLUDE | XML_PARSE_NODICT);
256     return(XML_PARSE_SAX1);
257 }
258 
des_parseroptions(int no ATTRIBUTE_UNUSED,int val ATTRIBUTE_UNUSED,int nr ATTRIBUTE_UNUSED)259 static void des_parseroptions(int no ATTRIBUTE_UNUSED, int val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
260 }
261 
262 #if 0
263 #define gen_nb_long 5
264 
265 static long gen_long(int no, int nr ATTRIBUTE_UNUSED) {
266     if (no == 0) return(0);
267     if (no == 1) return(1);
268     if (no == 2) return(-1);
269     if (no == 3) return(122);
270     return(-1);
271 }
272 
273 static void des_long(int no ATTRIBUTE_UNUSED, long val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
274 }
275 #endif
276 
277 #define gen_nb_xmlChar 4
278 
gen_xmlChar(int no,int nr ATTRIBUTE_UNUSED)279 static xmlChar gen_xmlChar(int no, int nr ATTRIBUTE_UNUSED) {
280     if (no == 0) return('a');
281     if (no == 1) return(' ');
282     if (no == 2) return((xmlChar) '\xf8');
283     return(0);
284 }
285 
des_xmlChar(int no ATTRIBUTE_UNUSED,xmlChar val ATTRIBUTE_UNUSED,int nr ATTRIBUTE_UNUSED)286 static void des_xmlChar(int no ATTRIBUTE_UNUSED, xmlChar val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
287 }
288 
289 #define gen_nb_unsigned_int 3
290 
gen_unsigned_int(int no,int nr ATTRIBUTE_UNUSED)291 static unsigned int gen_unsigned_int(int no, int nr ATTRIBUTE_UNUSED) {
292     if (no == 0) return(0);
293     if (no == 1) return(1);
294     if (no == 2) return(122);
295     return((unsigned int) -1);
296 }
297 
des_unsigned_int(int no ATTRIBUTE_UNUSED,unsigned int val ATTRIBUTE_UNUSED,int nr ATTRIBUTE_UNUSED)298 static void des_unsigned_int(int no ATTRIBUTE_UNUSED, unsigned int val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
299 }
300 
301 #ifdef LIBXML_SCHEMAS_ENABLED
302 
303 #define gen_nb_unsigned_long 4
304 
gen_unsigned_long(int no,int nr ATTRIBUTE_UNUSED)305 static unsigned long gen_unsigned_long(int no, int nr ATTRIBUTE_UNUSED) {
306     if (no == 0) return(0);
307     if (no == 1) return(1);
308     if (no == 2) return(122);
309     return((unsigned long) -1);
310 }
311 
des_unsigned_long(int no ATTRIBUTE_UNUSED,unsigned long val ATTRIBUTE_UNUSED,int nr ATTRIBUTE_UNUSED)312 static void des_unsigned_long(int no ATTRIBUTE_UNUSED, unsigned long val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
313 }
314 
315 #define gen_nb_unsigned_long_ptr 2
316 
gen_unsigned_long_ptr(int no,int nr)317 static unsigned long *gen_unsigned_long_ptr(int no, int nr) {
318     if (no == 0) return(&longtab[nr]);
319     return(NULL);
320 }
321 
des_unsigned_long_ptr(int no ATTRIBUTE_UNUSED,unsigned long * val ATTRIBUTE_UNUSED,int nr ATTRIBUTE_UNUSED)322 static void des_unsigned_long_ptr(int no ATTRIBUTE_UNUSED, unsigned long *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
323 }
324 
325 #endif /* LIBXML_SCHEMAS_ENABLED */
326 
327 #if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
328 
329 #define gen_nb_double 4
330 
gen_double(int no,int nr ATTRIBUTE_UNUSED)331 static double gen_double(int no, int nr ATTRIBUTE_UNUSED) {
332     if (no == 0) return(0);
333     if (no == 1) return(-1.1);
334 #if defined(LIBXML_XPATH_ENABLED)
335     if (no == 2) return(xmlXPathNAN);
336 #endif
337     return(-1);
338 }
339 
des_double(int no ATTRIBUTE_UNUSED,double val ATTRIBUTE_UNUSED,int nr ATTRIBUTE_UNUSED)340 static void des_double(int no ATTRIBUTE_UNUSED, double val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
341 }
342 
343 #endif /* defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) */
344 
345 #define gen_nb_int_ptr 2
346 
gen_int_ptr(int no,int nr)347 static int *gen_int_ptr(int no, int nr) {
348     if (no == 0) return(&inttab[nr]);
349     return(NULL);
350 }
351 
des_int_ptr(int no ATTRIBUTE_UNUSED,int * val ATTRIBUTE_UNUSED,int nr ATTRIBUTE_UNUSED)352 static void des_int_ptr(int no ATTRIBUTE_UNUSED, int *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
353 }
354 
355 #define gen_nb_const_char_ptr 4
356 
gen_const_char_ptr(int no,int nr ATTRIBUTE_UNUSED)357 static const char *gen_const_char_ptr(int no, int nr ATTRIBUTE_UNUSED) {
358     if (no == 0) return((char *) "foo");
359     if (no == 1) return((char *) "<foo/>");
360     if (no == 2) return((char *) "test/ent2");
361     return(NULL);
362 }
des_const_char_ptr(int no ATTRIBUTE_UNUSED,const char * val ATTRIBUTE_UNUSED,int nr ATTRIBUTE_UNUSED)363 static void des_const_char_ptr(int no ATTRIBUTE_UNUSED, const char *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
364 }
365 
366 #define gen_nb_xmlChar_ptr 2
367 
gen_xmlChar_ptr(int no,int nr ATTRIBUTE_UNUSED)368 static xmlChar *gen_xmlChar_ptr(int no, int nr ATTRIBUTE_UNUSED) {
369     if (no == 0) return(&chartab[0]);
370     return(NULL);
371 }
des_xmlChar_ptr(int no ATTRIBUTE_UNUSED,xmlChar * val ATTRIBUTE_UNUSED,int nr ATTRIBUTE_UNUSED)372 static void des_xmlChar_ptr(int no ATTRIBUTE_UNUSED, xmlChar *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
373 }
374 
375 #define gen_nb_FILE_ptr 2
376 
gen_FILE_ptr(int no,int nr ATTRIBUTE_UNUSED)377 static FILE *gen_FILE_ptr(int no, int nr ATTRIBUTE_UNUSED) {
378     if (no == 0) return(fopen("test.out", "a+"));
379     return(NULL);
380 }
des_FILE_ptr(int no ATTRIBUTE_UNUSED,FILE * val,int nr ATTRIBUTE_UNUSED)381 static void des_FILE_ptr(int no ATTRIBUTE_UNUSED, FILE *val, int nr ATTRIBUTE_UNUSED) {
382     if (val != NULL) fclose(val);
383 }
384 
385 #ifdef LIBXML_DEBUG_ENABLED
386 #define gen_nb_debug_FILE_ptr 2
gen_debug_FILE_ptr(int no ATTRIBUTE_UNUSED,int nr ATTRIBUTE_UNUSED)387 static FILE *gen_debug_FILE_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
388     return(fopen("test.out", "a+"));
389 }
des_debug_FILE_ptr(int no ATTRIBUTE_UNUSED,FILE * val,int nr ATTRIBUTE_UNUSED)390 static void des_debug_FILE_ptr(int no ATTRIBUTE_UNUSED, FILE *val, int nr ATTRIBUTE_UNUSED) {
391     if (val != NULL) fclose(val);
392 }
393 #endif
394 
395 #define gen_nb_const_xmlChar_ptr 5
396 
gen_const_xmlChar_ptr(int no,int nr ATTRIBUTE_UNUSED)397 static const xmlChar *gen_const_xmlChar_ptr(int no, int nr ATTRIBUTE_UNUSED) {
398     if (no == 0) return((xmlChar *) "foo");
399     if (no == 1) return((xmlChar *) "<foo/>");
400     if (no == 2) return((xmlChar *) "n" "\xf8" "ne");
401     if (no == 3) return((xmlChar *) " 2ab ");
402     return(NULL);
403 }
des_const_xmlChar_ptr(int no ATTRIBUTE_UNUSED,const xmlChar * val ATTRIBUTE_UNUSED,int nr ATTRIBUTE_UNUSED)404 static void des_const_xmlChar_ptr(int no ATTRIBUTE_UNUSED, const xmlChar *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
405 }
406 
407 #define gen_nb_filepath 8
408 
gen_filepath(int no,int nr ATTRIBUTE_UNUSED)409 static const char *gen_filepath(int no, int nr ATTRIBUTE_UNUSED) {
410     if (no == 0) return("missing.xml");
411     if (no == 1) return("<foo/>");
412     if (no == 2) return("test/ent2");
413     if (no == 3) return("test/valid/REC-xml-19980210.xml");
414     if (no == 4) return("test/valid/dtds/xhtml1-strict.dtd");
415     if (no == 5) return(REMOTE1GOOD);
416     if (no == 6) return(REMOTE1BAD);
417     return(NULL);
418 }
des_filepath(int no ATTRIBUTE_UNUSED,const char * val ATTRIBUTE_UNUSED,int nr ATTRIBUTE_UNUSED)419 static void des_filepath(int no ATTRIBUTE_UNUSED, const char *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
420 }
421 
422 #define gen_nb_eaten_name 2
423 
gen_eaten_name(int no,int nr ATTRIBUTE_UNUSED)424 static xmlChar *gen_eaten_name(int no, int nr ATTRIBUTE_UNUSED) {
425     if (no == 0) return(xmlStrdup(BAD_CAST "eaten"));
426     return(NULL);
427 }
des_eaten_name(int no ATTRIBUTE_UNUSED,xmlChar * val ATTRIBUTE_UNUSED,int nr ATTRIBUTE_UNUSED)428 static void des_eaten_name(int no ATTRIBUTE_UNUSED, xmlChar *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
429 }
430 
431 #define gen_nb_fileoutput 6
432 
gen_fileoutput(int no,int nr ATTRIBUTE_UNUSED)433 static const char *gen_fileoutput(int no, int nr ATTRIBUTE_UNUSED) {
434     if (no == 0) return("missing/dir/missing.xml");
435     if (no == 1) return("<foo/>");
436     if (no == 2) return(REMOTE2GOOD);
437     if (no == 3) return(REMOTE1GOOD);
438     if (no == 4) return(REMOTE1BAD);
439     return(NULL);
440 }
des_fileoutput(int no ATTRIBUTE_UNUSED,const char * val ATTRIBUTE_UNUSED,int nr ATTRIBUTE_UNUSED)441 static void des_fileoutput(int no ATTRIBUTE_UNUSED, const char *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
442 }
443 
444 #define gen_nb_xmlParserCtxtPtr 3
gen_xmlParserCtxtPtr(int no,int nr ATTRIBUTE_UNUSED)445 static xmlParserCtxtPtr gen_xmlParserCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) {
446     if (no == 0) return(xmlNewParserCtxt());
447     if (no == 1) return(xmlCreateMemoryParserCtxt("<doc/>", 6));
448     return(NULL);
449 }
des_xmlParserCtxtPtr(int no ATTRIBUTE_UNUSED,xmlParserCtxtPtr val,int nr ATTRIBUTE_UNUSED)450 static void des_xmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, xmlParserCtxtPtr val, int nr ATTRIBUTE_UNUSED) {
451     if (val != NULL)
452         xmlFreeParserCtxt(val);
453 }
454 
455 #if defined(LIBXML_SAX1_ENABLED) || \
456     defined(LIBXML_VALID_ENABLED) || \
457     defined(LIBXML_PUSH_ENABLED)
458 #define gen_nb_xmlSAXHandlerPtr 2
gen_xmlSAXHandlerPtr(int no,int nr ATTRIBUTE_UNUSED)459 static xmlSAXHandlerPtr gen_xmlSAXHandlerPtr(int no, int nr ATTRIBUTE_UNUSED) {
460     (void) no;
461 #ifdef LIBXML_SAX1_ENABLED
462     if (no == 0) return((xmlSAXHandlerPtr) &xmlDefaultSAXHandler);
463 #endif
464     return(NULL);
465 }
des_xmlSAXHandlerPtr(int no ATTRIBUTE_UNUSED,xmlSAXHandlerPtr val ATTRIBUTE_UNUSED,int nr ATTRIBUTE_UNUSED)466 static void des_xmlSAXHandlerPtr(int no ATTRIBUTE_UNUSED, xmlSAXHandlerPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
467 }
468 #endif
469 
470 #define gen_nb_xmlValidCtxtPtr 2
gen_xmlValidCtxtPtr(int no,int nr ATTRIBUTE_UNUSED)471 static xmlValidCtxtPtr gen_xmlValidCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) {
472     (void) no;
473 #ifdef LIBXML_VALID_ENABLED
474     if (no == 0) return(xmlNewValidCtxt());
475 #endif
476     return(NULL);
477 }
des_xmlValidCtxtPtr(int no ATTRIBUTE_UNUSED,xmlValidCtxtPtr val,int nr ATTRIBUTE_UNUSED)478 static void des_xmlValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlValidCtxtPtr val, int nr ATTRIBUTE_UNUSED) {
479     (void) val;
480 #ifdef LIBXML_VALID_ENABLED
481     if (val != NULL)
482         xmlFreeValidCtxt(val);
483 #endif
484 }
485 
486 #define gen_nb_xmlParserInputBufferPtr 8
487 
gen_xmlParserInputBufferPtr(int no,int nr ATTRIBUTE_UNUSED)488 static xmlParserInputBufferPtr gen_xmlParserInputBufferPtr(int no, int nr ATTRIBUTE_UNUSED) {
489     if (no == 0) return(xmlParserInputBufferCreateFilename("missing.xml", XML_CHAR_ENCODING_NONE));
490     if (no == 1) return(xmlParserInputBufferCreateFilename("<foo/>", XML_CHAR_ENCODING_NONE));
491     if (no == 2) return(xmlParserInputBufferCreateFilename("test/ent2", XML_CHAR_ENCODING_NONE));
492     if (no == 3) return(xmlParserInputBufferCreateFilename("test/valid/REC-xml-19980210.xml", XML_CHAR_ENCODING_NONE));
493     if (no == 4) return(xmlParserInputBufferCreateFilename("test/valid/dtds/xhtml1-strict.dtd", XML_CHAR_ENCODING_NONE));
494     if (no == 5) return(xmlParserInputBufferCreateFilename(REMOTE1GOOD, XML_CHAR_ENCODING_NONE));
495     if (no == 6) return(xmlParserInputBufferCreateFilename(REMOTE1BAD, XML_CHAR_ENCODING_NONE));
496     return(NULL);
497 }
des_xmlParserInputBufferPtr(int no ATTRIBUTE_UNUSED,xmlParserInputBufferPtr val,int nr ATTRIBUTE_UNUSED)498 static void des_xmlParserInputBufferPtr(int no ATTRIBUTE_UNUSED, xmlParserInputBufferPtr val, int nr ATTRIBUTE_UNUSED) {
499     xmlFreeParserInputBuffer(val);
500 }
501 
502 #define gen_nb_xmlDocPtr 4
gen_xmlDocPtr(int no,int nr ATTRIBUTE_UNUSED)503 static xmlDocPtr gen_xmlDocPtr(int no, int nr ATTRIBUTE_UNUSED) {
504     if (no == 0) return(xmlNewDoc(BAD_CAST "1.0"));
505     if (no == 1) return(xmlReadMemory("<foo/>", 6, "test", NULL, 0));
506     if (no == 2) return(xmlReadMemory("<!DOCTYPE foo []> <foo/>", 24, "test", NULL, 0));
507     return(NULL);
508 }
des_xmlDocPtr(int no ATTRIBUTE_UNUSED,xmlDocPtr val,int nr ATTRIBUTE_UNUSED)509 static void des_xmlDocPtr(int no ATTRIBUTE_UNUSED, xmlDocPtr val, int nr ATTRIBUTE_UNUSED) {
510     if ((val != NULL) && (val != api_doc) && (val->doc != api_doc))
511         xmlFreeDoc(val);
512 }
513 
514 #define gen_nb_xmlAttrPtr 2
gen_xmlAttrPtr(int no,int nr ATTRIBUTE_UNUSED)515 static xmlAttrPtr gen_xmlAttrPtr(int no, int nr ATTRIBUTE_UNUSED) {
516     if (no == 0) return(get_api_attr());
517     return(NULL);
518 }
des_xmlAttrPtr(int no,xmlAttrPtr val ATTRIBUTE_UNUSED,int nr ATTRIBUTE_UNUSED)519 static void des_xmlAttrPtr(int no, xmlAttrPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
520     if (no == 0) free_api_doc();
521 }
522 
523 #define gen_nb_xmlDictPtr 2
gen_xmlDictPtr(int no,int nr ATTRIBUTE_UNUSED)524 static xmlDictPtr gen_xmlDictPtr(int no, int nr ATTRIBUTE_UNUSED) {
525     if (no == 0) return(xmlDictCreate());
526     return(NULL);
527 }
des_xmlDictPtr(int no ATTRIBUTE_UNUSED,xmlDictPtr val,int nr ATTRIBUTE_UNUSED)528 static void des_xmlDictPtr(int no ATTRIBUTE_UNUSED, xmlDictPtr val, int nr ATTRIBUTE_UNUSED) {
529     if (val != NULL)
530         xmlDictFree(val);
531 }
532 
533 #define gen_nb_xmlNodePtr 3
gen_xmlNodePtr(int no,int nr ATTRIBUTE_UNUSED)534 static xmlNodePtr gen_xmlNodePtr(int no, int nr ATTRIBUTE_UNUSED) {
535     if (no == 0) return(xmlNewPI(BAD_CAST "test", NULL));
536     if (no == 1) return(get_api_root());
537     return(NULL);
538 /*     if (no == 2) return((xmlNodePtr) get_api_doc()); */
539 }
des_xmlNodePtr(int no,xmlNodePtr val,int nr ATTRIBUTE_UNUSED)540 static void des_xmlNodePtr(int no, xmlNodePtr val, int nr ATTRIBUTE_UNUSED) {
541     if (no == 1) {
542         free_api_doc();
543     } else if (val != NULL) {
544         xmlUnlinkNode(val);
545         xmlFreeNode(val);
546     }
547 }
548 
549 #define gen_nb_xmlDtdPtr 3
gen_xmlDtdPtr(int no,int nr ATTRIBUTE_UNUSED)550 static xmlDtdPtr gen_xmlDtdPtr(int no, int nr ATTRIBUTE_UNUSED) {
551     if (no == 0)
552         return(xmlNewDtd(NULL, BAD_CAST "dtd", BAD_CAST"foo", BAD_CAST"bar"));
553     if (no == 1) return(get_api_dtd());
554     return(NULL);
555 }
des_xmlDtdPtr(int no,xmlDtdPtr val,int nr ATTRIBUTE_UNUSED)556 static void des_xmlDtdPtr(int no, xmlDtdPtr val, int nr ATTRIBUTE_UNUSED) {
557     if (no == 1) free_api_doc();
558     else if (val != NULL) {
559         xmlUnlinkNode((xmlNodePtr) val);
560         xmlFreeNode((xmlNodePtr) val);
561     }
562 }
563 
564 #define gen_nb_xmlNsPtr 2
gen_xmlNsPtr(int no,int nr ATTRIBUTE_UNUSED)565 static xmlNsPtr gen_xmlNsPtr(int no, int nr ATTRIBUTE_UNUSED) {
566     if (no == 0) return(get_api_ns());
567     return(NULL);
568 }
des_xmlNsPtr(int no,xmlNsPtr val ATTRIBUTE_UNUSED,int nr ATTRIBUTE_UNUSED)569 static void des_xmlNsPtr(int no, xmlNsPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
570     if (no == 0) free_api_doc();
571 }
572 
573 #define gen_nb_xmlNodePtr_in 3
gen_xmlNodePtr_in(int no,int nr ATTRIBUTE_UNUSED)574 static xmlNodePtr gen_xmlNodePtr_in(int no, int nr ATTRIBUTE_UNUSED) {
575     if (no == 0) return(xmlNewPI(BAD_CAST "test", NULL));
576     if (no == 0) return(xmlNewText(BAD_CAST "text"));
577     return(NULL);
578 }
des_xmlNodePtr_in(int no ATTRIBUTE_UNUSED,xmlNodePtr val ATTRIBUTE_UNUSED,int nr ATTRIBUTE_UNUSED)579 static void des_xmlNodePtr_in(int no ATTRIBUTE_UNUSED, xmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
580 }
581 
582 #ifdef LIBXML_WRITER_ENABLED
583 #define gen_nb_xmlTextWriterPtr 2
gen_xmlTextWriterPtr(int no,int nr ATTRIBUTE_UNUSED)584 static xmlTextWriterPtr gen_xmlTextWriterPtr(int no, int nr ATTRIBUTE_UNUSED) {
585     if (no == 0) return(xmlNewTextWriterFilename("test.out", 0));
586     return(NULL);
587 }
des_xmlTextWriterPtr(int no ATTRIBUTE_UNUSED,xmlTextWriterPtr val,int nr ATTRIBUTE_UNUSED)588 static void des_xmlTextWriterPtr(int no ATTRIBUTE_UNUSED, xmlTextWriterPtr val, int nr ATTRIBUTE_UNUSED) {
589     if (val != NULL) xmlFreeTextWriter(val);
590 }
591 #endif
592 
593 #ifdef LIBXML_READER_ENABLED
594 #define gen_nb_xmlTextReaderPtr 4
gen_xmlTextReaderPtr(int no,int nr ATTRIBUTE_UNUSED)595 static xmlTextReaderPtr gen_xmlTextReaderPtr(int no, int nr ATTRIBUTE_UNUSED) {
596     if (no == 0) return(xmlNewTextReaderFilename("test/ent2"));
597     if (no == 1) return(xmlNewTextReaderFilename("test/valid/REC-xml-19980210.xml"));
598     if (no == 2) return(xmlNewTextReaderFilename("test/valid/dtds/xhtml1-strict.dtd"));
599     return(NULL);
600 }
des_xmlTextReaderPtr(int no ATTRIBUTE_UNUSED,xmlTextReaderPtr val,int nr ATTRIBUTE_UNUSED)601 static void des_xmlTextReaderPtr(int no ATTRIBUTE_UNUSED, xmlTextReaderPtr val, int nr ATTRIBUTE_UNUSED) {
602     if (val != NULL) xmlFreeTextReader(val);
603 }
604 #endif
605 
606 #define gen_nb_xmlBufferPtr 3
607 static const xmlChar *static_buf_content = (xmlChar *)"a static buffer";
gen_xmlBufferPtr(int no,int nr ATTRIBUTE_UNUSED)608 static xmlBufferPtr gen_xmlBufferPtr(int no, int nr ATTRIBUTE_UNUSED) {
609     if (no == 0) return(xmlBufferCreate());
610     if (no == 1) return(xmlBufferCreateStatic((void *)static_buf_content, 13));
611     return(NULL);
612 }
des_xmlBufferPtr(int no ATTRIBUTE_UNUSED,xmlBufferPtr val,int nr ATTRIBUTE_UNUSED)613 static void des_xmlBufferPtr(int no ATTRIBUTE_UNUSED, xmlBufferPtr val, int nr ATTRIBUTE_UNUSED) {
614     if (val != NULL) {
615         xmlBufferFree(val);
616     }
617 }
618 
619 #define gen_nb_xmlListPtr 2
gen_xmlListPtr(int no,int nr ATTRIBUTE_UNUSED)620 static xmlListPtr gen_xmlListPtr(int no, int nr ATTRIBUTE_UNUSED) {
621     if (no == 0) return(xmlListCreate(NULL, NULL));
622     return(NULL);
623 }
des_xmlListPtr(int no ATTRIBUTE_UNUSED,xmlListPtr val,int nr ATTRIBUTE_UNUSED)624 static void des_xmlListPtr(int no ATTRIBUTE_UNUSED, xmlListPtr val, int nr ATTRIBUTE_UNUSED) {
625     if (val != NULL) {
626         xmlListDelete(val);
627     }
628 }
629 
630 #define gen_nb_xmlHashTablePtr 2
gen_xmlHashTablePtr(int no,int nr ATTRIBUTE_UNUSED)631 static xmlHashTablePtr gen_xmlHashTablePtr(int no, int nr ATTRIBUTE_UNUSED) {
632     if (no == 0) return(xmlHashCreate(10));
633     return(NULL);
634 }
des_xmlHashTablePtr(int no ATTRIBUTE_UNUSED,xmlHashTablePtr val,int nr ATTRIBUTE_UNUSED)635 static void des_xmlHashTablePtr(int no ATTRIBUTE_UNUSED, xmlHashTablePtr val, int nr ATTRIBUTE_UNUSED) {
636     if (val != NULL) {
637         xmlHashFree(val, NULL);
638     }
639 }
640 
641 #include <libxml/xpathInternals.h>
642 
643 #ifdef LIBXML_XPATH_ENABLED
644 #define gen_nb_xmlXPathObjectPtr 5
gen_xmlXPathObjectPtr(int no,int nr ATTRIBUTE_UNUSED)645 static xmlXPathObjectPtr gen_xmlXPathObjectPtr(int no, int nr ATTRIBUTE_UNUSED) {
646     if (no == 0) return(xmlXPathNewString(BAD_CAST "string object"));
647     if (no == 1) return(xmlXPathNewFloat(1.1));
648     if (no == 2) return(xmlXPathNewBoolean(1));
649     if (no == 3) return(xmlXPathNewNodeSet(NULL));
650     return(NULL);
651 }
des_xmlXPathObjectPtr(int no ATTRIBUTE_UNUSED,xmlXPathObjectPtr val,int nr ATTRIBUTE_UNUSED)652 static void des_xmlXPathObjectPtr(int no ATTRIBUTE_UNUSED, xmlXPathObjectPtr val, int nr ATTRIBUTE_UNUSED) {
653     if (val != NULL) {
654         xmlXPathFreeObject(val);
655     }
656 }
657 #endif
658 
659 #ifdef LIBXML_OUTPUT_ENABLED
660 #define gen_nb_xmlOutputBufferPtr 2
gen_xmlOutputBufferPtr(int no,int nr ATTRIBUTE_UNUSED)661 static xmlOutputBufferPtr gen_xmlOutputBufferPtr(int no, int nr ATTRIBUTE_UNUSED) {
662     if (no == 0) return(xmlOutputBufferCreateFilename("test.out", NULL, 0));
663     return(NULL);
664 }
des_xmlOutputBufferPtr(int no ATTRIBUTE_UNUSED,xmlOutputBufferPtr val,int nr ATTRIBUTE_UNUSED)665 static void des_xmlOutputBufferPtr(int no ATTRIBUTE_UNUSED, xmlOutputBufferPtr val, int nr ATTRIBUTE_UNUSED) {
666     if (val != NULL) {
667         xmlOutputBufferClose(val);
668     }
669 }
670 #endif
671 
672 #ifdef LIBXML_HTTP_ENABLED
673 #define gen_nb_xmlNanoHTTPCtxtPtr 1
gen_xmlNanoHTTPCtxtPtr(int no,int nr ATTRIBUTE_UNUSED)674 static void *gen_xmlNanoHTTPCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) {
675     if (no == 0) return(xmlNanoHTTPOpen(REMOTE1GOOD, NULL));
676     if (no == 1) return(xmlNanoHTTPOpen(REMOTE2GOOD, NULL));
677     if (no == 2) return(xmlNanoHTTPOpen(REMOTE1BAD, NULL));
678     return(NULL);
679 }
des_xmlNanoHTTPCtxtPtr(int no ATTRIBUTE_UNUSED,void * val,int nr ATTRIBUTE_UNUSED)680 static void des_xmlNanoHTTPCtxtPtr(int no ATTRIBUTE_UNUSED, void *val, int nr ATTRIBUTE_UNUSED) {
681     if (val != NULL) {
682 	xmlNanoHTTPClose(val);
683     }
684 }
685 #endif
686 
687 #define gen_nb_xmlCharEncoding 4
gen_xmlCharEncoding(int no,int nr ATTRIBUTE_UNUSED)688 static xmlCharEncoding gen_xmlCharEncoding(int no, int nr ATTRIBUTE_UNUSED) {
689     if (no == 0) return(XML_CHAR_ENCODING_UTF8);
690     if (no == 1) return(XML_CHAR_ENCODING_NONE);
691     if (no == 2) return(XML_CHAR_ENCODING_8859_1);
692     return(XML_CHAR_ENCODING_ERROR);
693 }
des_xmlCharEncoding(int no ATTRIBUTE_UNUSED,xmlCharEncoding val ATTRIBUTE_UNUSED,int nr ATTRIBUTE_UNUSED)694 static void des_xmlCharEncoding(int no ATTRIBUTE_UNUSED, xmlCharEncoding val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
695 }
696 
697 #if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_EXPR_ENABLED)
698 
699 #define gen_nb_xmlExpCtxtPtr 1
gen_xmlExpCtxtPtr(int no ATTRIBUTE_UNUSED,int nr ATTRIBUTE_UNUSED)700 static xmlExpCtxtPtr gen_xmlExpCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
701     return(NULL);
702 }
des_xmlExpCtxtPtr(int no ATTRIBUTE_UNUSED,xmlExpCtxtPtr val ATTRIBUTE_UNUSED,int nr ATTRIBUTE_UNUSED)703 static void des_xmlExpCtxtPtr(int no ATTRIBUTE_UNUSED, xmlExpCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
704 }
705 
706 #define gen_nb_xmlExpNodePtr 1
gen_xmlExpNodePtr(int no ATTRIBUTE_UNUSED,int nr ATTRIBUTE_UNUSED)707 static xmlExpNodePtr gen_xmlExpNodePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
708     return(NULL);
709 }
des_xmlExpNodePtr(int no ATTRIBUTE_UNUSED,xmlExpNodePtr val ATTRIBUTE_UNUSED,int nr ATTRIBUTE_UNUSED)710 static void des_xmlExpNodePtr(int no ATTRIBUTE_UNUSED, xmlExpNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
711 }
712 
713 #endif
714 
715 #if defined(LIBXML_SCHEMAS_ENABLED)
716 #define gen_nb_xmlSchemaPtr 1
gen_xmlSchemaPtr(int no ATTRIBUTE_UNUSED,int nr ATTRIBUTE_UNUSED)717 static xmlSchemaPtr gen_xmlSchemaPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
718     return(NULL);
719 }
des_xmlSchemaPtr(int no ATTRIBUTE_UNUSED,xmlSchemaPtr val ATTRIBUTE_UNUSED,int nr ATTRIBUTE_UNUSED)720 static void des_xmlSchemaPtr(int no ATTRIBUTE_UNUSED, xmlSchemaPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
721 }
722 
723 #define gen_nb_xmlSchemaValidCtxtPtr 1
gen_xmlSchemaValidCtxtPtr(int no ATTRIBUTE_UNUSED,int nr ATTRIBUTE_UNUSED)724 static xmlSchemaValidCtxtPtr gen_xmlSchemaValidCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
725     return(NULL);
726 }
des_xmlSchemaValidCtxtPtr(int no ATTRIBUTE_UNUSED,xmlSchemaValidCtxtPtr val ATTRIBUTE_UNUSED,int nr ATTRIBUTE_UNUSED)727 static void des_xmlSchemaValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSchemaValidCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
728 }
729 
730 #endif /* LIBXML_SCHEMAS_ENABLED */
731 
732 #define gen_nb_xmlHashDeallocator 2
733 static void
test_xmlHashDeallocator(void * payload ATTRIBUTE_UNUSED,const xmlChar * name ATTRIBUTE_UNUSED)734 test_xmlHashDeallocator(void *payload ATTRIBUTE_UNUSED,
735                         const xmlChar *name ATTRIBUTE_UNUSED) {
736 }
737 
gen_xmlHashDeallocator(int no,int nr ATTRIBUTE_UNUSED)738 static xmlHashDeallocator gen_xmlHashDeallocator(int no, int nr ATTRIBUTE_UNUSED) {
739     if (no == 0) return(test_xmlHashDeallocator);
740     return(NULL);
741 }
des_xmlHashDeallocator(int no ATTRIBUTE_UNUSED,xmlHashDeallocator val ATTRIBUTE_UNUSED,int nr ATTRIBUTE_UNUSED)742 static void des_xmlHashDeallocator(int no ATTRIBUTE_UNUSED, xmlHashDeallocator val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
743 }
744 
745 
desret_int(int val ATTRIBUTE_UNUSED)746 static void desret_int(int val ATTRIBUTE_UNUSED) {
747 }
desret_xmlChar(xmlChar val ATTRIBUTE_UNUSED)748 static void desret_xmlChar(xmlChar val ATTRIBUTE_UNUSED) {
749 }
desret_long(long val ATTRIBUTE_UNUSED)750 static void desret_long(long val ATTRIBUTE_UNUSED) {
751 }
desret_unsigned_long(unsigned long val ATTRIBUTE_UNUSED)752 static void desret_unsigned_long(unsigned long val ATTRIBUTE_UNUSED) {
753 }
754 #if defined(LIBXML_XPATH_ENABLED)
desret_double(double val ATTRIBUTE_UNUSED)755 static void desret_double(double val ATTRIBUTE_UNUSED) {
756 }
757 #endif
desret_xmlCharEncoding(xmlCharEncoding val ATTRIBUTE_UNUSED)758 static void desret_xmlCharEncoding(xmlCharEncoding val ATTRIBUTE_UNUSED) {
759 }
760 #if 0
761 static void desret_const_void_ptr(void *val ATTRIBUTE_UNUSED) {
762 }
763 #endif
desret_void_ptr(void * val ATTRIBUTE_UNUSED)764 static void desret_void_ptr(void *val ATTRIBUTE_UNUSED) {
765 }
desret_const_char_ptr(const char * val ATTRIBUTE_UNUSED)766 static void desret_const_char_ptr(const char *val ATTRIBUTE_UNUSED) {
767 }
desret_const_xmlChar_ptr(const xmlChar * val ATTRIBUTE_UNUSED)768 static void desret_const_xmlChar_ptr(const xmlChar *val ATTRIBUTE_UNUSED) {
769 }
desret_xmlChar_ptr(xmlChar * val)770 static void desret_xmlChar_ptr(xmlChar *val) {
771     if (val != NULL)
772 	xmlFree(val);
773 }
desret_xmlDocPtr(xmlDocPtr val)774 static void desret_xmlDocPtr(xmlDocPtr val) {
775     if (val != api_doc)
776 	xmlFreeDoc(val);
777 }
desret_xmlDictPtr(xmlDictPtr val)778 static void desret_xmlDictPtr(xmlDictPtr val) {
779     xmlDictFree(val);
780 }
781 #ifdef LIBXML_OUTPUT_ENABLED
desret_xmlOutputBufferPtr(xmlOutputBufferPtr val)782 static void desret_xmlOutputBufferPtr(xmlOutputBufferPtr val) {
783     xmlOutputBufferClose(val);
784 }
785 #endif
786 #ifdef LIBXML_READER_ENABLED
desret_xmlTextReaderPtr(xmlTextReaderPtr val)787 static void desret_xmlTextReaderPtr(xmlTextReaderPtr val) {
788     xmlFreeTextReader(val);
789 }
790 #endif
desret_xmlNodePtr(xmlNodePtr val)791 static void desret_xmlNodePtr(xmlNodePtr val) {
792     if ((val != NULL) && (val != api_root) && (val != (xmlNodePtr) api_doc)) {
793 	xmlUnlinkNode(val);
794 	xmlFreeNode(val);
795     }
796 }
desret_xmlAttrPtr(xmlAttrPtr val)797 static void desret_xmlAttrPtr(xmlAttrPtr val) {
798     if (val != NULL) {
799 	xmlUnlinkNode((xmlNodePtr) val);
800 	xmlFreeNode((xmlNodePtr) val);
801     }
802 }
desret_xmlEntityPtr(xmlEntityPtr val)803 static void desret_xmlEntityPtr(xmlEntityPtr val) {
804     if (val != NULL) {
805 	xmlUnlinkNode((xmlNodePtr) val);
806 	xmlFreeNode((xmlNodePtr) val);
807     }
808 }
desret_xmlElementPtr(xmlElementPtr val)809 static void desret_xmlElementPtr(xmlElementPtr val) {
810     if (val != NULL) {
811 	xmlUnlinkNode((xmlNodePtr) val);
812     }
813 }
desret_xmlAttributePtr(xmlAttributePtr val)814 static void desret_xmlAttributePtr(xmlAttributePtr val) {
815     if (val != NULL) {
816 	xmlUnlinkNode((xmlNodePtr) val);
817     }
818 }
desret_xmlNsPtr(xmlNsPtr val ATTRIBUTE_UNUSED)819 static void desret_xmlNsPtr(xmlNsPtr val ATTRIBUTE_UNUSED) {
820 }
desret_xmlDtdPtr(xmlDtdPtr val)821 static void desret_xmlDtdPtr(xmlDtdPtr val) {
822     desret_xmlNodePtr((xmlNodePtr)val);
823 }
824 #ifdef LIBXML_XPATH_ENABLED
desret_xmlXPathObjectPtr(xmlXPathObjectPtr val)825 static void desret_xmlXPathObjectPtr(xmlXPathObjectPtr val) {
826     xmlXPathFreeObject(val);
827 }
desret_xmlNodeSetPtr(xmlNodeSetPtr val)828 static void desret_xmlNodeSetPtr(xmlNodeSetPtr val) {
829     xmlXPathFreeNodeSet(val);
830 }
831 #endif
desret_xmlParserCtxtPtr(xmlParserCtxtPtr val)832 static void desret_xmlParserCtxtPtr(xmlParserCtxtPtr val) {
833     xmlFreeParserCtxt(val);
834 }
desret_xmlParserInputBufferPtr(xmlParserInputBufferPtr val)835 static void desret_xmlParserInputBufferPtr(xmlParserInputBufferPtr val) {
836     xmlFreeParserInputBuffer(val);
837 }
desret_xmlParserInputPtr(xmlParserInputPtr val)838 static void desret_xmlParserInputPtr(xmlParserInputPtr val) {
839     xmlFreeInputStream(val);
840 }
841 #ifdef LIBXML_WRITER_ENABLED
desret_xmlTextWriterPtr(xmlTextWriterPtr val)842 static void desret_xmlTextWriterPtr(xmlTextWriterPtr val) {
843     xmlFreeTextWriter(val);
844 }
845 #endif
desret_xmlBufferPtr(xmlBufferPtr val)846 static void desret_xmlBufferPtr(xmlBufferPtr val) {
847     xmlBufferFree(val);
848 }
849 #ifdef LIBXML_SCHEMAS_ENABLED
desret_xmlSchemaParserCtxtPtr(xmlSchemaParserCtxtPtr val)850 static void desret_xmlSchemaParserCtxtPtr(xmlSchemaParserCtxtPtr val) {
851     xmlSchemaFreeParserCtxt(val);
852 }
desret_xmlSchemaTypePtr(xmlSchemaTypePtr val ATTRIBUTE_UNUSED)853 static void desret_xmlSchemaTypePtr(xmlSchemaTypePtr val ATTRIBUTE_UNUSED) {
854 }
desret_xmlRelaxNGParserCtxtPtr(xmlRelaxNGParserCtxtPtr val)855 static void desret_xmlRelaxNGParserCtxtPtr(xmlRelaxNGParserCtxtPtr val) {
856     xmlRelaxNGFreeParserCtxt(val);
857 }
858 #endif
859 #ifdef LIBXML_HTML_ENABLED
desret_const_htmlEntityDesc_ptr(const htmlEntityDesc * val ATTRIBUTE_UNUSED)860 static void desret_const_htmlEntityDesc_ptr(const htmlEntityDesc * val ATTRIBUTE_UNUSED) {
861 }
862 #endif
863 #ifdef LIBXML_HTTP_ENABLED
desret_xmlNanoHTTPCtxtPtr(void * val)864 static void desret_xmlNanoHTTPCtxtPtr(void *val) {
865     xmlNanoHTTPClose(val);
866 }
867 #endif
868 /* cut and pasted from autogenerated to avoid troubles */
869 #define gen_nb_const_xmlChar_ptr_ptr 1
870 static const xmlChar **
gen_const_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED,int nr ATTRIBUTE_UNUSED)871 gen_const_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
872     return(NULL);
873 }
des_const_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED,const xmlChar ** val ATTRIBUTE_UNUSED,int nr ATTRIBUTE_UNUSED)874 static void des_const_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, const xmlChar ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
875 }
876 
877 #define gen_nb_unsigned_char_ptr 1
gen_unsigned_char_ptr(int no ATTRIBUTE_UNUSED,int nr ATTRIBUTE_UNUSED)878 static unsigned char * gen_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
879     return(NULL);
880 }
des_unsigned_char_ptr(int no ATTRIBUTE_UNUSED,unsigned char * val ATTRIBUTE_UNUSED,int nr ATTRIBUTE_UNUSED)881 static void des_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, unsigned char * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
882 }
883 
884 #define gen_nb_const_unsigned_char_ptr 1
885 static const unsigned char *
gen_const_unsigned_char_ptr(int no ATTRIBUTE_UNUSED,int nr ATTRIBUTE_UNUSED)886 gen_const_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
887     return(NULL);
888 }
des_const_unsigned_char_ptr(int no ATTRIBUTE_UNUSED,const unsigned char * val ATTRIBUTE_UNUSED,int nr ATTRIBUTE_UNUSED)889 static void des_const_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, const unsigned char * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
890 }
891 
892 #ifdef LIBXML_HTML_ENABLED
893 #define gen_nb_htmlDocPtr 3
gen_htmlDocPtr(int no ATTRIBUTE_UNUSED,int nr ATTRIBUTE_UNUSED)894 static htmlDocPtr gen_htmlDocPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
895     if (no == 0) return(htmlNewDoc(NULL, NULL));
896     if (no == 1) return(htmlReadMemory("<html/>", 7, "test", NULL, 0));
897     return(NULL);
898 }
des_htmlDocPtr(int no ATTRIBUTE_UNUSED,htmlDocPtr val ATTRIBUTE_UNUSED,int nr ATTRIBUTE_UNUSED)899 static void des_htmlDocPtr(int no ATTRIBUTE_UNUSED, htmlDocPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
900     if ((val != NULL) && (val != api_doc) && (val->doc != api_doc))
901         xmlFreeDoc(val);
902 }
desret_htmlDocPtr(htmlDocPtr val)903 static void desret_htmlDocPtr(htmlDocPtr val) {
904     if ((val != NULL) && (val != api_doc) && (val->doc != api_doc))
905         xmlFreeDoc(val);
906 }
907 #define gen_nb_htmlParserCtxtPtr 3
gen_htmlParserCtxtPtr(int no ATTRIBUTE_UNUSED,int nr ATTRIBUTE_UNUSED)908 static htmlParserCtxtPtr gen_htmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
909     if (no == 0) return(xmlNewParserCtxt());
910     if (no == 1) return(htmlCreateMemoryParserCtxt("<html/>", 7));
911     return(NULL);
912 }
des_htmlParserCtxtPtr(int no ATTRIBUTE_UNUSED,htmlParserCtxtPtr val ATTRIBUTE_UNUSED,int nr ATTRIBUTE_UNUSED)913 static void des_htmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, htmlParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
914     if (val != NULL)
915         htmlFreeParserCtxt(val);
916 }
desret_htmlParserCtxtPtr(htmlParserCtxtPtr val)917 static void desret_htmlParserCtxtPtr(htmlParserCtxtPtr val) {
918     if (val != NULL)
919         htmlFreeParserCtxt(val);
920 }
921 #endif
922 
923 #ifdef LIBXML_XPATH_ENABLED
924 #define gen_nb_xmlNodeSetPtr 1
gen_xmlNodeSetPtr(int no ATTRIBUTE_UNUSED,int nr ATTRIBUTE_UNUSED)925 static xmlNodeSetPtr gen_xmlNodeSetPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
926     return(NULL);
927 }
des_xmlNodeSetPtr(int no ATTRIBUTE_UNUSED,xmlNodeSetPtr val ATTRIBUTE_UNUSED,int nr ATTRIBUTE_UNUSED)928 static void des_xmlNodeSetPtr(int no ATTRIBUTE_UNUSED, xmlNodeSetPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
929 }
930 #endif
931 
932 #ifdef LIBXML_PATTERN_ENABLED
933 #define gen_nb_xmlPatternPtr 1
gen_xmlPatternPtr(int no ATTRIBUTE_UNUSED,int nr ATTRIBUTE_UNUSED)934 static xmlPatternPtr gen_xmlPatternPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
935     return(NULL);
936 }
des_xmlPatternPtr(int no ATTRIBUTE_UNUSED,xmlPatternPtr val ATTRIBUTE_UNUSED,int nr ATTRIBUTE_UNUSED)937 static void des_xmlPatternPtr(int no ATTRIBUTE_UNUSED, xmlPatternPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
938 }
939 #endif
940 
941 #define gen_nb_xmlElementContentPtr 1
gen_xmlElementContentPtr(int no ATTRIBUTE_UNUSED,int nr ATTRIBUTE_UNUSED)942 static xmlElementContentPtr gen_xmlElementContentPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
943     return(NULL);
944 }
des_xmlElementContentPtr(int no ATTRIBUTE_UNUSED,xmlElementContentPtr val,int nr ATTRIBUTE_UNUSED)945 static void des_xmlElementContentPtr(int no ATTRIBUTE_UNUSED, xmlElementContentPtr val, int nr ATTRIBUTE_UNUSED) {
946     if (val != NULL)
947         xmlFreeElementContent(val);
948 }
desret_xmlElementContentPtr(xmlElementContentPtr val)949 static void desret_xmlElementContentPtr(xmlElementContentPtr val) {
950     if (val != NULL)
951         xmlFreeElementContent(val);
952 }
953 
954 #define gen_nb_xmlParserNodeInfoSeqPtr 1
gen_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED,int nr ATTRIBUTE_UNUSED)955 static xmlParserNodeInfoSeqPtr gen_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
956     return(NULL);
957 }
des_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED,xmlParserNodeInfoSeqPtr val ATTRIBUTE_UNUSED,int nr ATTRIBUTE_UNUSED)958 static void des_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, xmlParserNodeInfoSeqPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
959 }
960 
desret_const_xmlParserNodeInfo_ptr(const xmlParserNodeInfo * val ATTRIBUTE_UNUSED)961 static void desret_const_xmlParserNodeInfo_ptr(const xmlParserNodeInfo *val ATTRIBUTE_UNUSED) {
962 }
963 
964 #if defined(LIBXML_MODULES_ENABLED) || defined(LIBXML_READER_ENABLED) || \
965     defined(LIBXML_SCHEMAS_ENABLED)
966 #define gen_nb_void_ptr_ptr 1
gen_void_ptr_ptr(int no ATTRIBUTE_UNUSED,int nr ATTRIBUTE_UNUSED)967 static void ** gen_void_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
968     return(NULL);
969 }
des_void_ptr_ptr(int no ATTRIBUTE_UNUSED,void ** val ATTRIBUTE_UNUSED,int nr ATTRIBUTE_UNUSED)970 static void des_void_ptr_ptr(int no ATTRIBUTE_UNUSED, void ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
971 }
972 #endif
973 
974 #define gen_nb_xmlParserInputPtr 1
gen_xmlParserInputPtr(int no ATTRIBUTE_UNUSED,int nr ATTRIBUTE_UNUSED)975 static xmlParserInputPtr gen_xmlParserInputPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
976     return(NULL);
977 }
des_xmlParserInputPtr(int no ATTRIBUTE_UNUSED,xmlParserInputPtr val ATTRIBUTE_UNUSED,int nr ATTRIBUTE_UNUSED)978 static void des_xmlParserInputPtr(int no ATTRIBUTE_UNUSED, xmlParserInputPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
979 }
980 
981 /************************************************************************
982  *									*
983  *   WARNING: end of the manually maintained part of the test code	*
984  *            do not remove or alter the CUT HERE line			*
985  *									*
986  ************************************************************************/
987 
988 /* CUT HERE: everything below that line is generated */
989 #ifdef LIBXML_HTML_ENABLED
desret_htmlStatus(htmlStatus val ATTRIBUTE_UNUSED)990 static void desret_htmlStatus(htmlStatus val ATTRIBUTE_UNUSED) {
991 }
992 
993 #endif
994 
995 #define gen_nb_xmlAttributeDefault 4
gen_xmlAttributeDefault(int no,int nr ATTRIBUTE_UNUSED)996 static xmlAttributeDefault gen_xmlAttributeDefault(int no, int nr ATTRIBUTE_UNUSED) {
997     if (no == 1) return(XML_ATTRIBUTE_FIXED);
998     if (no == 2) return(XML_ATTRIBUTE_IMPLIED);
999     if (no == 3) return(XML_ATTRIBUTE_NONE);
1000     if (no == 4) return(XML_ATTRIBUTE_REQUIRED);
1001     return(0);
1002 }
1003 
des_xmlAttributeDefault(int no ATTRIBUTE_UNUSED,xmlAttributeDefault val ATTRIBUTE_UNUSED,int nr ATTRIBUTE_UNUSED)1004 static void des_xmlAttributeDefault(int no ATTRIBUTE_UNUSED, xmlAttributeDefault val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1005 }
1006 
1007 #define gen_nb_xmlAttributeType 4
gen_xmlAttributeType(int no,int nr ATTRIBUTE_UNUSED)1008 static xmlAttributeType gen_xmlAttributeType(int no, int nr ATTRIBUTE_UNUSED) {
1009     if (no == 1) return(XML_ATTRIBUTE_CDATA);
1010     if (no == 2) return(XML_ATTRIBUTE_ENTITIES);
1011     if (no == 3) return(XML_ATTRIBUTE_ENTITY);
1012     if (no == 4) return(XML_ATTRIBUTE_ENUMERATION);
1013     return(0);
1014 }
1015 
des_xmlAttributeType(int no ATTRIBUTE_UNUSED,xmlAttributeType val ATTRIBUTE_UNUSED,int nr ATTRIBUTE_UNUSED)1016 static void des_xmlAttributeType(int no ATTRIBUTE_UNUSED, xmlAttributeType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1017 }
1018 
1019 #define gen_nb_xmlBufferAllocationScheme 4
gen_xmlBufferAllocationScheme(int no,int nr ATTRIBUTE_UNUSED)1020 static xmlBufferAllocationScheme gen_xmlBufferAllocationScheme(int no, int nr ATTRIBUTE_UNUSED) {
1021     if (no == 1) return(XML_BUFFER_ALLOC_BOUNDED);
1022     if (no == 2) return(XML_BUFFER_ALLOC_DOUBLEIT);
1023     if (no == 3) return(XML_BUFFER_ALLOC_EXACT);
1024     if (no == 4) return(XML_BUFFER_ALLOC_HYBRID);
1025     return(0);
1026 }
1027 
des_xmlBufferAllocationScheme(int no ATTRIBUTE_UNUSED,xmlBufferAllocationScheme val ATTRIBUTE_UNUSED,int nr ATTRIBUTE_UNUSED)1028 static void des_xmlBufferAllocationScheme(int no ATTRIBUTE_UNUSED, xmlBufferAllocationScheme val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1029 }
1030 
desret_xmlBufferAllocationScheme(xmlBufferAllocationScheme val ATTRIBUTE_UNUSED)1031 static void desret_xmlBufferAllocationScheme(xmlBufferAllocationScheme val ATTRIBUTE_UNUSED) {
1032 }
1033 
1034 #ifdef LIBXML_CATALOG_ENABLED
1035 #define gen_nb_xmlCatalogAllow 4
gen_xmlCatalogAllow(int no,int nr ATTRIBUTE_UNUSED)1036 static xmlCatalogAllow gen_xmlCatalogAllow(int no, int nr ATTRIBUTE_UNUSED) {
1037     if (no == 1) return(XML_CATA_ALLOW_ALL);
1038     if (no == 2) return(XML_CATA_ALLOW_DOCUMENT);
1039     if (no == 3) return(XML_CATA_ALLOW_GLOBAL);
1040     if (no == 4) return(XML_CATA_ALLOW_NONE);
1041     return(0);
1042 }
1043 
des_xmlCatalogAllow(int no ATTRIBUTE_UNUSED,xmlCatalogAllow val ATTRIBUTE_UNUSED,int nr ATTRIBUTE_UNUSED)1044 static void des_xmlCatalogAllow(int no ATTRIBUTE_UNUSED, xmlCatalogAllow val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1045 }
1046 
desret_xmlCatalogAllow(xmlCatalogAllow val ATTRIBUTE_UNUSED)1047 static void desret_xmlCatalogAllow(xmlCatalogAllow val ATTRIBUTE_UNUSED) {
1048 }
1049 
1050 #endif
1051 
1052 #ifdef LIBXML_CATALOG_ENABLED
1053 #define gen_nb_xmlCatalogPrefer 3
gen_xmlCatalogPrefer(int no,int nr ATTRIBUTE_UNUSED)1054 static xmlCatalogPrefer gen_xmlCatalogPrefer(int no, int nr ATTRIBUTE_UNUSED) {
1055     if (no == 1) return(XML_CATA_PREFER_NONE);
1056     if (no == 2) return(XML_CATA_PREFER_PUBLIC);
1057     if (no == 3) return(XML_CATA_PREFER_SYSTEM);
1058     return(0);
1059 }
1060 
des_xmlCatalogPrefer(int no ATTRIBUTE_UNUSED,xmlCatalogPrefer val ATTRIBUTE_UNUSED,int nr ATTRIBUTE_UNUSED)1061 static void des_xmlCatalogPrefer(int no ATTRIBUTE_UNUSED, xmlCatalogPrefer val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1062 }
1063 
desret_xmlCatalogPrefer(xmlCatalogPrefer val ATTRIBUTE_UNUSED)1064 static void desret_xmlCatalogPrefer(xmlCatalogPrefer val ATTRIBUTE_UNUSED) {
1065 }
1066 
1067 #endif
1068 
1069 #define gen_nb_xmlElementContentType 4
gen_xmlElementContentType(int no,int nr ATTRIBUTE_UNUSED)1070 static xmlElementContentType gen_xmlElementContentType(int no, int nr ATTRIBUTE_UNUSED) {
1071     if (no == 1) return(XML_ELEMENT_CONTENT_ELEMENT);
1072     if (no == 2) return(XML_ELEMENT_CONTENT_OR);
1073     if (no == 3) return(XML_ELEMENT_CONTENT_PCDATA);
1074     if (no == 4) return(XML_ELEMENT_CONTENT_SEQ);
1075     return(0);
1076 }
1077 
des_xmlElementContentType(int no ATTRIBUTE_UNUSED,xmlElementContentType val ATTRIBUTE_UNUSED,int nr ATTRIBUTE_UNUSED)1078 static void des_xmlElementContentType(int no ATTRIBUTE_UNUSED, xmlElementContentType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1079 }
1080 
1081 #define gen_nb_xmlElementTypeVal 4
gen_xmlElementTypeVal(int no,int nr ATTRIBUTE_UNUSED)1082 static xmlElementTypeVal gen_xmlElementTypeVal(int no, int nr ATTRIBUTE_UNUSED) {
1083     if (no == 1) return(XML_ELEMENT_TYPE_ANY);
1084     if (no == 2) return(XML_ELEMENT_TYPE_ELEMENT);
1085     if (no == 3) return(XML_ELEMENT_TYPE_EMPTY);
1086     if (no == 4) return(XML_ELEMENT_TYPE_MIXED);
1087     return(0);
1088 }
1089 
des_xmlElementTypeVal(int no ATTRIBUTE_UNUSED,xmlElementTypeVal val ATTRIBUTE_UNUSED,int nr ATTRIBUTE_UNUSED)1090 static void des_xmlElementTypeVal(int no ATTRIBUTE_UNUSED, xmlElementTypeVal val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1091 }
1092 
1093 #define gen_nb_xmlFeature 4
gen_xmlFeature(int no,int nr ATTRIBUTE_UNUSED)1094 static xmlFeature gen_xmlFeature(int no, int nr ATTRIBUTE_UNUSED) {
1095     if (no == 1) return(XML_WITH_AUTOMATA);
1096     if (no == 2) return(XML_WITH_C14N);
1097     if (no == 3) return(XML_WITH_CATALOG);
1098     if (no == 4) return(XML_WITH_DEBUG);
1099     return(0);
1100 }
1101 
des_xmlFeature(int no ATTRIBUTE_UNUSED,xmlFeature val ATTRIBUTE_UNUSED,int nr ATTRIBUTE_UNUSED)1102 static void des_xmlFeature(int no ATTRIBUTE_UNUSED, xmlFeature val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1103 }
1104 
desret_xmlParserErrors(xmlParserErrors val ATTRIBUTE_UNUSED)1105 static void desret_xmlParserErrors(xmlParserErrors val ATTRIBUTE_UNUSED) {
1106 }
1107 
1108 #ifdef LIBXML_SCHEMAS_ENABLED
1109 #define gen_nb_xmlSchemaValType 4
gen_xmlSchemaValType(int no,int nr ATTRIBUTE_UNUSED)1110 static xmlSchemaValType gen_xmlSchemaValType(int no, int nr ATTRIBUTE_UNUSED) {
1111     if (no == 1) return(XML_SCHEMAS_ANYSIMPLETYPE);
1112     if (no == 2) return(XML_SCHEMAS_ANYTYPE);
1113     if (no == 3) return(XML_SCHEMAS_ANYURI);
1114     if (no == 4) return(XML_SCHEMAS_BASE64BINARY);
1115     return(0);
1116 }
1117 
des_xmlSchemaValType(int no ATTRIBUTE_UNUSED,xmlSchemaValType val ATTRIBUTE_UNUSED,int nr ATTRIBUTE_UNUSED)1118 static void des_xmlSchemaValType(int no ATTRIBUTE_UNUSED, xmlSchemaValType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1119 }
1120 
desret_xmlSchemaValType(xmlSchemaValType val ATTRIBUTE_UNUSED)1121 static void desret_xmlSchemaValType(xmlSchemaValType val ATTRIBUTE_UNUSED) {
1122 }
1123 
1124 #endif
1125 
1126 #ifdef LIBXML_SCHEMAS_ENABLED
1127 #define gen_nb_xmlSchemaWhitespaceValueType 4
gen_xmlSchemaWhitespaceValueType(int no,int nr ATTRIBUTE_UNUSED)1128 static xmlSchemaWhitespaceValueType gen_xmlSchemaWhitespaceValueType(int no, int nr ATTRIBUTE_UNUSED) {
1129     if (no == 1) return(XML_SCHEMA_WHITESPACE_COLLAPSE);
1130     if (no == 2) return(XML_SCHEMA_WHITESPACE_PRESERVE);
1131     if (no == 3) return(XML_SCHEMA_WHITESPACE_REPLACE);
1132     if (no == 4) return(XML_SCHEMA_WHITESPACE_UNKNOWN);
1133     return(0);
1134 }
1135 
des_xmlSchemaWhitespaceValueType(int no ATTRIBUTE_UNUSED,xmlSchemaWhitespaceValueType val ATTRIBUTE_UNUSED,int nr ATTRIBUTE_UNUSED)1136 static void des_xmlSchemaWhitespaceValueType(int no ATTRIBUTE_UNUSED, xmlSchemaWhitespaceValueType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1137 }
1138 
1139 #endif
1140 
1141 #include <libxml/HTMLparser.h>
1142 #include <libxml/HTMLtree.h>
1143 #include <libxml/SAX2.h>
1144 #include <libxml/c14n.h>
1145 #include <libxml/catalog.h>
1146 #include <libxml/chvalid.h>
1147 #include <libxml/debugXML.h>
1148 #include <libxml/dict.h>
1149 #include <libxml/encoding.h>
1150 #include <libxml/entities.h>
1151 #include <libxml/hash.h>
1152 #include <libxml/list.h>
1153 #include <libxml/nanohttp.h>
1154 #include <libxml/parser.h>
1155 #include <libxml/parserInternals.h>
1156 #include <libxml/pattern.h>
1157 #include <libxml/relaxng.h>
1158 #include <libxml/schemasInternals.h>
1159 #include <libxml/schematron.h>
1160 #include <libxml/tree.h>
1161 #include <libxml/uri.h>
1162 #include <libxml/valid.h>
1163 #include <libxml/xinclude.h>
1164 #include <libxml/xmlIO.h>
1165 #include <libxml/xmlautomata.h>
1166 #include <libxml/xmlerror.h>
1167 #include <libxml/xmlmodule.h>
1168 #include <libxml/xmlreader.h>
1169 #include <libxml/xmlregexp.h>
1170 #include <libxml/xmlsave.h>
1171 #include <libxml/xmlschemas.h>
1172 #include <libxml/xmlschemastypes.h>
1173 #include <libxml/xmlstring.h>
1174 #include <libxml/xmlwriter.h>
1175 #include <libxml/xpath.h>
1176 #include <libxml/xpathInternals.h>
1177 #include <libxml/xpointer.h>
1178 static int test_HTMLparser(void);
1179 static int test_HTMLtree(void);
1180 static int test_SAX2(void);
1181 static int test_c14n(void);
1182 static int test_catalog(void);
1183 static int test_chvalid(void);
1184 static int test_debugXML(void);
1185 static int test_dict(void);
1186 static int test_encoding(void);
1187 static int test_entities(void);
1188 static int test_hash(void);
1189 static int test_list(void);
1190 static int test_nanohttp(void);
1191 static int test_parser(void);
1192 static int test_parserInternals(void);
1193 static int test_pattern(void);
1194 static int test_relaxng(void);
1195 static int test_schemasInternals(void);
1196 static int test_schematron(void);
1197 static int test_tree(void);
1198 static int test_uri(void);
1199 static int test_valid(void);
1200 static int test_xinclude(void);
1201 static int test_xmlIO(void);
1202 static int test_xmlautomata(void);
1203 static int test_xmlerror(void);
1204 static int test_xmlmodule(void);
1205 static int test_xmlreader(void);
1206 static int test_xmlregexp(void);
1207 static int test_xmlsave(void);
1208 static int test_xmlschemas(void);
1209 static int test_xmlschemastypes(void);
1210 static int test_xmlstring(void);
1211 static int test_xmlwriter(void);
1212 static int test_xpath(void);
1213 static int test_xpathInternals(void);
1214 static int test_xpointer(void);
1215 
1216 /**
1217  * testlibxml2:
1218  *
1219  * Main entry point of the tester for the full libxml2 module,
1220  * it calls all the tester entry point for each module.
1221  *
1222  * Returns the number of error found
1223  */
1224 static int
testlibxml2(void)1225 testlibxml2(void)
1226 {
1227     int test_ret = 0;
1228 
1229     test_ret += test_HTMLparser();
1230     test_ret += test_HTMLtree();
1231     test_ret += test_SAX2();
1232     test_ret += test_c14n();
1233     test_ret += test_catalog();
1234     test_ret += test_chvalid();
1235     test_ret += test_debugXML();
1236     test_ret += test_dict();
1237     test_ret += test_encoding();
1238     test_ret += test_entities();
1239     test_ret += test_hash();
1240     test_ret += test_list();
1241     test_ret += test_nanohttp();
1242     test_ret += test_parser();
1243     test_ret += test_parserInternals();
1244     test_ret += test_pattern();
1245     test_ret += test_relaxng();
1246     test_ret += test_schemasInternals();
1247     test_ret += test_schematron();
1248     test_ret += test_tree();
1249     test_ret += test_uri();
1250     test_ret += test_valid();
1251     test_ret += test_xinclude();
1252     test_ret += test_xmlIO();
1253     test_ret += test_xmlautomata();
1254     test_ret += test_xmlerror();
1255     test_ret += test_xmlmodule();
1256     test_ret += test_xmlreader();
1257     test_ret += test_xmlregexp();
1258     test_ret += test_xmlsave();
1259     test_ret += test_xmlschemas();
1260     test_ret += test_xmlschemastypes();
1261     test_ret += test_xmlstring();
1262     test_ret += test_xmlwriter();
1263     test_ret += test_xpath();
1264     test_ret += test_xpathInternals();
1265     test_ret += test_xpointer();
1266 
1267     printf("Total: %d functions, %d tests, %d errors\n",
1268            function_tests, call_tests, test_ret);
1269     return(test_ret);
1270 }
1271 
1272 
1273 static int
test_UTF8ToHtml(void)1274 test_UTF8ToHtml(void) {
1275     int test_ret = 0;
1276 
1277 #if defined(LIBXML_HTML_ENABLED)
1278     int mem_base;
1279     int ret_val;
1280     unsigned char * out; /* a pointer to an array of bytes to store the result */
1281     int n_out;
1282     int * outlen; /* the length of @out */
1283     int n_outlen;
1284     const unsigned char * in; /* a pointer to an array of UTF-8 chars */
1285     int n_in;
1286     int * inlen; /* the length of @in */
1287     int n_inlen;
1288 
1289     for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
1290     for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
1291     for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
1292     for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
1293         mem_base = xmlMemBlocks();
1294         out = gen_unsigned_char_ptr(n_out, 0);
1295         outlen = gen_int_ptr(n_outlen, 1);
1296         in = gen_const_unsigned_char_ptr(n_in, 2);
1297         inlen = gen_int_ptr(n_inlen, 3);
1298 
1299         ret_val = UTF8ToHtml(out, outlen, in, inlen);
1300         desret_int(ret_val);
1301         call_tests++;
1302         des_unsigned_char_ptr(n_out, out, 0);
1303         des_int_ptr(n_outlen, outlen, 1);
1304         des_const_unsigned_char_ptr(n_in, in, 2);
1305         des_int_ptr(n_inlen, inlen, 3);
1306         xmlResetLastError();
1307         if (mem_base != xmlMemBlocks()) {
1308             printf("Leak of %d blocks found in UTF8ToHtml",
1309 	           xmlMemBlocks() - mem_base);
1310 	    test_ret++;
1311             printf(" %d", n_out);
1312             printf(" %d", n_outlen);
1313             printf(" %d", n_in);
1314             printf(" %d", n_inlen);
1315             printf("\n");
1316         }
1317     }
1318     }
1319     }
1320     }
1321     function_tests++;
1322 #endif
1323 
1324     return(test_ret);
1325 }
1326 
1327 #ifdef LIBXML_HTML_ENABLED
1328 
1329 #define gen_nb_const_htmlElemDesc_ptr 1
1330 #define gen_const_htmlElemDesc_ptr(no, nr) NULL
1331 #define des_const_htmlElemDesc_ptr(no, val, nr)
1332 #endif
1333 
1334 
1335 static int
test_htmlAttrAllowed(void)1336 test_htmlAttrAllowed(void) {
1337     int test_ret = 0;
1338 
1339 #if defined(LIBXML_HTML_ENABLED)
1340     int mem_base;
1341     htmlStatus ret_val;
1342     const htmlElemDesc * elt; /* HTML element */
1343     int n_elt;
1344     const xmlChar * attr; /* HTML attribute */
1345     int n_attr;
1346     int legacy; /* whether to allow deprecated attributes */
1347     int n_legacy;
1348 
1349     for (n_elt = 0;n_elt < gen_nb_const_htmlElemDesc_ptr;n_elt++) {
1350     for (n_attr = 0;n_attr < gen_nb_const_xmlChar_ptr;n_attr++) {
1351     for (n_legacy = 0;n_legacy < gen_nb_int;n_legacy++) {
1352         mem_base = xmlMemBlocks();
1353         elt = gen_const_htmlElemDesc_ptr(n_elt, 0);
1354         attr = gen_const_xmlChar_ptr(n_attr, 1);
1355         legacy = gen_int(n_legacy, 2);
1356 
1357         ret_val = htmlAttrAllowed(elt, attr, legacy);
1358         desret_htmlStatus(ret_val);
1359         call_tests++;
1360         des_const_htmlElemDesc_ptr(n_elt, elt, 0);
1361         des_const_xmlChar_ptr(n_attr, attr, 1);
1362         des_int(n_legacy, legacy, 2);
1363         xmlResetLastError();
1364         if (mem_base != xmlMemBlocks()) {
1365             printf("Leak of %d blocks found in htmlAttrAllowed",
1366 	           xmlMemBlocks() - mem_base);
1367 	    test_ret++;
1368             printf(" %d", n_elt);
1369             printf(" %d", n_attr);
1370             printf(" %d", n_legacy);
1371             printf("\n");
1372         }
1373     }
1374     }
1375     }
1376     function_tests++;
1377 #endif
1378 
1379     return(test_ret);
1380 }
1381 
1382 #ifdef LIBXML_HTML_ENABLED
1383 
1384 #define gen_nb_htmlNodePtr 1
1385 #define gen_htmlNodePtr(no, nr) NULL
1386 #define des_htmlNodePtr(no, val, nr)
1387 #endif
1388 
1389 
1390 static int
test_htmlAutoCloseTag(void)1391 test_htmlAutoCloseTag(void) {
1392     int test_ret = 0;
1393 
1394 #if defined(LIBXML_HTML_ENABLED)
1395     int mem_base;
1396     int ret_val;
1397     htmlDocPtr doc; /* the HTML document */
1398     int n_doc;
1399     const xmlChar * name; /* The tag name */
1400     int n_name;
1401     htmlNodePtr elem; /* the HTML element */
1402     int n_elem;
1403 
1404     for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) {
1405     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
1406     for (n_elem = 0;n_elem < gen_nb_htmlNodePtr;n_elem++) {
1407         mem_base = xmlMemBlocks();
1408         doc = gen_htmlDocPtr(n_doc, 0);
1409         name = gen_const_xmlChar_ptr(n_name, 1);
1410         elem = gen_htmlNodePtr(n_elem, 2);
1411 
1412         ret_val = htmlAutoCloseTag(doc, name, elem);
1413         desret_int(ret_val);
1414         call_tests++;
1415         des_htmlDocPtr(n_doc, doc, 0);
1416         des_const_xmlChar_ptr(n_name, name, 1);
1417         des_htmlNodePtr(n_elem, elem, 2);
1418         xmlResetLastError();
1419         if (mem_base != xmlMemBlocks()) {
1420             printf("Leak of %d blocks found in htmlAutoCloseTag",
1421 	           xmlMemBlocks() - mem_base);
1422 	    test_ret++;
1423             printf(" %d", n_doc);
1424             printf(" %d", n_name);
1425             printf(" %d", n_elem);
1426             printf("\n");
1427         }
1428     }
1429     }
1430     }
1431     function_tests++;
1432 #endif
1433 
1434     return(test_ret);
1435 }
1436 
1437 
1438 static int
test_htmlCreateFileParserCtxt(void)1439 test_htmlCreateFileParserCtxt(void) {
1440     int test_ret = 0;
1441 
1442 #if defined(LIBXML_HTML_ENABLED)
1443     int mem_base;
1444     htmlParserCtxtPtr ret_val;
1445     const char * filename; /* the filename */
1446     int n_filename;
1447     const char * encoding; /* optional encoding */
1448     int n_encoding;
1449 
1450     for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
1451     for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
1452         mem_base = xmlMemBlocks();
1453         filename = gen_fileoutput(n_filename, 0);
1454         encoding = gen_const_char_ptr(n_encoding, 1);
1455 
1456         ret_val = htmlCreateFileParserCtxt(filename, encoding);
1457         desret_htmlParserCtxtPtr(ret_val);
1458         call_tests++;
1459         des_fileoutput(n_filename, filename, 0);
1460         des_const_char_ptr(n_encoding, encoding, 1);
1461         xmlResetLastError();
1462         if (mem_base != xmlMemBlocks()) {
1463             printf("Leak of %d blocks found in htmlCreateFileParserCtxt",
1464 	           xmlMemBlocks() - mem_base);
1465 	    test_ret++;
1466             printf(" %d", n_filename);
1467             printf(" %d", n_encoding);
1468             printf("\n");
1469         }
1470     }
1471     }
1472     function_tests++;
1473 #endif
1474 
1475     return(test_ret);
1476 }
1477 
1478 
1479 static int
test_htmlCreateMemoryParserCtxt(void)1480 test_htmlCreateMemoryParserCtxt(void) {
1481     int test_ret = 0;
1482 
1483 #if defined(LIBXML_HTML_ENABLED)
1484     int mem_base;
1485     htmlParserCtxtPtr ret_val;
1486     const char * buffer; /* a pointer to a char array */
1487     int n_buffer;
1488     int size; /* the size of the array */
1489     int n_size;
1490 
1491     for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
1492     for (n_size = 0;n_size < gen_nb_int;n_size++) {
1493         mem_base = xmlMemBlocks();
1494         buffer = gen_const_char_ptr(n_buffer, 0);
1495         size = gen_int(n_size, 1);
1496         if ((buffer != NULL) &&
1497             (size > xmlStrlen(BAD_CAST buffer)))
1498             size = 0;
1499 
1500         ret_val = htmlCreateMemoryParserCtxt(buffer, size);
1501         desret_htmlParserCtxtPtr(ret_val);
1502         call_tests++;
1503         des_const_char_ptr(n_buffer, buffer, 0);
1504         des_int(n_size, size, 1);
1505         xmlResetLastError();
1506         if (mem_base != xmlMemBlocks()) {
1507             printf("Leak of %d blocks found in htmlCreateMemoryParserCtxt",
1508 	           xmlMemBlocks() - mem_base);
1509 	    test_ret++;
1510             printf(" %d", n_buffer);
1511             printf(" %d", n_size);
1512             printf("\n");
1513         }
1514     }
1515     }
1516     function_tests++;
1517 #endif
1518 
1519     return(test_ret);
1520 }
1521 
1522 #ifdef LIBXML_HTML_ENABLED
1523 
1524 #define gen_nb_htmlSAXHandlerPtr 1
1525 #define gen_htmlSAXHandlerPtr(no, nr) NULL
1526 #define des_htmlSAXHandlerPtr(no, val, nr)
1527 #endif
1528 
1529 
1530 static int
test_htmlCreatePushParserCtxt(void)1531 test_htmlCreatePushParserCtxt(void) {
1532     int test_ret = 0;
1533 
1534 #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_PUSH_ENABLED)
1535     int mem_base;
1536     htmlParserCtxtPtr ret_val;
1537     htmlSAXHandlerPtr sax; /* a SAX handler (optional) */
1538     int n_sax;
1539     void * user_data; /* The user data returned on SAX callbacks (optional) */
1540     int n_user_data;
1541     const char * chunk; /* a pointer to an array of chars (optional) */
1542     int n_chunk;
1543     int size; /* number of chars in the array */
1544     int n_size;
1545     const char * filename; /* only used for error reporting (optional) */
1546     int n_filename;
1547     xmlCharEncoding enc; /* encoding (deprecated, pass XML_CHAR_ENCODING_NONE) */
1548     int n_enc;
1549 
1550     for (n_sax = 0;n_sax < gen_nb_htmlSAXHandlerPtr;n_sax++) {
1551     for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
1552     for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
1553     for (n_size = 0;n_size < gen_nb_int;n_size++) {
1554     for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
1555     for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
1556         mem_base = xmlMemBlocks();
1557         sax = gen_htmlSAXHandlerPtr(n_sax, 0);
1558         user_data = gen_userdata(n_user_data, 1);
1559         chunk = gen_const_char_ptr(n_chunk, 2);
1560         size = gen_int(n_size, 3);
1561         filename = gen_fileoutput(n_filename, 4);
1562         enc = gen_xmlCharEncoding(n_enc, 5);
1563         if ((chunk != NULL) &&
1564             (size > xmlStrlen(BAD_CAST chunk)))
1565             size = 0;
1566 
1567         ret_val = htmlCreatePushParserCtxt(sax, user_data, chunk, size, filename, enc);
1568         desret_htmlParserCtxtPtr(ret_val);
1569         call_tests++;
1570         des_htmlSAXHandlerPtr(n_sax, sax, 0);
1571         des_userdata(n_user_data, user_data, 1);
1572         des_const_char_ptr(n_chunk, chunk, 2);
1573         des_int(n_size, size, 3);
1574         des_fileoutput(n_filename, filename, 4);
1575         des_xmlCharEncoding(n_enc, enc, 5);
1576         xmlResetLastError();
1577         if (mem_base != xmlMemBlocks()) {
1578             printf("Leak of %d blocks found in htmlCreatePushParserCtxt",
1579 	           xmlMemBlocks() - mem_base);
1580 	    test_ret++;
1581             printf(" %d", n_sax);
1582             printf(" %d", n_user_data);
1583             printf(" %d", n_chunk);
1584             printf(" %d", n_size);
1585             printf(" %d", n_filename);
1586             printf(" %d", n_enc);
1587             printf("\n");
1588         }
1589     }
1590     }
1591     }
1592     }
1593     }
1594     }
1595     function_tests++;
1596 #endif
1597 
1598     return(test_ret);
1599 }
1600 
1601 
1602 static int
test_htmlCtxtParseDocument(void)1603 test_htmlCtxtParseDocument(void) {
1604     int test_ret = 0;
1605 
1606 #if defined(LIBXML_HTML_ENABLED)
1607     int mem_base;
1608     htmlDocPtr ret_val;
1609     htmlParserCtxtPtr ctxt; /* an HTML parser context */
1610     int n_ctxt;
1611     xmlParserInputPtr input; /* parser input */
1612     int n_input;
1613 
1614     for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
1615     for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) {
1616         mem_base = xmlMemBlocks();
1617         ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
1618         input = gen_xmlParserInputPtr(n_input, 1);
1619 
1620         ret_val = htmlCtxtParseDocument(ctxt, input);
1621         desret_htmlDocPtr(ret_val);
1622         call_tests++;
1623         des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
1624         des_xmlParserInputPtr(n_input, input, 1);
1625         xmlResetLastError();
1626         if (mem_base != xmlMemBlocks()) {
1627             printf("Leak of %d blocks found in htmlCtxtParseDocument",
1628 	           xmlMemBlocks() - mem_base);
1629 	    test_ret++;
1630             printf(" %d", n_ctxt);
1631             printf(" %d", n_input);
1632             printf("\n");
1633         }
1634     }
1635     }
1636     function_tests++;
1637 #endif
1638 
1639     return(test_ret);
1640 }
1641 
1642 
1643 static int
test_htmlCtxtReadDoc(void)1644 test_htmlCtxtReadDoc(void) {
1645     int test_ret = 0;
1646 
1647 #if defined(LIBXML_HTML_ENABLED)
1648     int mem_base;
1649     htmlDocPtr ret_val;
1650     htmlParserCtxtPtr ctxt; /* an HTML parser context */
1651     int n_ctxt;
1652     const xmlChar * str; /* a pointer to a zero terminated string */
1653     int n_str;
1654     const char * URL; /* only used for error reporting (optional) */
1655     int n_URL;
1656     const char * encoding; /* the document encoding (optional) */
1657     int n_encoding;
1658     int options; /* a combination of htmlParserOptions */
1659     int n_options;
1660 
1661     for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
1662     for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
1663     for (n_URL = 0;n_URL < gen_nb_const_char_ptr;n_URL++) {
1664     for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
1665     for (n_options = 0;n_options < gen_nb_int;n_options++) {
1666         mem_base = xmlMemBlocks();
1667         ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
1668         str = gen_const_xmlChar_ptr(n_str, 1);
1669         URL = gen_const_char_ptr(n_URL, 2);
1670         encoding = gen_const_char_ptr(n_encoding, 3);
1671         options = gen_int(n_options, 4);
1672 
1673         ret_val = htmlCtxtReadDoc(ctxt, str, URL, encoding, options);
1674         desret_htmlDocPtr(ret_val);
1675         call_tests++;
1676         des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
1677         des_const_xmlChar_ptr(n_str, str, 1);
1678         des_const_char_ptr(n_URL, URL, 2);
1679         des_const_char_ptr(n_encoding, encoding, 3);
1680         des_int(n_options, options, 4);
1681         xmlResetLastError();
1682         if (mem_base != xmlMemBlocks()) {
1683             printf("Leak of %d blocks found in htmlCtxtReadDoc",
1684 	           xmlMemBlocks() - mem_base);
1685 	    test_ret++;
1686             printf(" %d", n_ctxt);
1687             printf(" %d", n_str);
1688             printf(" %d", n_URL);
1689             printf(" %d", n_encoding);
1690             printf(" %d", n_options);
1691             printf("\n");
1692         }
1693     }
1694     }
1695     }
1696     }
1697     }
1698     function_tests++;
1699 #endif
1700 
1701     return(test_ret);
1702 }
1703 
1704 
1705 static int
test_htmlCtxtReadFile(void)1706 test_htmlCtxtReadFile(void) {
1707     int test_ret = 0;
1708 
1709 #if defined(LIBXML_HTML_ENABLED)
1710     htmlDocPtr ret_val;
1711     htmlParserCtxtPtr ctxt; /* an HTML parser context */
1712     int n_ctxt;
1713     const char * filename; /* a file or URL */
1714     int n_filename;
1715     const char * encoding; /* the document encoding (optional) */
1716     int n_encoding;
1717     int options; /* a combination of htmlParserOptions */
1718     int n_options;
1719 
1720     for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
1721     for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
1722     for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
1723     for (n_options = 0;n_options < gen_nb_int;n_options++) {
1724         ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
1725         filename = gen_filepath(n_filename, 1);
1726         encoding = gen_const_char_ptr(n_encoding, 2);
1727         options = gen_int(n_options, 3);
1728 
1729         ret_val = htmlCtxtReadFile(ctxt, filename, encoding, options);
1730         desret_htmlDocPtr(ret_val);
1731         call_tests++;
1732         des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
1733         des_filepath(n_filename, filename, 1);
1734         des_const_char_ptr(n_encoding, encoding, 2);
1735         des_int(n_options, options, 3);
1736         xmlResetLastError();
1737     }
1738     }
1739     }
1740     }
1741     function_tests++;
1742 #endif
1743 
1744     return(test_ret);
1745 }
1746 
1747 
1748 static int
test_htmlCtxtReadMemory(void)1749 test_htmlCtxtReadMemory(void) {
1750     int test_ret = 0;
1751 
1752 #if defined(LIBXML_HTML_ENABLED)
1753     int mem_base;
1754     htmlDocPtr ret_val;
1755     htmlParserCtxtPtr ctxt; /* an HTML parser context */
1756     int n_ctxt;
1757     const char * buffer; /* a pointer to a char array */
1758     int n_buffer;
1759     int size; /* the size of the array */
1760     int n_size;
1761     const char * URL; /* only used for error reporting (optional) */
1762     int n_URL;
1763     const char * encoding; /* the document encoding (optinal) */
1764     int n_encoding;
1765     int options; /* a combination of htmlParserOptions */
1766     int n_options;
1767 
1768     for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
1769     for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
1770     for (n_size = 0;n_size < gen_nb_int;n_size++) {
1771     for (n_URL = 0;n_URL < gen_nb_const_char_ptr;n_URL++) {
1772     for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
1773     for (n_options = 0;n_options < gen_nb_int;n_options++) {
1774         mem_base = xmlMemBlocks();
1775         ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
1776         buffer = gen_const_char_ptr(n_buffer, 1);
1777         size = gen_int(n_size, 2);
1778         URL = gen_const_char_ptr(n_URL, 3);
1779         encoding = gen_const_char_ptr(n_encoding, 4);
1780         options = gen_int(n_options, 5);
1781         if ((buffer != NULL) &&
1782             (size > xmlStrlen(BAD_CAST buffer)))
1783             size = 0;
1784 
1785         ret_val = htmlCtxtReadMemory(ctxt, buffer, size, URL, encoding, options);
1786         desret_htmlDocPtr(ret_val);
1787         call_tests++;
1788         des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
1789         des_const_char_ptr(n_buffer, buffer, 1);
1790         des_int(n_size, size, 2);
1791         des_const_char_ptr(n_URL, URL, 3);
1792         des_const_char_ptr(n_encoding, encoding, 4);
1793         des_int(n_options, options, 5);
1794         xmlResetLastError();
1795         if (mem_base != xmlMemBlocks()) {
1796             printf("Leak of %d blocks found in htmlCtxtReadMemory",
1797 	           xmlMemBlocks() - mem_base);
1798 	    test_ret++;
1799             printf(" %d", n_ctxt);
1800             printf(" %d", n_buffer);
1801             printf(" %d", n_size);
1802             printf(" %d", n_URL);
1803             printf(" %d", n_encoding);
1804             printf(" %d", n_options);
1805             printf("\n");
1806         }
1807     }
1808     }
1809     }
1810     }
1811     }
1812     }
1813     function_tests++;
1814 #endif
1815 
1816     return(test_ret);
1817 }
1818 
1819 
1820 static int
test_htmlCtxtReset(void)1821 test_htmlCtxtReset(void) {
1822     int test_ret = 0;
1823 
1824 #if defined(LIBXML_HTML_ENABLED)
1825     int mem_base;
1826     htmlParserCtxtPtr ctxt; /* an HTML parser context */
1827     int n_ctxt;
1828 
1829     for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
1830         mem_base = xmlMemBlocks();
1831         ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
1832 
1833         htmlCtxtReset(ctxt);
1834         call_tests++;
1835         des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
1836         xmlResetLastError();
1837         if (mem_base != xmlMemBlocks()) {
1838             printf("Leak of %d blocks found in htmlCtxtReset",
1839 	           xmlMemBlocks() - mem_base);
1840 	    test_ret++;
1841             printf(" %d", n_ctxt);
1842             printf("\n");
1843         }
1844     }
1845     function_tests++;
1846 #endif
1847 
1848     return(test_ret);
1849 }
1850 
1851 
1852 static int
test_htmlCtxtUseOptions(void)1853 test_htmlCtxtUseOptions(void) {
1854     int test_ret = 0;
1855 
1856 #if defined(LIBXML_HTML_ENABLED)
1857     int mem_base;
1858     int ret_val;
1859     htmlParserCtxtPtr ctxt; /* an HTML parser context */
1860     int n_ctxt;
1861     int options; /* a combination of htmlParserOption(s) */
1862     int n_options;
1863 
1864     for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
1865     for (n_options = 0;n_options < gen_nb_int;n_options++) {
1866         mem_base = xmlMemBlocks();
1867         ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
1868         options = gen_int(n_options, 1);
1869 
1870         ret_val = htmlCtxtUseOptions(ctxt, options);
1871         desret_int(ret_val);
1872         call_tests++;
1873         des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
1874         des_int(n_options, options, 1);
1875         xmlResetLastError();
1876         if (mem_base != xmlMemBlocks()) {
1877             printf("Leak of %d blocks found in htmlCtxtUseOptions",
1878 	           xmlMemBlocks() - mem_base);
1879 	    test_ret++;
1880             printf(" %d", n_ctxt);
1881             printf(" %d", n_options);
1882             printf("\n");
1883         }
1884     }
1885     }
1886     function_tests++;
1887 #endif
1888 
1889     return(test_ret);
1890 }
1891 
1892 
1893 static int
test_htmlElementAllowedHere(void)1894 test_htmlElementAllowedHere(void) {
1895     int test_ret = 0;
1896 
1897 #if defined(LIBXML_HTML_ENABLED)
1898     int mem_base;
1899     int ret_val;
1900     const htmlElemDesc * parent; /* HTML parent element */
1901     int n_parent;
1902     const xmlChar * elt; /* HTML element */
1903     int n_elt;
1904 
1905     for (n_parent = 0;n_parent < gen_nb_const_htmlElemDesc_ptr;n_parent++) {
1906     for (n_elt = 0;n_elt < gen_nb_const_xmlChar_ptr;n_elt++) {
1907         mem_base = xmlMemBlocks();
1908         parent = gen_const_htmlElemDesc_ptr(n_parent, 0);
1909         elt = gen_const_xmlChar_ptr(n_elt, 1);
1910 
1911         ret_val = htmlElementAllowedHere(parent, elt);
1912         desret_int(ret_val);
1913         call_tests++;
1914         des_const_htmlElemDesc_ptr(n_parent, parent, 0);
1915         des_const_xmlChar_ptr(n_elt, elt, 1);
1916         xmlResetLastError();
1917         if (mem_base != xmlMemBlocks()) {
1918             printf("Leak of %d blocks found in htmlElementAllowedHere",
1919 	           xmlMemBlocks() - mem_base);
1920 	    test_ret++;
1921             printf(" %d", n_parent);
1922             printf(" %d", n_elt);
1923             printf("\n");
1924         }
1925     }
1926     }
1927     function_tests++;
1928 #endif
1929 
1930     return(test_ret);
1931 }
1932 
1933 
1934 static int
test_htmlElementStatusHere(void)1935 test_htmlElementStatusHere(void) {
1936     int test_ret = 0;
1937 
1938 #if defined(LIBXML_HTML_ENABLED)
1939     int mem_base;
1940     htmlStatus ret_val;
1941     const htmlElemDesc * parent; /* HTML parent element */
1942     int n_parent;
1943     const htmlElemDesc * elt; /* HTML element */
1944     int n_elt;
1945 
1946     for (n_parent = 0;n_parent < gen_nb_const_htmlElemDesc_ptr;n_parent++) {
1947     for (n_elt = 0;n_elt < gen_nb_const_htmlElemDesc_ptr;n_elt++) {
1948         mem_base = xmlMemBlocks();
1949         parent = gen_const_htmlElemDesc_ptr(n_parent, 0);
1950         elt = gen_const_htmlElemDesc_ptr(n_elt, 1);
1951 
1952         ret_val = htmlElementStatusHere(parent, elt);
1953         desret_htmlStatus(ret_val);
1954         call_tests++;
1955         des_const_htmlElemDesc_ptr(n_parent, parent, 0);
1956         des_const_htmlElemDesc_ptr(n_elt, elt, 1);
1957         xmlResetLastError();
1958         if (mem_base != xmlMemBlocks()) {
1959             printf("Leak of %d blocks found in htmlElementStatusHere",
1960 	           xmlMemBlocks() - mem_base);
1961 	    test_ret++;
1962             printf(" %d", n_parent);
1963             printf(" %d", n_elt);
1964             printf("\n");
1965         }
1966     }
1967     }
1968     function_tests++;
1969 #endif
1970 
1971     return(test_ret);
1972 }
1973 
1974 
1975 static int
test_htmlEncodeEntities(void)1976 test_htmlEncodeEntities(void) {
1977     int test_ret = 0;
1978 
1979 #if defined(LIBXML_HTML_ENABLED)
1980     int mem_base;
1981     int ret_val;
1982     unsigned char * out; /* a pointer to an array of bytes to store the result */
1983     int n_out;
1984     int * outlen; /* the length of @out */
1985     int n_outlen;
1986     const unsigned char * in; /* a pointer to an array of UTF-8 chars */
1987     int n_in;
1988     int * inlen; /* the length of @in */
1989     int n_inlen;
1990     int quoteChar; /* the quote character to escape (' or ") or zero. */
1991     int n_quoteChar;
1992 
1993     for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
1994     for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
1995     for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
1996     for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
1997     for (n_quoteChar = 0;n_quoteChar < gen_nb_int;n_quoteChar++) {
1998         mem_base = xmlMemBlocks();
1999         out = gen_unsigned_char_ptr(n_out, 0);
2000         outlen = gen_int_ptr(n_outlen, 1);
2001         in = gen_const_unsigned_char_ptr(n_in, 2);
2002         inlen = gen_int_ptr(n_inlen, 3);
2003         quoteChar = gen_int(n_quoteChar, 4);
2004 
2005         ret_val = htmlEncodeEntities(out, outlen, in, inlen, quoteChar);
2006         desret_int(ret_val);
2007         call_tests++;
2008         des_unsigned_char_ptr(n_out, out, 0);
2009         des_int_ptr(n_outlen, outlen, 1);
2010         des_const_unsigned_char_ptr(n_in, in, 2);
2011         des_int_ptr(n_inlen, inlen, 3);
2012         des_int(n_quoteChar, quoteChar, 4);
2013         xmlResetLastError();
2014         if (mem_base != xmlMemBlocks()) {
2015             printf("Leak of %d blocks found in htmlEncodeEntities",
2016 	           xmlMemBlocks() - mem_base);
2017 	    test_ret++;
2018             printf(" %d", n_out);
2019             printf(" %d", n_outlen);
2020             printf(" %d", n_in);
2021             printf(" %d", n_inlen);
2022             printf(" %d", n_quoteChar);
2023             printf("\n");
2024         }
2025     }
2026     }
2027     }
2028     }
2029     }
2030     function_tests++;
2031 #endif
2032 
2033     return(test_ret);
2034 }
2035 
2036 
2037 static int
test_htmlEntityLookup(void)2038 test_htmlEntityLookup(void) {
2039     int test_ret = 0;
2040 
2041 #if defined(LIBXML_HTML_ENABLED)
2042     int mem_base;
2043     const htmlEntityDesc * ret_val;
2044     const xmlChar * name; /* the entity name */
2045     int n_name;
2046 
2047     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
2048         mem_base = xmlMemBlocks();
2049         name = gen_const_xmlChar_ptr(n_name, 0);
2050 
2051         ret_val = htmlEntityLookup(name);
2052         desret_const_htmlEntityDesc_ptr(ret_val);
2053         call_tests++;
2054         des_const_xmlChar_ptr(n_name, name, 0);
2055         xmlResetLastError();
2056         if (mem_base != xmlMemBlocks()) {
2057             printf("Leak of %d blocks found in htmlEntityLookup",
2058 	           xmlMemBlocks() - mem_base);
2059 	    test_ret++;
2060             printf(" %d", n_name);
2061             printf("\n");
2062         }
2063     }
2064     function_tests++;
2065 #endif
2066 
2067     return(test_ret);
2068 }
2069 
2070 
2071 static int
test_htmlEntityValueLookup(void)2072 test_htmlEntityValueLookup(void) {
2073     int test_ret = 0;
2074 
2075 #if defined(LIBXML_HTML_ENABLED)
2076     int mem_base;
2077     const htmlEntityDesc * ret_val;
2078     unsigned int value; /* the entity's unicode value */
2079     int n_value;
2080 
2081     for (n_value = 0;n_value < gen_nb_unsigned_int;n_value++) {
2082         mem_base = xmlMemBlocks();
2083         value = gen_unsigned_int(n_value, 0);
2084 
2085         ret_val = htmlEntityValueLookup(value);
2086         desret_const_htmlEntityDesc_ptr(ret_val);
2087         call_tests++;
2088         des_unsigned_int(n_value, value, 0);
2089         xmlResetLastError();
2090         if (mem_base != xmlMemBlocks()) {
2091             printf("Leak of %d blocks found in htmlEntityValueLookup",
2092 	           xmlMemBlocks() - mem_base);
2093 	    test_ret++;
2094             printf(" %d", n_value);
2095             printf("\n");
2096         }
2097     }
2098     function_tests++;
2099 #endif
2100 
2101     return(test_ret);
2102 }
2103 
2104 
2105 static int
test_htmlHandleOmittedElem(void)2106 test_htmlHandleOmittedElem(void) {
2107     int test_ret = 0;
2108 
2109 #if defined(LIBXML_HTML_ENABLED)
2110     int mem_base;
2111     int ret_val;
2112     int val; /* int 0 or 1 */
2113     int n_val;
2114 
2115     for (n_val = 0;n_val < gen_nb_int;n_val++) {
2116         mem_base = xmlMemBlocks();
2117         val = gen_int(n_val, 0);
2118 
2119         ret_val = htmlHandleOmittedElem(val);
2120         desret_int(ret_val);
2121         call_tests++;
2122         des_int(n_val, val, 0);
2123         xmlResetLastError();
2124         if (mem_base != xmlMemBlocks()) {
2125             printf("Leak of %d blocks found in htmlHandleOmittedElem",
2126 	           xmlMemBlocks() - mem_base);
2127 	    test_ret++;
2128             printf(" %d", n_val);
2129             printf("\n");
2130         }
2131     }
2132     function_tests++;
2133 #endif
2134 
2135     return(test_ret);
2136 }
2137 
2138 
2139 static int
test_htmlInitAutoClose(void)2140 test_htmlInitAutoClose(void) {
2141     int test_ret = 0;
2142 
2143 #if defined(LIBXML_HTML_ENABLED)
2144     int mem_base;
2145 
2146         mem_base = xmlMemBlocks();
2147 
2148         htmlInitAutoClose();
2149         call_tests++;
2150         xmlResetLastError();
2151         if (mem_base != xmlMemBlocks()) {
2152             printf("Leak of %d blocks found in htmlInitAutoClose",
2153 	           xmlMemBlocks() - mem_base);
2154 	    test_ret++;
2155             printf("\n");
2156         }
2157     function_tests++;
2158 #endif
2159 
2160     return(test_ret);
2161 }
2162 
2163 
2164 static int
test_htmlIsAutoClosed(void)2165 test_htmlIsAutoClosed(void) {
2166     int test_ret = 0;
2167 
2168 #if defined(LIBXML_HTML_ENABLED)
2169     int mem_base;
2170     int ret_val;
2171     htmlDocPtr doc; /* the HTML document */
2172     int n_doc;
2173     htmlNodePtr elem; /* the HTML element */
2174     int n_elem;
2175 
2176     for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) {
2177     for (n_elem = 0;n_elem < gen_nb_htmlNodePtr;n_elem++) {
2178         mem_base = xmlMemBlocks();
2179         doc = gen_htmlDocPtr(n_doc, 0);
2180         elem = gen_htmlNodePtr(n_elem, 1);
2181 
2182         ret_val = htmlIsAutoClosed(doc, elem);
2183         desret_int(ret_val);
2184         call_tests++;
2185         des_htmlDocPtr(n_doc, doc, 0);
2186         des_htmlNodePtr(n_elem, elem, 1);
2187         xmlResetLastError();
2188         if (mem_base != xmlMemBlocks()) {
2189             printf("Leak of %d blocks found in htmlIsAutoClosed",
2190 	           xmlMemBlocks() - mem_base);
2191 	    test_ret++;
2192             printf(" %d", n_doc);
2193             printf(" %d", n_elem);
2194             printf("\n");
2195         }
2196     }
2197     }
2198     function_tests++;
2199 #endif
2200 
2201     return(test_ret);
2202 }
2203 
2204 
2205 static int
test_htmlIsScriptAttribute(void)2206 test_htmlIsScriptAttribute(void) {
2207     int test_ret = 0;
2208 
2209 #if defined(LIBXML_HTML_ENABLED)
2210     int mem_base;
2211     int ret_val;
2212     const xmlChar * name; /* an attribute name */
2213     int n_name;
2214 
2215     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
2216         mem_base = xmlMemBlocks();
2217         name = gen_const_xmlChar_ptr(n_name, 0);
2218 
2219         ret_val = htmlIsScriptAttribute(name);
2220         desret_int(ret_val);
2221         call_tests++;
2222         des_const_xmlChar_ptr(n_name, name, 0);
2223         xmlResetLastError();
2224         if (mem_base != xmlMemBlocks()) {
2225             printf("Leak of %d blocks found in htmlIsScriptAttribute",
2226 	           xmlMemBlocks() - mem_base);
2227 	    test_ret++;
2228             printf(" %d", n_name);
2229             printf("\n");
2230         }
2231     }
2232     function_tests++;
2233 #endif
2234 
2235     return(test_ret);
2236 }
2237 
2238 
2239 static int
test_htmlNewParserCtxt(void)2240 test_htmlNewParserCtxt(void) {
2241     int test_ret = 0;
2242 
2243 #if defined(LIBXML_HTML_ENABLED)
2244     int mem_base;
2245     htmlParserCtxtPtr ret_val;
2246 
2247         mem_base = xmlMemBlocks();
2248 
2249         ret_val = htmlNewParserCtxt();
2250         desret_htmlParserCtxtPtr(ret_val);
2251         call_tests++;
2252         xmlResetLastError();
2253         if (mem_base != xmlMemBlocks()) {
2254             printf("Leak of %d blocks found in htmlNewParserCtxt",
2255 	           xmlMemBlocks() - mem_base);
2256 	    test_ret++;
2257             printf("\n");
2258         }
2259     function_tests++;
2260 #endif
2261 
2262     return(test_ret);
2263 }
2264 
2265 #ifdef LIBXML_HTML_ENABLED
2266 
2267 #define gen_nb_const_htmlSAXHandler_ptr 1
2268 #define gen_const_htmlSAXHandler_ptr(no, nr) NULL
2269 #define des_const_htmlSAXHandler_ptr(no, val, nr)
2270 #endif
2271 
2272 
2273 static int
test_htmlNewSAXParserCtxt(void)2274 test_htmlNewSAXParserCtxt(void) {
2275     int test_ret = 0;
2276 
2277 #if defined(LIBXML_HTML_ENABLED)
2278     int mem_base;
2279     htmlParserCtxtPtr ret_val;
2280     const htmlSAXHandler * sax; /* SAX handler */
2281     int n_sax;
2282     void * userData; /* user data */
2283     int n_userData;
2284 
2285     for (n_sax = 0;n_sax < gen_nb_const_htmlSAXHandler_ptr;n_sax++) {
2286     for (n_userData = 0;n_userData < gen_nb_userdata;n_userData++) {
2287         mem_base = xmlMemBlocks();
2288         sax = gen_const_htmlSAXHandler_ptr(n_sax, 0);
2289         userData = gen_userdata(n_userData, 1);
2290 
2291         ret_val = htmlNewSAXParserCtxt(sax, userData);
2292         desret_htmlParserCtxtPtr(ret_val);
2293         call_tests++;
2294         des_const_htmlSAXHandler_ptr(n_sax, sax, 0);
2295         des_userdata(n_userData, userData, 1);
2296         xmlResetLastError();
2297         if (mem_base != xmlMemBlocks()) {
2298             printf("Leak of %d blocks found in htmlNewSAXParserCtxt",
2299 	           xmlMemBlocks() - mem_base);
2300 	    test_ret++;
2301             printf(" %d", n_sax);
2302             printf(" %d", n_userData);
2303             printf("\n");
2304         }
2305     }
2306     }
2307     function_tests++;
2308 #endif
2309 
2310     return(test_ret);
2311 }
2312 
2313 
2314 static int
test_htmlNodeStatus(void)2315 test_htmlNodeStatus(void) {
2316     int test_ret = 0;
2317 
2318 #if defined(LIBXML_HTML_ENABLED)
2319     int mem_base;
2320     htmlStatus ret_val;
2321     htmlNodePtr node; /* an htmlNodePtr in a tree */
2322     int n_node;
2323     int legacy; /* whether to allow deprecated elements (YES is faster here for Element nodes) */
2324     int n_legacy;
2325 
2326     for (n_node = 0;n_node < gen_nb_htmlNodePtr;n_node++) {
2327     for (n_legacy = 0;n_legacy < gen_nb_int;n_legacy++) {
2328         mem_base = xmlMemBlocks();
2329         node = gen_htmlNodePtr(n_node, 0);
2330         legacy = gen_int(n_legacy, 1);
2331 
2332         ret_val = htmlNodeStatus(node, legacy);
2333         desret_htmlStatus(ret_val);
2334         call_tests++;
2335         des_htmlNodePtr(n_node, node, 0);
2336         des_int(n_legacy, legacy, 1);
2337         xmlResetLastError();
2338         if (mem_base != xmlMemBlocks()) {
2339             printf("Leak of %d blocks found in htmlNodeStatus",
2340 	           xmlMemBlocks() - mem_base);
2341 	    test_ret++;
2342             printf(" %d", n_node);
2343             printf(" %d", n_legacy);
2344             printf("\n");
2345         }
2346     }
2347     }
2348     function_tests++;
2349 #endif
2350 
2351     return(test_ret);
2352 }
2353 
2354 
2355 static int
test_htmlParseCharRef(void)2356 test_htmlParseCharRef(void) {
2357     int test_ret = 0;
2358 
2359 #if defined(LIBXML_HTML_ENABLED)
2360     int mem_base;
2361     int ret_val;
2362     htmlParserCtxtPtr ctxt; /* an HTML parser context */
2363     int n_ctxt;
2364 
2365     for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
2366         mem_base = xmlMemBlocks();
2367         ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
2368 
2369         ret_val = htmlParseCharRef(ctxt);
2370         desret_int(ret_val);
2371         call_tests++;
2372         des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
2373         xmlResetLastError();
2374         if (mem_base != xmlMemBlocks()) {
2375             printf("Leak of %d blocks found in htmlParseCharRef",
2376 	           xmlMemBlocks() - mem_base);
2377 	    test_ret++;
2378             printf(" %d", n_ctxt);
2379             printf("\n");
2380         }
2381     }
2382     function_tests++;
2383 #endif
2384 
2385     return(test_ret);
2386 }
2387 
2388 
2389 static int
test_htmlParseChunk(void)2390 test_htmlParseChunk(void) {
2391     int test_ret = 0;
2392 
2393 #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_PUSH_ENABLED)
2394     int mem_base;
2395     int ret_val;
2396     htmlParserCtxtPtr ctxt; /* an HTML parser context */
2397     int n_ctxt;
2398     const char * chunk; /* chunk of memory */
2399     int n_chunk;
2400     int size; /* size of chunk in bytes */
2401     int n_size;
2402     int terminate; /* last chunk indicator */
2403     int n_terminate;
2404 
2405     for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
2406     for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
2407     for (n_size = 0;n_size < gen_nb_int;n_size++) {
2408     for (n_terminate = 0;n_terminate < gen_nb_int;n_terminate++) {
2409         mem_base = xmlMemBlocks();
2410         ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
2411         chunk = gen_const_char_ptr(n_chunk, 1);
2412         size = gen_int(n_size, 2);
2413         terminate = gen_int(n_terminate, 3);
2414         if ((chunk != NULL) &&
2415             (size > xmlStrlen(BAD_CAST chunk)))
2416             size = 0;
2417 
2418         ret_val = htmlParseChunk(ctxt, chunk, size, terminate);
2419         if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
2420         desret_int(ret_val);
2421         call_tests++;
2422         des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
2423         des_const_char_ptr(n_chunk, chunk, 1);
2424         des_int(n_size, size, 2);
2425         des_int(n_terminate, terminate, 3);
2426         xmlResetLastError();
2427         if (mem_base != xmlMemBlocks()) {
2428             printf("Leak of %d blocks found in htmlParseChunk",
2429 	           xmlMemBlocks() - mem_base);
2430 	    test_ret++;
2431             printf(" %d", n_ctxt);
2432             printf(" %d", n_chunk);
2433             printf(" %d", n_size);
2434             printf(" %d", n_terminate);
2435             printf("\n");
2436         }
2437     }
2438     }
2439     }
2440     }
2441     function_tests++;
2442 #endif
2443 
2444     return(test_ret);
2445 }
2446 
2447 
2448 static int
test_htmlParseDoc(void)2449 test_htmlParseDoc(void) {
2450     int test_ret = 0;
2451 
2452 #if defined(LIBXML_HTML_ENABLED)
2453     int mem_base;
2454     htmlDocPtr ret_val;
2455     const xmlChar * cur; /* a pointer to an array of xmlChar */
2456     int n_cur;
2457     const char * encoding; /* the encoding (optional) */
2458     int n_encoding;
2459 
2460     for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
2461     for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2462         mem_base = xmlMemBlocks();
2463         cur = gen_const_xmlChar_ptr(n_cur, 0);
2464         encoding = gen_const_char_ptr(n_encoding, 1);
2465 
2466         ret_val = htmlParseDoc(cur, encoding);
2467         desret_htmlDocPtr(ret_val);
2468         call_tests++;
2469         des_const_xmlChar_ptr(n_cur, cur, 0);
2470         des_const_char_ptr(n_encoding, encoding, 1);
2471         xmlResetLastError();
2472         if (mem_base != xmlMemBlocks()) {
2473             printf("Leak of %d blocks found in htmlParseDoc",
2474 	           xmlMemBlocks() - mem_base);
2475 	    test_ret++;
2476             printf(" %d", n_cur);
2477             printf(" %d", n_encoding);
2478             printf("\n");
2479         }
2480     }
2481     }
2482     function_tests++;
2483 #endif
2484 
2485     return(test_ret);
2486 }
2487 
2488 
2489 static int
test_htmlParseDocument(void)2490 test_htmlParseDocument(void) {
2491     int test_ret = 0;
2492 
2493 #if defined(LIBXML_HTML_ENABLED)
2494     int mem_base;
2495     int ret_val;
2496     htmlParserCtxtPtr ctxt; /* an HTML parser context */
2497     int n_ctxt;
2498 
2499     for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
2500         mem_base = xmlMemBlocks();
2501         ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
2502 
2503         ret_val = htmlParseDocument(ctxt);
2504         if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
2505         desret_int(ret_val);
2506         call_tests++;
2507         des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
2508         xmlResetLastError();
2509         if (mem_base != xmlMemBlocks()) {
2510             printf("Leak of %d blocks found in htmlParseDocument",
2511 	           xmlMemBlocks() - mem_base);
2512 	    test_ret++;
2513             printf(" %d", n_ctxt);
2514             printf("\n");
2515         }
2516     }
2517     function_tests++;
2518 #endif
2519 
2520     return(test_ret);
2521 }
2522 
2523 
2524 static int
test_htmlParseElement(void)2525 test_htmlParseElement(void) {
2526     int test_ret = 0;
2527 
2528 #if defined(LIBXML_HTML_ENABLED)
2529     int mem_base;
2530     htmlParserCtxtPtr ctxt; /* an HTML parser context */
2531     int n_ctxt;
2532 
2533     for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
2534         mem_base = xmlMemBlocks();
2535         ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
2536 
2537         htmlParseElement(ctxt);
2538         call_tests++;
2539         des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
2540         xmlResetLastError();
2541         if (mem_base != xmlMemBlocks()) {
2542             printf("Leak of %d blocks found in htmlParseElement",
2543 	           xmlMemBlocks() - mem_base);
2544 	    test_ret++;
2545             printf(" %d", n_ctxt);
2546             printf("\n");
2547         }
2548     }
2549     function_tests++;
2550 #endif
2551 
2552     return(test_ret);
2553 }
2554 
2555 
2556 static int
test_htmlParseEntityRef(void)2557 test_htmlParseEntityRef(void) {
2558     int test_ret = 0;
2559 
2560 #if defined(LIBXML_HTML_ENABLED)
2561     int mem_base;
2562     const htmlEntityDesc * ret_val;
2563     htmlParserCtxtPtr ctxt; /* an HTML parser context */
2564     int n_ctxt;
2565     const xmlChar ** str; /* location to store the entity name */
2566     int n_str;
2567 
2568     for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
2569     for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr_ptr;n_str++) {
2570         mem_base = xmlMemBlocks();
2571         ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
2572         str = gen_const_xmlChar_ptr_ptr(n_str, 1);
2573 
2574         ret_val = htmlParseEntityRef(ctxt, str);
2575         desret_const_htmlEntityDesc_ptr(ret_val);
2576         call_tests++;
2577         des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
2578         des_const_xmlChar_ptr_ptr(n_str, str, 1);
2579         xmlResetLastError();
2580         if (mem_base != xmlMemBlocks()) {
2581             printf("Leak of %d blocks found in htmlParseEntityRef",
2582 	           xmlMemBlocks() - mem_base);
2583 	    test_ret++;
2584             printf(" %d", n_ctxt);
2585             printf(" %d", n_str);
2586             printf("\n");
2587         }
2588     }
2589     }
2590     function_tests++;
2591 #endif
2592 
2593     return(test_ret);
2594 }
2595 
2596 
2597 static int
test_htmlParseFile(void)2598 test_htmlParseFile(void) {
2599     int test_ret = 0;
2600 
2601 #if defined(LIBXML_HTML_ENABLED)
2602     htmlDocPtr ret_val;
2603     const char * filename; /* the filename */
2604     int n_filename;
2605     const char * encoding; /* encoding (optional) */
2606     int n_encoding;
2607 
2608     for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
2609     for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2610         filename = gen_filepath(n_filename, 0);
2611         encoding = gen_const_char_ptr(n_encoding, 1);
2612 
2613         ret_val = htmlParseFile(filename, encoding);
2614         desret_htmlDocPtr(ret_val);
2615         call_tests++;
2616         des_filepath(n_filename, filename, 0);
2617         des_const_char_ptr(n_encoding, encoding, 1);
2618         xmlResetLastError();
2619     }
2620     }
2621     function_tests++;
2622 #endif
2623 
2624     return(test_ret);
2625 }
2626 
2627 
2628 static int
test_htmlReadDoc(void)2629 test_htmlReadDoc(void) {
2630     int test_ret = 0;
2631 
2632 #if defined(LIBXML_HTML_ENABLED)
2633     int mem_base;
2634     htmlDocPtr ret_val;
2635     const xmlChar * str; /* a pointer to a zero terminated string */
2636     int n_str;
2637     const char * url; /* only used for error reporting (optoinal) */
2638     int n_url;
2639     const char * encoding; /* the document encoding (optional) */
2640     int n_encoding;
2641     int options; /* a combination of htmlParserOptions */
2642     int n_options;
2643 
2644     for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
2645     for (n_url = 0;n_url < gen_nb_const_char_ptr;n_url++) {
2646     for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2647     for (n_options = 0;n_options < gen_nb_int;n_options++) {
2648         mem_base = xmlMemBlocks();
2649         str = gen_const_xmlChar_ptr(n_str, 0);
2650         url = gen_const_char_ptr(n_url, 1);
2651         encoding = gen_const_char_ptr(n_encoding, 2);
2652         options = gen_int(n_options, 3);
2653 
2654         ret_val = htmlReadDoc(str, url, encoding, options);
2655         desret_htmlDocPtr(ret_val);
2656         call_tests++;
2657         des_const_xmlChar_ptr(n_str, str, 0);
2658         des_const_char_ptr(n_url, url, 1);
2659         des_const_char_ptr(n_encoding, encoding, 2);
2660         des_int(n_options, options, 3);
2661         xmlResetLastError();
2662         if (mem_base != xmlMemBlocks()) {
2663             printf("Leak of %d blocks found in htmlReadDoc",
2664 	           xmlMemBlocks() - mem_base);
2665 	    test_ret++;
2666             printf(" %d", n_str);
2667             printf(" %d", n_url);
2668             printf(" %d", n_encoding);
2669             printf(" %d", n_options);
2670             printf("\n");
2671         }
2672     }
2673     }
2674     }
2675     }
2676     function_tests++;
2677 #endif
2678 
2679     return(test_ret);
2680 }
2681 
2682 
2683 static int
test_htmlReadFile(void)2684 test_htmlReadFile(void) {
2685     int test_ret = 0;
2686 
2687 #if defined(LIBXML_HTML_ENABLED)
2688     int mem_base;
2689     htmlDocPtr ret_val;
2690     const char * filename; /* a file or URL */
2691     int n_filename;
2692     const char * encoding; /* the document encoding (optional) */
2693     int n_encoding;
2694     int options; /* a combination of htmlParserOptions */
2695     int n_options;
2696 
2697     for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
2698     for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2699     for (n_options = 0;n_options < gen_nb_int;n_options++) {
2700         mem_base = xmlMemBlocks();
2701         filename = gen_filepath(n_filename, 0);
2702         encoding = gen_const_char_ptr(n_encoding, 1);
2703         options = gen_int(n_options, 2);
2704 
2705         ret_val = htmlReadFile(filename, encoding, options);
2706         desret_htmlDocPtr(ret_val);
2707         call_tests++;
2708         des_filepath(n_filename, filename, 0);
2709         des_const_char_ptr(n_encoding, encoding, 1);
2710         des_int(n_options, options, 2);
2711         xmlResetLastError();
2712         if (mem_base != xmlMemBlocks()) {
2713             printf("Leak of %d blocks found in htmlReadFile",
2714 	           xmlMemBlocks() - mem_base);
2715 	    test_ret++;
2716             printf(" %d", n_filename);
2717             printf(" %d", n_encoding);
2718             printf(" %d", n_options);
2719             printf("\n");
2720         }
2721     }
2722     }
2723     }
2724     function_tests++;
2725 #endif
2726 
2727     return(test_ret);
2728 }
2729 
2730 
2731 static int
test_htmlReadMemory(void)2732 test_htmlReadMemory(void) {
2733     int test_ret = 0;
2734 
2735 #if defined(LIBXML_HTML_ENABLED)
2736     int mem_base;
2737     htmlDocPtr ret_val;
2738     const char * buffer; /* a pointer to a char array */
2739     int n_buffer;
2740     int size; /* the size of the array */
2741     int n_size;
2742     const char * url; /* only used for error reporting (optional) */
2743     int n_url;
2744     const char * encoding; /* the document encoding, or NULL */
2745     int n_encoding;
2746     int options; /* a combination of htmlParserOption(s) */
2747     int n_options;
2748 
2749     for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
2750     for (n_size = 0;n_size < gen_nb_int;n_size++) {
2751     for (n_url = 0;n_url < gen_nb_const_char_ptr;n_url++) {
2752     for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2753     for (n_options = 0;n_options < gen_nb_int;n_options++) {
2754         mem_base = xmlMemBlocks();
2755         buffer = gen_const_char_ptr(n_buffer, 0);
2756         size = gen_int(n_size, 1);
2757         url = gen_const_char_ptr(n_url, 2);
2758         encoding = gen_const_char_ptr(n_encoding, 3);
2759         options = gen_int(n_options, 4);
2760         if ((buffer != NULL) &&
2761             (size > xmlStrlen(BAD_CAST buffer)))
2762             size = 0;
2763 
2764         ret_val = htmlReadMemory(buffer, size, url, encoding, options);
2765         desret_htmlDocPtr(ret_val);
2766         call_tests++;
2767         des_const_char_ptr(n_buffer, buffer, 0);
2768         des_int(n_size, size, 1);
2769         des_const_char_ptr(n_url, url, 2);
2770         des_const_char_ptr(n_encoding, encoding, 3);
2771         des_int(n_options, options, 4);
2772         xmlResetLastError();
2773         if (mem_base != xmlMemBlocks()) {
2774             printf("Leak of %d blocks found in htmlReadMemory",
2775 	           xmlMemBlocks() - mem_base);
2776 	    test_ret++;
2777             printf(" %d", n_buffer);
2778             printf(" %d", n_size);
2779             printf(" %d", n_url);
2780             printf(" %d", n_encoding);
2781             printf(" %d", n_options);
2782             printf("\n");
2783         }
2784     }
2785     }
2786     }
2787     }
2788     }
2789     function_tests++;
2790 #endif
2791 
2792     return(test_ret);
2793 }
2794 
2795 
2796 static int
test_htmlSAXParseDoc(void)2797 test_htmlSAXParseDoc(void) {
2798     int test_ret = 0;
2799 
2800 #if defined(LIBXML_HTML_ENABLED)
2801     int mem_base;
2802     htmlDocPtr ret_val;
2803     const xmlChar * cur; /* a pointer to an array of xmlChar */
2804     int n_cur;
2805     const char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
2806     int n_encoding;
2807     htmlSAXHandlerPtr sax; /* the SAX handler block */
2808     int n_sax;
2809     void * userData; /* if using SAX, this pointer will be provided on callbacks. */
2810     int n_userData;
2811 
2812     for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
2813     for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2814     for (n_sax = 0;n_sax < gen_nb_htmlSAXHandlerPtr;n_sax++) {
2815     for (n_userData = 0;n_userData < gen_nb_userdata;n_userData++) {
2816         mem_base = xmlMemBlocks();
2817         cur = gen_const_xmlChar_ptr(n_cur, 0);
2818         encoding = gen_const_char_ptr(n_encoding, 1);
2819         sax = gen_htmlSAXHandlerPtr(n_sax, 2);
2820         userData = gen_userdata(n_userData, 3);
2821 
2822         ret_val = htmlSAXParseDoc(cur, encoding, sax, userData);
2823         desret_htmlDocPtr(ret_val);
2824         call_tests++;
2825         des_const_xmlChar_ptr(n_cur, cur, 0);
2826         des_const_char_ptr(n_encoding, encoding, 1);
2827         des_htmlSAXHandlerPtr(n_sax, sax, 2);
2828         des_userdata(n_userData, userData, 3);
2829         xmlResetLastError();
2830         if (mem_base != xmlMemBlocks()) {
2831             printf("Leak of %d blocks found in htmlSAXParseDoc",
2832 	           xmlMemBlocks() - mem_base);
2833 	    test_ret++;
2834             printf(" %d", n_cur);
2835             printf(" %d", n_encoding);
2836             printf(" %d", n_sax);
2837             printf(" %d", n_userData);
2838             printf("\n");
2839         }
2840     }
2841     }
2842     }
2843     }
2844     function_tests++;
2845 #endif
2846 
2847     return(test_ret);
2848 }
2849 
2850 
2851 static int
test_htmlSAXParseFile(void)2852 test_htmlSAXParseFile(void) {
2853     int test_ret = 0;
2854 
2855 #if defined(LIBXML_HTML_ENABLED)
2856     int mem_base;
2857     htmlDocPtr ret_val;
2858     const char * filename; /* the filename */
2859     int n_filename;
2860     const char * encoding; /* encoding (optional) */
2861     int n_encoding;
2862     htmlSAXHandlerPtr sax; /* the SAX handler block */
2863     int n_sax;
2864     void * userData; /* if using SAX, this pointer will be provided on callbacks. */
2865     int n_userData;
2866 
2867     for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
2868     for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2869     for (n_sax = 0;n_sax < gen_nb_htmlSAXHandlerPtr;n_sax++) {
2870     for (n_userData = 0;n_userData < gen_nb_userdata;n_userData++) {
2871         mem_base = xmlMemBlocks();
2872         filename = gen_filepath(n_filename, 0);
2873         encoding = gen_const_char_ptr(n_encoding, 1);
2874         sax = gen_htmlSAXHandlerPtr(n_sax, 2);
2875         userData = gen_userdata(n_userData, 3);
2876 
2877         ret_val = htmlSAXParseFile(filename, encoding, sax, userData);
2878         desret_htmlDocPtr(ret_val);
2879         call_tests++;
2880         des_filepath(n_filename, filename, 0);
2881         des_const_char_ptr(n_encoding, encoding, 1);
2882         des_htmlSAXHandlerPtr(n_sax, sax, 2);
2883         des_userdata(n_userData, userData, 3);
2884         xmlResetLastError();
2885         if (mem_base != xmlMemBlocks()) {
2886             printf("Leak of %d blocks found in htmlSAXParseFile",
2887 	           xmlMemBlocks() - mem_base);
2888 	    test_ret++;
2889             printf(" %d", n_filename);
2890             printf(" %d", n_encoding);
2891             printf(" %d", n_sax);
2892             printf(" %d", n_userData);
2893             printf("\n");
2894         }
2895     }
2896     }
2897     }
2898     }
2899     function_tests++;
2900 #endif
2901 
2902     return(test_ret);
2903 }
2904 
2905 
2906 static int
test_htmlTagLookup(void)2907 test_htmlTagLookup(void) {
2908     int test_ret = 0;
2909 
2910 
2911     /* missing type support */
2912     return(test_ret);
2913 }
2914 
2915 static int
test_HTMLparser(void)2916 test_HTMLparser(void) {
2917     int test_ret = 0;
2918 
2919     if (quiet == 0) printf("Testing HTMLparser : 36 of 42 functions ...\n");
2920     test_ret += test_UTF8ToHtml();
2921     test_ret += test_htmlAttrAllowed();
2922     test_ret += test_htmlAutoCloseTag();
2923     test_ret += test_htmlCreateFileParserCtxt();
2924     test_ret += test_htmlCreateMemoryParserCtxt();
2925     test_ret += test_htmlCreatePushParserCtxt();
2926     test_ret += test_htmlCtxtParseDocument();
2927     test_ret += test_htmlCtxtReadDoc();
2928     test_ret += test_htmlCtxtReadFile();
2929     test_ret += test_htmlCtxtReadMemory();
2930     test_ret += test_htmlCtxtReset();
2931     test_ret += test_htmlCtxtUseOptions();
2932     test_ret += test_htmlElementAllowedHere();
2933     test_ret += test_htmlElementStatusHere();
2934     test_ret += test_htmlEncodeEntities();
2935     test_ret += test_htmlEntityLookup();
2936     test_ret += test_htmlEntityValueLookup();
2937     test_ret += test_htmlHandleOmittedElem();
2938     test_ret += test_htmlInitAutoClose();
2939     test_ret += test_htmlIsAutoClosed();
2940     test_ret += test_htmlIsScriptAttribute();
2941     test_ret += test_htmlNewParserCtxt();
2942     test_ret += test_htmlNewSAXParserCtxt();
2943     test_ret += test_htmlNodeStatus();
2944     test_ret += test_htmlParseCharRef();
2945     test_ret += test_htmlParseChunk();
2946     test_ret += test_htmlParseDoc();
2947     test_ret += test_htmlParseDocument();
2948     test_ret += test_htmlParseElement();
2949     test_ret += test_htmlParseEntityRef();
2950     test_ret += test_htmlParseFile();
2951     test_ret += test_htmlReadDoc();
2952     test_ret += test_htmlReadFile();
2953     test_ret += test_htmlReadMemory();
2954     test_ret += test_htmlSAXParseDoc();
2955     test_ret += test_htmlSAXParseFile();
2956     test_ret += test_htmlTagLookup();
2957 
2958     if (test_ret != 0)
2959 	printf("Module HTMLparser: %d errors\n", test_ret);
2960     return(test_ret);
2961 }
2962 
2963 static int
test_htmlDocContentDumpFormatOutput(void)2964 test_htmlDocContentDumpFormatOutput(void) {
2965     int test_ret = 0;
2966 
2967 #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
2968     int mem_base;
2969     xmlOutputBufferPtr buf; /* the HTML buffer output */
2970     int n_buf;
2971     xmlDocPtr cur; /* the document */
2972     int n_cur;
2973     const char * encoding; /* the encoding string (unused) */
2974     int n_encoding;
2975     int format; /* should formatting spaces been added */
2976     int n_format;
2977 
2978     for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
2979     for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
2980     for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2981     for (n_format = 0;n_format < gen_nb_int;n_format++) {
2982         mem_base = xmlMemBlocks();
2983         buf = gen_xmlOutputBufferPtr(n_buf, 0);
2984         cur = gen_xmlDocPtr(n_cur, 1);
2985         encoding = gen_const_char_ptr(n_encoding, 2);
2986         format = gen_int(n_format, 3);
2987 
2988         htmlDocContentDumpFormatOutput(buf, cur, encoding, format);
2989         call_tests++;
2990         des_xmlOutputBufferPtr(n_buf, buf, 0);
2991         des_xmlDocPtr(n_cur, cur, 1);
2992         des_const_char_ptr(n_encoding, encoding, 2);
2993         des_int(n_format, format, 3);
2994         xmlResetLastError();
2995         if (mem_base != xmlMemBlocks()) {
2996             printf("Leak of %d blocks found in htmlDocContentDumpFormatOutput",
2997 	           xmlMemBlocks() - mem_base);
2998 	    test_ret++;
2999             printf(" %d", n_buf);
3000             printf(" %d", n_cur);
3001             printf(" %d", n_encoding);
3002             printf(" %d", n_format);
3003             printf("\n");
3004         }
3005     }
3006     }
3007     }
3008     }
3009     function_tests++;
3010 #endif
3011 
3012     return(test_ret);
3013 }
3014 
3015 
3016 static int
test_htmlDocContentDumpOutput(void)3017 test_htmlDocContentDumpOutput(void) {
3018     int test_ret = 0;
3019 
3020 #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
3021     int mem_base;
3022     xmlOutputBufferPtr buf; /* the HTML buffer output */
3023     int n_buf;
3024     xmlDocPtr cur; /* the document */
3025     int n_cur;
3026     const char * encoding; /* the encoding string (unused) */
3027     int n_encoding;
3028 
3029     for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
3030     for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
3031     for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3032         mem_base = xmlMemBlocks();
3033         buf = gen_xmlOutputBufferPtr(n_buf, 0);
3034         cur = gen_xmlDocPtr(n_cur, 1);
3035         encoding = gen_const_char_ptr(n_encoding, 2);
3036 
3037         htmlDocContentDumpOutput(buf, cur, encoding);
3038         call_tests++;
3039         des_xmlOutputBufferPtr(n_buf, buf, 0);
3040         des_xmlDocPtr(n_cur, cur, 1);
3041         des_const_char_ptr(n_encoding, encoding, 2);
3042         xmlResetLastError();
3043         if (mem_base != xmlMemBlocks()) {
3044             printf("Leak of %d blocks found in htmlDocContentDumpOutput",
3045 	           xmlMemBlocks() - mem_base);
3046 	    test_ret++;
3047             printf(" %d", n_buf);
3048             printf(" %d", n_cur);
3049             printf(" %d", n_encoding);
3050             printf("\n");
3051         }
3052     }
3053     }
3054     }
3055     function_tests++;
3056 #endif
3057 
3058     return(test_ret);
3059 }
3060 
3061 
3062 static int
test_htmlDocDump(void)3063 test_htmlDocDump(void) {
3064     int test_ret = 0;
3065 
3066 #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
3067     int mem_base;
3068     int ret_val;
3069     FILE * f; /* the FILE* */
3070     int n_f;
3071     xmlDocPtr cur; /* the document */
3072     int n_cur;
3073 
3074     for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) {
3075     for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
3076         mem_base = xmlMemBlocks();
3077         f = gen_FILE_ptr(n_f, 0);
3078         cur = gen_xmlDocPtr(n_cur, 1);
3079 
3080         ret_val = htmlDocDump(f, cur);
3081         desret_int(ret_val);
3082         call_tests++;
3083         des_FILE_ptr(n_f, f, 0);
3084         des_xmlDocPtr(n_cur, cur, 1);
3085         xmlResetLastError();
3086         if (mem_base != xmlMemBlocks()) {
3087             printf("Leak of %d blocks found in htmlDocDump",
3088 	           xmlMemBlocks() - mem_base);
3089 	    test_ret++;
3090             printf(" %d", n_f);
3091             printf(" %d", n_cur);
3092             printf("\n");
3093         }
3094     }
3095     }
3096     function_tests++;
3097 #endif
3098 
3099     return(test_ret);
3100 }
3101 
3102 
3103 #define gen_nb_xmlChar_ptr_ptr 1
3104 #define gen_xmlChar_ptr_ptr(no, nr) NULL
3105 #define des_xmlChar_ptr_ptr(no, val, nr)
3106 
3107 static int
test_htmlDocDumpMemory(void)3108 test_htmlDocDumpMemory(void) {
3109     int test_ret = 0;
3110 
3111 #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
3112     int mem_base;
3113     xmlDocPtr cur; /* the document */
3114     int n_cur;
3115     xmlChar ** mem; /* OUT: the memory pointer */
3116     int n_mem;
3117     int * size; /* OUT: the memory length */
3118     int n_size;
3119 
3120     for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
3121     for (n_mem = 0;n_mem < gen_nb_xmlChar_ptr_ptr;n_mem++) {
3122     for (n_size = 0;n_size < gen_nb_int_ptr;n_size++) {
3123         mem_base = xmlMemBlocks();
3124         cur = gen_xmlDocPtr(n_cur, 0);
3125         mem = gen_xmlChar_ptr_ptr(n_mem, 1);
3126         size = gen_int_ptr(n_size, 2);
3127 
3128         htmlDocDumpMemory(cur, mem, size);
3129         call_tests++;
3130         des_xmlDocPtr(n_cur, cur, 0);
3131         des_xmlChar_ptr_ptr(n_mem, mem, 1);
3132         des_int_ptr(n_size, size, 2);
3133         xmlResetLastError();
3134         if (mem_base != xmlMemBlocks()) {
3135             printf("Leak of %d blocks found in htmlDocDumpMemory",
3136 	           xmlMemBlocks() - mem_base);
3137 	    test_ret++;
3138             printf(" %d", n_cur);
3139             printf(" %d", n_mem);
3140             printf(" %d", n_size);
3141             printf("\n");
3142         }
3143     }
3144     }
3145     }
3146     function_tests++;
3147 #endif
3148 
3149     return(test_ret);
3150 }
3151 
3152 
3153 static int
test_htmlDocDumpMemoryFormat(void)3154 test_htmlDocDumpMemoryFormat(void) {
3155     int test_ret = 0;
3156 
3157 #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
3158     int mem_base;
3159     xmlDocPtr cur; /* the document */
3160     int n_cur;
3161     xmlChar ** mem; /* OUT: the memory pointer */
3162     int n_mem;
3163     int * size; /* OUT: the memory length */
3164     int n_size;
3165     int format; /* should formatting spaces been added */
3166     int n_format;
3167 
3168     for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
3169     for (n_mem = 0;n_mem < gen_nb_xmlChar_ptr_ptr;n_mem++) {
3170     for (n_size = 0;n_size < gen_nb_int_ptr;n_size++) {
3171     for (n_format = 0;n_format < gen_nb_int;n_format++) {
3172         mem_base = xmlMemBlocks();
3173         cur = gen_xmlDocPtr(n_cur, 0);
3174         mem = gen_xmlChar_ptr_ptr(n_mem, 1);
3175         size = gen_int_ptr(n_size, 2);
3176         format = gen_int(n_format, 3);
3177 
3178         htmlDocDumpMemoryFormat(cur, mem, size, format);
3179         call_tests++;
3180         des_xmlDocPtr(n_cur, cur, 0);
3181         des_xmlChar_ptr_ptr(n_mem, mem, 1);
3182         des_int_ptr(n_size, size, 2);
3183         des_int(n_format, format, 3);
3184         xmlResetLastError();
3185         if (mem_base != xmlMemBlocks()) {
3186             printf("Leak of %d blocks found in htmlDocDumpMemoryFormat",
3187 	           xmlMemBlocks() - mem_base);
3188 	    test_ret++;
3189             printf(" %d", n_cur);
3190             printf(" %d", n_mem);
3191             printf(" %d", n_size);
3192             printf(" %d", n_format);
3193             printf("\n");
3194         }
3195     }
3196     }
3197     }
3198     }
3199     function_tests++;
3200 #endif
3201 
3202     return(test_ret);
3203 }
3204 
3205 
3206 static int
test_htmlGetMetaEncoding(void)3207 test_htmlGetMetaEncoding(void) {
3208     int test_ret = 0;
3209 
3210 #if defined(LIBXML_HTML_ENABLED)
3211     int mem_base;
3212     const xmlChar * ret_val;
3213     htmlDocPtr doc; /* the document */
3214     int n_doc;
3215 
3216     for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) {
3217         mem_base = xmlMemBlocks();
3218         doc = gen_htmlDocPtr(n_doc, 0);
3219 
3220         ret_val = htmlGetMetaEncoding(doc);
3221         desret_const_xmlChar_ptr(ret_val);
3222         call_tests++;
3223         des_htmlDocPtr(n_doc, doc, 0);
3224         xmlResetLastError();
3225         if (mem_base != xmlMemBlocks()) {
3226             printf("Leak of %d blocks found in htmlGetMetaEncoding",
3227 	           xmlMemBlocks() - mem_base);
3228 	    test_ret++;
3229             printf(" %d", n_doc);
3230             printf("\n");
3231         }
3232     }
3233     function_tests++;
3234 #endif
3235 
3236     return(test_ret);
3237 }
3238 
3239 
3240 static int
test_htmlIsBooleanAttr(void)3241 test_htmlIsBooleanAttr(void) {
3242     int test_ret = 0;
3243 
3244 #if defined(LIBXML_HTML_ENABLED)
3245     int mem_base;
3246     int ret_val;
3247     const xmlChar * name; /* the name of the attribute to check */
3248     int n_name;
3249 
3250     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
3251         mem_base = xmlMemBlocks();
3252         name = gen_const_xmlChar_ptr(n_name, 0);
3253 
3254         ret_val = htmlIsBooleanAttr(name);
3255         desret_int(ret_val);
3256         call_tests++;
3257         des_const_xmlChar_ptr(n_name, name, 0);
3258         xmlResetLastError();
3259         if (mem_base != xmlMemBlocks()) {
3260             printf("Leak of %d blocks found in htmlIsBooleanAttr",
3261 	           xmlMemBlocks() - mem_base);
3262 	    test_ret++;
3263             printf(" %d", n_name);
3264             printf("\n");
3265         }
3266     }
3267     function_tests++;
3268 #endif
3269 
3270     return(test_ret);
3271 }
3272 
3273 
3274 static int
test_htmlNewDoc(void)3275 test_htmlNewDoc(void) {
3276     int test_ret = 0;
3277 
3278 #if defined(LIBXML_HTML_ENABLED)
3279     int mem_base;
3280     htmlDocPtr ret_val;
3281     const xmlChar * URI; /* URI for the dtd, or NULL */
3282     int n_URI;
3283     const xmlChar * ExternalID; /* the external ID of the DTD, or NULL */
3284     int n_ExternalID;
3285 
3286     for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
3287     for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
3288         mem_base = xmlMemBlocks();
3289         URI = gen_const_xmlChar_ptr(n_URI, 0);
3290         ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 1);
3291 
3292         ret_val = htmlNewDoc(URI, ExternalID);
3293         desret_htmlDocPtr(ret_val);
3294         call_tests++;
3295         des_const_xmlChar_ptr(n_URI, URI, 0);
3296         des_const_xmlChar_ptr(n_ExternalID, ExternalID, 1);
3297         xmlResetLastError();
3298         if (mem_base != xmlMemBlocks()) {
3299             printf("Leak of %d blocks found in htmlNewDoc",
3300 	           xmlMemBlocks() - mem_base);
3301 	    test_ret++;
3302             printf(" %d", n_URI);
3303             printf(" %d", n_ExternalID);
3304             printf("\n");
3305         }
3306     }
3307     }
3308     function_tests++;
3309 #endif
3310 
3311     return(test_ret);
3312 }
3313 
3314 
3315 static int
test_htmlNewDocNoDtD(void)3316 test_htmlNewDocNoDtD(void) {
3317     int test_ret = 0;
3318 
3319 #if defined(LIBXML_HTML_ENABLED)
3320     int mem_base;
3321     htmlDocPtr ret_val;
3322     const xmlChar * URI; /* URI for the dtd, or NULL */
3323     int n_URI;
3324     const xmlChar * ExternalID; /* the external ID of the DTD, or NULL */
3325     int n_ExternalID;
3326 
3327     for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
3328     for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
3329         mem_base = xmlMemBlocks();
3330         URI = gen_const_xmlChar_ptr(n_URI, 0);
3331         ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 1);
3332 
3333         ret_val = htmlNewDocNoDtD(URI, ExternalID);
3334         desret_htmlDocPtr(ret_val);
3335         call_tests++;
3336         des_const_xmlChar_ptr(n_URI, URI, 0);
3337         des_const_xmlChar_ptr(n_ExternalID, ExternalID, 1);
3338         xmlResetLastError();
3339         if (mem_base != xmlMemBlocks()) {
3340             printf("Leak of %d blocks found in htmlNewDocNoDtD",
3341 	           xmlMemBlocks() - mem_base);
3342 	    test_ret++;
3343             printf(" %d", n_URI);
3344             printf(" %d", n_ExternalID);
3345             printf("\n");
3346         }
3347     }
3348     }
3349     function_tests++;
3350 #endif
3351 
3352     return(test_ret);
3353 }
3354 
3355 
3356 static int
test_htmlNodeDump(void)3357 test_htmlNodeDump(void) {
3358     int test_ret = 0;
3359 
3360 #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
3361     int mem_base;
3362     int ret_val;
3363     xmlBufferPtr buf; /* the HTML buffer output */
3364     int n_buf;
3365     xmlDocPtr doc; /* the document */
3366     int n_doc;
3367     xmlNodePtr cur; /* the current node */
3368     int n_cur;
3369 
3370     for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
3371     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3372     for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3373         mem_base = xmlMemBlocks();
3374         buf = gen_xmlBufferPtr(n_buf, 0);
3375         doc = gen_xmlDocPtr(n_doc, 1);
3376         cur = gen_xmlNodePtr(n_cur, 2);
3377 
3378         ret_val = htmlNodeDump(buf, doc, cur);
3379         desret_int(ret_val);
3380         call_tests++;
3381         des_xmlBufferPtr(n_buf, buf, 0);
3382         des_xmlDocPtr(n_doc, doc, 1);
3383         des_xmlNodePtr(n_cur, cur, 2);
3384         xmlResetLastError();
3385         if (mem_base != xmlMemBlocks()) {
3386             printf("Leak of %d blocks found in htmlNodeDump",
3387 	           xmlMemBlocks() - mem_base);
3388 	    test_ret++;
3389             printf(" %d", n_buf);
3390             printf(" %d", n_doc);
3391             printf(" %d", n_cur);
3392             printf("\n");
3393         }
3394     }
3395     }
3396     }
3397     function_tests++;
3398 #endif
3399 
3400     return(test_ret);
3401 }
3402 
3403 
3404 static int
test_htmlNodeDumpFile(void)3405 test_htmlNodeDumpFile(void) {
3406     int test_ret = 0;
3407 
3408 #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
3409     int mem_base;
3410     FILE * out; /* the FILE pointer */
3411     int n_out;
3412     xmlDocPtr doc; /* the document */
3413     int n_doc;
3414     xmlNodePtr cur; /* the current node */
3415     int n_cur;
3416 
3417     for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) {
3418     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3419     for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3420         mem_base = xmlMemBlocks();
3421         out = gen_FILE_ptr(n_out, 0);
3422         doc = gen_xmlDocPtr(n_doc, 1);
3423         cur = gen_xmlNodePtr(n_cur, 2);
3424 
3425         htmlNodeDumpFile(out, doc, cur);
3426         call_tests++;
3427         des_FILE_ptr(n_out, out, 0);
3428         des_xmlDocPtr(n_doc, doc, 1);
3429         des_xmlNodePtr(n_cur, cur, 2);
3430         xmlResetLastError();
3431         if (mem_base != xmlMemBlocks()) {
3432             printf("Leak of %d blocks found in htmlNodeDumpFile",
3433 	           xmlMemBlocks() - mem_base);
3434 	    test_ret++;
3435             printf(" %d", n_out);
3436             printf(" %d", n_doc);
3437             printf(" %d", n_cur);
3438             printf("\n");
3439         }
3440     }
3441     }
3442     }
3443     function_tests++;
3444 #endif
3445 
3446     return(test_ret);
3447 }
3448 
3449 
3450 static int
test_htmlNodeDumpFileFormat(void)3451 test_htmlNodeDumpFileFormat(void) {
3452     int test_ret = 0;
3453 
3454 #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
3455     int mem_base;
3456     int ret_val;
3457     FILE * out; /* the FILE pointer */
3458     int n_out;
3459     xmlDocPtr doc; /* the document */
3460     int n_doc;
3461     xmlNodePtr cur; /* the current node */
3462     int n_cur;
3463     const char * encoding; /* the document encoding */
3464     int n_encoding;
3465     int format; /* should formatting spaces been added */
3466     int n_format;
3467 
3468     for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) {
3469     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3470     for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3471     for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3472     for (n_format = 0;n_format < gen_nb_int;n_format++) {
3473         mem_base = xmlMemBlocks();
3474         out = gen_FILE_ptr(n_out, 0);
3475         doc = gen_xmlDocPtr(n_doc, 1);
3476         cur = gen_xmlNodePtr(n_cur, 2);
3477         encoding = gen_const_char_ptr(n_encoding, 3);
3478         format = gen_int(n_format, 4);
3479 
3480         ret_val = htmlNodeDumpFileFormat(out, doc, cur, encoding, format);
3481         desret_int(ret_val);
3482         call_tests++;
3483         des_FILE_ptr(n_out, out, 0);
3484         des_xmlDocPtr(n_doc, doc, 1);
3485         des_xmlNodePtr(n_cur, cur, 2);
3486         des_const_char_ptr(n_encoding, encoding, 3);
3487         des_int(n_format, format, 4);
3488         xmlResetLastError();
3489         if (mem_base != xmlMemBlocks()) {
3490             printf("Leak of %d blocks found in htmlNodeDumpFileFormat",
3491 	           xmlMemBlocks() - mem_base);
3492 	    test_ret++;
3493             printf(" %d", n_out);
3494             printf(" %d", n_doc);
3495             printf(" %d", n_cur);
3496             printf(" %d", n_encoding);
3497             printf(" %d", n_format);
3498             printf("\n");
3499         }
3500     }
3501     }
3502     }
3503     }
3504     }
3505     function_tests++;
3506 #endif
3507 
3508     return(test_ret);
3509 }
3510 
3511 
3512 static int
test_htmlNodeDumpFormatOutput(void)3513 test_htmlNodeDumpFormatOutput(void) {
3514     int test_ret = 0;
3515 
3516 #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
3517     int mem_base;
3518     xmlOutputBufferPtr buf; /* the HTML buffer output */
3519     int n_buf;
3520     xmlDocPtr doc; /* the document */
3521     int n_doc;
3522     xmlNodePtr cur; /* the current node */
3523     int n_cur;
3524     const char * encoding; /* the encoding string (unused) */
3525     int n_encoding;
3526     int format; /* should formatting spaces been added */
3527     int n_format;
3528 
3529     for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
3530     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3531     for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3532     for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3533     for (n_format = 0;n_format < gen_nb_int;n_format++) {
3534         mem_base = xmlMemBlocks();
3535         buf = gen_xmlOutputBufferPtr(n_buf, 0);
3536         doc = gen_xmlDocPtr(n_doc, 1);
3537         cur = gen_xmlNodePtr(n_cur, 2);
3538         encoding = gen_const_char_ptr(n_encoding, 3);
3539         format = gen_int(n_format, 4);
3540 
3541         htmlNodeDumpFormatOutput(buf, doc, cur, encoding, format);
3542         call_tests++;
3543         des_xmlOutputBufferPtr(n_buf, buf, 0);
3544         des_xmlDocPtr(n_doc, doc, 1);
3545         des_xmlNodePtr(n_cur, cur, 2);
3546         des_const_char_ptr(n_encoding, encoding, 3);
3547         des_int(n_format, format, 4);
3548         xmlResetLastError();
3549         if (mem_base != xmlMemBlocks()) {
3550             printf("Leak of %d blocks found in htmlNodeDumpFormatOutput",
3551 	           xmlMemBlocks() - mem_base);
3552 	    test_ret++;
3553             printf(" %d", n_buf);
3554             printf(" %d", n_doc);
3555             printf(" %d", n_cur);
3556             printf(" %d", n_encoding);
3557             printf(" %d", n_format);
3558             printf("\n");
3559         }
3560     }
3561     }
3562     }
3563     }
3564     }
3565     function_tests++;
3566 #endif
3567 
3568     return(test_ret);
3569 }
3570 
3571 
3572 static int
test_htmlNodeDumpOutput(void)3573 test_htmlNodeDumpOutput(void) {
3574     int test_ret = 0;
3575 
3576 #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
3577     int mem_base;
3578     xmlOutputBufferPtr buf; /* the HTML buffer output */
3579     int n_buf;
3580     xmlDocPtr doc; /* the document */
3581     int n_doc;
3582     xmlNodePtr cur; /* the current node */
3583     int n_cur;
3584     const char * encoding; /* the encoding string (unused) */
3585     int n_encoding;
3586 
3587     for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
3588     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3589     for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3590     for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3591         mem_base = xmlMemBlocks();
3592         buf = gen_xmlOutputBufferPtr(n_buf, 0);
3593         doc = gen_xmlDocPtr(n_doc, 1);
3594         cur = gen_xmlNodePtr(n_cur, 2);
3595         encoding = gen_const_char_ptr(n_encoding, 3);
3596 
3597         htmlNodeDumpOutput(buf, doc, cur, encoding);
3598         call_tests++;
3599         des_xmlOutputBufferPtr(n_buf, buf, 0);
3600         des_xmlDocPtr(n_doc, doc, 1);
3601         des_xmlNodePtr(n_cur, cur, 2);
3602         des_const_char_ptr(n_encoding, encoding, 3);
3603         xmlResetLastError();
3604         if (mem_base != xmlMemBlocks()) {
3605             printf("Leak of %d blocks found in htmlNodeDumpOutput",
3606 	           xmlMemBlocks() - mem_base);
3607 	    test_ret++;
3608             printf(" %d", n_buf);
3609             printf(" %d", n_doc);
3610             printf(" %d", n_cur);
3611             printf(" %d", n_encoding);
3612             printf("\n");
3613         }
3614     }
3615     }
3616     }
3617     }
3618     function_tests++;
3619 #endif
3620 
3621     return(test_ret);
3622 }
3623 
3624 
3625 static int
test_htmlSaveFile(void)3626 test_htmlSaveFile(void) {
3627     int test_ret = 0;
3628 
3629 #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
3630     int mem_base;
3631     int ret_val;
3632     const char * filename; /* the filename (or URL) */
3633     int n_filename;
3634     xmlDocPtr cur; /* the document */
3635     int n_cur;
3636 
3637     for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
3638     for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
3639         mem_base = xmlMemBlocks();
3640         filename = gen_fileoutput(n_filename, 0);
3641         cur = gen_xmlDocPtr(n_cur, 1);
3642 
3643         ret_val = htmlSaveFile(filename, cur);
3644         desret_int(ret_val);
3645         call_tests++;
3646         des_fileoutput(n_filename, filename, 0);
3647         des_xmlDocPtr(n_cur, cur, 1);
3648         xmlResetLastError();
3649         if (mem_base != xmlMemBlocks()) {
3650             printf("Leak of %d blocks found in htmlSaveFile",
3651 	           xmlMemBlocks() - mem_base);
3652 	    test_ret++;
3653             printf(" %d", n_filename);
3654             printf(" %d", n_cur);
3655             printf("\n");
3656         }
3657     }
3658     }
3659     function_tests++;
3660 #endif
3661 
3662     return(test_ret);
3663 }
3664 
3665 
3666 static int
test_htmlSaveFileEnc(void)3667 test_htmlSaveFileEnc(void) {
3668     int test_ret = 0;
3669 
3670 #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
3671     int mem_base;
3672     int ret_val;
3673     const char * filename; /* the filename */
3674     int n_filename;
3675     xmlDocPtr cur; /* the document */
3676     int n_cur;
3677     const char * encoding; /* the document encoding */
3678     int n_encoding;
3679 
3680     for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
3681     for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
3682     for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3683         mem_base = xmlMemBlocks();
3684         filename = gen_fileoutput(n_filename, 0);
3685         cur = gen_xmlDocPtr(n_cur, 1);
3686         encoding = gen_const_char_ptr(n_encoding, 2);
3687 
3688         ret_val = htmlSaveFileEnc(filename, cur, encoding);
3689         desret_int(ret_val);
3690         call_tests++;
3691         des_fileoutput(n_filename, filename, 0);
3692         des_xmlDocPtr(n_cur, cur, 1);
3693         des_const_char_ptr(n_encoding, encoding, 2);
3694         xmlResetLastError();
3695         if (mem_base != xmlMemBlocks()) {
3696             printf("Leak of %d blocks found in htmlSaveFileEnc",
3697 	           xmlMemBlocks() - mem_base);
3698 	    test_ret++;
3699             printf(" %d", n_filename);
3700             printf(" %d", n_cur);
3701             printf(" %d", n_encoding);
3702             printf("\n");
3703         }
3704     }
3705     }
3706     }
3707     function_tests++;
3708 #endif
3709 
3710     return(test_ret);
3711 }
3712 
3713 
3714 static int
test_htmlSaveFileFormat(void)3715 test_htmlSaveFileFormat(void) {
3716     int test_ret = 0;
3717 
3718 #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
3719     int mem_base;
3720     int ret_val;
3721     const char * filename; /* the filename */
3722     int n_filename;
3723     xmlDocPtr cur; /* the document */
3724     int n_cur;
3725     const char * encoding; /* the document encoding */
3726     int n_encoding;
3727     int format; /* should formatting spaces been added */
3728     int n_format;
3729 
3730     for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
3731     for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
3732     for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3733     for (n_format = 0;n_format < gen_nb_int;n_format++) {
3734         mem_base = xmlMemBlocks();
3735         filename = gen_fileoutput(n_filename, 0);
3736         cur = gen_xmlDocPtr(n_cur, 1);
3737         encoding = gen_const_char_ptr(n_encoding, 2);
3738         format = gen_int(n_format, 3);
3739 
3740         ret_val = htmlSaveFileFormat(filename, cur, encoding, format);
3741         desret_int(ret_val);
3742         call_tests++;
3743         des_fileoutput(n_filename, filename, 0);
3744         des_xmlDocPtr(n_cur, cur, 1);
3745         des_const_char_ptr(n_encoding, encoding, 2);
3746         des_int(n_format, format, 3);
3747         xmlResetLastError();
3748         if (mem_base != xmlMemBlocks()) {
3749             printf("Leak of %d blocks found in htmlSaveFileFormat",
3750 	           xmlMemBlocks() - mem_base);
3751 	    test_ret++;
3752             printf(" %d", n_filename);
3753             printf(" %d", n_cur);
3754             printf(" %d", n_encoding);
3755             printf(" %d", n_format);
3756             printf("\n");
3757         }
3758     }
3759     }
3760     }
3761     }
3762     function_tests++;
3763 #endif
3764 
3765     return(test_ret);
3766 }
3767 
3768 
3769 static int
test_htmlSetMetaEncoding(void)3770 test_htmlSetMetaEncoding(void) {
3771     int test_ret = 0;
3772 
3773 #if defined(LIBXML_HTML_ENABLED)
3774     int mem_base;
3775     int ret_val;
3776     htmlDocPtr doc; /* the document */
3777     int n_doc;
3778     const xmlChar * encoding; /* the encoding string */
3779     int n_encoding;
3780 
3781     for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) {
3782     for (n_encoding = 0;n_encoding < gen_nb_const_xmlChar_ptr;n_encoding++) {
3783         mem_base = xmlMemBlocks();
3784         doc = gen_htmlDocPtr(n_doc, 0);
3785         encoding = gen_const_xmlChar_ptr(n_encoding, 1);
3786 
3787         ret_val = htmlSetMetaEncoding(doc, encoding);
3788         desret_int(ret_val);
3789         call_tests++;
3790         des_htmlDocPtr(n_doc, doc, 0);
3791         des_const_xmlChar_ptr(n_encoding, encoding, 1);
3792         xmlResetLastError();
3793         if (mem_base != xmlMemBlocks()) {
3794             printf("Leak of %d blocks found in htmlSetMetaEncoding",
3795 	           xmlMemBlocks() - mem_base);
3796 	    test_ret++;
3797             printf(" %d", n_doc);
3798             printf(" %d", n_encoding);
3799             printf("\n");
3800         }
3801     }
3802     }
3803     function_tests++;
3804 #endif
3805 
3806     return(test_ret);
3807 }
3808 
3809 static int
test_HTMLtree(void)3810 test_HTMLtree(void) {
3811     int test_ret = 0;
3812 
3813     if (quiet == 0) printf("Testing HTMLtree : 18 of 18 functions ...\n");
3814     test_ret += test_htmlDocContentDumpFormatOutput();
3815     test_ret += test_htmlDocContentDumpOutput();
3816     test_ret += test_htmlDocDump();
3817     test_ret += test_htmlDocDumpMemory();
3818     test_ret += test_htmlDocDumpMemoryFormat();
3819     test_ret += test_htmlGetMetaEncoding();
3820     test_ret += test_htmlIsBooleanAttr();
3821     test_ret += test_htmlNewDoc();
3822     test_ret += test_htmlNewDocNoDtD();
3823     test_ret += test_htmlNodeDump();
3824     test_ret += test_htmlNodeDumpFile();
3825     test_ret += test_htmlNodeDumpFileFormat();
3826     test_ret += test_htmlNodeDumpFormatOutput();
3827     test_ret += test_htmlNodeDumpOutput();
3828     test_ret += test_htmlSaveFile();
3829     test_ret += test_htmlSaveFileEnc();
3830     test_ret += test_htmlSaveFileFormat();
3831     test_ret += test_htmlSetMetaEncoding();
3832 
3833     if (test_ret != 0)
3834 	printf("Module HTMLtree: %d errors\n", test_ret);
3835     return(test_ret);
3836 }
3837 
3838 static int
test_htmlDefaultSAXHandlerInit(void)3839 test_htmlDefaultSAXHandlerInit(void) {
3840     int test_ret = 0;
3841 
3842 #if defined(LIBXML_HTML_ENABLED)
3843 #ifdef LIBXML_HTML_ENABLED
3844     int mem_base;
3845 
3846         mem_base = xmlMemBlocks();
3847 
3848         htmlDefaultSAXHandlerInit();
3849         call_tests++;
3850         xmlResetLastError();
3851         if (mem_base != xmlMemBlocks()) {
3852             printf("Leak of %d blocks found in htmlDefaultSAXHandlerInit",
3853 	           xmlMemBlocks() - mem_base);
3854 	    test_ret++;
3855             printf("\n");
3856         }
3857     function_tests++;
3858 #endif
3859 #endif
3860 
3861     return(test_ret);
3862 }
3863 
3864 
3865 static int
test_xmlDefaultSAXHandlerInit(void)3866 test_xmlDefaultSAXHandlerInit(void) {
3867     int test_ret = 0;
3868 
3869     int mem_base;
3870 
3871         mem_base = xmlMemBlocks();
3872 
3873         xmlDefaultSAXHandlerInit();
3874         call_tests++;
3875         xmlResetLastError();
3876         if (mem_base != xmlMemBlocks()) {
3877             printf("Leak of %d blocks found in xmlDefaultSAXHandlerInit",
3878 	           xmlMemBlocks() - mem_base);
3879 	    test_ret++;
3880             printf("\n");
3881         }
3882     function_tests++;
3883 
3884     return(test_ret);
3885 }
3886 
3887 
3888 #define gen_nb_xmlEnumerationPtr 1
3889 #define gen_xmlEnumerationPtr(no, nr) NULL
3890 #define des_xmlEnumerationPtr(no, val, nr)
3891 
3892 static int
test_xmlSAX2AttributeDecl(void)3893 test_xmlSAX2AttributeDecl(void) {
3894     int test_ret = 0;
3895 
3896     int mem_base;
3897     void * ctx; /* the user data (XML parser context) */
3898     int n_ctx;
3899     const xmlChar * elem; /* the name of the element */
3900     int n_elem;
3901     const xmlChar * fullname; /* the attribute name */
3902     int n_fullname;
3903     int type; /* the attribute type */
3904     int n_type;
3905     int def; /* the type of default value */
3906     int n_def;
3907     const xmlChar * defaultValue; /* the attribute default value */
3908     int n_defaultValue;
3909     xmlEnumerationPtr tree; /* the tree of enumerated value set */
3910     int n_tree;
3911 
3912     for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3913     for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) {
3914     for (n_fullname = 0;n_fullname < gen_nb_const_xmlChar_ptr;n_fullname++) {
3915     for (n_type = 0;n_type < gen_nb_int;n_type++) {
3916     for (n_def = 0;n_def < gen_nb_int;n_def++) {
3917     for (n_defaultValue = 0;n_defaultValue < gen_nb_const_xmlChar_ptr;n_defaultValue++) {
3918     for (n_tree = 0;n_tree < gen_nb_xmlEnumerationPtr;n_tree++) {
3919         mem_base = xmlMemBlocks();
3920         ctx = gen_void_ptr(n_ctx, 0);
3921         elem = gen_const_xmlChar_ptr(n_elem, 1);
3922         fullname = gen_const_xmlChar_ptr(n_fullname, 2);
3923         type = gen_int(n_type, 3);
3924         def = gen_int(n_def, 4);
3925         defaultValue = gen_const_xmlChar_ptr(n_defaultValue, 5);
3926         tree = gen_xmlEnumerationPtr(n_tree, 6);
3927 
3928         xmlSAX2AttributeDecl(ctx, elem, fullname, type, def, defaultValue, tree);
3929         call_tests++;
3930         des_void_ptr(n_ctx, ctx, 0);
3931         des_const_xmlChar_ptr(n_elem, elem, 1);
3932         des_const_xmlChar_ptr(n_fullname, fullname, 2);
3933         des_int(n_type, type, 3);
3934         des_int(n_def, def, 4);
3935         des_const_xmlChar_ptr(n_defaultValue, defaultValue, 5);
3936         des_xmlEnumerationPtr(n_tree, tree, 6);
3937         xmlResetLastError();
3938         if (mem_base != xmlMemBlocks()) {
3939             printf("Leak of %d blocks found in xmlSAX2AttributeDecl",
3940 	           xmlMemBlocks() - mem_base);
3941 	    test_ret++;
3942             printf(" %d", n_ctx);
3943             printf(" %d", n_elem);
3944             printf(" %d", n_fullname);
3945             printf(" %d", n_type);
3946             printf(" %d", n_def);
3947             printf(" %d", n_defaultValue);
3948             printf(" %d", n_tree);
3949             printf("\n");
3950         }
3951     }
3952     }
3953     }
3954     }
3955     }
3956     }
3957     }
3958     function_tests++;
3959 
3960     return(test_ret);
3961 }
3962 
3963 
3964 static int
test_xmlSAX2CDataBlock(void)3965 test_xmlSAX2CDataBlock(void) {
3966     int test_ret = 0;
3967 
3968     int mem_base;
3969     void * ctx; /* the user data (XML parser context) */
3970     int n_ctx;
3971     const xmlChar * value; /* The pcdata content */
3972     int n_value;
3973     int len; /* the block length */
3974     int n_len;
3975 
3976     for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3977     for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
3978     for (n_len = 0;n_len < gen_nb_int;n_len++) {
3979         mem_base = xmlMemBlocks();
3980         ctx = gen_void_ptr(n_ctx, 0);
3981         value = gen_const_xmlChar_ptr(n_value, 1);
3982         len = gen_int(n_len, 2);
3983         if ((value != NULL) &&
3984             (len > xmlStrlen(BAD_CAST value)))
3985             len = 0;
3986 
3987         xmlSAX2CDataBlock(ctx, value, len);
3988         call_tests++;
3989         des_void_ptr(n_ctx, ctx, 0);
3990         des_const_xmlChar_ptr(n_value, value, 1);
3991         des_int(n_len, len, 2);
3992         xmlResetLastError();
3993         if (mem_base != xmlMemBlocks()) {
3994             printf("Leak of %d blocks found in xmlSAX2CDataBlock",
3995 	           xmlMemBlocks() - mem_base);
3996 	    test_ret++;
3997             printf(" %d", n_ctx);
3998             printf(" %d", n_value);
3999             printf(" %d", n_len);
4000             printf("\n");
4001         }
4002     }
4003     }
4004     }
4005     function_tests++;
4006 
4007     return(test_ret);
4008 }
4009 
4010 
4011 static int
test_xmlSAX2Characters(void)4012 test_xmlSAX2Characters(void) {
4013     int test_ret = 0;
4014 
4015     int mem_base;
4016     void * ctx; /* the user data (XML parser context) */
4017     int n_ctx;
4018     const xmlChar * ch; /* a xmlChar string */
4019     int n_ch;
4020     int len; /* the number of xmlChar */
4021     int n_len;
4022 
4023     for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4024     for (n_ch = 0;n_ch < gen_nb_const_xmlChar_ptr;n_ch++) {
4025     for (n_len = 0;n_len < gen_nb_int;n_len++) {
4026         mem_base = xmlMemBlocks();
4027         ctx = gen_void_ptr(n_ctx, 0);
4028         ch = gen_const_xmlChar_ptr(n_ch, 1);
4029         len = gen_int(n_len, 2);
4030         if ((ch != NULL) &&
4031             (len > xmlStrlen(BAD_CAST ch)))
4032             len = 0;
4033 
4034         xmlSAX2Characters(ctx, ch, len);
4035         call_tests++;
4036         des_void_ptr(n_ctx, ctx, 0);
4037         des_const_xmlChar_ptr(n_ch, ch, 1);
4038         des_int(n_len, len, 2);
4039         xmlResetLastError();
4040         if (mem_base != xmlMemBlocks()) {
4041             printf("Leak of %d blocks found in xmlSAX2Characters",
4042 	           xmlMemBlocks() - mem_base);
4043 	    test_ret++;
4044             printf(" %d", n_ctx);
4045             printf(" %d", n_ch);
4046             printf(" %d", n_len);
4047             printf("\n");
4048         }
4049     }
4050     }
4051     }
4052     function_tests++;
4053 
4054     return(test_ret);
4055 }
4056 
4057 
4058 static int
test_xmlSAX2Comment(void)4059 test_xmlSAX2Comment(void) {
4060     int test_ret = 0;
4061 
4062     int mem_base;
4063     void * ctx; /* the user data (XML parser context) */
4064     int n_ctx;
4065     const xmlChar * value; /* the xmlSAX2Comment content */
4066     int n_value;
4067 
4068     for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4069     for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
4070         mem_base = xmlMemBlocks();
4071         ctx = gen_void_ptr(n_ctx, 0);
4072         value = gen_const_xmlChar_ptr(n_value, 1);
4073 
4074         xmlSAX2Comment(ctx, value);
4075         call_tests++;
4076         des_void_ptr(n_ctx, ctx, 0);
4077         des_const_xmlChar_ptr(n_value, value, 1);
4078         xmlResetLastError();
4079         if (mem_base != xmlMemBlocks()) {
4080             printf("Leak of %d blocks found in xmlSAX2Comment",
4081 	           xmlMemBlocks() - mem_base);
4082 	    test_ret++;
4083             printf(" %d", n_ctx);
4084             printf(" %d", n_value);
4085             printf("\n");
4086         }
4087     }
4088     }
4089     function_tests++;
4090 
4091     return(test_ret);
4092 }
4093 
4094 
4095 static int
test_xmlSAX2ElementDecl(void)4096 test_xmlSAX2ElementDecl(void) {
4097     int test_ret = 0;
4098 
4099     int mem_base;
4100     void * ctx; /* the user data (XML parser context) */
4101     int n_ctx;
4102     const xmlChar * name; /* the element name */
4103     int n_name;
4104     int type; /* the element type */
4105     int n_type;
4106     xmlElementContentPtr content; /* the element value tree */
4107     int n_content;
4108 
4109     for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4110     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4111     for (n_type = 0;n_type < gen_nb_int;n_type++) {
4112     for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) {
4113         mem_base = xmlMemBlocks();
4114         ctx = gen_void_ptr(n_ctx, 0);
4115         name = gen_const_xmlChar_ptr(n_name, 1);
4116         type = gen_int(n_type, 2);
4117         content = gen_xmlElementContentPtr(n_content, 3);
4118 
4119         xmlSAX2ElementDecl(ctx, name, type, content);
4120         call_tests++;
4121         des_void_ptr(n_ctx, ctx, 0);
4122         des_const_xmlChar_ptr(n_name, name, 1);
4123         des_int(n_type, type, 2);
4124         des_xmlElementContentPtr(n_content, content, 3);
4125         xmlResetLastError();
4126         if (mem_base != xmlMemBlocks()) {
4127             printf("Leak of %d blocks found in xmlSAX2ElementDecl",
4128 	           xmlMemBlocks() - mem_base);
4129 	    test_ret++;
4130             printf(" %d", n_ctx);
4131             printf(" %d", n_name);
4132             printf(" %d", n_type);
4133             printf(" %d", n_content);
4134             printf("\n");
4135         }
4136     }
4137     }
4138     }
4139     }
4140     function_tests++;
4141 
4142     return(test_ret);
4143 }
4144 
4145 
4146 static int
test_xmlSAX2EndDocument(void)4147 test_xmlSAX2EndDocument(void) {
4148     int test_ret = 0;
4149 
4150     int mem_base;
4151     void * ctx; /* the user data (XML parser context) */
4152     int n_ctx;
4153 
4154     for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4155         mem_base = xmlMemBlocks();
4156         ctx = gen_void_ptr(n_ctx, 0);
4157 
4158         xmlSAX2EndDocument(ctx);
4159         call_tests++;
4160         des_void_ptr(n_ctx, ctx, 0);
4161         xmlResetLastError();
4162         if (mem_base != xmlMemBlocks()) {
4163             printf("Leak of %d blocks found in xmlSAX2EndDocument",
4164 	           xmlMemBlocks() - mem_base);
4165 	    test_ret++;
4166             printf(" %d", n_ctx);
4167             printf("\n");
4168         }
4169     }
4170     function_tests++;
4171 
4172     return(test_ret);
4173 }
4174 
4175 
4176 static int
test_xmlSAX2EndElement(void)4177 test_xmlSAX2EndElement(void) {
4178     int test_ret = 0;
4179 
4180 #ifdef LIBXML_SAX1_ENABLED
4181     int mem_base;
4182     void * ctx; /* the user data (XML parser context) */
4183     int n_ctx;
4184     const xmlChar * name; /* The element name */
4185     int n_name;
4186 
4187     for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4188     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4189         mem_base = xmlMemBlocks();
4190         ctx = gen_void_ptr(n_ctx, 0);
4191         name = gen_const_xmlChar_ptr(n_name, 1);
4192 
4193         xmlSAX2EndElement(ctx, name);
4194         call_tests++;
4195         des_void_ptr(n_ctx, ctx, 0);
4196         des_const_xmlChar_ptr(n_name, name, 1);
4197         xmlResetLastError();
4198         if (mem_base != xmlMemBlocks()) {
4199             printf("Leak of %d blocks found in xmlSAX2EndElement",
4200 	           xmlMemBlocks() - mem_base);
4201 	    test_ret++;
4202             printf(" %d", n_ctx);
4203             printf(" %d", n_name);
4204             printf("\n");
4205         }
4206     }
4207     }
4208     function_tests++;
4209 #endif
4210 
4211     return(test_ret);
4212 }
4213 
4214 
4215 static int
test_xmlSAX2EndElementNs(void)4216 test_xmlSAX2EndElementNs(void) {
4217     int test_ret = 0;
4218 
4219     int mem_base;
4220     void * ctx; /* the user data (XML parser context) */
4221     int n_ctx;
4222     const xmlChar * localname; /* the local name of the element */
4223     int n_localname;
4224     const xmlChar * prefix; /* the element namespace prefix if available */
4225     int n_prefix;
4226     const xmlChar * URI; /* the element namespace name if available */
4227     int n_URI;
4228 
4229     for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4230     for (n_localname = 0;n_localname < gen_nb_const_xmlChar_ptr;n_localname++) {
4231     for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
4232     for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
4233         mem_base = xmlMemBlocks();
4234         ctx = gen_void_ptr(n_ctx, 0);
4235         localname = gen_const_xmlChar_ptr(n_localname, 1);
4236         prefix = gen_const_xmlChar_ptr(n_prefix, 2);
4237         URI = gen_const_xmlChar_ptr(n_URI, 3);
4238 
4239         xmlSAX2EndElementNs(ctx, localname, prefix, URI);
4240         call_tests++;
4241         des_void_ptr(n_ctx, ctx, 0);
4242         des_const_xmlChar_ptr(n_localname, localname, 1);
4243         des_const_xmlChar_ptr(n_prefix, prefix, 2);
4244         des_const_xmlChar_ptr(n_URI, URI, 3);
4245         xmlResetLastError();
4246         if (mem_base != xmlMemBlocks()) {
4247             printf("Leak of %d blocks found in xmlSAX2EndElementNs",
4248 	           xmlMemBlocks() - mem_base);
4249 	    test_ret++;
4250             printf(" %d", n_ctx);
4251             printf(" %d", n_localname);
4252             printf(" %d", n_prefix);
4253             printf(" %d", n_URI);
4254             printf("\n");
4255         }
4256     }
4257     }
4258     }
4259     }
4260     function_tests++;
4261 
4262     return(test_ret);
4263 }
4264 
4265 
4266 static int
test_xmlSAX2EntityDecl(void)4267 test_xmlSAX2EntityDecl(void) {
4268     int test_ret = 0;
4269 
4270     int mem_base;
4271     void * ctx; /* the user data (XML parser context) */
4272     int n_ctx;
4273     const xmlChar * name; /* the entity name */
4274     int n_name;
4275     int type; /* the entity type */
4276     int n_type;
4277     const xmlChar * publicId; /* The public ID of the entity */
4278     int n_publicId;
4279     const xmlChar * systemId; /* The system ID of the entity */
4280     int n_systemId;
4281     xmlChar * content; /* the entity value (without processing). */
4282     int n_content;
4283 
4284     for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4285     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4286     for (n_type = 0;n_type < gen_nb_int;n_type++) {
4287     for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) {
4288     for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) {
4289     for (n_content = 0;n_content < gen_nb_xmlChar_ptr;n_content++) {
4290         mem_base = xmlMemBlocks();
4291         ctx = gen_void_ptr(n_ctx, 0);
4292         name = gen_const_xmlChar_ptr(n_name, 1);
4293         type = gen_int(n_type, 2);
4294         publicId = gen_const_xmlChar_ptr(n_publicId, 3);
4295         systemId = gen_const_xmlChar_ptr(n_systemId, 4);
4296         content = gen_xmlChar_ptr(n_content, 5);
4297 
4298         xmlSAX2EntityDecl(ctx, name, type, publicId, systemId, content);
4299         call_tests++;
4300         des_void_ptr(n_ctx, ctx, 0);
4301         des_const_xmlChar_ptr(n_name, name, 1);
4302         des_int(n_type, type, 2);
4303         des_const_xmlChar_ptr(n_publicId, publicId, 3);
4304         des_const_xmlChar_ptr(n_systemId, systemId, 4);
4305         des_xmlChar_ptr(n_content, content, 5);
4306         xmlResetLastError();
4307         if (mem_base != xmlMemBlocks()) {
4308             printf("Leak of %d blocks found in xmlSAX2EntityDecl",
4309 	           xmlMemBlocks() - mem_base);
4310 	    test_ret++;
4311             printf(" %d", n_ctx);
4312             printf(" %d", n_name);
4313             printf(" %d", n_type);
4314             printf(" %d", n_publicId);
4315             printf(" %d", n_systemId);
4316             printf(" %d", n_content);
4317             printf("\n");
4318         }
4319     }
4320     }
4321     }
4322     }
4323     }
4324     }
4325     function_tests++;
4326 
4327     return(test_ret);
4328 }
4329 
4330 
4331 static int
test_xmlSAX2ExternalSubset(void)4332 test_xmlSAX2ExternalSubset(void) {
4333     int test_ret = 0;
4334 
4335     int mem_base;
4336     void * ctx; /* the user data (XML parser context) */
4337     int n_ctx;
4338     const xmlChar * name; /* the root element name */
4339     int n_name;
4340     const xmlChar * ExternalID; /* the external ID */
4341     int n_ExternalID;
4342     const xmlChar * SystemID; /* the SYSTEM ID (e.g. filename or URL) */
4343     int n_SystemID;
4344 
4345     for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4346     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4347     for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
4348     for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
4349         mem_base = xmlMemBlocks();
4350         ctx = gen_void_ptr(n_ctx, 0);
4351         name = gen_const_xmlChar_ptr(n_name, 1);
4352         ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2);
4353         SystemID = gen_const_xmlChar_ptr(n_SystemID, 3);
4354 
4355         xmlSAX2ExternalSubset(ctx, name, ExternalID, SystemID);
4356         call_tests++;
4357         des_void_ptr(n_ctx, ctx, 0);
4358         des_const_xmlChar_ptr(n_name, name, 1);
4359         des_const_xmlChar_ptr(n_ExternalID, ExternalID, 2);
4360         des_const_xmlChar_ptr(n_SystemID, SystemID, 3);
4361         xmlResetLastError();
4362         if (mem_base != xmlMemBlocks()) {
4363             printf("Leak of %d blocks found in xmlSAX2ExternalSubset",
4364 	           xmlMemBlocks() - mem_base);
4365 	    test_ret++;
4366             printf(" %d", n_ctx);
4367             printf(" %d", n_name);
4368             printf(" %d", n_ExternalID);
4369             printf(" %d", n_SystemID);
4370             printf("\n");
4371         }
4372     }
4373     }
4374     }
4375     }
4376     function_tests++;
4377 
4378     return(test_ret);
4379 }
4380 
4381 
4382 static int
test_xmlSAX2GetColumnNumber(void)4383 test_xmlSAX2GetColumnNumber(void) {
4384     int test_ret = 0;
4385 
4386     int mem_base;
4387     int ret_val;
4388     void * ctx; /* the user data (XML parser context) */
4389     int n_ctx;
4390 
4391     for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4392         mem_base = xmlMemBlocks();
4393         ctx = gen_void_ptr(n_ctx, 0);
4394 
4395         ret_val = xmlSAX2GetColumnNumber(ctx);
4396         desret_int(ret_val);
4397         call_tests++;
4398         des_void_ptr(n_ctx, ctx, 0);
4399         xmlResetLastError();
4400         if (mem_base != xmlMemBlocks()) {
4401             printf("Leak of %d blocks found in xmlSAX2GetColumnNumber",
4402 	           xmlMemBlocks() - mem_base);
4403 	    test_ret++;
4404             printf(" %d", n_ctx);
4405             printf("\n");
4406         }
4407     }
4408     function_tests++;
4409 
4410     return(test_ret);
4411 }
4412 
4413 
4414 static int
test_xmlSAX2GetEntity(void)4415 test_xmlSAX2GetEntity(void) {
4416     int test_ret = 0;
4417 
4418     int mem_base;
4419     xmlEntityPtr ret_val;
4420     void * ctx; /* the user data (XML parser context) */
4421     int n_ctx;
4422     const xmlChar * name; /* The entity name */
4423     int n_name;
4424 
4425     for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4426     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4427         mem_base = xmlMemBlocks();
4428         ctx = gen_void_ptr(n_ctx, 0);
4429         name = gen_const_xmlChar_ptr(n_name, 1);
4430 
4431         ret_val = xmlSAX2GetEntity(ctx, name);
4432         desret_xmlEntityPtr(ret_val);
4433         call_tests++;
4434         des_void_ptr(n_ctx, ctx, 0);
4435         des_const_xmlChar_ptr(n_name, name, 1);
4436         xmlResetLastError();
4437         if (mem_base != xmlMemBlocks()) {
4438             printf("Leak of %d blocks found in xmlSAX2GetEntity",
4439 	           xmlMemBlocks() - mem_base);
4440 	    test_ret++;
4441             printf(" %d", n_ctx);
4442             printf(" %d", n_name);
4443             printf("\n");
4444         }
4445     }
4446     }
4447     function_tests++;
4448 
4449     return(test_ret);
4450 }
4451 
4452 
4453 static int
test_xmlSAX2GetLineNumber(void)4454 test_xmlSAX2GetLineNumber(void) {
4455     int test_ret = 0;
4456 
4457     int mem_base;
4458     int ret_val;
4459     void * ctx; /* the user data (XML parser context) */
4460     int n_ctx;
4461 
4462     for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4463         mem_base = xmlMemBlocks();
4464         ctx = gen_void_ptr(n_ctx, 0);
4465 
4466         ret_val = xmlSAX2GetLineNumber(ctx);
4467         desret_int(ret_val);
4468         call_tests++;
4469         des_void_ptr(n_ctx, ctx, 0);
4470         xmlResetLastError();
4471         if (mem_base != xmlMemBlocks()) {
4472             printf("Leak of %d blocks found in xmlSAX2GetLineNumber",
4473 	           xmlMemBlocks() - mem_base);
4474 	    test_ret++;
4475             printf(" %d", n_ctx);
4476             printf("\n");
4477         }
4478     }
4479     function_tests++;
4480 
4481     return(test_ret);
4482 }
4483 
4484 
4485 static int
test_xmlSAX2GetParameterEntity(void)4486 test_xmlSAX2GetParameterEntity(void) {
4487     int test_ret = 0;
4488 
4489     int mem_base;
4490     xmlEntityPtr ret_val;
4491     void * ctx; /* the user data (XML parser context) */
4492     int n_ctx;
4493     const xmlChar * name; /* The entity name */
4494     int n_name;
4495 
4496     for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4497     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4498         mem_base = xmlMemBlocks();
4499         ctx = gen_void_ptr(n_ctx, 0);
4500         name = gen_const_xmlChar_ptr(n_name, 1);
4501 
4502         ret_val = xmlSAX2GetParameterEntity(ctx, name);
4503         desret_xmlEntityPtr(ret_val);
4504         call_tests++;
4505         des_void_ptr(n_ctx, ctx, 0);
4506         des_const_xmlChar_ptr(n_name, name, 1);
4507         xmlResetLastError();
4508         if (mem_base != xmlMemBlocks()) {
4509             printf("Leak of %d blocks found in xmlSAX2GetParameterEntity",
4510 	           xmlMemBlocks() - mem_base);
4511 	    test_ret++;
4512             printf(" %d", n_ctx);
4513             printf(" %d", n_name);
4514             printf("\n");
4515         }
4516     }
4517     }
4518     function_tests++;
4519 
4520     return(test_ret);
4521 }
4522 
4523 
4524 static int
test_xmlSAX2GetPublicId(void)4525 test_xmlSAX2GetPublicId(void) {
4526     int test_ret = 0;
4527 
4528     int mem_base;
4529     const xmlChar * ret_val;
4530     void * ctx; /* the user data (XML parser context) */
4531     int n_ctx;
4532 
4533     for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4534         mem_base = xmlMemBlocks();
4535         ctx = gen_void_ptr(n_ctx, 0);
4536 
4537         ret_val = xmlSAX2GetPublicId(ctx);
4538         desret_const_xmlChar_ptr(ret_val);
4539         call_tests++;
4540         des_void_ptr(n_ctx, ctx, 0);
4541         xmlResetLastError();
4542         if (mem_base != xmlMemBlocks()) {
4543             printf("Leak of %d blocks found in xmlSAX2GetPublicId",
4544 	           xmlMemBlocks() - mem_base);
4545 	    test_ret++;
4546             printf(" %d", n_ctx);
4547             printf("\n");
4548         }
4549     }
4550     function_tests++;
4551 
4552     return(test_ret);
4553 }
4554 
4555 
4556 static int
test_xmlSAX2GetSystemId(void)4557 test_xmlSAX2GetSystemId(void) {
4558     int test_ret = 0;
4559 
4560     int mem_base;
4561     const xmlChar * ret_val;
4562     void * ctx; /* the user data (XML parser context) */
4563     int n_ctx;
4564 
4565     for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4566         mem_base = xmlMemBlocks();
4567         ctx = gen_void_ptr(n_ctx, 0);
4568 
4569         ret_val = xmlSAX2GetSystemId(ctx);
4570         desret_const_xmlChar_ptr(ret_val);
4571         call_tests++;
4572         des_void_ptr(n_ctx, ctx, 0);
4573         xmlResetLastError();
4574         if (mem_base != xmlMemBlocks()) {
4575             printf("Leak of %d blocks found in xmlSAX2GetSystemId",
4576 	           xmlMemBlocks() - mem_base);
4577 	    test_ret++;
4578             printf(" %d", n_ctx);
4579             printf("\n");
4580         }
4581     }
4582     function_tests++;
4583 
4584     return(test_ret);
4585 }
4586 
4587 
4588 static int
test_xmlSAX2HasExternalSubset(void)4589 test_xmlSAX2HasExternalSubset(void) {
4590     int test_ret = 0;
4591 
4592     int mem_base;
4593     int ret_val;
4594     void * ctx; /* the user data (XML parser context) */
4595     int n_ctx;
4596 
4597     for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4598         mem_base = xmlMemBlocks();
4599         ctx = gen_void_ptr(n_ctx, 0);
4600 
4601         ret_val = xmlSAX2HasExternalSubset(ctx);
4602         desret_int(ret_val);
4603         call_tests++;
4604         des_void_ptr(n_ctx, ctx, 0);
4605         xmlResetLastError();
4606         if (mem_base != xmlMemBlocks()) {
4607             printf("Leak of %d blocks found in xmlSAX2HasExternalSubset",
4608 	           xmlMemBlocks() - mem_base);
4609 	    test_ret++;
4610             printf(" %d", n_ctx);
4611             printf("\n");
4612         }
4613     }
4614     function_tests++;
4615 
4616     return(test_ret);
4617 }
4618 
4619 
4620 static int
test_xmlSAX2HasInternalSubset(void)4621 test_xmlSAX2HasInternalSubset(void) {
4622     int test_ret = 0;
4623 
4624     int mem_base;
4625     int ret_val;
4626     void * ctx; /* the user data (XML parser context) */
4627     int n_ctx;
4628 
4629     for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4630         mem_base = xmlMemBlocks();
4631         ctx = gen_void_ptr(n_ctx, 0);
4632 
4633         ret_val = xmlSAX2HasInternalSubset(ctx);
4634         desret_int(ret_val);
4635         call_tests++;
4636         des_void_ptr(n_ctx, ctx, 0);
4637         xmlResetLastError();
4638         if (mem_base != xmlMemBlocks()) {
4639             printf("Leak of %d blocks found in xmlSAX2HasInternalSubset",
4640 	           xmlMemBlocks() - mem_base);
4641 	    test_ret++;
4642             printf(" %d", n_ctx);
4643             printf("\n");
4644         }
4645     }
4646     function_tests++;
4647 
4648     return(test_ret);
4649 }
4650 
4651 
4652 static int
test_xmlSAX2IgnorableWhitespace(void)4653 test_xmlSAX2IgnorableWhitespace(void) {
4654     int test_ret = 0;
4655 
4656     int mem_base;
4657     void * ctx; /* the user data (XML parser context) */
4658     int n_ctx;
4659     const xmlChar * ch; /* a xmlChar string */
4660     int n_ch;
4661     int len; /* the number of xmlChar */
4662     int n_len;
4663 
4664     for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4665     for (n_ch = 0;n_ch < gen_nb_const_xmlChar_ptr;n_ch++) {
4666     for (n_len = 0;n_len < gen_nb_int;n_len++) {
4667         mem_base = xmlMemBlocks();
4668         ctx = gen_void_ptr(n_ctx, 0);
4669         ch = gen_const_xmlChar_ptr(n_ch, 1);
4670         len = gen_int(n_len, 2);
4671         if ((ch != NULL) &&
4672             (len > xmlStrlen(BAD_CAST ch)))
4673             len = 0;
4674 
4675         xmlSAX2IgnorableWhitespace(ctx, ch, len);
4676         call_tests++;
4677         des_void_ptr(n_ctx, ctx, 0);
4678         des_const_xmlChar_ptr(n_ch, ch, 1);
4679         des_int(n_len, len, 2);
4680         xmlResetLastError();
4681         if (mem_base != xmlMemBlocks()) {
4682             printf("Leak of %d blocks found in xmlSAX2IgnorableWhitespace",
4683 	           xmlMemBlocks() - mem_base);
4684 	    test_ret++;
4685             printf(" %d", n_ctx);
4686             printf(" %d", n_ch);
4687             printf(" %d", n_len);
4688             printf("\n");
4689         }
4690     }
4691     }
4692     }
4693     function_tests++;
4694 
4695     return(test_ret);
4696 }
4697 
4698 
4699 #define gen_nb_xmlSAXHandler_ptr 1
4700 #define gen_xmlSAXHandler_ptr(no, nr) NULL
4701 #define des_xmlSAXHandler_ptr(no, val, nr)
4702 
4703 static int
test_xmlSAX2InitDefaultSAXHandler(void)4704 test_xmlSAX2InitDefaultSAXHandler(void) {
4705     int test_ret = 0;
4706 
4707     int mem_base;
4708     xmlSAXHandler * hdlr; /* the SAX handler */
4709     int n_hdlr;
4710     int warning; /* flag if non-zero sets the handler warning procedure */
4711     int n_warning;
4712 
4713     for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) {
4714     for (n_warning = 0;n_warning < gen_nb_int;n_warning++) {
4715         mem_base = xmlMemBlocks();
4716         hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0);
4717         warning = gen_int(n_warning, 1);
4718 
4719         xmlSAX2InitDefaultSAXHandler(hdlr, warning);
4720         call_tests++;
4721         des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0);
4722         des_int(n_warning, warning, 1);
4723         xmlResetLastError();
4724         if (mem_base != xmlMemBlocks()) {
4725             printf("Leak of %d blocks found in xmlSAX2InitDefaultSAXHandler",
4726 	           xmlMemBlocks() - mem_base);
4727 	    test_ret++;
4728             printf(" %d", n_hdlr);
4729             printf(" %d", n_warning);
4730             printf("\n");
4731         }
4732     }
4733     }
4734     function_tests++;
4735 
4736     return(test_ret);
4737 }
4738 
4739 
4740 static int
test_xmlSAX2InitHtmlDefaultSAXHandler(void)4741 test_xmlSAX2InitHtmlDefaultSAXHandler(void) {
4742     int test_ret = 0;
4743 
4744 #if defined(LIBXML_HTML_ENABLED)
4745     int mem_base;
4746     xmlSAXHandler * hdlr; /* the SAX handler */
4747     int n_hdlr;
4748 
4749     for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) {
4750         mem_base = xmlMemBlocks();
4751         hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0);
4752 
4753         xmlSAX2InitHtmlDefaultSAXHandler(hdlr);
4754         call_tests++;
4755         des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0);
4756         xmlResetLastError();
4757         if (mem_base != xmlMemBlocks()) {
4758             printf("Leak of %d blocks found in xmlSAX2InitHtmlDefaultSAXHandler",
4759 	           xmlMemBlocks() - mem_base);
4760 	    test_ret++;
4761             printf(" %d", n_hdlr);
4762             printf("\n");
4763         }
4764     }
4765     function_tests++;
4766 #endif
4767 
4768     return(test_ret);
4769 }
4770 
4771 
4772 static int
test_xmlSAX2InternalSubset(void)4773 test_xmlSAX2InternalSubset(void) {
4774     int test_ret = 0;
4775 
4776     int mem_base;
4777     void * ctx; /* the user data (XML parser context) */
4778     int n_ctx;
4779     const xmlChar * name; /* the root element name */
4780     int n_name;
4781     const xmlChar * ExternalID; /* the external ID */
4782     int n_ExternalID;
4783     const xmlChar * SystemID; /* the SYSTEM ID (e.g. filename or URL) */
4784     int n_SystemID;
4785 
4786     for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4787     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4788     for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
4789     for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
4790         mem_base = xmlMemBlocks();
4791         ctx = gen_void_ptr(n_ctx, 0);
4792         name = gen_const_xmlChar_ptr(n_name, 1);
4793         ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2);
4794         SystemID = gen_const_xmlChar_ptr(n_SystemID, 3);
4795 
4796         xmlSAX2InternalSubset(ctx, name, ExternalID, SystemID);
4797         call_tests++;
4798         des_void_ptr(n_ctx, ctx, 0);
4799         des_const_xmlChar_ptr(n_name, name, 1);
4800         des_const_xmlChar_ptr(n_ExternalID, ExternalID, 2);
4801         des_const_xmlChar_ptr(n_SystemID, SystemID, 3);
4802         xmlResetLastError();
4803         if (mem_base != xmlMemBlocks()) {
4804             printf("Leak of %d blocks found in xmlSAX2InternalSubset",
4805 	           xmlMemBlocks() - mem_base);
4806 	    test_ret++;
4807             printf(" %d", n_ctx);
4808             printf(" %d", n_name);
4809             printf(" %d", n_ExternalID);
4810             printf(" %d", n_SystemID);
4811             printf("\n");
4812         }
4813     }
4814     }
4815     }
4816     }
4817     function_tests++;
4818 
4819     return(test_ret);
4820 }
4821 
4822 
4823 static int
test_xmlSAX2IsStandalone(void)4824 test_xmlSAX2IsStandalone(void) {
4825     int test_ret = 0;
4826 
4827     int mem_base;
4828     int ret_val;
4829     void * ctx; /* the user data (XML parser context) */
4830     int n_ctx;
4831 
4832     for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4833         mem_base = xmlMemBlocks();
4834         ctx = gen_void_ptr(n_ctx, 0);
4835 
4836         ret_val = xmlSAX2IsStandalone(ctx);
4837         desret_int(ret_val);
4838         call_tests++;
4839         des_void_ptr(n_ctx, ctx, 0);
4840         xmlResetLastError();
4841         if (mem_base != xmlMemBlocks()) {
4842             printf("Leak of %d blocks found in xmlSAX2IsStandalone",
4843 	           xmlMemBlocks() - mem_base);
4844 	    test_ret++;
4845             printf(" %d", n_ctx);
4846             printf("\n");
4847         }
4848     }
4849     function_tests++;
4850 
4851     return(test_ret);
4852 }
4853 
4854 
4855 static int
test_xmlSAX2NotationDecl(void)4856 test_xmlSAX2NotationDecl(void) {
4857     int test_ret = 0;
4858 
4859     int mem_base;
4860     void * ctx; /* the user data (XML parser context) */
4861     int n_ctx;
4862     const xmlChar * name; /* The name of the notation */
4863     int n_name;
4864     const xmlChar * publicId; /* The public ID of the entity */
4865     int n_publicId;
4866     const xmlChar * systemId; /* The system ID of the entity */
4867     int n_systemId;
4868 
4869     for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4870     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4871     for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) {
4872     for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) {
4873         mem_base = xmlMemBlocks();
4874         ctx = gen_void_ptr(n_ctx, 0);
4875         name = gen_const_xmlChar_ptr(n_name, 1);
4876         publicId = gen_const_xmlChar_ptr(n_publicId, 2);
4877         systemId = gen_const_xmlChar_ptr(n_systemId, 3);
4878 
4879         xmlSAX2NotationDecl(ctx, name, publicId, systemId);
4880         call_tests++;
4881         des_void_ptr(n_ctx, ctx, 0);
4882         des_const_xmlChar_ptr(n_name, name, 1);
4883         des_const_xmlChar_ptr(n_publicId, publicId, 2);
4884         des_const_xmlChar_ptr(n_systemId, systemId, 3);
4885         xmlResetLastError();
4886         if (mem_base != xmlMemBlocks()) {
4887             printf("Leak of %d blocks found in xmlSAX2NotationDecl",
4888 	           xmlMemBlocks() - mem_base);
4889 	    test_ret++;
4890             printf(" %d", n_ctx);
4891             printf(" %d", n_name);
4892             printf(" %d", n_publicId);
4893             printf(" %d", n_systemId);
4894             printf("\n");
4895         }
4896     }
4897     }
4898     }
4899     }
4900     function_tests++;
4901 
4902     return(test_ret);
4903 }
4904 
4905 
4906 static int
test_xmlSAX2ProcessingInstruction(void)4907 test_xmlSAX2ProcessingInstruction(void) {
4908     int test_ret = 0;
4909 
4910     int mem_base;
4911     void * ctx; /* the user data (XML parser context) */
4912     int n_ctx;
4913     const xmlChar * target; /* the target name */
4914     int n_target;
4915     const xmlChar * data; /* the PI data's */
4916     int n_data;
4917 
4918     for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4919     for (n_target = 0;n_target < gen_nb_const_xmlChar_ptr;n_target++) {
4920     for (n_data = 0;n_data < gen_nb_const_xmlChar_ptr;n_data++) {
4921         mem_base = xmlMemBlocks();
4922         ctx = gen_void_ptr(n_ctx, 0);
4923         target = gen_const_xmlChar_ptr(n_target, 1);
4924         data = gen_const_xmlChar_ptr(n_data, 2);
4925 
4926         xmlSAX2ProcessingInstruction(ctx, target, data);
4927         call_tests++;
4928         des_void_ptr(n_ctx, ctx, 0);
4929         des_const_xmlChar_ptr(n_target, target, 1);
4930         des_const_xmlChar_ptr(n_data, data, 2);
4931         xmlResetLastError();
4932         if (mem_base != xmlMemBlocks()) {
4933             printf("Leak of %d blocks found in xmlSAX2ProcessingInstruction",
4934 	           xmlMemBlocks() - mem_base);
4935 	    test_ret++;
4936             printf(" %d", n_ctx);
4937             printf(" %d", n_target);
4938             printf(" %d", n_data);
4939             printf("\n");
4940         }
4941     }
4942     }
4943     }
4944     function_tests++;
4945 
4946     return(test_ret);
4947 }
4948 
4949 
4950 static int
test_xmlSAX2Reference(void)4951 test_xmlSAX2Reference(void) {
4952     int test_ret = 0;
4953 
4954     int mem_base;
4955     void * ctx; /* the user data (XML parser context) */
4956     int n_ctx;
4957     const xmlChar * name; /* The entity name */
4958     int n_name;
4959 
4960     for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4961     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4962         mem_base = xmlMemBlocks();
4963         ctx = gen_void_ptr(n_ctx, 0);
4964         name = gen_const_xmlChar_ptr(n_name, 1);
4965 
4966         xmlSAX2Reference(ctx, name);
4967         call_tests++;
4968         des_void_ptr(n_ctx, ctx, 0);
4969         des_const_xmlChar_ptr(n_name, name, 1);
4970         xmlResetLastError();
4971         if (mem_base != xmlMemBlocks()) {
4972             printf("Leak of %d blocks found in xmlSAX2Reference",
4973 	           xmlMemBlocks() - mem_base);
4974 	    test_ret++;
4975             printf(" %d", n_ctx);
4976             printf(" %d", n_name);
4977             printf("\n");
4978         }
4979     }
4980     }
4981     function_tests++;
4982 
4983     return(test_ret);
4984 }
4985 
4986 
4987 static int
test_xmlSAX2ResolveEntity(void)4988 test_xmlSAX2ResolveEntity(void) {
4989     int test_ret = 0;
4990 
4991     int mem_base;
4992     xmlParserInputPtr ret_val;
4993     void * ctx; /* the user data (XML parser context) */
4994     int n_ctx;
4995     const xmlChar * publicId; /* The public ID of the entity */
4996     int n_publicId;
4997     const xmlChar * systemId; /* The system ID of the entity */
4998     int n_systemId;
4999 
5000     for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
5001     for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) {
5002     for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) {
5003         mem_base = xmlMemBlocks();
5004         ctx = gen_void_ptr(n_ctx, 0);
5005         publicId = gen_const_xmlChar_ptr(n_publicId, 1);
5006         systemId = gen_const_xmlChar_ptr(n_systemId, 2);
5007 
5008         ret_val = xmlSAX2ResolveEntity(ctx, publicId, systemId);
5009         desret_xmlParserInputPtr(ret_val);
5010         call_tests++;
5011         des_void_ptr(n_ctx, ctx, 0);
5012         des_const_xmlChar_ptr(n_publicId, publicId, 1);
5013         des_const_xmlChar_ptr(n_systemId, systemId, 2);
5014         xmlResetLastError();
5015         if (mem_base != xmlMemBlocks()) {
5016             printf("Leak of %d blocks found in xmlSAX2ResolveEntity",
5017 	           xmlMemBlocks() - mem_base);
5018 	    test_ret++;
5019             printf(" %d", n_ctx);
5020             printf(" %d", n_publicId);
5021             printf(" %d", n_systemId);
5022             printf("\n");
5023         }
5024     }
5025     }
5026     }
5027     function_tests++;
5028 
5029     return(test_ret);
5030 }
5031 
5032 
5033 #define gen_nb_xmlSAXLocatorPtr 1
5034 #define gen_xmlSAXLocatorPtr(no, nr) NULL
5035 #define des_xmlSAXLocatorPtr(no, val, nr)
5036 
5037 static int
test_xmlSAX2SetDocumentLocator(void)5038 test_xmlSAX2SetDocumentLocator(void) {
5039     int test_ret = 0;
5040 
5041     int mem_base;
5042     void * ctx; /* the user data (XML parser context) */
5043     int n_ctx;
5044     xmlSAXLocatorPtr loc; /* A SAX Locator */
5045     int n_loc;
5046 
5047     for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
5048     for (n_loc = 0;n_loc < gen_nb_xmlSAXLocatorPtr;n_loc++) {
5049         mem_base = xmlMemBlocks();
5050         ctx = gen_void_ptr(n_ctx, 0);
5051         loc = gen_xmlSAXLocatorPtr(n_loc, 1);
5052 
5053         xmlSAX2SetDocumentLocator(ctx, loc);
5054         call_tests++;
5055         des_void_ptr(n_ctx, ctx, 0);
5056         des_xmlSAXLocatorPtr(n_loc, loc, 1);
5057         xmlResetLastError();
5058         if (mem_base != xmlMemBlocks()) {
5059             printf("Leak of %d blocks found in xmlSAX2SetDocumentLocator",
5060 	           xmlMemBlocks() - mem_base);
5061 	    test_ret++;
5062             printf(" %d", n_ctx);
5063             printf(" %d", n_loc);
5064             printf("\n");
5065         }
5066     }
5067     }
5068     function_tests++;
5069 
5070     return(test_ret);
5071 }
5072 
5073 
5074 static int
test_xmlSAX2StartDocument(void)5075 test_xmlSAX2StartDocument(void) {
5076     int test_ret = 0;
5077 
5078     int mem_base;
5079     void * ctx; /* the user data (XML parser context) */
5080     int n_ctx;
5081 
5082     for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
5083         mem_base = xmlMemBlocks();
5084         ctx = gen_void_ptr(n_ctx, 0);
5085 
5086         xmlSAX2StartDocument(ctx);
5087         call_tests++;
5088         des_void_ptr(n_ctx, ctx, 0);
5089         xmlResetLastError();
5090         if (mem_base != xmlMemBlocks()) {
5091             printf("Leak of %d blocks found in xmlSAX2StartDocument",
5092 	           xmlMemBlocks() - mem_base);
5093 	    test_ret++;
5094             printf(" %d", n_ctx);
5095             printf("\n");
5096         }
5097     }
5098     function_tests++;
5099 
5100     return(test_ret);
5101 }
5102 
5103 
5104 static int
test_xmlSAX2StartElement(void)5105 test_xmlSAX2StartElement(void) {
5106     int test_ret = 0;
5107 
5108 #ifdef LIBXML_SAX1_ENABLED
5109     int mem_base;
5110     void * ctx; /* the user data (XML parser context) */
5111     int n_ctx;
5112     const xmlChar * fullname; /* The element name, including namespace prefix */
5113     int n_fullname;
5114     const xmlChar ** atts; /* An array of name/value attributes pairs, NULL terminated */
5115     int n_atts;
5116 
5117     for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
5118     for (n_fullname = 0;n_fullname < gen_nb_const_xmlChar_ptr;n_fullname++) {
5119     for (n_atts = 0;n_atts < gen_nb_const_xmlChar_ptr_ptr;n_atts++) {
5120         mem_base = xmlMemBlocks();
5121         ctx = gen_void_ptr(n_ctx, 0);
5122         fullname = gen_const_xmlChar_ptr(n_fullname, 1);
5123         atts = gen_const_xmlChar_ptr_ptr(n_atts, 2);
5124 
5125         xmlSAX2StartElement(ctx, fullname, atts);
5126         call_tests++;
5127         des_void_ptr(n_ctx, ctx, 0);
5128         des_const_xmlChar_ptr(n_fullname, fullname, 1);
5129         des_const_xmlChar_ptr_ptr(n_atts, atts, 2);
5130         xmlResetLastError();
5131         if (mem_base != xmlMemBlocks()) {
5132             printf("Leak of %d blocks found in xmlSAX2StartElement",
5133 	           xmlMemBlocks() - mem_base);
5134 	    test_ret++;
5135             printf(" %d", n_ctx);
5136             printf(" %d", n_fullname);
5137             printf(" %d", n_atts);
5138             printf("\n");
5139         }
5140     }
5141     }
5142     }
5143     function_tests++;
5144 #endif
5145 
5146     return(test_ret);
5147 }
5148 
5149 
5150 static int
test_xmlSAX2StartElementNs(void)5151 test_xmlSAX2StartElementNs(void) {
5152     int test_ret = 0;
5153 
5154     int mem_base;
5155     void * ctx; /* the user data (XML parser context) */
5156     int n_ctx;
5157     const xmlChar * localname; /* the local name of the element */
5158     int n_localname;
5159     const xmlChar * prefix; /* the element namespace prefix if available */
5160     int n_prefix;
5161     const xmlChar * URI; /* the element namespace name if available */
5162     int n_URI;
5163     int nb_namespaces; /* number of namespace definitions on that node */
5164     int n_nb_namespaces;
5165     const xmlChar ** namespaces; /* pointer to the array of prefix/URI pairs namespace definitions */
5166     int n_namespaces;
5167     int nb_attributes; /* the number of attributes on that node */
5168     int n_nb_attributes;
5169     int nb_defaulted; /* the number of defaulted attributes. */
5170     int n_nb_defaulted;
5171     const xmlChar ** attributes; /* pointer to the array of (localname/prefix/URI/value/end) attribute values. */
5172     int n_attributes;
5173 
5174     for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
5175     for (n_localname = 0;n_localname < gen_nb_const_xmlChar_ptr;n_localname++) {
5176     for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
5177     for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
5178     for (n_nb_namespaces = 0;n_nb_namespaces < gen_nb_int;n_nb_namespaces++) {
5179     for (n_namespaces = 0;n_namespaces < gen_nb_const_xmlChar_ptr_ptr;n_namespaces++) {
5180     for (n_nb_attributes = 0;n_nb_attributes < gen_nb_int;n_nb_attributes++) {
5181     for (n_nb_defaulted = 0;n_nb_defaulted < gen_nb_int;n_nb_defaulted++) {
5182     for (n_attributes = 0;n_attributes < gen_nb_const_xmlChar_ptr_ptr;n_attributes++) {
5183         mem_base = xmlMemBlocks();
5184         ctx = gen_void_ptr(n_ctx, 0);
5185         localname = gen_const_xmlChar_ptr(n_localname, 1);
5186         prefix = gen_const_xmlChar_ptr(n_prefix, 2);
5187         URI = gen_const_xmlChar_ptr(n_URI, 3);
5188         nb_namespaces = gen_int(n_nb_namespaces, 4);
5189         namespaces = gen_const_xmlChar_ptr_ptr(n_namespaces, 5);
5190         nb_attributes = gen_int(n_nb_attributes, 6);
5191         nb_defaulted = gen_int(n_nb_defaulted, 7);
5192         attributes = gen_const_xmlChar_ptr_ptr(n_attributes, 8);
5193 
5194         xmlSAX2StartElementNs(ctx, localname, prefix, URI, nb_namespaces, namespaces, nb_attributes, nb_defaulted, attributes);
5195         call_tests++;
5196         des_void_ptr(n_ctx, ctx, 0);
5197         des_const_xmlChar_ptr(n_localname, localname, 1);
5198         des_const_xmlChar_ptr(n_prefix, prefix, 2);
5199         des_const_xmlChar_ptr(n_URI, URI, 3);
5200         des_int(n_nb_namespaces, nb_namespaces, 4);
5201         des_const_xmlChar_ptr_ptr(n_namespaces, namespaces, 5);
5202         des_int(n_nb_attributes, nb_attributes, 6);
5203         des_int(n_nb_defaulted, nb_defaulted, 7);
5204         des_const_xmlChar_ptr_ptr(n_attributes, attributes, 8);
5205         xmlResetLastError();
5206         if (mem_base != xmlMemBlocks()) {
5207             printf("Leak of %d blocks found in xmlSAX2StartElementNs",
5208 	           xmlMemBlocks() - mem_base);
5209 	    test_ret++;
5210             printf(" %d", n_ctx);
5211             printf(" %d", n_localname);
5212             printf(" %d", n_prefix);
5213             printf(" %d", n_URI);
5214             printf(" %d", n_nb_namespaces);
5215             printf(" %d", n_namespaces);
5216             printf(" %d", n_nb_attributes);
5217             printf(" %d", n_nb_defaulted);
5218             printf(" %d", n_attributes);
5219             printf("\n");
5220         }
5221     }
5222     }
5223     }
5224     }
5225     }
5226     }
5227     }
5228     }
5229     }
5230     function_tests++;
5231 
5232     return(test_ret);
5233 }
5234 
5235 
5236 static int
test_xmlSAX2UnparsedEntityDecl(void)5237 test_xmlSAX2UnparsedEntityDecl(void) {
5238     int test_ret = 0;
5239 
5240     int mem_base;
5241     void * ctx; /* the user data (XML parser context) */
5242     int n_ctx;
5243     const xmlChar * name; /* The name of the entity */
5244     int n_name;
5245     const xmlChar * publicId; /* The public ID of the entity */
5246     int n_publicId;
5247     const xmlChar * systemId; /* The system ID of the entity */
5248     int n_systemId;
5249     const xmlChar * notationName; /* the name of the notation */
5250     int n_notationName;
5251 
5252     for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
5253     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
5254     for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) {
5255     for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) {
5256     for (n_notationName = 0;n_notationName < gen_nb_const_xmlChar_ptr;n_notationName++) {
5257         mem_base = xmlMemBlocks();
5258         ctx = gen_void_ptr(n_ctx, 0);
5259         name = gen_const_xmlChar_ptr(n_name, 1);
5260         publicId = gen_const_xmlChar_ptr(n_publicId, 2);
5261         systemId = gen_const_xmlChar_ptr(n_systemId, 3);
5262         notationName = gen_const_xmlChar_ptr(n_notationName, 4);
5263 
5264         xmlSAX2UnparsedEntityDecl(ctx, name, publicId, systemId, notationName);
5265         call_tests++;
5266         des_void_ptr(n_ctx, ctx, 0);
5267         des_const_xmlChar_ptr(n_name, name, 1);
5268         des_const_xmlChar_ptr(n_publicId, publicId, 2);
5269         des_const_xmlChar_ptr(n_systemId, systemId, 3);
5270         des_const_xmlChar_ptr(n_notationName, notationName, 4);
5271         xmlResetLastError();
5272         if (mem_base != xmlMemBlocks()) {
5273             printf("Leak of %d blocks found in xmlSAX2UnparsedEntityDecl",
5274 	           xmlMemBlocks() - mem_base);
5275 	    test_ret++;
5276             printf(" %d", n_ctx);
5277             printf(" %d", n_name);
5278             printf(" %d", n_publicId);
5279             printf(" %d", n_systemId);
5280             printf(" %d", n_notationName);
5281             printf("\n");
5282         }
5283     }
5284     }
5285     }
5286     }
5287     }
5288     function_tests++;
5289 
5290     return(test_ret);
5291 }
5292 
5293 
5294 static int
test_xmlSAXDefaultVersion(void)5295 test_xmlSAXDefaultVersion(void) {
5296     int test_ret = 0;
5297 
5298 #if defined(LIBXML_SAX1_ENABLED)
5299 #ifdef LIBXML_SAX1_ENABLED
5300     int mem_base;
5301     int ret_val;
5302     int version; /* the version, must be 2 */
5303     int n_version;
5304 
5305     for (n_version = 0;n_version < gen_nb_int;n_version++) {
5306         mem_base = xmlMemBlocks();
5307         version = gen_int(n_version, 0);
5308 
5309         {
5310             int original_version = xmlSAXDefaultVersion(2);
5311 
5312 
5313         ret_val = xmlSAXDefaultVersion(version);
5314 
5315             (void)xmlSAXDefaultVersion(original_version);
5316         }
5317 
5318         desret_int(ret_val);
5319         call_tests++;
5320         des_int(n_version, version, 0);
5321         xmlResetLastError();
5322         if (mem_base != xmlMemBlocks()) {
5323             printf("Leak of %d blocks found in xmlSAXDefaultVersion",
5324 	           xmlMemBlocks() - mem_base);
5325 	    test_ret++;
5326             printf(" %d", n_version);
5327             printf("\n");
5328         }
5329     }
5330     function_tests++;
5331 #endif
5332 #endif
5333 
5334     return(test_ret);
5335 }
5336 
5337 
5338 static int
test_xmlSAXVersion(void)5339 test_xmlSAXVersion(void) {
5340     int test_ret = 0;
5341 
5342     int mem_base;
5343     int ret_val;
5344     xmlSAXHandler * hdlr; /* the SAX handler */
5345     int n_hdlr;
5346     int version; /* the version, 1 or 2 */
5347     int n_version;
5348 
5349     for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) {
5350     for (n_version = 0;n_version < gen_nb_int;n_version++) {
5351         mem_base = xmlMemBlocks();
5352         hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0);
5353         version = gen_int(n_version, 1);
5354 
5355         ret_val = xmlSAXVersion(hdlr, version);
5356         desret_int(ret_val);
5357         call_tests++;
5358         des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0);
5359         des_int(n_version, version, 1);
5360         xmlResetLastError();
5361         if (mem_base != xmlMemBlocks()) {
5362             printf("Leak of %d blocks found in xmlSAXVersion",
5363 	           xmlMemBlocks() - mem_base);
5364 	    test_ret++;
5365             printf(" %d", n_hdlr);
5366             printf(" %d", n_version);
5367             printf("\n");
5368         }
5369     }
5370     }
5371     function_tests++;
5372 
5373     return(test_ret);
5374 }
5375 
5376 static int
test_SAX2(void)5377 test_SAX2(void) {
5378     int test_ret = 0;
5379 
5380     if (quiet == 0) printf("Testing SAX2 : 36 of 36 functions ...\n");
5381     test_ret += test_htmlDefaultSAXHandlerInit();
5382     test_ret += test_xmlDefaultSAXHandlerInit();
5383     test_ret += test_xmlSAX2AttributeDecl();
5384     test_ret += test_xmlSAX2CDataBlock();
5385     test_ret += test_xmlSAX2Characters();
5386     test_ret += test_xmlSAX2Comment();
5387     test_ret += test_xmlSAX2ElementDecl();
5388     test_ret += test_xmlSAX2EndDocument();
5389     test_ret += test_xmlSAX2EndElement();
5390     test_ret += test_xmlSAX2EndElementNs();
5391     test_ret += test_xmlSAX2EntityDecl();
5392     test_ret += test_xmlSAX2ExternalSubset();
5393     test_ret += test_xmlSAX2GetColumnNumber();
5394     test_ret += test_xmlSAX2GetEntity();
5395     test_ret += test_xmlSAX2GetLineNumber();
5396     test_ret += test_xmlSAX2GetParameterEntity();
5397     test_ret += test_xmlSAX2GetPublicId();
5398     test_ret += test_xmlSAX2GetSystemId();
5399     test_ret += test_xmlSAX2HasExternalSubset();
5400     test_ret += test_xmlSAX2HasInternalSubset();
5401     test_ret += test_xmlSAX2IgnorableWhitespace();
5402     test_ret += test_xmlSAX2InitDefaultSAXHandler();
5403     test_ret += test_xmlSAX2InitHtmlDefaultSAXHandler();
5404     test_ret += test_xmlSAX2InternalSubset();
5405     test_ret += test_xmlSAX2IsStandalone();
5406     test_ret += test_xmlSAX2NotationDecl();
5407     test_ret += test_xmlSAX2ProcessingInstruction();
5408     test_ret += test_xmlSAX2Reference();
5409     test_ret += test_xmlSAX2ResolveEntity();
5410     test_ret += test_xmlSAX2SetDocumentLocator();
5411     test_ret += test_xmlSAX2StartDocument();
5412     test_ret += test_xmlSAX2StartElement();
5413     test_ret += test_xmlSAX2StartElementNs();
5414     test_ret += test_xmlSAX2UnparsedEntityDecl();
5415     test_ret += test_xmlSAXDefaultVersion();
5416     test_ret += test_xmlSAXVersion();
5417 
5418     if (test_ret != 0)
5419 	printf("Module SAX2: %d errors\n", test_ret);
5420     return(test_ret);
5421 }
5422 
5423 static int
test_xmlC14NDocDumpMemory(void)5424 test_xmlC14NDocDumpMemory(void) {
5425     int test_ret = 0;
5426 
5427 #if defined(LIBXML_C14N_ENABLED)
5428     int mem_base;
5429     int ret_val;
5430     xmlDocPtr doc; /* the XML document for canonization */
5431     int n_doc;
5432     xmlNodeSetPtr nodes; /* the nodes set to be included in the canonized image or NULL if all document nodes should be included */
5433     int n_nodes;
5434     int mode; /* the c14n mode (see @xmlC14NMode) */
5435     int n_mode;
5436     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) */
5437     int n_inclusive_ns_prefixes;
5438     int with_comments; /* include comments in the result (!=0) or not (==0) */
5439     int n_with_comments;
5440     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 */
5441     int n_doc_txt_ptr;
5442 
5443     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
5444     for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
5445     for (n_mode = 0;n_mode < gen_nb_int;n_mode++) {
5446     for (n_inclusive_ns_prefixes = 0;n_inclusive_ns_prefixes < gen_nb_xmlChar_ptr_ptr;n_inclusive_ns_prefixes++) {
5447     for (n_with_comments = 0;n_with_comments < gen_nb_int;n_with_comments++) {
5448     for (n_doc_txt_ptr = 0;n_doc_txt_ptr < gen_nb_xmlChar_ptr_ptr;n_doc_txt_ptr++) {
5449         mem_base = xmlMemBlocks();
5450         doc = gen_xmlDocPtr(n_doc, 0);
5451         nodes = gen_xmlNodeSetPtr(n_nodes, 1);
5452         mode = gen_int(n_mode, 2);
5453         inclusive_ns_prefixes = gen_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, 3);
5454         with_comments = gen_int(n_with_comments, 4);
5455         doc_txt_ptr = gen_xmlChar_ptr_ptr(n_doc_txt_ptr, 5);
5456 
5457         ret_val = xmlC14NDocDumpMemory(doc, nodes, mode, inclusive_ns_prefixes, with_comments, doc_txt_ptr);
5458         desret_int(ret_val);
5459         call_tests++;
5460         des_xmlDocPtr(n_doc, doc, 0);
5461         des_xmlNodeSetPtr(n_nodes, nodes, 1);
5462         des_int(n_mode, mode, 2);
5463         des_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, inclusive_ns_prefixes, 3);
5464         des_int(n_with_comments, with_comments, 4);
5465         des_xmlChar_ptr_ptr(n_doc_txt_ptr, doc_txt_ptr, 5);
5466         xmlResetLastError();
5467         if (mem_base != xmlMemBlocks()) {
5468             printf("Leak of %d blocks found in xmlC14NDocDumpMemory",
5469 	           xmlMemBlocks() - mem_base);
5470 	    test_ret++;
5471             printf(" %d", n_doc);
5472             printf(" %d", n_nodes);
5473             printf(" %d", n_mode);
5474             printf(" %d", n_inclusive_ns_prefixes);
5475             printf(" %d", n_with_comments);
5476             printf(" %d", n_doc_txt_ptr);
5477             printf("\n");
5478         }
5479     }
5480     }
5481     }
5482     }
5483     }
5484     }
5485     function_tests++;
5486 #endif
5487 
5488     return(test_ret);
5489 }
5490 
5491 
5492 static int
test_xmlC14NDocSave(void)5493 test_xmlC14NDocSave(void) {
5494     int test_ret = 0;
5495 
5496 #if defined(LIBXML_C14N_ENABLED)
5497     int mem_base;
5498     int ret_val;
5499     xmlDocPtr doc; /* the XML document for canonization */
5500     int n_doc;
5501     xmlNodeSetPtr nodes; /* the nodes set to be included in the canonized image or NULL if all document nodes should be included */
5502     int n_nodes;
5503     int mode; /* the c14n mode (see @xmlC14NMode) */
5504     int n_mode;
5505     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) */
5506     int n_inclusive_ns_prefixes;
5507     int with_comments; /* include comments in the result (!=0) or not (==0) */
5508     int n_with_comments;
5509     const char * filename; /* the filename to store canonical XML image */
5510     int n_filename;
5511     int compression; /* the compression level (zlib required): -1 - libxml default, 0 - uncompressed, >0 - compression level */
5512     int n_compression;
5513 
5514     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
5515     for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
5516     for (n_mode = 0;n_mode < gen_nb_int;n_mode++) {
5517     for (n_inclusive_ns_prefixes = 0;n_inclusive_ns_prefixes < gen_nb_xmlChar_ptr_ptr;n_inclusive_ns_prefixes++) {
5518     for (n_with_comments = 0;n_with_comments < gen_nb_int;n_with_comments++) {
5519     for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
5520     for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
5521         mem_base = xmlMemBlocks();
5522         doc = gen_xmlDocPtr(n_doc, 0);
5523         nodes = gen_xmlNodeSetPtr(n_nodes, 1);
5524         mode = gen_int(n_mode, 2);
5525         inclusive_ns_prefixes = gen_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, 3);
5526         with_comments = gen_int(n_with_comments, 4);
5527         filename = gen_fileoutput(n_filename, 5);
5528         compression = gen_int(n_compression, 6);
5529 
5530         ret_val = xmlC14NDocSave(doc, nodes, mode, inclusive_ns_prefixes, with_comments, filename, compression);
5531         desret_int(ret_val);
5532         call_tests++;
5533         des_xmlDocPtr(n_doc, doc, 0);
5534         des_xmlNodeSetPtr(n_nodes, nodes, 1);
5535         des_int(n_mode, mode, 2);
5536         des_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, inclusive_ns_prefixes, 3);
5537         des_int(n_with_comments, with_comments, 4);
5538         des_fileoutput(n_filename, filename, 5);
5539         des_int(n_compression, compression, 6);
5540         xmlResetLastError();
5541         if (mem_base != xmlMemBlocks()) {
5542             printf("Leak of %d blocks found in xmlC14NDocSave",
5543 	           xmlMemBlocks() - mem_base);
5544 	    test_ret++;
5545             printf(" %d", n_doc);
5546             printf(" %d", n_nodes);
5547             printf(" %d", n_mode);
5548             printf(" %d", n_inclusive_ns_prefixes);
5549             printf(" %d", n_with_comments);
5550             printf(" %d", n_filename);
5551             printf(" %d", n_compression);
5552             printf("\n");
5553         }
5554     }
5555     }
5556     }
5557     }
5558     }
5559     }
5560     }
5561     function_tests++;
5562 #endif
5563 
5564     return(test_ret);
5565 }
5566 
5567 
5568 static int
test_xmlC14NDocSaveTo(void)5569 test_xmlC14NDocSaveTo(void) {
5570     int test_ret = 0;
5571 
5572 #if defined(LIBXML_C14N_ENABLED)
5573     int mem_base;
5574     int ret_val;
5575     xmlDocPtr doc; /* the XML document for canonization */
5576     int n_doc;
5577     xmlNodeSetPtr nodes; /* the nodes set to be included in the canonized image or NULL if all document nodes should be included */
5578     int n_nodes;
5579     int mode; /* the c14n mode (see @xmlC14NMode) */
5580     int n_mode;
5581     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) */
5582     int n_inclusive_ns_prefixes;
5583     int with_comments; /* include comments in the result (!=0) or not (==0) */
5584     int n_with_comments;
5585     xmlOutputBufferPtr buf; /* the output buffer to store canonical XML; this buffer MUST have encoder==NULL because C14N requires UTF-8 output */
5586     int n_buf;
5587 
5588     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
5589     for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
5590     for (n_mode = 0;n_mode < gen_nb_int;n_mode++) {
5591     for (n_inclusive_ns_prefixes = 0;n_inclusive_ns_prefixes < gen_nb_xmlChar_ptr_ptr;n_inclusive_ns_prefixes++) {
5592     for (n_with_comments = 0;n_with_comments < gen_nb_int;n_with_comments++) {
5593     for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
5594         mem_base = xmlMemBlocks();
5595         doc = gen_xmlDocPtr(n_doc, 0);
5596         nodes = gen_xmlNodeSetPtr(n_nodes, 1);
5597         mode = gen_int(n_mode, 2);
5598         inclusive_ns_prefixes = gen_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, 3);
5599         with_comments = gen_int(n_with_comments, 4);
5600         buf = gen_xmlOutputBufferPtr(n_buf, 5);
5601 
5602         ret_val = xmlC14NDocSaveTo(doc, nodes, mode, inclusive_ns_prefixes, with_comments, buf);
5603         desret_int(ret_val);
5604         call_tests++;
5605         des_xmlDocPtr(n_doc, doc, 0);
5606         des_xmlNodeSetPtr(n_nodes, nodes, 1);
5607         des_int(n_mode, mode, 2);
5608         des_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, inclusive_ns_prefixes, 3);
5609         des_int(n_with_comments, with_comments, 4);
5610         des_xmlOutputBufferPtr(n_buf, buf, 5);
5611         xmlResetLastError();
5612         if (mem_base != xmlMemBlocks()) {
5613             printf("Leak of %d blocks found in xmlC14NDocSaveTo",
5614 	           xmlMemBlocks() - mem_base);
5615 	    test_ret++;
5616             printf(" %d", n_doc);
5617             printf(" %d", n_nodes);
5618             printf(" %d", n_mode);
5619             printf(" %d", n_inclusive_ns_prefixes);
5620             printf(" %d", n_with_comments);
5621             printf(" %d", n_buf);
5622             printf("\n");
5623         }
5624     }
5625     }
5626     }
5627     }
5628     }
5629     }
5630     function_tests++;
5631 #endif
5632 
5633     return(test_ret);
5634 }
5635 
5636 
5637 static int
test_xmlC14NExecute(void)5638 test_xmlC14NExecute(void) {
5639     int test_ret = 0;
5640 
5641 
5642     /* missing type support */
5643     return(test_ret);
5644 }
5645 
5646 static int
test_c14n(void)5647 test_c14n(void) {
5648     int test_ret = 0;
5649 
5650     if (quiet == 0) printf("Testing c14n : 3 of 4 functions ...\n");
5651     test_ret += test_xmlC14NDocDumpMemory();
5652     test_ret += test_xmlC14NDocSave();
5653     test_ret += test_xmlC14NDocSaveTo();
5654     test_ret += test_xmlC14NExecute();
5655 
5656     if (test_ret != 0)
5657 	printf("Module c14n: %d errors\n", test_ret);
5658     return(test_ret);
5659 }
5660 #ifdef LIBXML_CATALOG_ENABLED
5661 
5662 #define gen_nb_xmlCatalogPtr 1
5663 #define gen_xmlCatalogPtr(no, nr) NULL
5664 #define des_xmlCatalogPtr(no, val, nr)
5665 #endif
5666 
5667 
5668 static int
test_xmlACatalogAdd(void)5669 test_xmlACatalogAdd(void) {
5670     int test_ret = 0;
5671 
5672 #if defined(LIBXML_CATALOG_ENABLED)
5673     int mem_base;
5674     int ret_val;
5675     xmlCatalogPtr catal; /* a Catalog */
5676     int n_catal;
5677     const xmlChar * type; /* the type of record to add to the catalog */
5678     int n_type;
5679     const xmlChar * orig; /* the system, public or prefix to match */
5680     int n_orig;
5681     const xmlChar * replace; /* the replacement value for the match */
5682     int n_replace;
5683 
5684     for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5685     for (n_type = 0;n_type < gen_nb_const_xmlChar_ptr;n_type++) {
5686     for (n_orig = 0;n_orig < gen_nb_const_xmlChar_ptr;n_orig++) {
5687     for (n_replace = 0;n_replace < gen_nb_const_xmlChar_ptr;n_replace++) {
5688         mem_base = xmlMemBlocks();
5689         catal = gen_xmlCatalogPtr(n_catal, 0);
5690         type = gen_const_xmlChar_ptr(n_type, 1);
5691         orig = gen_const_xmlChar_ptr(n_orig, 2);
5692         replace = gen_const_xmlChar_ptr(n_replace, 3);
5693 
5694         ret_val = xmlACatalogAdd(catal, type, orig, replace);
5695         desret_int(ret_val);
5696         call_tests++;
5697         des_xmlCatalogPtr(n_catal, catal, 0);
5698         des_const_xmlChar_ptr(n_type, type, 1);
5699         des_const_xmlChar_ptr(n_orig, orig, 2);
5700         des_const_xmlChar_ptr(n_replace, replace, 3);
5701         xmlResetLastError();
5702         if (mem_base != xmlMemBlocks()) {
5703             printf("Leak of %d blocks found in xmlACatalogAdd",
5704 	           xmlMemBlocks() - mem_base);
5705 	    test_ret++;
5706             printf(" %d", n_catal);
5707             printf(" %d", n_type);
5708             printf(" %d", n_orig);
5709             printf(" %d", n_replace);
5710             printf("\n");
5711         }
5712     }
5713     }
5714     }
5715     }
5716     function_tests++;
5717 #endif
5718 
5719     return(test_ret);
5720 }
5721 
5722 
5723 static int
test_xmlACatalogDump(void)5724 test_xmlACatalogDump(void) {
5725     int test_ret = 0;
5726 
5727 #if defined(LIBXML_CATALOG_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
5728     int mem_base;
5729     xmlCatalogPtr catal; /* a Catalog */
5730     int n_catal;
5731     FILE * out; /* the file. */
5732     int n_out;
5733 
5734     for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5735     for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) {
5736         mem_base = xmlMemBlocks();
5737         catal = gen_xmlCatalogPtr(n_catal, 0);
5738         out = gen_FILE_ptr(n_out, 1);
5739 
5740         xmlACatalogDump(catal, out);
5741         call_tests++;
5742         des_xmlCatalogPtr(n_catal, catal, 0);
5743         des_FILE_ptr(n_out, out, 1);
5744         xmlResetLastError();
5745         if (mem_base != xmlMemBlocks()) {
5746             printf("Leak of %d blocks found in xmlACatalogDump",
5747 	           xmlMemBlocks() - mem_base);
5748 	    test_ret++;
5749             printf(" %d", n_catal);
5750             printf(" %d", n_out);
5751             printf("\n");
5752         }
5753     }
5754     }
5755     function_tests++;
5756 #endif
5757 
5758     return(test_ret);
5759 }
5760 
5761 
5762 static int
test_xmlACatalogRemove(void)5763 test_xmlACatalogRemove(void) {
5764     int test_ret = 0;
5765 
5766 #if defined(LIBXML_CATALOG_ENABLED)
5767     int mem_base;
5768     int ret_val;
5769     xmlCatalogPtr catal; /* a Catalog */
5770     int n_catal;
5771     const xmlChar * value; /* the value to remove */
5772     int n_value;
5773 
5774     for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5775     for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
5776         mem_base = xmlMemBlocks();
5777         catal = gen_xmlCatalogPtr(n_catal, 0);
5778         value = gen_const_xmlChar_ptr(n_value, 1);
5779 
5780         ret_val = xmlACatalogRemove(catal, value);
5781         desret_int(ret_val);
5782         call_tests++;
5783         des_xmlCatalogPtr(n_catal, catal, 0);
5784         des_const_xmlChar_ptr(n_value, value, 1);
5785         xmlResetLastError();
5786         if (mem_base != xmlMemBlocks()) {
5787             printf("Leak of %d blocks found in xmlACatalogRemove",
5788 	           xmlMemBlocks() - mem_base);
5789 	    test_ret++;
5790             printf(" %d", n_catal);
5791             printf(" %d", n_value);
5792             printf("\n");
5793         }
5794     }
5795     }
5796     function_tests++;
5797 #endif
5798 
5799     return(test_ret);
5800 }
5801 
5802 
5803 static int
test_xmlACatalogResolve(void)5804 test_xmlACatalogResolve(void) {
5805     int test_ret = 0;
5806 
5807 #if defined(LIBXML_CATALOG_ENABLED)
5808     int mem_base;
5809     xmlChar * ret_val;
5810     xmlCatalogPtr catal; /* a Catalog */
5811     int n_catal;
5812     const xmlChar * pubID; /* the public ID string */
5813     int n_pubID;
5814     const xmlChar * sysID; /* the system ID string */
5815     int n_sysID;
5816 
5817     for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5818     for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
5819     for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
5820         mem_base = xmlMemBlocks();
5821         catal = gen_xmlCatalogPtr(n_catal, 0);
5822         pubID = gen_const_xmlChar_ptr(n_pubID, 1);
5823         sysID = gen_const_xmlChar_ptr(n_sysID, 2);
5824 
5825         ret_val = xmlACatalogResolve(catal, pubID, sysID);
5826         desret_xmlChar_ptr(ret_val);
5827         call_tests++;
5828         des_xmlCatalogPtr(n_catal, catal, 0);
5829         des_const_xmlChar_ptr(n_pubID, pubID, 1);
5830         des_const_xmlChar_ptr(n_sysID, sysID, 2);
5831         xmlResetLastError();
5832         if (mem_base != xmlMemBlocks()) {
5833             printf("Leak of %d blocks found in xmlACatalogResolve",
5834 	           xmlMemBlocks() - mem_base);
5835 	    test_ret++;
5836             printf(" %d", n_catal);
5837             printf(" %d", n_pubID);
5838             printf(" %d", n_sysID);
5839             printf("\n");
5840         }
5841     }
5842     }
5843     }
5844     function_tests++;
5845 #endif
5846 
5847     return(test_ret);
5848 }
5849 
5850 
5851 static int
test_xmlACatalogResolvePublic(void)5852 test_xmlACatalogResolvePublic(void) {
5853     int test_ret = 0;
5854 
5855 #if defined(LIBXML_CATALOG_ENABLED)
5856     int mem_base;
5857     xmlChar * ret_val;
5858     xmlCatalogPtr catal; /* a Catalog */
5859     int n_catal;
5860     const xmlChar * pubID; /* the public ID string */
5861     int n_pubID;
5862 
5863     for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5864     for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
5865         mem_base = xmlMemBlocks();
5866         catal = gen_xmlCatalogPtr(n_catal, 0);
5867         pubID = gen_const_xmlChar_ptr(n_pubID, 1);
5868 
5869         ret_val = xmlACatalogResolvePublic(catal, pubID);
5870         desret_xmlChar_ptr(ret_val);
5871         call_tests++;
5872         des_xmlCatalogPtr(n_catal, catal, 0);
5873         des_const_xmlChar_ptr(n_pubID, pubID, 1);
5874         xmlResetLastError();
5875         if (mem_base != xmlMemBlocks()) {
5876             printf("Leak of %d blocks found in xmlACatalogResolvePublic",
5877 	           xmlMemBlocks() - mem_base);
5878 	    test_ret++;
5879             printf(" %d", n_catal);
5880             printf(" %d", n_pubID);
5881             printf("\n");
5882         }
5883     }
5884     }
5885     function_tests++;
5886 #endif
5887 
5888     return(test_ret);
5889 }
5890 
5891 
5892 static int
test_xmlACatalogResolveSystem(void)5893 test_xmlACatalogResolveSystem(void) {
5894     int test_ret = 0;
5895 
5896 #if defined(LIBXML_CATALOG_ENABLED)
5897     int mem_base;
5898     xmlChar * ret_val;
5899     xmlCatalogPtr catal; /* a Catalog */
5900     int n_catal;
5901     const xmlChar * sysID; /* the system ID string */
5902     int n_sysID;
5903 
5904     for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5905     for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
5906         mem_base = xmlMemBlocks();
5907         catal = gen_xmlCatalogPtr(n_catal, 0);
5908         sysID = gen_const_xmlChar_ptr(n_sysID, 1);
5909 
5910         ret_val = xmlACatalogResolveSystem(catal, sysID);
5911         desret_xmlChar_ptr(ret_val);
5912         call_tests++;
5913         des_xmlCatalogPtr(n_catal, catal, 0);
5914         des_const_xmlChar_ptr(n_sysID, sysID, 1);
5915         xmlResetLastError();
5916         if (mem_base != xmlMemBlocks()) {
5917             printf("Leak of %d blocks found in xmlACatalogResolveSystem",
5918 	           xmlMemBlocks() - mem_base);
5919 	    test_ret++;
5920             printf(" %d", n_catal);
5921             printf(" %d", n_sysID);
5922             printf("\n");
5923         }
5924     }
5925     }
5926     function_tests++;
5927 #endif
5928 
5929     return(test_ret);
5930 }
5931 
5932 
5933 static int
test_xmlACatalogResolveURI(void)5934 test_xmlACatalogResolveURI(void) {
5935     int test_ret = 0;
5936 
5937 #if defined(LIBXML_CATALOG_ENABLED)
5938     int mem_base;
5939     xmlChar * ret_val;
5940     xmlCatalogPtr catal; /* a Catalog */
5941     int n_catal;
5942     const xmlChar * URI; /* the URI */
5943     int n_URI;
5944 
5945     for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5946     for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
5947         mem_base = xmlMemBlocks();
5948         catal = gen_xmlCatalogPtr(n_catal, 0);
5949         URI = gen_const_xmlChar_ptr(n_URI, 1);
5950 
5951         ret_val = xmlACatalogResolveURI(catal, URI);
5952         desret_xmlChar_ptr(ret_val);
5953         call_tests++;
5954         des_xmlCatalogPtr(n_catal, catal, 0);
5955         des_const_xmlChar_ptr(n_URI, URI, 1);
5956         xmlResetLastError();
5957         if (mem_base != xmlMemBlocks()) {
5958             printf("Leak of %d blocks found in xmlACatalogResolveURI",
5959 	           xmlMemBlocks() - mem_base);
5960 	    test_ret++;
5961             printf(" %d", n_catal);
5962             printf(" %d", n_URI);
5963             printf("\n");
5964         }
5965     }
5966     }
5967     function_tests++;
5968 #endif
5969 
5970     return(test_ret);
5971 }
5972 
5973 
5974 static int
test_xmlCatalogAdd(void)5975 test_xmlCatalogAdd(void) {
5976     int test_ret = 0;
5977 
5978 #if defined(LIBXML_CATALOG_ENABLED)
5979     int mem_base;
5980     int ret_val;
5981     const xmlChar * type; /* the type of record to add to the catalog */
5982     int n_type;
5983     const xmlChar * orig; /* the system, public or prefix to match */
5984     int n_orig;
5985     const xmlChar * replace; /* the replacement value for the match */
5986     int n_replace;
5987 
5988     for (n_type = 0;n_type < gen_nb_const_xmlChar_ptr;n_type++) {
5989     for (n_orig = 0;n_orig < gen_nb_const_xmlChar_ptr;n_orig++) {
5990     for (n_replace = 0;n_replace < gen_nb_const_xmlChar_ptr;n_replace++) {
5991         mem_base = xmlMemBlocks();
5992         type = gen_const_xmlChar_ptr(n_type, 0);
5993         orig = gen_const_xmlChar_ptr(n_orig, 1);
5994         replace = gen_const_xmlChar_ptr(n_replace, 2);
5995 
5996         ret_val = xmlCatalogAdd(type, orig, replace);
5997         desret_int(ret_val);
5998         call_tests++;
5999         des_const_xmlChar_ptr(n_type, type, 0);
6000         des_const_xmlChar_ptr(n_orig, orig, 1);
6001         des_const_xmlChar_ptr(n_replace, replace, 2);
6002         xmlResetLastError();
6003         if (mem_base != xmlMemBlocks()) {
6004             printf("Leak of %d blocks found in xmlCatalogAdd",
6005 	           xmlMemBlocks() - mem_base);
6006 	    test_ret++;
6007             printf(" %d", n_type);
6008             printf(" %d", n_orig);
6009             printf(" %d", n_replace);
6010             printf("\n");
6011         }
6012     }
6013     }
6014     }
6015     function_tests++;
6016 #endif
6017 
6018     return(test_ret);
6019 }
6020 
6021 
6022 static int
test_xmlCatalogCleanup(void)6023 test_xmlCatalogCleanup(void) {
6024     int test_ret = 0;
6025 
6026 #if defined(LIBXML_CATALOG_ENABLED)
6027 
6028 
6029         xmlCatalogCleanup();
6030         call_tests++;
6031         xmlResetLastError();
6032     function_tests++;
6033 #endif
6034 
6035     return(test_ret);
6036 }
6037 
6038 
6039 static int
test_xmlCatalogConvert(void)6040 test_xmlCatalogConvert(void) {
6041     int test_ret = 0;
6042 
6043 #if defined(LIBXML_CATALOG_ENABLED)
6044     int ret_val;
6045 
6046 
6047         ret_val = xmlCatalogConvert();
6048         desret_int(ret_val);
6049         call_tests++;
6050         xmlResetLastError();
6051     function_tests++;
6052 #endif
6053 
6054     return(test_ret);
6055 }
6056 
6057 
6058 static int
test_xmlCatalogDump(void)6059 test_xmlCatalogDump(void) {
6060     int test_ret = 0;
6061 
6062 #if defined(LIBXML_CATALOG_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
6063     int mem_base;
6064     FILE * out; /* the file. */
6065     int n_out;
6066 
6067     for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) {
6068         mem_base = xmlMemBlocks();
6069         out = gen_FILE_ptr(n_out, 0);
6070 
6071         xmlCatalogDump(out);
6072         call_tests++;
6073         des_FILE_ptr(n_out, out, 0);
6074         xmlResetLastError();
6075         if (mem_base != xmlMemBlocks()) {
6076             printf("Leak of %d blocks found in xmlCatalogDump",
6077 	           xmlMemBlocks() - mem_base);
6078 	    test_ret++;
6079             printf(" %d", n_out);
6080             printf("\n");
6081         }
6082     }
6083     function_tests++;
6084 #endif
6085 
6086     return(test_ret);
6087 }
6088 
6089 
6090 static int
test_xmlCatalogGetDefaults(void)6091 test_xmlCatalogGetDefaults(void) {
6092     int test_ret = 0;
6093 
6094 #if defined(LIBXML_CATALOG_ENABLED)
6095     int mem_base;
6096     xmlCatalogAllow ret_val;
6097 
6098         mem_base = xmlMemBlocks();
6099 
6100         ret_val = xmlCatalogGetDefaults();
6101         desret_xmlCatalogAllow(ret_val);
6102         call_tests++;
6103         xmlResetLastError();
6104         if (mem_base != xmlMemBlocks()) {
6105             printf("Leak of %d blocks found in xmlCatalogGetDefaults",
6106 	           xmlMemBlocks() - mem_base);
6107 	    test_ret++;
6108             printf("\n");
6109         }
6110     function_tests++;
6111 #endif
6112 
6113     return(test_ret);
6114 }
6115 
6116 
6117 static int
test_xmlCatalogIsEmpty(void)6118 test_xmlCatalogIsEmpty(void) {
6119     int test_ret = 0;
6120 
6121 #if defined(LIBXML_CATALOG_ENABLED)
6122     int mem_base;
6123     int ret_val;
6124     xmlCatalogPtr catal; /* should this create an SGML catalog */
6125     int n_catal;
6126 
6127     for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
6128         mem_base = xmlMemBlocks();
6129         catal = gen_xmlCatalogPtr(n_catal, 0);
6130 
6131         ret_val = xmlCatalogIsEmpty(catal);
6132         desret_int(ret_val);
6133         call_tests++;
6134         des_xmlCatalogPtr(n_catal, catal, 0);
6135         xmlResetLastError();
6136         if (mem_base != xmlMemBlocks()) {
6137             printf("Leak of %d blocks found in xmlCatalogIsEmpty",
6138 	           xmlMemBlocks() - mem_base);
6139 	    test_ret++;
6140             printf(" %d", n_catal);
6141             printf("\n");
6142         }
6143     }
6144     function_tests++;
6145 #endif
6146 
6147     return(test_ret);
6148 }
6149 
6150 
6151 static int
test_xmlCatalogLocalResolve(void)6152 test_xmlCatalogLocalResolve(void) {
6153     int test_ret = 0;
6154 
6155 #if defined(LIBXML_CATALOG_ENABLED)
6156     int mem_base;
6157     xmlChar * ret_val;
6158     void * catalogs; /* a document's list of catalogs */
6159     int n_catalogs;
6160     const xmlChar * pubID; /* the public ID string */
6161     int n_pubID;
6162     const xmlChar * sysID; /* the system ID string */
6163     int n_sysID;
6164 
6165     for (n_catalogs = 0;n_catalogs < gen_nb_void_ptr;n_catalogs++) {
6166     for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
6167     for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
6168         mem_base = xmlMemBlocks();
6169         catalogs = gen_void_ptr(n_catalogs, 0);
6170         pubID = gen_const_xmlChar_ptr(n_pubID, 1);
6171         sysID = gen_const_xmlChar_ptr(n_sysID, 2);
6172 
6173         ret_val = xmlCatalogLocalResolve(catalogs, pubID, sysID);
6174         desret_xmlChar_ptr(ret_val);
6175         call_tests++;
6176         des_void_ptr(n_catalogs, catalogs, 0);
6177         des_const_xmlChar_ptr(n_pubID, pubID, 1);
6178         des_const_xmlChar_ptr(n_sysID, sysID, 2);
6179         xmlResetLastError();
6180         if (mem_base != xmlMemBlocks()) {
6181             printf("Leak of %d blocks found in xmlCatalogLocalResolve",
6182 	           xmlMemBlocks() - mem_base);
6183 	    test_ret++;
6184             printf(" %d", n_catalogs);
6185             printf(" %d", n_pubID);
6186             printf(" %d", n_sysID);
6187             printf("\n");
6188         }
6189     }
6190     }
6191     }
6192     function_tests++;
6193 #endif
6194 
6195     return(test_ret);
6196 }
6197 
6198 
6199 static int
test_xmlCatalogLocalResolveURI(void)6200 test_xmlCatalogLocalResolveURI(void) {
6201     int test_ret = 0;
6202 
6203 #if defined(LIBXML_CATALOG_ENABLED)
6204     int mem_base;
6205     xmlChar * ret_val;
6206     void * catalogs; /* a document's list of catalogs */
6207     int n_catalogs;
6208     const xmlChar * URI; /* the URI */
6209     int n_URI;
6210 
6211     for (n_catalogs = 0;n_catalogs < gen_nb_void_ptr;n_catalogs++) {
6212     for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
6213         mem_base = xmlMemBlocks();
6214         catalogs = gen_void_ptr(n_catalogs, 0);
6215         URI = gen_const_xmlChar_ptr(n_URI, 1);
6216 
6217         ret_val = xmlCatalogLocalResolveURI(catalogs, URI);
6218         desret_xmlChar_ptr(ret_val);
6219         call_tests++;
6220         des_void_ptr(n_catalogs, catalogs, 0);
6221         des_const_xmlChar_ptr(n_URI, URI, 1);
6222         xmlResetLastError();
6223         if (mem_base != xmlMemBlocks()) {
6224             printf("Leak of %d blocks found in xmlCatalogLocalResolveURI",
6225 	           xmlMemBlocks() - mem_base);
6226 	    test_ret++;
6227             printf(" %d", n_catalogs);
6228             printf(" %d", n_URI);
6229             printf("\n");
6230         }
6231     }
6232     }
6233     function_tests++;
6234 #endif
6235 
6236     return(test_ret);
6237 }
6238 
6239 
6240 static int
test_xmlCatalogRemove(void)6241 test_xmlCatalogRemove(void) {
6242     int test_ret = 0;
6243 
6244 #if defined(LIBXML_CATALOG_ENABLED)
6245     int ret_val;
6246     const xmlChar * value; /* the value to remove */
6247     int n_value;
6248 
6249     for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
6250         value = gen_const_xmlChar_ptr(n_value, 0);
6251 
6252         ret_val = xmlCatalogRemove(value);
6253         desret_int(ret_val);
6254         call_tests++;
6255         des_const_xmlChar_ptr(n_value, value, 0);
6256         xmlResetLastError();
6257     }
6258     function_tests++;
6259 #endif
6260 
6261     return(test_ret);
6262 }
6263 
6264 
6265 static int
test_xmlCatalogResolve(void)6266 test_xmlCatalogResolve(void) {
6267     int test_ret = 0;
6268 
6269 #if defined(LIBXML_CATALOG_ENABLED)
6270     xmlChar * ret_val;
6271     const xmlChar * pubID; /* the public ID string */
6272     int n_pubID;
6273     const xmlChar * sysID; /* the system ID string */
6274     int n_sysID;
6275 
6276     for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
6277     for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
6278         pubID = gen_const_xmlChar_ptr(n_pubID, 0);
6279         sysID = gen_const_xmlChar_ptr(n_sysID, 1);
6280 
6281         ret_val = xmlCatalogResolve(pubID, sysID);
6282         desret_xmlChar_ptr(ret_val);
6283         call_tests++;
6284         des_const_xmlChar_ptr(n_pubID, pubID, 0);
6285         des_const_xmlChar_ptr(n_sysID, sysID, 1);
6286         xmlResetLastError();
6287     }
6288     }
6289     function_tests++;
6290 #endif
6291 
6292     return(test_ret);
6293 }
6294 
6295 
6296 static int
test_xmlCatalogResolvePublic(void)6297 test_xmlCatalogResolvePublic(void) {
6298     int test_ret = 0;
6299 
6300 #if defined(LIBXML_CATALOG_ENABLED)
6301     int mem_base;
6302     xmlChar * ret_val;
6303     const xmlChar * pubID; /* the public ID string */
6304     int n_pubID;
6305 
6306     for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
6307         mem_base = xmlMemBlocks();
6308         pubID = gen_const_xmlChar_ptr(n_pubID, 0);
6309 
6310         ret_val = xmlCatalogResolvePublic(pubID);
6311         desret_xmlChar_ptr(ret_val);
6312         call_tests++;
6313         des_const_xmlChar_ptr(n_pubID, pubID, 0);
6314         xmlResetLastError();
6315         if (mem_base != xmlMemBlocks()) {
6316             printf("Leak of %d blocks found in xmlCatalogResolvePublic",
6317 	           xmlMemBlocks() - mem_base);
6318 	    test_ret++;
6319             printf(" %d", n_pubID);
6320             printf("\n");
6321         }
6322     }
6323     function_tests++;
6324 #endif
6325 
6326     return(test_ret);
6327 }
6328 
6329 
6330 static int
test_xmlCatalogResolveSystem(void)6331 test_xmlCatalogResolveSystem(void) {
6332     int test_ret = 0;
6333 
6334 #if defined(LIBXML_CATALOG_ENABLED)
6335     int mem_base;
6336     xmlChar * ret_val;
6337     const xmlChar * sysID; /* the system ID string */
6338     int n_sysID;
6339 
6340     for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
6341         mem_base = xmlMemBlocks();
6342         sysID = gen_const_xmlChar_ptr(n_sysID, 0);
6343 
6344         ret_val = xmlCatalogResolveSystem(sysID);
6345         desret_xmlChar_ptr(ret_val);
6346         call_tests++;
6347         des_const_xmlChar_ptr(n_sysID, sysID, 0);
6348         xmlResetLastError();
6349         if (mem_base != xmlMemBlocks()) {
6350             printf("Leak of %d blocks found in xmlCatalogResolveSystem",
6351 	           xmlMemBlocks() - mem_base);
6352 	    test_ret++;
6353             printf(" %d", n_sysID);
6354             printf("\n");
6355         }
6356     }
6357     function_tests++;
6358 #endif
6359 
6360     return(test_ret);
6361 }
6362 
6363 
6364 static int
test_xmlCatalogResolveURI(void)6365 test_xmlCatalogResolveURI(void) {
6366     int test_ret = 0;
6367 
6368 #if defined(LIBXML_CATALOG_ENABLED)
6369     int mem_base;
6370     xmlChar * ret_val;
6371     const xmlChar * URI; /* the URI */
6372     int n_URI;
6373 
6374     for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
6375         mem_base = xmlMemBlocks();
6376         URI = gen_const_xmlChar_ptr(n_URI, 0);
6377 
6378         ret_val = xmlCatalogResolveURI(URI);
6379         desret_xmlChar_ptr(ret_val);
6380         call_tests++;
6381         des_const_xmlChar_ptr(n_URI, URI, 0);
6382         xmlResetLastError();
6383         if (mem_base != xmlMemBlocks()) {
6384             printf("Leak of %d blocks found in xmlCatalogResolveURI",
6385 	           xmlMemBlocks() - mem_base);
6386 	    test_ret++;
6387             printf(" %d", n_URI);
6388             printf("\n");
6389         }
6390     }
6391     function_tests++;
6392 #endif
6393 
6394     return(test_ret);
6395 }
6396 
6397 
6398 static int
test_xmlCatalogSetDefaultPrefer(void)6399 test_xmlCatalogSetDefaultPrefer(void) {
6400     int test_ret = 0;
6401 
6402 #if defined(LIBXML_CATALOG_ENABLED)
6403     int mem_base;
6404     xmlCatalogPrefer ret_val;
6405     xmlCatalogPrefer prefer; /* the default preference for delegation */
6406     int n_prefer;
6407 
6408     for (n_prefer = 0;n_prefer < gen_nb_xmlCatalogPrefer;n_prefer++) {
6409         mem_base = xmlMemBlocks();
6410         prefer = gen_xmlCatalogPrefer(n_prefer, 0);
6411 
6412         ret_val = xmlCatalogSetDefaultPrefer(prefer);
6413         desret_xmlCatalogPrefer(ret_val);
6414         call_tests++;
6415         des_xmlCatalogPrefer(n_prefer, prefer, 0);
6416         xmlResetLastError();
6417         if (mem_base != xmlMemBlocks()) {
6418             printf("Leak of %d blocks found in xmlCatalogSetDefaultPrefer",
6419 	           xmlMemBlocks() - mem_base);
6420 	    test_ret++;
6421             printf(" %d", n_prefer);
6422             printf("\n");
6423         }
6424     }
6425     function_tests++;
6426 #endif
6427 
6428     return(test_ret);
6429 }
6430 
6431 
6432 static int
test_xmlCatalogSetDefaults(void)6433 test_xmlCatalogSetDefaults(void) {
6434     int test_ret = 0;
6435 
6436 #if defined(LIBXML_CATALOG_ENABLED)
6437     int mem_base;
6438     xmlCatalogAllow allow; /* what catalogs should be accepted */
6439     int n_allow;
6440 
6441     for (n_allow = 0;n_allow < gen_nb_xmlCatalogAllow;n_allow++) {
6442         mem_base = xmlMemBlocks();
6443         allow = gen_xmlCatalogAllow(n_allow, 0);
6444 
6445         xmlCatalogSetDefaults(allow);
6446         call_tests++;
6447         des_xmlCatalogAllow(n_allow, allow, 0);
6448         xmlResetLastError();
6449         if (mem_base != xmlMemBlocks()) {
6450             printf("Leak of %d blocks found in xmlCatalogSetDefaults",
6451 	           xmlMemBlocks() - mem_base);
6452 	    test_ret++;
6453             printf(" %d", n_allow);
6454             printf("\n");
6455         }
6456     }
6457     function_tests++;
6458 #endif
6459 
6460     return(test_ret);
6461 }
6462 
6463 
6464 static int
test_xmlConvertSGMLCatalog(void)6465 test_xmlConvertSGMLCatalog(void) {
6466     int test_ret = 0;
6467 
6468 #if defined(LIBXML_CATALOG_ENABLED)
6469     int mem_base;
6470     int ret_val;
6471     xmlCatalogPtr catal; /* the catalog */
6472     int n_catal;
6473 
6474     for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
6475         mem_base = xmlMemBlocks();
6476         catal = gen_xmlCatalogPtr(n_catal, 0);
6477 
6478         ret_val = xmlConvertSGMLCatalog(catal);
6479         desret_int(ret_val);
6480         call_tests++;
6481         des_xmlCatalogPtr(n_catal, catal, 0);
6482         xmlResetLastError();
6483         if (mem_base != xmlMemBlocks()) {
6484             printf("Leak of %d blocks found in xmlConvertSGMLCatalog",
6485 	           xmlMemBlocks() - mem_base);
6486 	    test_ret++;
6487             printf(" %d", n_catal);
6488             printf("\n");
6489         }
6490     }
6491     function_tests++;
6492 #endif
6493 
6494     return(test_ret);
6495 }
6496 
6497 
6498 static int
test_xmlInitializeCatalog(void)6499 test_xmlInitializeCatalog(void) {
6500     int test_ret = 0;
6501 
6502 #if defined(LIBXML_CATALOG_ENABLED)
6503     int mem_base;
6504 
6505         mem_base = xmlMemBlocks();
6506 
6507         xmlInitializeCatalog();
6508         call_tests++;
6509         xmlResetLastError();
6510         if (mem_base != xmlMemBlocks()) {
6511             printf("Leak of %d blocks found in xmlInitializeCatalog",
6512 	           xmlMemBlocks() - mem_base);
6513 	    test_ret++;
6514             printf("\n");
6515         }
6516     function_tests++;
6517 #endif
6518 
6519     return(test_ret);
6520 }
6521 
6522 
6523 static int
test_xmlLoadACatalog(void)6524 test_xmlLoadACatalog(void) {
6525     int test_ret = 0;
6526 
6527 
6528     /* missing type support */
6529     return(test_ret);
6530 }
6531 
6532 
6533 static int
test_xmlLoadCatalog(void)6534 test_xmlLoadCatalog(void) {
6535     int test_ret = 0;
6536 
6537 #if defined(LIBXML_CATALOG_ENABLED)
6538     int ret_val;
6539     const char * filename; /* a file path */
6540     int n_filename;
6541 
6542     for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
6543         filename = gen_filepath(n_filename, 0);
6544 
6545         ret_val = xmlLoadCatalog(filename);
6546         desret_int(ret_val);
6547         call_tests++;
6548         des_filepath(n_filename, filename, 0);
6549         xmlResetLastError();
6550     }
6551     function_tests++;
6552 #endif
6553 
6554     return(test_ret);
6555 }
6556 
6557 
6558 static int
test_xmlLoadCatalogs(void)6559 test_xmlLoadCatalogs(void) {
6560     int test_ret = 0;
6561 
6562 #if defined(LIBXML_CATALOG_ENABLED)
6563     const char * pathss; /* a list of directories separated by a colon or a space. */
6564     int n_pathss;
6565 
6566     for (n_pathss = 0;n_pathss < gen_nb_const_char_ptr;n_pathss++) {
6567         pathss = gen_const_char_ptr(n_pathss, 0);
6568 
6569         xmlLoadCatalogs(pathss);
6570         call_tests++;
6571         des_const_char_ptr(n_pathss, pathss, 0);
6572         xmlResetLastError();
6573     }
6574     function_tests++;
6575 #endif
6576 
6577     return(test_ret);
6578 }
6579 
6580 
6581 static int
test_xmlLoadSGMLSuperCatalog(void)6582 test_xmlLoadSGMLSuperCatalog(void) {
6583     int test_ret = 0;
6584 
6585 
6586     /* missing type support */
6587     return(test_ret);
6588 }
6589 
6590 
6591 static int
test_xmlNewCatalog(void)6592 test_xmlNewCatalog(void) {
6593     int test_ret = 0;
6594 
6595 
6596     /* missing type support */
6597     return(test_ret);
6598 }
6599 
6600 
6601 static int
test_xmlParseCatalogFile(void)6602 test_xmlParseCatalogFile(void) {
6603     int test_ret = 0;
6604 
6605 #if defined(LIBXML_CATALOG_ENABLED)
6606     int mem_base;
6607     xmlDocPtr ret_val;
6608     const char * filename; /* the filename */
6609     int n_filename;
6610 
6611     for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
6612         mem_base = xmlMemBlocks();
6613         filename = gen_filepath(n_filename, 0);
6614 
6615         ret_val = xmlParseCatalogFile(filename);
6616         desret_xmlDocPtr(ret_val);
6617         call_tests++;
6618         des_filepath(n_filename, filename, 0);
6619         xmlResetLastError();
6620         if (mem_base != xmlMemBlocks()) {
6621             printf("Leak of %d blocks found in xmlParseCatalogFile",
6622 	           xmlMemBlocks() - mem_base);
6623 	    test_ret++;
6624             printf(" %d", n_filename);
6625             printf("\n");
6626         }
6627     }
6628     function_tests++;
6629 #endif
6630 
6631     return(test_ret);
6632 }
6633 
6634 static int
test_catalog(void)6635 test_catalog(void) {
6636     int test_ret = 0;
6637 
6638     if (quiet == 0) printf("Testing catalog : 27 of 36 functions ...\n");
6639     test_ret += test_xmlACatalogAdd();
6640     test_ret += test_xmlACatalogDump();
6641     test_ret += test_xmlACatalogRemove();
6642     test_ret += test_xmlACatalogResolve();
6643     test_ret += test_xmlACatalogResolvePublic();
6644     test_ret += test_xmlACatalogResolveSystem();
6645     test_ret += test_xmlACatalogResolveURI();
6646     test_ret += test_xmlCatalogAdd();
6647     test_ret += test_xmlCatalogCleanup();
6648     test_ret += test_xmlCatalogConvert();
6649     test_ret += test_xmlCatalogDump();
6650     test_ret += test_xmlCatalogGetDefaults();
6651     test_ret += test_xmlCatalogIsEmpty();
6652     test_ret += test_xmlCatalogLocalResolve();
6653     test_ret += test_xmlCatalogLocalResolveURI();
6654     test_ret += test_xmlCatalogRemove();
6655     test_ret += test_xmlCatalogResolve();
6656     test_ret += test_xmlCatalogResolvePublic();
6657     test_ret += test_xmlCatalogResolveSystem();
6658     test_ret += test_xmlCatalogResolveURI();
6659     test_ret += test_xmlCatalogSetDefaultPrefer();
6660     test_ret += test_xmlCatalogSetDefaults();
6661     test_ret += test_xmlConvertSGMLCatalog();
6662     test_ret += test_xmlInitializeCatalog();
6663     test_ret += test_xmlLoadACatalog();
6664     test_ret += test_xmlLoadCatalog();
6665     test_ret += test_xmlLoadCatalogs();
6666     test_ret += test_xmlLoadSGMLSuperCatalog();
6667     test_ret += test_xmlNewCatalog();
6668     test_ret += test_xmlParseCatalogFile();
6669 
6670     if (test_ret != 0)
6671 	printf("Module catalog: %d errors\n", test_ret);
6672     return(test_ret);
6673 }
6674 
6675 #define gen_nb_const_xmlChRangeGroup_ptr 1
6676 #define gen_const_xmlChRangeGroup_ptr(no, nr) NULL
6677 #define des_const_xmlChRangeGroup_ptr(no, val, nr)
6678 
6679 static int
test_xmlCharInRange(void)6680 test_xmlCharInRange(void) {
6681     int test_ret = 0;
6682 
6683     int mem_base;
6684     int ret_val;
6685     unsigned int val; /* character to be validated */
6686     int n_val;
6687     const xmlChRangeGroup * rptr; /* pointer to range to be used to validate */
6688     int n_rptr;
6689 
6690     for (n_val = 0;n_val < gen_nb_unsigned_int;n_val++) {
6691     for (n_rptr = 0;n_rptr < gen_nb_const_xmlChRangeGroup_ptr;n_rptr++) {
6692         mem_base = xmlMemBlocks();
6693         val = gen_unsigned_int(n_val, 0);
6694         rptr = gen_const_xmlChRangeGroup_ptr(n_rptr, 1);
6695 
6696         ret_val = xmlCharInRange(val, rptr);
6697         desret_int(ret_val);
6698         call_tests++;
6699         des_unsigned_int(n_val, val, 0);
6700         des_const_xmlChRangeGroup_ptr(n_rptr, rptr, 1);
6701         xmlResetLastError();
6702         if (mem_base != xmlMemBlocks()) {
6703             printf("Leak of %d blocks found in xmlCharInRange",
6704 	           xmlMemBlocks() - mem_base);
6705 	    test_ret++;
6706             printf(" %d", n_val);
6707             printf(" %d", n_rptr);
6708             printf("\n");
6709         }
6710     }
6711     }
6712     function_tests++;
6713 
6714     return(test_ret);
6715 }
6716 
6717 
6718 static int
test_xmlIsBaseChar(void)6719 test_xmlIsBaseChar(void) {
6720     int test_ret = 0;
6721 
6722     int mem_base;
6723     int ret_val;
6724     unsigned int ch; /* character to validate */
6725     int n_ch;
6726 
6727     for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6728         mem_base = xmlMemBlocks();
6729         ch = gen_unsigned_int(n_ch, 0);
6730 
6731         ret_val = xmlIsBaseChar(ch);
6732         desret_int(ret_val);
6733         call_tests++;
6734         des_unsigned_int(n_ch, ch, 0);
6735         xmlResetLastError();
6736         if (mem_base != xmlMemBlocks()) {
6737             printf("Leak of %d blocks found in xmlIsBaseChar",
6738 	           xmlMemBlocks() - mem_base);
6739 	    test_ret++;
6740             printf(" %d", n_ch);
6741             printf("\n");
6742         }
6743     }
6744     function_tests++;
6745 
6746     return(test_ret);
6747 }
6748 
6749 
6750 static int
test_xmlIsBlank(void)6751 test_xmlIsBlank(void) {
6752     int test_ret = 0;
6753 
6754     int mem_base;
6755     int ret_val;
6756     unsigned int ch; /* character to validate */
6757     int n_ch;
6758 
6759     for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6760         mem_base = xmlMemBlocks();
6761         ch = gen_unsigned_int(n_ch, 0);
6762 
6763         ret_val = xmlIsBlank(ch);
6764         desret_int(ret_val);
6765         call_tests++;
6766         des_unsigned_int(n_ch, ch, 0);
6767         xmlResetLastError();
6768         if (mem_base != xmlMemBlocks()) {
6769             printf("Leak of %d blocks found in xmlIsBlank",
6770 	           xmlMemBlocks() - mem_base);
6771 	    test_ret++;
6772             printf(" %d", n_ch);
6773             printf("\n");
6774         }
6775     }
6776     function_tests++;
6777 
6778     return(test_ret);
6779 }
6780 
6781 
6782 static int
test_xmlIsChar(void)6783 test_xmlIsChar(void) {
6784     int test_ret = 0;
6785 
6786     int mem_base;
6787     int ret_val;
6788     unsigned int ch; /* character to validate */
6789     int n_ch;
6790 
6791     for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6792         mem_base = xmlMemBlocks();
6793         ch = gen_unsigned_int(n_ch, 0);
6794 
6795         ret_val = xmlIsChar(ch);
6796         desret_int(ret_val);
6797         call_tests++;
6798         des_unsigned_int(n_ch, ch, 0);
6799         xmlResetLastError();
6800         if (mem_base != xmlMemBlocks()) {
6801             printf("Leak of %d blocks found in xmlIsChar",
6802 	           xmlMemBlocks() - mem_base);
6803 	    test_ret++;
6804             printf(" %d", n_ch);
6805             printf("\n");
6806         }
6807     }
6808     function_tests++;
6809 
6810     return(test_ret);
6811 }
6812 
6813 
6814 static int
test_xmlIsCombining(void)6815 test_xmlIsCombining(void) {
6816     int test_ret = 0;
6817 
6818     int mem_base;
6819     int ret_val;
6820     unsigned int ch; /* character to validate */
6821     int n_ch;
6822 
6823     for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6824         mem_base = xmlMemBlocks();
6825         ch = gen_unsigned_int(n_ch, 0);
6826 
6827         ret_val = xmlIsCombining(ch);
6828         desret_int(ret_val);
6829         call_tests++;
6830         des_unsigned_int(n_ch, ch, 0);
6831         xmlResetLastError();
6832         if (mem_base != xmlMemBlocks()) {
6833             printf("Leak of %d blocks found in xmlIsCombining",
6834 	           xmlMemBlocks() - mem_base);
6835 	    test_ret++;
6836             printf(" %d", n_ch);
6837             printf("\n");
6838         }
6839     }
6840     function_tests++;
6841 
6842     return(test_ret);
6843 }
6844 
6845 
6846 static int
test_xmlIsDigit(void)6847 test_xmlIsDigit(void) {
6848     int test_ret = 0;
6849 
6850     int mem_base;
6851     int ret_val;
6852     unsigned int ch; /* character to validate */
6853     int n_ch;
6854 
6855     for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6856         mem_base = xmlMemBlocks();
6857         ch = gen_unsigned_int(n_ch, 0);
6858 
6859         ret_val = xmlIsDigit(ch);
6860         desret_int(ret_val);
6861         call_tests++;
6862         des_unsigned_int(n_ch, ch, 0);
6863         xmlResetLastError();
6864         if (mem_base != xmlMemBlocks()) {
6865             printf("Leak of %d blocks found in xmlIsDigit",
6866 	           xmlMemBlocks() - mem_base);
6867 	    test_ret++;
6868             printf(" %d", n_ch);
6869             printf("\n");
6870         }
6871     }
6872     function_tests++;
6873 
6874     return(test_ret);
6875 }
6876 
6877 
6878 static int
test_xmlIsExtender(void)6879 test_xmlIsExtender(void) {
6880     int test_ret = 0;
6881 
6882     int mem_base;
6883     int ret_val;
6884     unsigned int ch; /* character to validate */
6885     int n_ch;
6886 
6887     for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6888         mem_base = xmlMemBlocks();
6889         ch = gen_unsigned_int(n_ch, 0);
6890 
6891         ret_val = xmlIsExtender(ch);
6892         desret_int(ret_val);
6893         call_tests++;
6894         des_unsigned_int(n_ch, ch, 0);
6895         xmlResetLastError();
6896         if (mem_base != xmlMemBlocks()) {
6897             printf("Leak of %d blocks found in xmlIsExtender",
6898 	           xmlMemBlocks() - mem_base);
6899 	    test_ret++;
6900             printf(" %d", n_ch);
6901             printf("\n");
6902         }
6903     }
6904     function_tests++;
6905 
6906     return(test_ret);
6907 }
6908 
6909 
6910 static int
test_xmlIsIdeographic(void)6911 test_xmlIsIdeographic(void) {
6912     int test_ret = 0;
6913 
6914     int mem_base;
6915     int ret_val;
6916     unsigned int ch; /* character to validate */
6917     int n_ch;
6918 
6919     for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6920         mem_base = xmlMemBlocks();
6921         ch = gen_unsigned_int(n_ch, 0);
6922 
6923         ret_val = xmlIsIdeographic(ch);
6924         desret_int(ret_val);
6925         call_tests++;
6926         des_unsigned_int(n_ch, ch, 0);
6927         xmlResetLastError();
6928         if (mem_base != xmlMemBlocks()) {
6929             printf("Leak of %d blocks found in xmlIsIdeographic",
6930 	           xmlMemBlocks() - mem_base);
6931 	    test_ret++;
6932             printf(" %d", n_ch);
6933             printf("\n");
6934         }
6935     }
6936     function_tests++;
6937 
6938     return(test_ret);
6939 }
6940 
6941 
6942 static int
test_xmlIsPubidChar(void)6943 test_xmlIsPubidChar(void) {
6944     int test_ret = 0;
6945 
6946     int mem_base;
6947     int ret_val;
6948     unsigned int ch; /* character to validate */
6949     int n_ch;
6950 
6951     for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6952         mem_base = xmlMemBlocks();
6953         ch = gen_unsigned_int(n_ch, 0);
6954 
6955         ret_val = xmlIsPubidChar(ch);
6956         desret_int(ret_val);
6957         call_tests++;
6958         des_unsigned_int(n_ch, ch, 0);
6959         xmlResetLastError();
6960         if (mem_base != xmlMemBlocks()) {
6961             printf("Leak of %d blocks found in xmlIsPubidChar",
6962 	           xmlMemBlocks() - mem_base);
6963 	    test_ret++;
6964             printf(" %d", n_ch);
6965             printf("\n");
6966         }
6967     }
6968     function_tests++;
6969 
6970     return(test_ret);
6971 }
6972 
6973 static int
test_chvalid(void)6974 test_chvalid(void) {
6975     int test_ret = 0;
6976 
6977     if (quiet == 0) printf("Testing chvalid : 9 of 9 functions ...\n");
6978     test_ret += test_xmlCharInRange();
6979     test_ret += test_xmlIsBaseChar();
6980     test_ret += test_xmlIsBlank();
6981     test_ret += test_xmlIsChar();
6982     test_ret += test_xmlIsCombining();
6983     test_ret += test_xmlIsDigit();
6984     test_ret += test_xmlIsExtender();
6985     test_ret += test_xmlIsIdeographic();
6986     test_ret += test_xmlIsPubidChar();
6987 
6988     if (test_ret != 0)
6989 	printf("Module chvalid: %d errors\n", test_ret);
6990     return(test_ret);
6991 }
6992 
6993 static int
test_xmlDebugCheckDocument(void)6994 test_xmlDebugCheckDocument(void) {
6995     int test_ret = 0;
6996 
6997 #if defined(LIBXML_DEBUG_ENABLED)
6998     int mem_base;
6999     int ret_val;
7000     FILE * output; /* the FILE * for the output */
7001     int n_output;
7002     xmlDocPtr doc; /* the document */
7003     int n_doc;
7004 
7005     for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7006     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
7007         mem_base = xmlMemBlocks();
7008         output = gen_debug_FILE_ptr(n_output, 0);
7009         doc = gen_xmlDocPtr(n_doc, 1);
7010 
7011         ret_val = xmlDebugCheckDocument(output, doc);
7012         desret_int(ret_val);
7013         call_tests++;
7014         des_debug_FILE_ptr(n_output, output, 0);
7015         des_xmlDocPtr(n_doc, doc, 1);
7016         xmlResetLastError();
7017         if (mem_base != xmlMemBlocks()) {
7018             printf("Leak of %d blocks found in xmlDebugCheckDocument",
7019 	           xmlMemBlocks() - mem_base);
7020 	    test_ret++;
7021             printf(" %d", n_output);
7022             printf(" %d", n_doc);
7023             printf("\n");
7024         }
7025     }
7026     }
7027     function_tests++;
7028 #endif
7029 
7030     return(test_ret);
7031 }
7032 
7033 
7034 static int
test_xmlDebugDumpAttr(void)7035 test_xmlDebugDumpAttr(void) {
7036     int test_ret = 0;
7037 
7038 #if defined(LIBXML_DEBUG_ENABLED)
7039     int mem_base;
7040     FILE * output; /* the FILE * for the output */
7041     int n_output;
7042     xmlAttrPtr attr; /* the attribute */
7043     int n_attr;
7044     int depth; /* the indentation level. */
7045     int n_depth;
7046 
7047     for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7048     for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
7049     for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
7050         mem_base = xmlMemBlocks();
7051         output = gen_debug_FILE_ptr(n_output, 0);
7052         attr = gen_xmlAttrPtr(n_attr, 1);
7053         depth = gen_int(n_depth, 2);
7054 
7055         xmlDebugDumpAttr(output, attr, depth);
7056         call_tests++;
7057         des_debug_FILE_ptr(n_output, output, 0);
7058         des_xmlAttrPtr(n_attr, attr, 1);
7059         des_int(n_depth, depth, 2);
7060         xmlResetLastError();
7061         if (mem_base != xmlMemBlocks()) {
7062             printf("Leak of %d blocks found in xmlDebugDumpAttr",
7063 	           xmlMemBlocks() - mem_base);
7064 	    test_ret++;
7065             printf(" %d", n_output);
7066             printf(" %d", n_attr);
7067             printf(" %d", n_depth);
7068             printf("\n");
7069         }
7070     }
7071     }
7072     }
7073     function_tests++;
7074 #endif
7075 
7076     return(test_ret);
7077 }
7078 
7079 
7080 static int
test_xmlDebugDumpAttrList(void)7081 test_xmlDebugDumpAttrList(void) {
7082     int test_ret = 0;
7083 
7084 #if defined(LIBXML_DEBUG_ENABLED)
7085     int mem_base;
7086     FILE * output; /* the FILE * for the output */
7087     int n_output;
7088     xmlAttrPtr attr; /* the attribute list */
7089     int n_attr;
7090     int depth; /* the indentation level. */
7091     int n_depth;
7092 
7093     for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7094     for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
7095     for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
7096         mem_base = xmlMemBlocks();
7097         output = gen_debug_FILE_ptr(n_output, 0);
7098         attr = gen_xmlAttrPtr(n_attr, 1);
7099         depth = gen_int(n_depth, 2);
7100 
7101         xmlDebugDumpAttrList(output, attr, depth);
7102         call_tests++;
7103         des_debug_FILE_ptr(n_output, output, 0);
7104         des_xmlAttrPtr(n_attr, attr, 1);
7105         des_int(n_depth, depth, 2);
7106         xmlResetLastError();
7107         if (mem_base != xmlMemBlocks()) {
7108             printf("Leak of %d blocks found in xmlDebugDumpAttrList",
7109 	           xmlMemBlocks() - mem_base);
7110 	    test_ret++;
7111             printf(" %d", n_output);
7112             printf(" %d", n_attr);
7113             printf(" %d", n_depth);
7114             printf("\n");
7115         }
7116     }
7117     }
7118     }
7119     function_tests++;
7120 #endif
7121 
7122     return(test_ret);
7123 }
7124 
7125 
7126 static int
test_xmlDebugDumpDTD(void)7127 test_xmlDebugDumpDTD(void) {
7128     int test_ret = 0;
7129 
7130 #if defined(LIBXML_DEBUG_ENABLED)
7131     int mem_base;
7132     FILE * output; /* the FILE * for the output */
7133     int n_output;
7134     xmlDtdPtr dtd; /* the DTD */
7135     int n_dtd;
7136 
7137     for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7138     for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
7139         mem_base = xmlMemBlocks();
7140         output = gen_debug_FILE_ptr(n_output, 0);
7141         dtd = gen_xmlDtdPtr(n_dtd, 1);
7142 
7143         xmlDebugDumpDTD(output, dtd);
7144         call_tests++;
7145         des_debug_FILE_ptr(n_output, output, 0);
7146         des_xmlDtdPtr(n_dtd, dtd, 1);
7147         xmlResetLastError();
7148         if (mem_base != xmlMemBlocks()) {
7149             printf("Leak of %d blocks found in xmlDebugDumpDTD",
7150 	           xmlMemBlocks() - mem_base);
7151 	    test_ret++;
7152             printf(" %d", n_output);
7153             printf(" %d", n_dtd);
7154             printf("\n");
7155         }
7156     }
7157     }
7158     function_tests++;
7159 #endif
7160 
7161     return(test_ret);
7162 }
7163 
7164 
7165 static int
test_xmlDebugDumpDocument(void)7166 test_xmlDebugDumpDocument(void) {
7167     int test_ret = 0;
7168 
7169 #if defined(LIBXML_DEBUG_ENABLED)
7170     int mem_base;
7171     FILE * output; /* the FILE * for the output */
7172     int n_output;
7173     xmlDocPtr doc; /* the document */
7174     int n_doc;
7175 
7176     for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7177     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
7178         mem_base = xmlMemBlocks();
7179         output = gen_debug_FILE_ptr(n_output, 0);
7180         doc = gen_xmlDocPtr(n_doc, 1);
7181 
7182         xmlDebugDumpDocument(output, doc);
7183         call_tests++;
7184         des_debug_FILE_ptr(n_output, output, 0);
7185         des_xmlDocPtr(n_doc, doc, 1);
7186         xmlResetLastError();
7187         if (mem_base != xmlMemBlocks()) {
7188             printf("Leak of %d blocks found in xmlDebugDumpDocument",
7189 	           xmlMemBlocks() - mem_base);
7190 	    test_ret++;
7191             printf(" %d", n_output);
7192             printf(" %d", n_doc);
7193             printf("\n");
7194         }
7195     }
7196     }
7197     function_tests++;
7198 #endif
7199 
7200     return(test_ret);
7201 }
7202 
7203 
7204 static int
test_xmlDebugDumpDocumentHead(void)7205 test_xmlDebugDumpDocumentHead(void) {
7206     int test_ret = 0;
7207 
7208 #if defined(LIBXML_DEBUG_ENABLED)
7209     int mem_base;
7210     FILE * output; /* the FILE * for the output */
7211     int n_output;
7212     xmlDocPtr doc; /* the document */
7213     int n_doc;
7214 
7215     for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7216     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
7217         mem_base = xmlMemBlocks();
7218         output = gen_debug_FILE_ptr(n_output, 0);
7219         doc = gen_xmlDocPtr(n_doc, 1);
7220 
7221         xmlDebugDumpDocumentHead(output, doc);
7222         call_tests++;
7223         des_debug_FILE_ptr(n_output, output, 0);
7224         des_xmlDocPtr(n_doc, doc, 1);
7225         xmlResetLastError();
7226         if (mem_base != xmlMemBlocks()) {
7227             printf("Leak of %d blocks found in xmlDebugDumpDocumentHead",
7228 	           xmlMemBlocks() - mem_base);
7229 	    test_ret++;
7230             printf(" %d", n_output);
7231             printf(" %d", n_doc);
7232             printf("\n");
7233         }
7234     }
7235     }
7236     function_tests++;
7237 #endif
7238 
7239     return(test_ret);
7240 }
7241 
7242 
7243 static int
test_xmlDebugDumpEntities(void)7244 test_xmlDebugDumpEntities(void) {
7245     int test_ret = 0;
7246 
7247 #if defined(LIBXML_DEBUG_ENABLED)
7248     int mem_base;
7249     FILE * output; /* the FILE * for the output */
7250     int n_output;
7251     xmlDocPtr doc; /* the document */
7252     int n_doc;
7253 
7254     for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7255     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
7256         mem_base = xmlMemBlocks();
7257         output = gen_debug_FILE_ptr(n_output, 0);
7258         doc = gen_xmlDocPtr(n_doc, 1);
7259 
7260         xmlDebugDumpEntities(output, doc);
7261         call_tests++;
7262         des_debug_FILE_ptr(n_output, output, 0);
7263         des_xmlDocPtr(n_doc, doc, 1);
7264         xmlResetLastError();
7265         if (mem_base != xmlMemBlocks()) {
7266             printf("Leak of %d blocks found in xmlDebugDumpEntities",
7267 	           xmlMemBlocks() - mem_base);
7268 	    test_ret++;
7269             printf(" %d", n_output);
7270             printf(" %d", n_doc);
7271             printf("\n");
7272         }
7273     }
7274     }
7275     function_tests++;
7276 #endif
7277 
7278     return(test_ret);
7279 }
7280 
7281 
7282 static int
test_xmlDebugDumpNode(void)7283 test_xmlDebugDumpNode(void) {
7284     int test_ret = 0;
7285 
7286 #if defined(LIBXML_DEBUG_ENABLED)
7287     int mem_base;
7288     FILE * output; /* the FILE * for the output */
7289     int n_output;
7290     xmlNodePtr node; /* the node */
7291     int n_node;
7292     int depth; /* the indentation level. */
7293     int n_depth;
7294 
7295     for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7296     for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7297     for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
7298         mem_base = xmlMemBlocks();
7299         output = gen_debug_FILE_ptr(n_output, 0);
7300         node = gen_xmlNodePtr(n_node, 1);
7301         depth = gen_int(n_depth, 2);
7302 
7303         xmlDebugDumpNode(output, node, depth);
7304         call_tests++;
7305         des_debug_FILE_ptr(n_output, output, 0);
7306         des_xmlNodePtr(n_node, node, 1);
7307         des_int(n_depth, depth, 2);
7308         xmlResetLastError();
7309         if (mem_base != xmlMemBlocks()) {
7310             printf("Leak of %d blocks found in xmlDebugDumpNode",
7311 	           xmlMemBlocks() - mem_base);
7312 	    test_ret++;
7313             printf(" %d", n_output);
7314             printf(" %d", n_node);
7315             printf(" %d", n_depth);
7316             printf("\n");
7317         }
7318     }
7319     }
7320     }
7321     function_tests++;
7322 #endif
7323 
7324     return(test_ret);
7325 }
7326 
7327 
7328 static int
test_xmlDebugDumpNodeList(void)7329 test_xmlDebugDumpNodeList(void) {
7330     int test_ret = 0;
7331 
7332 #if defined(LIBXML_DEBUG_ENABLED)
7333     int mem_base;
7334     FILE * output; /* the FILE * for the output */
7335     int n_output;
7336     xmlNodePtr node; /* the node list */
7337     int n_node;
7338     int depth; /* the indentation level. */
7339     int n_depth;
7340 
7341     for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7342     for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7343     for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
7344         mem_base = xmlMemBlocks();
7345         output = gen_debug_FILE_ptr(n_output, 0);
7346         node = gen_xmlNodePtr(n_node, 1);
7347         depth = gen_int(n_depth, 2);
7348 
7349         xmlDebugDumpNodeList(output, node, depth);
7350         call_tests++;
7351         des_debug_FILE_ptr(n_output, output, 0);
7352         des_xmlNodePtr(n_node, node, 1);
7353         des_int(n_depth, depth, 2);
7354         xmlResetLastError();
7355         if (mem_base != xmlMemBlocks()) {
7356             printf("Leak of %d blocks found in xmlDebugDumpNodeList",
7357 	           xmlMemBlocks() - mem_base);
7358 	    test_ret++;
7359             printf(" %d", n_output);
7360             printf(" %d", n_node);
7361             printf(" %d", n_depth);
7362             printf("\n");
7363         }
7364     }
7365     }
7366     }
7367     function_tests++;
7368 #endif
7369 
7370     return(test_ret);
7371 }
7372 
7373 
7374 static int
test_xmlDebugDumpOneNode(void)7375 test_xmlDebugDumpOneNode(void) {
7376     int test_ret = 0;
7377 
7378 #if defined(LIBXML_DEBUG_ENABLED)
7379     int mem_base;
7380     FILE * output; /* the FILE * for the output */
7381     int n_output;
7382     xmlNodePtr node; /* the node */
7383     int n_node;
7384     int depth; /* the indentation level. */
7385     int n_depth;
7386 
7387     for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7388     for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7389     for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
7390         mem_base = xmlMemBlocks();
7391         output = gen_debug_FILE_ptr(n_output, 0);
7392         node = gen_xmlNodePtr(n_node, 1);
7393         depth = gen_int(n_depth, 2);
7394 
7395         xmlDebugDumpOneNode(output, node, depth);
7396         call_tests++;
7397         des_debug_FILE_ptr(n_output, output, 0);
7398         des_xmlNodePtr(n_node, node, 1);
7399         des_int(n_depth, depth, 2);
7400         xmlResetLastError();
7401         if (mem_base != xmlMemBlocks()) {
7402             printf("Leak of %d blocks found in xmlDebugDumpOneNode",
7403 	           xmlMemBlocks() - mem_base);
7404 	    test_ret++;
7405             printf(" %d", n_output);
7406             printf(" %d", n_node);
7407             printf(" %d", n_depth);
7408             printf("\n");
7409         }
7410     }
7411     }
7412     }
7413     function_tests++;
7414 #endif
7415 
7416     return(test_ret);
7417 }
7418 
7419 
7420 static int
test_xmlDebugDumpString(void)7421 test_xmlDebugDumpString(void) {
7422     int test_ret = 0;
7423 
7424 #if defined(LIBXML_DEBUG_ENABLED)
7425     int mem_base;
7426     FILE * output; /* the FILE * for the output */
7427     int n_output;
7428     const xmlChar * str; /* the string */
7429     int n_str;
7430 
7431     for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7432     for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
7433         mem_base = xmlMemBlocks();
7434         output = gen_debug_FILE_ptr(n_output, 0);
7435         str = gen_const_xmlChar_ptr(n_str, 1);
7436 
7437         xmlDebugDumpString(output, str);
7438         call_tests++;
7439         des_debug_FILE_ptr(n_output, output, 0);
7440         des_const_xmlChar_ptr(n_str, str, 1);
7441         xmlResetLastError();
7442         if (mem_base != xmlMemBlocks()) {
7443             printf("Leak of %d blocks found in xmlDebugDumpString",
7444 	           xmlMemBlocks() - mem_base);
7445 	    test_ret++;
7446             printf(" %d", n_output);
7447             printf(" %d", n_str);
7448             printf("\n");
7449         }
7450     }
7451     }
7452     function_tests++;
7453 #endif
7454 
7455     return(test_ret);
7456 }
7457 
7458 static int
test_debugXML(void)7459 test_debugXML(void) {
7460     int test_ret = 0;
7461 
7462     if (quiet == 0) printf("Testing debugXML : 11 of 11 functions ...\n");
7463     test_ret += test_xmlDebugCheckDocument();
7464     test_ret += test_xmlDebugDumpAttr();
7465     test_ret += test_xmlDebugDumpAttrList();
7466     test_ret += test_xmlDebugDumpDTD();
7467     test_ret += test_xmlDebugDumpDocument();
7468     test_ret += test_xmlDebugDumpDocumentHead();
7469     test_ret += test_xmlDebugDumpEntities();
7470     test_ret += test_xmlDebugDumpNode();
7471     test_ret += test_xmlDebugDumpNodeList();
7472     test_ret += test_xmlDebugDumpOneNode();
7473     test_ret += test_xmlDebugDumpString();
7474 
7475     if (test_ret != 0)
7476 	printf("Module debugXML: %d errors\n", test_ret);
7477     return(test_ret);
7478 }
7479 
7480 static int
test_xmlDictCleanup(void)7481 test_xmlDictCleanup(void) {
7482     int test_ret = 0;
7483 
7484     int mem_base;
7485 
7486         mem_base = xmlMemBlocks();
7487 
7488         xmlDictCleanup();
7489         call_tests++;
7490         xmlResetLastError();
7491         if (mem_base != xmlMemBlocks()) {
7492             printf("Leak of %d blocks found in xmlDictCleanup",
7493 	           xmlMemBlocks() - mem_base);
7494 	    test_ret++;
7495             printf("\n");
7496         }
7497     function_tests++;
7498 
7499     return(test_ret);
7500 }
7501 
7502 
7503 static int
test_xmlDictCreate(void)7504 test_xmlDictCreate(void) {
7505     int test_ret = 0;
7506 
7507     int mem_base;
7508     xmlDictPtr ret_val;
7509 
7510         mem_base = xmlMemBlocks();
7511 
7512         ret_val = xmlDictCreate();
7513         desret_xmlDictPtr(ret_val);
7514         call_tests++;
7515         xmlResetLastError();
7516         if (mem_base != xmlMemBlocks()) {
7517             printf("Leak of %d blocks found in xmlDictCreate",
7518 	           xmlMemBlocks() - mem_base);
7519 	    test_ret++;
7520             printf("\n");
7521         }
7522     function_tests++;
7523 
7524     return(test_ret);
7525 }
7526 
7527 
7528 static int
test_xmlDictCreateSub(void)7529 test_xmlDictCreateSub(void) {
7530     int test_ret = 0;
7531 
7532     int mem_base;
7533     xmlDictPtr ret_val;
7534     xmlDictPtr sub; /* an existing dictionary */
7535     int n_sub;
7536 
7537     for (n_sub = 0;n_sub < gen_nb_xmlDictPtr;n_sub++) {
7538         mem_base = xmlMemBlocks();
7539         sub = gen_xmlDictPtr(n_sub, 0);
7540 
7541         ret_val = xmlDictCreateSub(sub);
7542         desret_xmlDictPtr(ret_val);
7543         call_tests++;
7544         des_xmlDictPtr(n_sub, sub, 0);
7545         xmlResetLastError();
7546         if (mem_base != xmlMemBlocks()) {
7547             printf("Leak of %d blocks found in xmlDictCreateSub",
7548 	           xmlMemBlocks() - mem_base);
7549 	    test_ret++;
7550             printf(" %d", n_sub);
7551             printf("\n");
7552         }
7553     }
7554     function_tests++;
7555 
7556     return(test_ret);
7557 }
7558 
7559 
7560 static int
test_xmlDictExists(void)7561 test_xmlDictExists(void) {
7562     int test_ret = 0;
7563 
7564     int mem_base;
7565     const xmlChar * ret_val;
7566     xmlDictPtr dict; /* the dictionary */
7567     int n_dict;
7568     const xmlChar * name; /* the name of the userdata */
7569     int n_name;
7570     int len; /* the length of the name, if -1 it is recomputed */
7571     int n_len;
7572 
7573     for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
7574     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
7575     for (n_len = 0;n_len < gen_nb_int;n_len++) {
7576         mem_base = xmlMemBlocks();
7577         dict = gen_xmlDictPtr(n_dict, 0);
7578         name = gen_const_xmlChar_ptr(n_name, 1);
7579         len = gen_int(n_len, 2);
7580         if ((name != NULL) &&
7581             (len > xmlStrlen(BAD_CAST name)))
7582             len = 0;
7583 
7584         ret_val = xmlDictExists(dict, name, len);
7585         desret_const_xmlChar_ptr(ret_val);
7586         call_tests++;
7587         des_xmlDictPtr(n_dict, dict, 0);
7588         des_const_xmlChar_ptr(n_name, name, 1);
7589         des_int(n_len, len, 2);
7590         xmlResetLastError();
7591         if (mem_base != xmlMemBlocks()) {
7592             printf("Leak of %d blocks found in xmlDictExists",
7593 	           xmlMemBlocks() - mem_base);
7594 	    test_ret++;
7595             printf(" %d", n_dict);
7596             printf(" %d", n_name);
7597             printf(" %d", n_len);
7598             printf("\n");
7599         }
7600     }
7601     }
7602     }
7603     function_tests++;
7604 
7605     return(test_ret);
7606 }
7607 
7608 
7609 static int
test_xmlDictGetUsage(void)7610 test_xmlDictGetUsage(void) {
7611     int test_ret = 0;
7612 
7613 
7614     /* missing type support */
7615     return(test_ret);
7616 }
7617 
7618 
7619 static int
test_xmlDictLookup(void)7620 test_xmlDictLookup(void) {
7621     int test_ret = 0;
7622 
7623     int mem_base;
7624     const xmlChar * ret_val;
7625     xmlDictPtr dict; /* dictionary */
7626     int n_dict;
7627     const xmlChar * name; /* string key */
7628     int n_name;
7629     int len; /* length of the key, if -1 it is recomputed */
7630     int n_len;
7631 
7632     for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
7633     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
7634     for (n_len = 0;n_len < gen_nb_int;n_len++) {
7635         mem_base = xmlMemBlocks();
7636         dict = gen_xmlDictPtr(n_dict, 0);
7637         name = gen_const_xmlChar_ptr(n_name, 1);
7638         len = gen_int(n_len, 2);
7639         if ((name != NULL) &&
7640             (len > xmlStrlen(BAD_CAST name)))
7641             len = 0;
7642 
7643         ret_val = xmlDictLookup(dict, name, len);
7644         desret_const_xmlChar_ptr(ret_val);
7645         call_tests++;
7646         des_xmlDictPtr(n_dict, dict, 0);
7647         des_const_xmlChar_ptr(n_name, name, 1);
7648         des_int(n_len, len, 2);
7649         xmlResetLastError();
7650         if (mem_base != xmlMemBlocks()) {
7651             printf("Leak of %d blocks found in xmlDictLookup",
7652 	           xmlMemBlocks() - mem_base);
7653 	    test_ret++;
7654             printf(" %d", n_dict);
7655             printf(" %d", n_name);
7656             printf(" %d", n_len);
7657             printf("\n");
7658         }
7659     }
7660     }
7661     }
7662     function_tests++;
7663 
7664     return(test_ret);
7665 }
7666 
7667 
7668 static int
test_xmlDictOwns(void)7669 test_xmlDictOwns(void) {
7670     int test_ret = 0;
7671 
7672     int mem_base;
7673     int ret_val;
7674     xmlDictPtr dict; /* the dictionary */
7675     int n_dict;
7676     const xmlChar * str; /* the string */
7677     int n_str;
7678 
7679     for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
7680     for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
7681         mem_base = xmlMemBlocks();
7682         dict = gen_xmlDictPtr(n_dict, 0);
7683         str = gen_const_xmlChar_ptr(n_str, 1);
7684 
7685         ret_val = xmlDictOwns(dict, str);
7686         desret_int(ret_val);
7687         call_tests++;
7688         des_xmlDictPtr(n_dict, dict, 0);
7689         des_const_xmlChar_ptr(n_str, str, 1);
7690         xmlResetLastError();
7691         if (mem_base != xmlMemBlocks()) {
7692             printf("Leak of %d blocks found in xmlDictOwns",
7693 	           xmlMemBlocks() - mem_base);
7694 	    test_ret++;
7695             printf(" %d", n_dict);
7696             printf(" %d", n_str);
7697             printf("\n");
7698         }
7699     }
7700     }
7701     function_tests++;
7702 
7703     return(test_ret);
7704 }
7705 
7706 
7707 static int
test_xmlDictQLookup(void)7708 test_xmlDictQLookup(void) {
7709     int test_ret = 0;
7710 
7711     int mem_base;
7712     const xmlChar * ret_val;
7713     xmlDictPtr dict; /* the dictionary */
7714     int n_dict;
7715     const xmlChar * prefix; /* the prefix */
7716     int n_prefix;
7717     const xmlChar * name; /* the name */
7718     int n_name;
7719 
7720     for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
7721     for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
7722     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
7723         mem_base = xmlMemBlocks();
7724         dict = gen_xmlDictPtr(n_dict, 0);
7725         prefix = gen_const_xmlChar_ptr(n_prefix, 1);
7726         name = gen_const_xmlChar_ptr(n_name, 2);
7727 
7728         ret_val = xmlDictQLookup(dict, prefix, name);
7729         desret_const_xmlChar_ptr(ret_val);
7730         call_tests++;
7731         des_xmlDictPtr(n_dict, dict, 0);
7732         des_const_xmlChar_ptr(n_prefix, prefix, 1);
7733         des_const_xmlChar_ptr(n_name, name, 2);
7734         xmlResetLastError();
7735         if (mem_base != xmlMemBlocks()) {
7736             printf("Leak of %d blocks found in xmlDictQLookup",
7737 	           xmlMemBlocks() - mem_base);
7738 	    test_ret++;
7739             printf(" %d", n_dict);
7740             printf(" %d", n_prefix);
7741             printf(" %d", n_name);
7742             printf("\n");
7743         }
7744     }
7745     }
7746     }
7747     function_tests++;
7748 
7749     return(test_ret);
7750 }
7751 
7752 
7753 static int
test_xmlDictReference(void)7754 test_xmlDictReference(void) {
7755     int test_ret = 0;
7756 
7757     int mem_base;
7758     int ret_val;
7759     xmlDictPtr dict; /* the dictionary */
7760     int n_dict;
7761 
7762     for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
7763         mem_base = xmlMemBlocks();
7764         dict = gen_xmlDictPtr(n_dict, 0);
7765 
7766         ret_val = xmlDictReference(dict);
7767         xmlDictFree(dict);
7768         desret_int(ret_val);
7769         call_tests++;
7770         des_xmlDictPtr(n_dict, dict, 0);
7771         xmlResetLastError();
7772         if (mem_base != xmlMemBlocks()) {
7773             printf("Leak of %d blocks found in xmlDictReference",
7774 	           xmlMemBlocks() - mem_base);
7775 	    test_ret++;
7776             printf(" %d", n_dict);
7777             printf("\n");
7778         }
7779     }
7780     function_tests++;
7781 
7782     return(test_ret);
7783 }
7784 
7785 
7786 static int
test_xmlDictSetLimit(void)7787 test_xmlDictSetLimit(void) {
7788     int test_ret = 0;
7789 
7790 
7791     /* missing type support */
7792     return(test_ret);
7793 }
7794 
7795 
7796 static int
test_xmlDictSize(void)7797 test_xmlDictSize(void) {
7798     int test_ret = 0;
7799 
7800     int mem_base;
7801     int ret_val;
7802     xmlDictPtr dict; /* the dictionary */
7803     int n_dict;
7804 
7805     for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
7806         mem_base = xmlMemBlocks();
7807         dict = gen_xmlDictPtr(n_dict, 0);
7808 
7809         ret_val = xmlDictSize(dict);
7810         desret_int(ret_val);
7811         call_tests++;
7812         des_xmlDictPtr(n_dict, dict, 0);
7813         xmlResetLastError();
7814         if (mem_base != xmlMemBlocks()) {
7815             printf("Leak of %d blocks found in xmlDictSize",
7816 	           xmlMemBlocks() - mem_base);
7817 	    test_ret++;
7818             printf(" %d", n_dict);
7819             printf("\n");
7820         }
7821     }
7822     function_tests++;
7823 
7824     return(test_ret);
7825 }
7826 
7827 
7828 static int
test_xmlInitializeDict(void)7829 test_xmlInitializeDict(void) {
7830     int test_ret = 0;
7831 
7832     int mem_base;
7833     int ret_val;
7834 
7835         mem_base = xmlMemBlocks();
7836 
7837         ret_val = xmlInitializeDict();
7838         desret_int(ret_val);
7839         call_tests++;
7840         xmlResetLastError();
7841         if (mem_base != xmlMemBlocks()) {
7842             printf("Leak of %d blocks found in xmlInitializeDict",
7843 	           xmlMemBlocks() - mem_base);
7844 	    test_ret++;
7845             printf("\n");
7846         }
7847     function_tests++;
7848 
7849     return(test_ret);
7850 }
7851 
7852 static int
test_dict(void)7853 test_dict(void) {
7854     int test_ret = 0;
7855 
7856     if (quiet == 0) printf("Testing dict : 10 of 13 functions ...\n");
7857     test_ret += test_xmlDictCleanup();
7858     test_ret += test_xmlDictCreate();
7859     test_ret += test_xmlDictCreateSub();
7860     test_ret += test_xmlDictExists();
7861     test_ret += test_xmlDictGetUsage();
7862     test_ret += test_xmlDictLookup();
7863     test_ret += test_xmlDictOwns();
7864     test_ret += test_xmlDictQLookup();
7865     test_ret += test_xmlDictReference();
7866     test_ret += test_xmlDictSetLimit();
7867     test_ret += test_xmlDictSize();
7868     test_ret += test_xmlInitializeDict();
7869 
7870     if (test_ret != 0)
7871 	printf("Module dict: %d errors\n", test_ret);
7872     return(test_ret);
7873 }
7874 
7875 static int
test_UTF8Toisolat1(void)7876 test_UTF8Toisolat1(void) {
7877     int test_ret = 0;
7878 
7879 #if defined(LIBXML_OUTPUT_ENABLED)
7880 #ifdef LIBXML_OUTPUT_ENABLED
7881     int mem_base;
7882     int ret_val;
7883     unsigned char * out; /* a pointer to an array of bytes to store the result */
7884     int n_out;
7885     int * outlen; /* the length of @out */
7886     int n_outlen;
7887     const unsigned char * in; /* a pointer to an array of UTF-8 chars */
7888     int n_in;
7889     int * inlen; /* the length of @in */
7890     int n_inlen;
7891 
7892     for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
7893     for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
7894     for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
7895     for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
7896         mem_base = xmlMemBlocks();
7897         out = gen_unsigned_char_ptr(n_out, 0);
7898         outlen = gen_int_ptr(n_outlen, 1);
7899         in = gen_const_unsigned_char_ptr(n_in, 2);
7900         inlen = gen_int_ptr(n_inlen, 3);
7901 
7902         ret_val = UTF8Toisolat1(out, outlen, in, inlen);
7903         desret_int(ret_val);
7904         call_tests++;
7905         des_unsigned_char_ptr(n_out, out, 0);
7906         des_int_ptr(n_outlen, outlen, 1);
7907         des_const_unsigned_char_ptr(n_in, in, 2);
7908         des_int_ptr(n_inlen, inlen, 3);
7909         xmlResetLastError();
7910         if (mem_base != xmlMemBlocks()) {
7911             printf("Leak of %d blocks found in UTF8Toisolat1",
7912 	           xmlMemBlocks() - mem_base);
7913 	    test_ret++;
7914             printf(" %d", n_out);
7915             printf(" %d", n_outlen);
7916             printf(" %d", n_in);
7917             printf(" %d", n_inlen);
7918             printf("\n");
7919         }
7920     }
7921     }
7922     }
7923     }
7924     function_tests++;
7925 #endif
7926 #endif
7927 
7928     return(test_ret);
7929 }
7930 
7931 
7932 static int
test_isolat1ToUTF8(void)7933 test_isolat1ToUTF8(void) {
7934     int test_ret = 0;
7935 
7936     int mem_base;
7937     int ret_val;
7938     unsigned char * out; /* a pointer to an array of bytes to store the result */
7939     int n_out;
7940     int * outlen; /* the length of @out */
7941     int n_outlen;
7942     const unsigned char * in; /* a pointer to an array of ISO Latin 1 chars */
7943     int n_in;
7944     int * inlen; /* the length of @in */
7945     int n_inlen;
7946 
7947     for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
7948     for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
7949     for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
7950     for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
7951         mem_base = xmlMemBlocks();
7952         out = gen_unsigned_char_ptr(n_out, 0);
7953         outlen = gen_int_ptr(n_outlen, 1);
7954         in = gen_const_unsigned_char_ptr(n_in, 2);
7955         inlen = gen_int_ptr(n_inlen, 3);
7956 
7957         ret_val = isolat1ToUTF8(out, outlen, in, inlen);
7958         desret_int(ret_val);
7959         call_tests++;
7960         des_unsigned_char_ptr(n_out, out, 0);
7961         des_int_ptr(n_outlen, outlen, 1);
7962         des_const_unsigned_char_ptr(n_in, in, 2);
7963         des_int_ptr(n_inlen, inlen, 3);
7964         xmlResetLastError();
7965         if (mem_base != xmlMemBlocks()) {
7966             printf("Leak of %d blocks found in isolat1ToUTF8",
7967 	           xmlMemBlocks() - mem_base);
7968 	    test_ret++;
7969             printf(" %d", n_out);
7970             printf(" %d", n_outlen);
7971             printf(" %d", n_in);
7972             printf(" %d", n_inlen);
7973             printf("\n");
7974         }
7975     }
7976     }
7977     }
7978     }
7979     function_tests++;
7980 
7981     return(test_ret);
7982 }
7983 
7984 
7985 static int
test_xmlAddEncodingAlias(void)7986 test_xmlAddEncodingAlias(void) {
7987     int test_ret = 0;
7988 
7989     int ret_val;
7990     const char * name; /* the encoding name as parsed, in UTF-8 format (ASCII actually) */
7991     int n_name;
7992     const char * alias; /* the alias name as parsed, in UTF-8 format (ASCII actually) */
7993     int n_alias;
7994 
7995     for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
7996     for (n_alias = 0;n_alias < gen_nb_const_char_ptr;n_alias++) {
7997         name = gen_const_char_ptr(n_name, 0);
7998         alias = gen_const_char_ptr(n_alias, 1);
7999 
8000         ret_val = xmlAddEncodingAlias(name, alias);
8001         desret_int(ret_val);
8002         call_tests++;
8003         des_const_char_ptr(n_name, name, 0);
8004         des_const_char_ptr(n_alias, alias, 1);
8005         xmlResetLastError();
8006     }
8007     }
8008     function_tests++;
8009 
8010     return(test_ret);
8011 }
8012 
8013 
8014 #define gen_nb_xmlCharEncodingHandler_ptr 1
8015 #define gen_xmlCharEncodingHandler_ptr(no, nr) NULL
8016 #define des_xmlCharEncodingHandler_ptr(no, val, nr)
8017 
8018 static int
test_xmlCharEncCloseFunc(void)8019 test_xmlCharEncCloseFunc(void) {
8020     int test_ret = 0;
8021 
8022     int mem_base;
8023     int ret_val;
8024     xmlCharEncodingHandler * handler; /* char encoding transformation data structure */
8025     int n_handler;
8026 
8027     for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) {
8028         mem_base = xmlMemBlocks();
8029         handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0);
8030 
8031         ret_val = xmlCharEncCloseFunc(handler);
8032         desret_int(ret_val);
8033         call_tests++;
8034         des_xmlCharEncodingHandler_ptr(n_handler, handler, 0);
8035         xmlResetLastError();
8036         if (mem_base != xmlMemBlocks()) {
8037             printf("Leak of %d blocks found in xmlCharEncCloseFunc",
8038 	           xmlMemBlocks() - mem_base);
8039 	    test_ret++;
8040             printf(" %d", n_handler);
8041             printf("\n");
8042         }
8043     }
8044     function_tests++;
8045 
8046     return(test_ret);
8047 }
8048 
8049 
8050 static int
test_xmlCharEncFirstLine(void)8051 test_xmlCharEncFirstLine(void) {
8052     int test_ret = 0;
8053 
8054     int mem_base;
8055     int ret_val;
8056     xmlCharEncodingHandler * handler; /* char encoding transformation data structure */
8057     int n_handler;
8058     xmlBufferPtr out; /* an xmlBuffer for the output. */
8059     int n_out;
8060     xmlBufferPtr in; /* an xmlBuffer for the input */
8061     int n_in;
8062 
8063     for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) {
8064     for (n_out = 0;n_out < gen_nb_xmlBufferPtr;n_out++) {
8065     for (n_in = 0;n_in < gen_nb_xmlBufferPtr;n_in++) {
8066         mem_base = xmlMemBlocks();
8067         handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0);
8068         out = gen_xmlBufferPtr(n_out, 1);
8069         in = gen_xmlBufferPtr(n_in, 2);
8070 
8071         ret_val = xmlCharEncFirstLine(handler, out, in);
8072         desret_int(ret_val);
8073         call_tests++;
8074         des_xmlCharEncodingHandler_ptr(n_handler, handler, 0);
8075         des_xmlBufferPtr(n_out, out, 1);
8076         des_xmlBufferPtr(n_in, in, 2);
8077         xmlResetLastError();
8078         if (mem_base != xmlMemBlocks()) {
8079             printf("Leak of %d blocks found in xmlCharEncFirstLine",
8080 	           xmlMemBlocks() - mem_base);
8081 	    test_ret++;
8082             printf(" %d", n_handler);
8083             printf(" %d", n_out);
8084             printf(" %d", n_in);
8085             printf("\n");
8086         }
8087     }
8088     }
8089     }
8090     function_tests++;
8091 
8092     return(test_ret);
8093 }
8094 
8095 
8096 static int
test_xmlCharEncInFunc(void)8097 test_xmlCharEncInFunc(void) {
8098     int test_ret = 0;
8099 
8100     int mem_base;
8101     int ret_val;
8102     xmlCharEncodingHandler * handler; /* char encoding transformation data structure */
8103     int n_handler;
8104     xmlBufferPtr out; /* an xmlBuffer for the output. */
8105     int n_out;
8106     xmlBufferPtr in; /* an xmlBuffer for the input */
8107     int n_in;
8108 
8109     for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) {
8110     for (n_out = 0;n_out < gen_nb_xmlBufferPtr;n_out++) {
8111     for (n_in = 0;n_in < gen_nb_xmlBufferPtr;n_in++) {
8112         mem_base = xmlMemBlocks();
8113         handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0);
8114         out = gen_xmlBufferPtr(n_out, 1);
8115         in = gen_xmlBufferPtr(n_in, 2);
8116 
8117         ret_val = xmlCharEncInFunc(handler, out, in);
8118         desret_int(ret_val);
8119         call_tests++;
8120         des_xmlCharEncodingHandler_ptr(n_handler, handler, 0);
8121         des_xmlBufferPtr(n_out, out, 1);
8122         des_xmlBufferPtr(n_in, in, 2);
8123         xmlResetLastError();
8124         if (mem_base != xmlMemBlocks()) {
8125             printf("Leak of %d blocks found in xmlCharEncInFunc",
8126 	           xmlMemBlocks() - mem_base);
8127 	    test_ret++;
8128             printf(" %d", n_handler);
8129             printf(" %d", n_out);
8130             printf(" %d", n_in);
8131             printf("\n");
8132         }
8133     }
8134     }
8135     }
8136     function_tests++;
8137 
8138     return(test_ret);
8139 }
8140 
8141 
8142 static int
test_xmlCharEncOutFunc(void)8143 test_xmlCharEncOutFunc(void) {
8144     int test_ret = 0;
8145 
8146     int mem_base;
8147     int ret_val;
8148     xmlCharEncodingHandler * handler; /* char encoding transformation data structure */
8149     int n_handler;
8150     xmlBufferPtr out; /* an xmlBuffer for the output. */
8151     int n_out;
8152     xmlBufferPtr in; /* an xmlBuffer for the input */
8153     int n_in;
8154 
8155     for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) {
8156     for (n_out = 0;n_out < gen_nb_xmlBufferPtr;n_out++) {
8157     for (n_in = 0;n_in < gen_nb_xmlBufferPtr;n_in++) {
8158         mem_base = xmlMemBlocks();
8159         handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0);
8160         out = gen_xmlBufferPtr(n_out, 1);
8161         in = gen_xmlBufferPtr(n_in, 2);
8162 
8163         ret_val = xmlCharEncOutFunc(handler, out, in);
8164         desret_int(ret_val);
8165         call_tests++;
8166         des_xmlCharEncodingHandler_ptr(n_handler, handler, 0);
8167         des_xmlBufferPtr(n_out, out, 1);
8168         des_xmlBufferPtr(n_in, in, 2);
8169         xmlResetLastError();
8170         if (mem_base != xmlMemBlocks()) {
8171             printf("Leak of %d blocks found in xmlCharEncOutFunc",
8172 	           xmlMemBlocks() - mem_base);
8173 	    test_ret++;
8174             printf(" %d", n_handler);
8175             printf(" %d", n_out);
8176             printf(" %d", n_in);
8177             printf("\n");
8178         }
8179     }
8180     }
8181     }
8182     function_tests++;
8183 
8184     return(test_ret);
8185 }
8186 
8187 
8188 static int
test_xmlCleanupCharEncodingHandlers(void)8189 test_xmlCleanupCharEncodingHandlers(void) {
8190     int test_ret = 0;
8191 
8192 
8193 
8194         xmlCleanupCharEncodingHandlers();
8195         call_tests++;
8196         xmlResetLastError();
8197     function_tests++;
8198 
8199     return(test_ret);
8200 }
8201 
8202 
8203 static int
test_xmlCleanupEncodingAliases(void)8204 test_xmlCleanupEncodingAliases(void) {
8205     int test_ret = 0;
8206 
8207     int mem_base;
8208 
8209         mem_base = xmlMemBlocks();
8210 
8211         xmlCleanupEncodingAliases();
8212         call_tests++;
8213         xmlResetLastError();
8214         if (mem_base != xmlMemBlocks()) {
8215             printf("Leak of %d blocks found in xmlCleanupEncodingAliases",
8216 	           xmlMemBlocks() - mem_base);
8217 	    test_ret++;
8218             printf("\n");
8219         }
8220     function_tests++;
8221 
8222     return(test_ret);
8223 }
8224 
8225 
8226 static int
test_xmlCreateCharEncodingHandler(void)8227 test_xmlCreateCharEncodingHandler(void) {
8228     int test_ret = 0;
8229 
8230 
8231     /* missing type support */
8232     return(test_ret);
8233 }
8234 
8235 
8236 static int
test_xmlDelEncodingAlias(void)8237 test_xmlDelEncodingAlias(void) {
8238     int test_ret = 0;
8239 
8240     int mem_base;
8241     int ret_val;
8242     const char * alias; /* the alias name as parsed, in UTF-8 format (ASCII actually) */
8243     int n_alias;
8244 
8245     for (n_alias = 0;n_alias < gen_nb_const_char_ptr;n_alias++) {
8246         mem_base = xmlMemBlocks();
8247         alias = gen_const_char_ptr(n_alias, 0);
8248 
8249         ret_val = xmlDelEncodingAlias(alias);
8250         desret_int(ret_val);
8251         call_tests++;
8252         des_const_char_ptr(n_alias, alias, 0);
8253         xmlResetLastError();
8254         if (mem_base != xmlMemBlocks()) {
8255             printf("Leak of %d blocks found in xmlDelEncodingAlias",
8256 	           xmlMemBlocks() - mem_base);
8257 	    test_ret++;
8258             printf(" %d", n_alias);
8259             printf("\n");
8260         }
8261     }
8262     function_tests++;
8263 
8264     return(test_ret);
8265 }
8266 
8267 
8268 static int
test_xmlDetectCharEncoding(void)8269 test_xmlDetectCharEncoding(void) {
8270     int test_ret = 0;
8271 
8272     int mem_base;
8273     xmlCharEncoding ret_val;
8274     const 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). */
8275     int n_in;
8276     int len; /* pointer to the length of the buffer */
8277     int n_len;
8278 
8279     for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
8280     for (n_len = 0;n_len < gen_nb_int;n_len++) {
8281         mem_base = xmlMemBlocks();
8282         in = gen_const_unsigned_char_ptr(n_in, 0);
8283         len = gen_int(n_len, 1);
8284 
8285         ret_val = xmlDetectCharEncoding(in, len);
8286         desret_xmlCharEncoding(ret_val);
8287         call_tests++;
8288         des_const_unsigned_char_ptr(n_in, in, 0);
8289         des_int(n_len, len, 1);
8290         xmlResetLastError();
8291         if (mem_base != xmlMemBlocks()) {
8292             printf("Leak of %d blocks found in xmlDetectCharEncoding",
8293 	           xmlMemBlocks() - mem_base);
8294 	    test_ret++;
8295             printf(" %d", n_in);
8296             printf(" %d", n_len);
8297             printf("\n");
8298         }
8299     }
8300     }
8301     function_tests++;
8302 
8303     return(test_ret);
8304 }
8305 
8306 
8307 static int
test_xmlFindCharEncodingHandler(void)8308 test_xmlFindCharEncodingHandler(void) {
8309     int test_ret = 0;
8310 
8311 
8312     /* missing type support */
8313     return(test_ret);
8314 }
8315 
8316 
8317 static int
test_xmlGetCharEncodingHandler(void)8318 test_xmlGetCharEncodingHandler(void) {
8319     int test_ret = 0;
8320 
8321 
8322     /* missing type support */
8323     return(test_ret);
8324 }
8325 
8326 
8327 static int
test_xmlGetCharEncodingName(void)8328 test_xmlGetCharEncodingName(void) {
8329     int test_ret = 0;
8330 
8331     int mem_base;
8332     const char * ret_val;
8333     xmlCharEncoding enc; /* the encoding */
8334     int n_enc;
8335 
8336     for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
8337         mem_base = xmlMemBlocks();
8338         enc = gen_xmlCharEncoding(n_enc, 0);
8339 
8340         ret_val = xmlGetCharEncodingName(enc);
8341         desret_const_char_ptr(ret_val);
8342         call_tests++;
8343         des_xmlCharEncoding(n_enc, enc, 0);
8344         xmlResetLastError();
8345         if (mem_base != xmlMemBlocks()) {
8346             printf("Leak of %d blocks found in xmlGetCharEncodingName",
8347 	           xmlMemBlocks() - mem_base);
8348 	    test_ret++;
8349             printf(" %d", n_enc);
8350             printf("\n");
8351         }
8352     }
8353     function_tests++;
8354 
8355     return(test_ret);
8356 }
8357 
8358 
8359 static int
test_xmlGetEncodingAlias(void)8360 test_xmlGetEncodingAlias(void) {
8361     int test_ret = 0;
8362 
8363     int mem_base;
8364     const char * ret_val;
8365     const char * alias; /* the alias name as parsed, in UTF-8 format (ASCII actually) */
8366     int n_alias;
8367 
8368     for (n_alias = 0;n_alias < gen_nb_const_char_ptr;n_alias++) {
8369         mem_base = xmlMemBlocks();
8370         alias = gen_const_char_ptr(n_alias, 0);
8371 
8372         ret_val = xmlGetEncodingAlias(alias);
8373         desret_const_char_ptr(ret_val);
8374         call_tests++;
8375         des_const_char_ptr(n_alias, alias, 0);
8376         xmlResetLastError();
8377         if (mem_base != xmlMemBlocks()) {
8378             printf("Leak of %d blocks found in xmlGetEncodingAlias",
8379 	           xmlMemBlocks() - mem_base);
8380 	    test_ret++;
8381             printf(" %d", n_alias);
8382             printf("\n");
8383         }
8384     }
8385     function_tests++;
8386 
8387     return(test_ret);
8388 }
8389 
8390 
8391 static int
test_xmlInitCharEncodingHandlers(void)8392 test_xmlInitCharEncodingHandlers(void) {
8393     int test_ret = 0;
8394 
8395 
8396 
8397         xmlInitCharEncodingHandlers();
8398         call_tests++;
8399         xmlResetLastError();
8400     function_tests++;
8401 
8402     return(test_ret);
8403 }
8404 
8405 
8406 static int
test_xmlLookupCharEncodingHandler(void)8407 test_xmlLookupCharEncodingHandler(void) {
8408     int test_ret = 0;
8409 
8410 
8411     /* missing type support */
8412     return(test_ret);
8413 }
8414 
8415 
8416 static int
test_xmlNewCharEncodingHandler(void)8417 test_xmlNewCharEncodingHandler(void) {
8418     int test_ret = 0;
8419 
8420 
8421     /* missing type support */
8422     return(test_ret);
8423 }
8424 
8425 
8426 static int
test_xmlOpenCharEncodingHandler(void)8427 test_xmlOpenCharEncodingHandler(void) {
8428     int test_ret = 0;
8429 
8430 
8431     /* missing type support */
8432     return(test_ret);
8433 }
8434 
8435 
8436 static int
test_xmlParseCharEncoding(void)8437 test_xmlParseCharEncoding(void) {
8438     int test_ret = 0;
8439 
8440     int mem_base;
8441     xmlCharEncoding ret_val;
8442     const char * name; /* the encoding name as parsed, in UTF-8 format (ASCII actually) */
8443     int n_name;
8444 
8445     for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
8446         mem_base = xmlMemBlocks();
8447         name = gen_const_char_ptr(n_name, 0);
8448 
8449         ret_val = xmlParseCharEncoding(name);
8450         desret_xmlCharEncoding(ret_val);
8451         call_tests++;
8452         des_const_char_ptr(n_name, name, 0);
8453         xmlResetLastError();
8454         if (mem_base != xmlMemBlocks()) {
8455             printf("Leak of %d blocks found in xmlParseCharEncoding",
8456 	           xmlMemBlocks() - mem_base);
8457 	    test_ret++;
8458             printf(" %d", n_name);
8459             printf("\n");
8460         }
8461     }
8462     function_tests++;
8463 
8464     return(test_ret);
8465 }
8466 
8467 
8468 #define gen_nb_xmlCharEncodingHandlerPtr 1
8469 #define gen_xmlCharEncodingHandlerPtr(no, nr) NULL
8470 #define des_xmlCharEncodingHandlerPtr(no, val, nr)
8471 
8472 static int
test_xmlRegisterCharEncodingHandler(void)8473 test_xmlRegisterCharEncodingHandler(void) {
8474     int test_ret = 0;
8475 
8476     int mem_base;
8477     xmlCharEncodingHandlerPtr handler; /* the xmlCharEncodingHandlerPtr handler block */
8478     int n_handler;
8479 
8480     for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandlerPtr;n_handler++) {
8481         mem_base = xmlMemBlocks();
8482         handler = gen_xmlCharEncodingHandlerPtr(n_handler, 0);
8483 
8484         xmlRegisterCharEncodingHandler(handler);
8485         call_tests++;
8486         des_xmlCharEncodingHandlerPtr(n_handler, handler, 0);
8487         xmlResetLastError();
8488         if (mem_base != xmlMemBlocks()) {
8489             printf("Leak of %d blocks found in xmlRegisterCharEncodingHandler",
8490 	           xmlMemBlocks() - mem_base);
8491 	    test_ret++;
8492             printf(" %d", n_handler);
8493             printf("\n");
8494         }
8495     }
8496     function_tests++;
8497 
8498     return(test_ret);
8499 }
8500 
8501 static int
test_encoding(void)8502 test_encoding(void) {
8503     int test_ret = 0;
8504 
8505     if (quiet == 0) printf("Testing encoding : 16 of 22 functions ...\n");
8506     test_ret += test_UTF8Toisolat1();
8507     test_ret += test_isolat1ToUTF8();
8508     test_ret += test_xmlAddEncodingAlias();
8509     test_ret += test_xmlCharEncCloseFunc();
8510     test_ret += test_xmlCharEncFirstLine();
8511     test_ret += test_xmlCharEncInFunc();
8512     test_ret += test_xmlCharEncOutFunc();
8513     test_ret += test_xmlCleanupCharEncodingHandlers();
8514     test_ret += test_xmlCleanupEncodingAliases();
8515     test_ret += test_xmlCreateCharEncodingHandler();
8516     test_ret += test_xmlDelEncodingAlias();
8517     test_ret += test_xmlDetectCharEncoding();
8518     test_ret += test_xmlFindCharEncodingHandler();
8519     test_ret += test_xmlGetCharEncodingHandler();
8520     test_ret += test_xmlGetCharEncodingName();
8521     test_ret += test_xmlGetEncodingAlias();
8522     test_ret += test_xmlInitCharEncodingHandlers();
8523     test_ret += test_xmlLookupCharEncodingHandler();
8524     test_ret += test_xmlNewCharEncodingHandler();
8525     test_ret += test_xmlOpenCharEncodingHandler();
8526     test_ret += test_xmlParseCharEncoding();
8527     test_ret += test_xmlRegisterCharEncodingHandler();
8528 
8529     if (test_ret != 0)
8530 	printf("Module encoding: %d errors\n", test_ret);
8531     return(test_ret);
8532 }
8533 
8534 static int
test_xmlAddDocEntity(void)8535 test_xmlAddDocEntity(void) {
8536     int test_ret = 0;
8537 
8538     int mem_base;
8539     xmlEntityPtr ret_val;
8540     xmlDocPtr doc; /* the document */
8541     int n_doc;
8542     const xmlChar * name; /* the entity name */
8543     int n_name;
8544     int type; /* the entity type XML_xxx_yyy_ENTITY */
8545     int n_type;
8546     const xmlChar * ExternalID; /* the entity external ID if available */
8547     int n_ExternalID;
8548     const xmlChar * SystemID; /* the entity system ID if available */
8549     int n_SystemID;
8550     const xmlChar * content; /* the entity content */
8551     int n_content;
8552 
8553     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
8554     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
8555     for (n_type = 0;n_type < gen_nb_int;n_type++) {
8556     for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
8557     for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
8558     for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
8559         mem_base = xmlMemBlocks();
8560         doc = gen_xmlDocPtr(n_doc, 0);
8561         name = gen_const_xmlChar_ptr(n_name, 1);
8562         type = gen_int(n_type, 2);
8563         ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 3);
8564         SystemID = gen_const_xmlChar_ptr(n_SystemID, 4);
8565         content = gen_const_xmlChar_ptr(n_content, 5);
8566 
8567         ret_val = xmlAddDocEntity(doc, name, type, ExternalID, SystemID, content);
8568         desret_xmlEntityPtr(ret_val);
8569         call_tests++;
8570         des_xmlDocPtr(n_doc, doc, 0);
8571         des_const_xmlChar_ptr(n_name, name, 1);
8572         des_int(n_type, type, 2);
8573         des_const_xmlChar_ptr(n_ExternalID, ExternalID, 3);
8574         des_const_xmlChar_ptr(n_SystemID, SystemID, 4);
8575         des_const_xmlChar_ptr(n_content, content, 5);
8576         xmlResetLastError();
8577         if (mem_base != xmlMemBlocks()) {
8578             printf("Leak of %d blocks found in xmlAddDocEntity",
8579 	           xmlMemBlocks() - mem_base);
8580 	    test_ret++;
8581             printf(" %d", n_doc);
8582             printf(" %d", n_name);
8583             printf(" %d", n_type);
8584             printf(" %d", n_ExternalID);
8585             printf(" %d", n_SystemID);
8586             printf(" %d", n_content);
8587             printf("\n");
8588         }
8589     }
8590     }
8591     }
8592     }
8593     }
8594     }
8595     function_tests++;
8596 
8597     return(test_ret);
8598 }
8599 
8600 
8601 static int
test_xmlAddDtdEntity(void)8602 test_xmlAddDtdEntity(void) {
8603     int test_ret = 0;
8604 
8605     int mem_base;
8606     xmlEntityPtr ret_val;
8607     xmlDocPtr doc; /* the document */
8608     int n_doc;
8609     const xmlChar * name; /* the entity name */
8610     int n_name;
8611     int type; /* the entity type XML_xxx_yyy_ENTITY */
8612     int n_type;
8613     const xmlChar * ExternalID; /* the entity external ID if available */
8614     int n_ExternalID;
8615     const xmlChar * SystemID; /* the entity system ID if available */
8616     int n_SystemID;
8617     const xmlChar * content; /* the entity content */
8618     int n_content;
8619 
8620     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
8621     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
8622     for (n_type = 0;n_type < gen_nb_int;n_type++) {
8623     for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
8624     for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
8625     for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
8626         mem_base = xmlMemBlocks();
8627         doc = gen_xmlDocPtr(n_doc, 0);
8628         name = gen_const_xmlChar_ptr(n_name, 1);
8629         type = gen_int(n_type, 2);
8630         ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 3);
8631         SystemID = gen_const_xmlChar_ptr(n_SystemID, 4);
8632         content = gen_const_xmlChar_ptr(n_content, 5);
8633 
8634         ret_val = xmlAddDtdEntity(doc, name, type, ExternalID, SystemID, content);
8635         desret_xmlEntityPtr(ret_val);
8636         call_tests++;
8637         des_xmlDocPtr(n_doc, doc, 0);
8638         des_const_xmlChar_ptr(n_name, name, 1);
8639         des_int(n_type, type, 2);
8640         des_const_xmlChar_ptr(n_ExternalID, ExternalID, 3);
8641         des_const_xmlChar_ptr(n_SystemID, SystemID, 4);
8642         des_const_xmlChar_ptr(n_content, content, 5);
8643         xmlResetLastError();
8644         if (mem_base != xmlMemBlocks()) {
8645             printf("Leak of %d blocks found in xmlAddDtdEntity",
8646 	           xmlMemBlocks() - mem_base);
8647 	    test_ret++;
8648             printf(" %d", n_doc);
8649             printf(" %d", n_name);
8650             printf(" %d", n_type);
8651             printf(" %d", n_ExternalID);
8652             printf(" %d", n_SystemID);
8653             printf(" %d", n_content);
8654             printf("\n");
8655         }
8656     }
8657     }
8658     }
8659     }
8660     }
8661     }
8662     function_tests++;
8663 
8664     return(test_ret);
8665 }
8666 
8667 
8668 #define gen_nb_xmlEntityPtr_ptr 1
8669 #define gen_xmlEntityPtr_ptr(no, nr) NULL
8670 #define des_xmlEntityPtr_ptr(no, val, nr)
8671 
8672 static int
test_xmlAddEntity(void)8673 test_xmlAddEntity(void) {
8674     int test_ret = 0;
8675 
8676     int mem_base;
8677     int ret_val;
8678     xmlDocPtr doc; /* the document */
8679     int n_doc;
8680     int extSubset; /* add to the external or internal subset */
8681     int n_extSubset;
8682     const xmlChar * name; /* the entity name */
8683     int n_name;
8684     int type; /* the entity type XML_xxx_yyy_ENTITY */
8685     int n_type;
8686     const xmlChar * ExternalID; /* the entity external ID if available */
8687     int n_ExternalID;
8688     const xmlChar * SystemID; /* the entity system ID if available */
8689     int n_SystemID;
8690     const xmlChar * content; /* the entity content */
8691     int n_content;
8692     xmlEntityPtr * out; /* pointer to resulting entity (optional) */
8693     int n_out;
8694 
8695     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
8696     for (n_extSubset = 0;n_extSubset < gen_nb_int;n_extSubset++) {
8697     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
8698     for (n_type = 0;n_type < gen_nb_int;n_type++) {
8699     for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
8700     for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
8701     for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
8702     for (n_out = 0;n_out < gen_nb_xmlEntityPtr_ptr;n_out++) {
8703         mem_base = xmlMemBlocks();
8704         doc = gen_xmlDocPtr(n_doc, 0);
8705         extSubset = gen_int(n_extSubset, 1);
8706         name = gen_const_xmlChar_ptr(n_name, 2);
8707         type = gen_int(n_type, 3);
8708         ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 4);
8709         SystemID = gen_const_xmlChar_ptr(n_SystemID, 5);
8710         content = gen_const_xmlChar_ptr(n_content, 6);
8711         out = gen_xmlEntityPtr_ptr(n_out, 7);
8712 
8713         ret_val = xmlAddEntity(doc, extSubset, name, type, ExternalID, SystemID, content, out);
8714         desret_int(ret_val);
8715         call_tests++;
8716         des_xmlDocPtr(n_doc, doc, 0);
8717         des_int(n_extSubset, extSubset, 1);
8718         des_const_xmlChar_ptr(n_name, name, 2);
8719         des_int(n_type, type, 3);
8720         des_const_xmlChar_ptr(n_ExternalID, ExternalID, 4);
8721         des_const_xmlChar_ptr(n_SystemID, SystemID, 5);
8722         des_const_xmlChar_ptr(n_content, content, 6);
8723         des_xmlEntityPtr_ptr(n_out, out, 7);
8724         xmlResetLastError();
8725         if (mem_base != xmlMemBlocks()) {
8726             printf("Leak of %d blocks found in xmlAddEntity",
8727 	           xmlMemBlocks() - mem_base);
8728 	    test_ret++;
8729             printf(" %d", n_doc);
8730             printf(" %d", n_extSubset);
8731             printf(" %d", n_name);
8732             printf(" %d", n_type);
8733             printf(" %d", n_ExternalID);
8734             printf(" %d", n_SystemID);
8735             printf(" %d", n_content);
8736             printf(" %d", n_out);
8737             printf("\n");
8738         }
8739     }
8740     }
8741     }
8742     }
8743     }
8744     }
8745     }
8746     }
8747     function_tests++;
8748 
8749     return(test_ret);
8750 }
8751 
8752 
8753 static int
test_xmlCopyEntitiesTable(void)8754 test_xmlCopyEntitiesTable(void) {
8755     int test_ret = 0;
8756 
8757 
8758     /* missing type support */
8759     return(test_ret);
8760 }
8761 
8762 
8763 static int
test_xmlCreateEntitiesTable(void)8764 test_xmlCreateEntitiesTable(void) {
8765     int test_ret = 0;
8766 
8767 
8768     /* missing type support */
8769     return(test_ret);
8770 }
8771 
8772 
8773 #define gen_nb_xmlEntitiesTablePtr 1
8774 #define gen_xmlEntitiesTablePtr(no, nr) NULL
8775 #define des_xmlEntitiesTablePtr(no, val, nr)
8776 
8777 static int
test_xmlDumpEntitiesTable(void)8778 test_xmlDumpEntitiesTable(void) {
8779     int test_ret = 0;
8780 
8781 #if defined(LIBXML_OUTPUT_ENABLED)
8782     int mem_base;
8783     xmlBufferPtr buf; /* An XML buffer. */
8784     int n_buf;
8785     xmlEntitiesTablePtr table; /* An entity table */
8786     int n_table;
8787 
8788     for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
8789     for (n_table = 0;n_table < gen_nb_xmlEntitiesTablePtr;n_table++) {
8790         mem_base = xmlMemBlocks();
8791         buf = gen_xmlBufferPtr(n_buf, 0);
8792         table = gen_xmlEntitiesTablePtr(n_table, 1);
8793 
8794         xmlDumpEntitiesTable(buf, table);
8795         call_tests++;
8796         des_xmlBufferPtr(n_buf, buf, 0);
8797         des_xmlEntitiesTablePtr(n_table, table, 1);
8798         xmlResetLastError();
8799         if (mem_base != xmlMemBlocks()) {
8800             printf("Leak of %d blocks found in xmlDumpEntitiesTable",
8801 	           xmlMemBlocks() - mem_base);
8802 	    test_ret++;
8803             printf(" %d", n_buf);
8804             printf(" %d", n_table);
8805             printf("\n");
8806         }
8807     }
8808     }
8809     function_tests++;
8810 #endif
8811 
8812     return(test_ret);
8813 }
8814 
8815 
8816 #define gen_nb_xmlEntityPtr 1
8817 #define gen_xmlEntityPtr(no, nr) NULL
8818 #define des_xmlEntityPtr(no, val, nr)
8819 
8820 static int
test_xmlDumpEntityDecl(void)8821 test_xmlDumpEntityDecl(void) {
8822     int test_ret = 0;
8823 
8824 #if defined(LIBXML_OUTPUT_ENABLED)
8825     int mem_base;
8826     xmlBufferPtr buf; /* An XML buffer. */
8827     int n_buf;
8828     xmlEntityPtr ent; /* An entity table */
8829     int n_ent;
8830 
8831     for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
8832     for (n_ent = 0;n_ent < gen_nb_xmlEntityPtr;n_ent++) {
8833         mem_base = xmlMemBlocks();
8834         buf = gen_xmlBufferPtr(n_buf, 0);
8835         ent = gen_xmlEntityPtr(n_ent, 1);
8836 
8837         xmlDumpEntityDecl(buf, ent);
8838         call_tests++;
8839         des_xmlBufferPtr(n_buf, buf, 0);
8840         des_xmlEntityPtr(n_ent, ent, 1);
8841         xmlResetLastError();
8842         if (mem_base != xmlMemBlocks()) {
8843             printf("Leak of %d blocks found in xmlDumpEntityDecl",
8844 	           xmlMemBlocks() - mem_base);
8845 	    test_ret++;
8846             printf(" %d", n_buf);
8847             printf(" %d", n_ent);
8848             printf("\n");
8849         }
8850     }
8851     }
8852     function_tests++;
8853 #endif
8854 
8855     return(test_ret);
8856 }
8857 
8858 
8859 static int
test_xmlEncodeEntitiesReentrant(void)8860 test_xmlEncodeEntitiesReentrant(void) {
8861     int test_ret = 0;
8862 
8863     int mem_base;
8864     xmlChar * ret_val;
8865     xmlDocPtr doc; /* the document containing the string */
8866     int n_doc;
8867     const xmlChar * input; /* A string to convert to XML. */
8868     int n_input;
8869 
8870     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
8871     for (n_input = 0;n_input < gen_nb_const_xmlChar_ptr;n_input++) {
8872         mem_base = xmlMemBlocks();
8873         doc = gen_xmlDocPtr(n_doc, 0);
8874         input = gen_const_xmlChar_ptr(n_input, 1);
8875 
8876         ret_val = xmlEncodeEntitiesReentrant(doc, input);
8877         desret_xmlChar_ptr(ret_val);
8878         call_tests++;
8879         des_xmlDocPtr(n_doc, doc, 0);
8880         des_const_xmlChar_ptr(n_input, input, 1);
8881         xmlResetLastError();
8882         if (mem_base != xmlMemBlocks()) {
8883             printf("Leak of %d blocks found in xmlEncodeEntitiesReentrant",
8884 	           xmlMemBlocks() - mem_base);
8885 	    test_ret++;
8886             printf(" %d", n_doc);
8887             printf(" %d", n_input);
8888             printf("\n");
8889         }
8890     }
8891     }
8892     function_tests++;
8893 
8894     return(test_ret);
8895 }
8896 
8897 
8898 #define gen_nb_const_xmlDoc_ptr 1
8899 #define gen_const_xmlDoc_ptr(no, nr) NULL
8900 #define des_const_xmlDoc_ptr(no, val, nr)
8901 
8902 static int
test_xmlEncodeSpecialChars(void)8903 test_xmlEncodeSpecialChars(void) {
8904     int test_ret = 0;
8905 
8906     int mem_base;
8907     xmlChar * ret_val;
8908     const xmlDoc * doc; /* the document containing the string */
8909     int n_doc;
8910     const xmlChar * input; /* A string to convert to XML. */
8911     int n_input;
8912 
8913     for (n_doc = 0;n_doc < gen_nb_const_xmlDoc_ptr;n_doc++) {
8914     for (n_input = 0;n_input < gen_nb_const_xmlChar_ptr;n_input++) {
8915         mem_base = xmlMemBlocks();
8916         doc = gen_const_xmlDoc_ptr(n_doc, 0);
8917         input = gen_const_xmlChar_ptr(n_input, 1);
8918 
8919         ret_val = xmlEncodeSpecialChars(doc, input);
8920         desret_xmlChar_ptr(ret_val);
8921         call_tests++;
8922         des_const_xmlDoc_ptr(n_doc, doc, 0);
8923         des_const_xmlChar_ptr(n_input, input, 1);
8924         xmlResetLastError();
8925         if (mem_base != xmlMemBlocks()) {
8926             printf("Leak of %d blocks found in xmlEncodeSpecialChars",
8927 	           xmlMemBlocks() - mem_base);
8928 	    test_ret++;
8929             printf(" %d", n_doc);
8930             printf(" %d", n_input);
8931             printf("\n");
8932         }
8933     }
8934     }
8935     function_tests++;
8936 
8937     return(test_ret);
8938 }
8939 
8940 
8941 static int
test_xmlGetDocEntity(void)8942 test_xmlGetDocEntity(void) {
8943     int test_ret = 0;
8944 
8945     int mem_base;
8946     xmlEntityPtr ret_val;
8947     const xmlDoc * doc; /* the document referencing the entity */
8948     int n_doc;
8949     const xmlChar * name; /* the entity name */
8950     int n_name;
8951 
8952     for (n_doc = 0;n_doc < gen_nb_const_xmlDoc_ptr;n_doc++) {
8953     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
8954         mem_base = xmlMemBlocks();
8955         doc = gen_const_xmlDoc_ptr(n_doc, 0);
8956         name = gen_const_xmlChar_ptr(n_name, 1);
8957 
8958         ret_val = xmlGetDocEntity(doc, name);
8959         desret_xmlEntityPtr(ret_val);
8960         call_tests++;
8961         des_const_xmlDoc_ptr(n_doc, doc, 0);
8962         des_const_xmlChar_ptr(n_name, name, 1);
8963         xmlResetLastError();
8964         if (mem_base != xmlMemBlocks()) {
8965             printf("Leak of %d blocks found in xmlGetDocEntity",
8966 	           xmlMemBlocks() - mem_base);
8967 	    test_ret++;
8968             printf(" %d", n_doc);
8969             printf(" %d", n_name);
8970             printf("\n");
8971         }
8972     }
8973     }
8974     function_tests++;
8975 
8976     return(test_ret);
8977 }
8978 
8979 
8980 static int
test_xmlGetDtdEntity(void)8981 test_xmlGetDtdEntity(void) {
8982     int test_ret = 0;
8983 
8984     int mem_base;
8985     xmlEntityPtr ret_val;
8986     xmlDocPtr doc; /* the document referencing the entity */
8987     int n_doc;
8988     const xmlChar * name; /* the entity name */
8989     int n_name;
8990 
8991     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
8992     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
8993         mem_base = xmlMemBlocks();
8994         doc = gen_xmlDocPtr(n_doc, 0);
8995         name = gen_const_xmlChar_ptr(n_name, 1);
8996 
8997         ret_val = xmlGetDtdEntity(doc, name);
8998         desret_xmlEntityPtr(ret_val);
8999         call_tests++;
9000         des_xmlDocPtr(n_doc, doc, 0);
9001         des_const_xmlChar_ptr(n_name, name, 1);
9002         xmlResetLastError();
9003         if (mem_base != xmlMemBlocks()) {
9004             printf("Leak of %d blocks found in xmlGetDtdEntity",
9005 	           xmlMemBlocks() - mem_base);
9006 	    test_ret++;
9007             printf(" %d", n_doc);
9008             printf(" %d", n_name);
9009             printf("\n");
9010         }
9011     }
9012     }
9013     function_tests++;
9014 
9015     return(test_ret);
9016 }
9017 
9018 
9019 static int
test_xmlGetParameterEntity(void)9020 test_xmlGetParameterEntity(void) {
9021     int test_ret = 0;
9022 
9023     int mem_base;
9024     xmlEntityPtr ret_val;
9025     xmlDocPtr doc; /* the document referencing the entity */
9026     int n_doc;
9027     const xmlChar * name; /* the entity name */
9028     int n_name;
9029 
9030     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9031     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9032         mem_base = xmlMemBlocks();
9033         doc = gen_xmlDocPtr(n_doc, 0);
9034         name = gen_const_xmlChar_ptr(n_name, 1);
9035 
9036         ret_val = xmlGetParameterEntity(doc, name);
9037         desret_xmlEntityPtr(ret_val);
9038         call_tests++;
9039         des_xmlDocPtr(n_doc, doc, 0);
9040         des_const_xmlChar_ptr(n_name, name, 1);
9041         xmlResetLastError();
9042         if (mem_base != xmlMemBlocks()) {
9043             printf("Leak of %d blocks found in xmlGetParameterEntity",
9044 	           xmlMemBlocks() - mem_base);
9045 	    test_ret++;
9046             printf(" %d", n_doc);
9047             printf(" %d", n_name);
9048             printf("\n");
9049         }
9050     }
9051     }
9052     function_tests++;
9053 
9054     return(test_ret);
9055 }
9056 
9057 
9058 static int
test_xmlGetPredefinedEntity(void)9059 test_xmlGetPredefinedEntity(void) {
9060     int test_ret = 0;
9061 
9062     int mem_base;
9063     xmlEntityPtr ret_val;
9064     const xmlChar * name; /* the entity name */
9065     int n_name;
9066 
9067     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9068         mem_base = xmlMemBlocks();
9069         name = gen_const_xmlChar_ptr(n_name, 0);
9070 
9071         ret_val = xmlGetPredefinedEntity(name);
9072         desret_xmlEntityPtr(ret_val);
9073         call_tests++;
9074         des_const_xmlChar_ptr(n_name, name, 0);
9075         xmlResetLastError();
9076         if (mem_base != xmlMemBlocks()) {
9077             printf("Leak of %d blocks found in xmlGetPredefinedEntity",
9078 	           xmlMemBlocks() - mem_base);
9079 	    test_ret++;
9080             printf(" %d", n_name);
9081             printf("\n");
9082         }
9083     }
9084     function_tests++;
9085 
9086     return(test_ret);
9087 }
9088 
9089 
9090 static int
test_xmlNewEntity(void)9091 test_xmlNewEntity(void) {
9092     int test_ret = 0;
9093 
9094     int mem_base;
9095     xmlEntityPtr ret_val;
9096     xmlDocPtr doc; /* the document */
9097     int n_doc;
9098     const xmlChar * name; /* the entity name */
9099     int n_name;
9100     int type; /* the entity type XML_xxx_yyy_ENTITY */
9101     int n_type;
9102     const xmlChar * ExternalID; /* the entity external ID if available */
9103     int n_ExternalID;
9104     const xmlChar * SystemID; /* the entity system ID if available */
9105     int n_SystemID;
9106     const xmlChar * content; /* the entity content */
9107     int n_content;
9108 
9109     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9110     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9111     for (n_type = 0;n_type < gen_nb_int;n_type++) {
9112     for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
9113     for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
9114     for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
9115         mem_base = xmlMemBlocks();
9116         doc = gen_xmlDocPtr(n_doc, 0);
9117         name = gen_const_xmlChar_ptr(n_name, 1);
9118         type = gen_int(n_type, 2);
9119         ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 3);
9120         SystemID = gen_const_xmlChar_ptr(n_SystemID, 4);
9121         content = gen_const_xmlChar_ptr(n_content, 5);
9122 
9123         ret_val = xmlNewEntity(doc, name, type, ExternalID, SystemID, content);
9124         desret_xmlEntityPtr(ret_val);
9125         call_tests++;
9126         des_xmlDocPtr(n_doc, doc, 0);
9127         des_const_xmlChar_ptr(n_name, name, 1);
9128         des_int(n_type, type, 2);
9129         des_const_xmlChar_ptr(n_ExternalID, ExternalID, 3);
9130         des_const_xmlChar_ptr(n_SystemID, SystemID, 4);
9131         des_const_xmlChar_ptr(n_content, content, 5);
9132         xmlResetLastError();
9133         if (mem_base != xmlMemBlocks()) {
9134             printf("Leak of %d blocks found in xmlNewEntity",
9135 	           xmlMemBlocks() - mem_base);
9136 	    test_ret++;
9137             printf(" %d", n_doc);
9138             printf(" %d", n_name);
9139             printf(" %d", n_type);
9140             printf(" %d", n_ExternalID);
9141             printf(" %d", n_SystemID);
9142             printf(" %d", n_content);
9143             printf("\n");
9144         }
9145     }
9146     }
9147     }
9148     }
9149     }
9150     }
9151     function_tests++;
9152 
9153     return(test_ret);
9154 }
9155 
9156 static int
test_entities(void)9157 test_entities(void) {
9158     int test_ret = 0;
9159 
9160     if (quiet == 0) printf("Testing entities : 12 of 16 functions ...\n");
9161     test_ret += test_xmlAddDocEntity();
9162     test_ret += test_xmlAddDtdEntity();
9163     test_ret += test_xmlAddEntity();
9164     test_ret += test_xmlCopyEntitiesTable();
9165     test_ret += test_xmlCreateEntitiesTable();
9166     test_ret += test_xmlDumpEntitiesTable();
9167     test_ret += test_xmlDumpEntityDecl();
9168     test_ret += test_xmlEncodeEntitiesReentrant();
9169     test_ret += test_xmlEncodeSpecialChars();
9170     test_ret += test_xmlGetDocEntity();
9171     test_ret += test_xmlGetDtdEntity();
9172     test_ret += test_xmlGetParameterEntity();
9173     test_ret += test_xmlGetPredefinedEntity();
9174     test_ret += test_xmlNewEntity();
9175 
9176     if (test_ret != 0)
9177 	printf("Module entities: %d errors\n", test_ret);
9178     return(test_ret);
9179 }
9180 
9181 static int
test_xmlHashAdd(void)9182 test_xmlHashAdd(void) {
9183     int test_ret = 0;
9184 
9185     int mem_base;
9186     int ret_val;
9187     xmlHashTablePtr hash; /* hash table */
9188     int n_hash;
9189     const xmlChar * key; /* string key */
9190     int n_key;
9191     void * payload; /* pointer to the payload */
9192     int n_payload;
9193 
9194     for (n_hash = 0;n_hash < gen_nb_xmlHashTablePtr;n_hash++) {
9195     for (n_key = 0;n_key < gen_nb_const_xmlChar_ptr;n_key++) {
9196     for (n_payload = 0;n_payload < gen_nb_void_ptr;n_payload++) {
9197         mem_base = xmlMemBlocks();
9198         hash = gen_xmlHashTablePtr(n_hash, 0);
9199         key = gen_const_xmlChar_ptr(n_key, 1);
9200         payload = gen_void_ptr(n_payload, 2);
9201 
9202         ret_val = xmlHashAdd(hash, key, payload);
9203         desret_int(ret_val);
9204         call_tests++;
9205         des_xmlHashTablePtr(n_hash, hash, 0);
9206         des_const_xmlChar_ptr(n_key, key, 1);
9207         des_void_ptr(n_payload, payload, 2);
9208         xmlResetLastError();
9209         if (mem_base != xmlMemBlocks()) {
9210             printf("Leak of %d blocks found in xmlHashAdd",
9211 	           xmlMemBlocks() - mem_base);
9212 	    test_ret++;
9213             printf(" %d", n_hash);
9214             printf(" %d", n_key);
9215             printf(" %d", n_payload);
9216             printf("\n");
9217         }
9218     }
9219     }
9220     }
9221     function_tests++;
9222 
9223     return(test_ret);
9224 }
9225 
9226 
9227 static int
test_xmlHashAdd2(void)9228 test_xmlHashAdd2(void) {
9229     int test_ret = 0;
9230 
9231     int mem_base;
9232     int ret_val;
9233     xmlHashTablePtr hash; /* hash table */
9234     int n_hash;
9235     const xmlChar * key; /* first string key */
9236     int n_key;
9237     const xmlChar * key2; /* second string key */
9238     int n_key2;
9239     void * payload; /* pointer to the payload */
9240     int n_payload;
9241 
9242     for (n_hash = 0;n_hash < gen_nb_xmlHashTablePtr;n_hash++) {
9243     for (n_key = 0;n_key < gen_nb_const_xmlChar_ptr;n_key++) {
9244     for (n_key2 = 0;n_key2 < gen_nb_const_xmlChar_ptr;n_key2++) {
9245     for (n_payload = 0;n_payload < gen_nb_void_ptr;n_payload++) {
9246         mem_base = xmlMemBlocks();
9247         hash = gen_xmlHashTablePtr(n_hash, 0);
9248         key = gen_const_xmlChar_ptr(n_key, 1);
9249         key2 = gen_const_xmlChar_ptr(n_key2, 2);
9250         payload = gen_void_ptr(n_payload, 3);
9251 
9252         ret_val = xmlHashAdd2(hash, key, key2, payload);
9253         desret_int(ret_val);
9254         call_tests++;
9255         des_xmlHashTablePtr(n_hash, hash, 0);
9256         des_const_xmlChar_ptr(n_key, key, 1);
9257         des_const_xmlChar_ptr(n_key2, key2, 2);
9258         des_void_ptr(n_payload, payload, 3);
9259         xmlResetLastError();
9260         if (mem_base != xmlMemBlocks()) {
9261             printf("Leak of %d blocks found in xmlHashAdd2",
9262 	           xmlMemBlocks() - mem_base);
9263 	    test_ret++;
9264             printf(" %d", n_hash);
9265             printf(" %d", n_key);
9266             printf(" %d", n_key2);
9267             printf(" %d", n_payload);
9268             printf("\n");
9269         }
9270     }
9271     }
9272     }
9273     }
9274     function_tests++;
9275 
9276     return(test_ret);
9277 }
9278 
9279 
9280 static int
test_xmlHashAdd3(void)9281 test_xmlHashAdd3(void) {
9282     int test_ret = 0;
9283 
9284     int mem_base;
9285     int ret_val;
9286     xmlHashTablePtr hash; /* hash table */
9287     int n_hash;
9288     const xmlChar * key; /* first string key */
9289     int n_key;
9290     const xmlChar * key2; /* second string key */
9291     int n_key2;
9292     const xmlChar * key3; /* third string key */
9293     int n_key3;
9294     void * payload; /* pointer to the payload */
9295     int n_payload;
9296 
9297     for (n_hash = 0;n_hash < gen_nb_xmlHashTablePtr;n_hash++) {
9298     for (n_key = 0;n_key < gen_nb_const_xmlChar_ptr;n_key++) {
9299     for (n_key2 = 0;n_key2 < gen_nb_const_xmlChar_ptr;n_key2++) {
9300     for (n_key3 = 0;n_key3 < gen_nb_const_xmlChar_ptr;n_key3++) {
9301     for (n_payload = 0;n_payload < gen_nb_void_ptr;n_payload++) {
9302         mem_base = xmlMemBlocks();
9303         hash = gen_xmlHashTablePtr(n_hash, 0);
9304         key = gen_const_xmlChar_ptr(n_key, 1);
9305         key2 = gen_const_xmlChar_ptr(n_key2, 2);
9306         key3 = gen_const_xmlChar_ptr(n_key3, 3);
9307         payload = gen_void_ptr(n_payload, 4);
9308 
9309         ret_val = xmlHashAdd3(hash, key, key2, key3, payload);
9310         desret_int(ret_val);
9311         call_tests++;
9312         des_xmlHashTablePtr(n_hash, hash, 0);
9313         des_const_xmlChar_ptr(n_key, key, 1);
9314         des_const_xmlChar_ptr(n_key2, key2, 2);
9315         des_const_xmlChar_ptr(n_key3, key3, 3);
9316         des_void_ptr(n_payload, payload, 4);
9317         xmlResetLastError();
9318         if (mem_base != xmlMemBlocks()) {
9319             printf("Leak of %d blocks found in xmlHashAdd3",
9320 	           xmlMemBlocks() - mem_base);
9321 	    test_ret++;
9322             printf(" %d", n_hash);
9323             printf(" %d", n_key);
9324             printf(" %d", n_key2);
9325             printf(" %d", n_key3);
9326             printf(" %d", n_payload);
9327             printf("\n");
9328         }
9329     }
9330     }
9331     }
9332     }
9333     }
9334     function_tests++;
9335 
9336     return(test_ret);
9337 }
9338 
9339 
9340 static int
test_xmlHashAddEntry(void)9341 test_xmlHashAddEntry(void) {
9342     int test_ret = 0;
9343 
9344     int mem_base;
9345     int ret_val;
9346     xmlHashTablePtr hash; /* hash table */
9347     int n_hash;
9348     const xmlChar * key; /* string key */
9349     int n_key;
9350     void * payload; /* pointer to the payload */
9351     int n_payload;
9352 
9353     for (n_hash = 0;n_hash < gen_nb_xmlHashTablePtr;n_hash++) {
9354     for (n_key = 0;n_key < gen_nb_const_xmlChar_ptr;n_key++) {
9355     for (n_payload = 0;n_payload < gen_nb_void_ptr;n_payload++) {
9356         mem_base = xmlMemBlocks();
9357         hash = gen_xmlHashTablePtr(n_hash, 0);
9358         key = gen_const_xmlChar_ptr(n_key, 1);
9359         payload = gen_void_ptr(n_payload, 2);
9360 
9361         ret_val = xmlHashAddEntry(hash, key, payload);
9362         desret_int(ret_val);
9363         call_tests++;
9364         des_xmlHashTablePtr(n_hash, hash, 0);
9365         des_const_xmlChar_ptr(n_key, key, 1);
9366         des_void_ptr(n_payload, payload, 2);
9367         xmlResetLastError();
9368         if (mem_base != xmlMemBlocks()) {
9369             printf("Leak of %d blocks found in xmlHashAddEntry",
9370 	           xmlMemBlocks() - mem_base);
9371 	    test_ret++;
9372             printf(" %d", n_hash);
9373             printf(" %d", n_key);
9374             printf(" %d", n_payload);
9375             printf("\n");
9376         }
9377     }
9378     }
9379     }
9380     function_tests++;
9381 
9382     return(test_ret);
9383 }
9384 
9385 
9386 static int
test_xmlHashAddEntry2(void)9387 test_xmlHashAddEntry2(void) {
9388     int test_ret = 0;
9389 
9390     int mem_base;
9391     int ret_val;
9392     xmlHashTablePtr hash; /* hash table */
9393     int n_hash;
9394     const xmlChar * key; /* first string key */
9395     int n_key;
9396     const xmlChar * key2; /* second string key */
9397     int n_key2;
9398     void * payload; /* pointer to the payload */
9399     int n_payload;
9400 
9401     for (n_hash = 0;n_hash < gen_nb_xmlHashTablePtr;n_hash++) {
9402     for (n_key = 0;n_key < gen_nb_const_xmlChar_ptr;n_key++) {
9403     for (n_key2 = 0;n_key2 < gen_nb_const_xmlChar_ptr;n_key2++) {
9404     for (n_payload = 0;n_payload < gen_nb_void_ptr;n_payload++) {
9405         mem_base = xmlMemBlocks();
9406         hash = gen_xmlHashTablePtr(n_hash, 0);
9407         key = gen_const_xmlChar_ptr(n_key, 1);
9408         key2 = gen_const_xmlChar_ptr(n_key2, 2);
9409         payload = gen_void_ptr(n_payload, 3);
9410 
9411         ret_val = xmlHashAddEntry2(hash, key, key2, payload);
9412         desret_int(ret_val);
9413         call_tests++;
9414         des_xmlHashTablePtr(n_hash, hash, 0);
9415         des_const_xmlChar_ptr(n_key, key, 1);
9416         des_const_xmlChar_ptr(n_key2, key2, 2);
9417         des_void_ptr(n_payload, payload, 3);
9418         xmlResetLastError();
9419         if (mem_base != xmlMemBlocks()) {
9420             printf("Leak of %d blocks found in xmlHashAddEntry2",
9421 	           xmlMemBlocks() - mem_base);
9422 	    test_ret++;
9423             printf(" %d", n_hash);
9424             printf(" %d", n_key);
9425             printf(" %d", n_key2);
9426             printf(" %d", n_payload);
9427             printf("\n");
9428         }
9429     }
9430     }
9431     }
9432     }
9433     function_tests++;
9434 
9435     return(test_ret);
9436 }
9437 
9438 
9439 static int
test_xmlHashAddEntry3(void)9440 test_xmlHashAddEntry3(void) {
9441     int test_ret = 0;
9442 
9443     int mem_base;
9444     int ret_val;
9445     xmlHashTablePtr hash; /* hash table */
9446     int n_hash;
9447     const xmlChar * key; /* first string key */
9448     int n_key;
9449     const xmlChar * key2; /* second string key */
9450     int n_key2;
9451     const xmlChar * key3; /* third string key */
9452     int n_key3;
9453     void * payload; /* pointer to the payload */
9454     int n_payload;
9455 
9456     for (n_hash = 0;n_hash < gen_nb_xmlHashTablePtr;n_hash++) {
9457     for (n_key = 0;n_key < gen_nb_const_xmlChar_ptr;n_key++) {
9458     for (n_key2 = 0;n_key2 < gen_nb_const_xmlChar_ptr;n_key2++) {
9459     for (n_key3 = 0;n_key3 < gen_nb_const_xmlChar_ptr;n_key3++) {
9460     for (n_payload = 0;n_payload < gen_nb_void_ptr;n_payload++) {
9461         mem_base = xmlMemBlocks();
9462         hash = gen_xmlHashTablePtr(n_hash, 0);
9463         key = gen_const_xmlChar_ptr(n_key, 1);
9464         key2 = gen_const_xmlChar_ptr(n_key2, 2);
9465         key3 = gen_const_xmlChar_ptr(n_key3, 3);
9466         payload = gen_void_ptr(n_payload, 4);
9467 
9468         ret_val = xmlHashAddEntry3(hash, key, key2, key3, payload);
9469         desret_int(ret_val);
9470         call_tests++;
9471         des_xmlHashTablePtr(n_hash, hash, 0);
9472         des_const_xmlChar_ptr(n_key, key, 1);
9473         des_const_xmlChar_ptr(n_key2, key2, 2);
9474         des_const_xmlChar_ptr(n_key3, key3, 3);
9475         des_void_ptr(n_payload, payload, 4);
9476         xmlResetLastError();
9477         if (mem_base != xmlMemBlocks()) {
9478             printf("Leak of %d blocks found in xmlHashAddEntry3",
9479 	           xmlMemBlocks() - mem_base);
9480 	    test_ret++;
9481             printf(" %d", n_hash);
9482             printf(" %d", n_key);
9483             printf(" %d", n_key2);
9484             printf(" %d", n_key3);
9485             printf(" %d", n_payload);
9486             printf("\n");
9487         }
9488     }
9489     }
9490     }
9491     }
9492     }
9493     function_tests++;
9494 
9495     return(test_ret);
9496 }
9497 
9498 
9499 static int
test_xmlHashCopy(void)9500 test_xmlHashCopy(void) {
9501     int test_ret = 0;
9502 
9503 
9504     /* missing type support */
9505     return(test_ret);
9506 }
9507 
9508 
9509 static int
test_xmlHashCopySafe(void)9510 test_xmlHashCopySafe(void) {
9511     int test_ret = 0;
9512 
9513 
9514     /* missing type support */
9515     return(test_ret);
9516 }
9517 
9518 
9519 static int
test_xmlHashCreate(void)9520 test_xmlHashCreate(void) {
9521     int test_ret = 0;
9522 
9523 
9524     /* missing type support */
9525     return(test_ret);
9526 }
9527 
9528 
9529 static int
test_xmlHashCreateDict(void)9530 test_xmlHashCreateDict(void) {
9531     int test_ret = 0;
9532 
9533 
9534     /* missing type support */
9535     return(test_ret);
9536 }
9537 
9538 
9539 static int
test_xmlHashDefaultDeallocator(void)9540 test_xmlHashDefaultDeallocator(void) {
9541     int test_ret = 0;
9542 
9543     int mem_base;
9544     void * entry; /* hash table entry */
9545     int n_entry;
9546     const xmlChar * key; /* the entry's string key */
9547     int n_key;
9548 
9549     for (n_entry = 0;n_entry < gen_nb_void_ptr;n_entry++) {
9550     for (n_key = 0;n_key < gen_nb_const_xmlChar_ptr;n_key++) {
9551         mem_base = xmlMemBlocks();
9552         entry = gen_void_ptr(n_entry, 0);
9553         key = gen_const_xmlChar_ptr(n_key, 1);
9554 
9555         xmlHashDefaultDeallocator(entry, key);
9556         call_tests++;
9557         des_void_ptr(n_entry, entry, 0);
9558         des_const_xmlChar_ptr(n_key, key, 1);
9559         xmlResetLastError();
9560         if (mem_base != xmlMemBlocks()) {
9561             printf("Leak of %d blocks found in xmlHashDefaultDeallocator",
9562 	           xmlMemBlocks() - mem_base);
9563 	    test_ret++;
9564             printf(" %d", n_entry);
9565             printf(" %d", n_key);
9566             printf("\n");
9567         }
9568     }
9569     }
9570     function_tests++;
9571 
9572     return(test_ret);
9573 }
9574 
9575 
9576 static int
test_xmlHashLookup(void)9577 test_xmlHashLookup(void) {
9578     int test_ret = 0;
9579 
9580     int mem_base;
9581     void * ret_val;
9582     xmlHashTablePtr hash; /* hash table */
9583     int n_hash;
9584     const xmlChar * key; /* string key */
9585     int n_key;
9586 
9587     for (n_hash = 0;n_hash < gen_nb_xmlHashTablePtr;n_hash++) {
9588     for (n_key = 0;n_key < gen_nb_const_xmlChar_ptr;n_key++) {
9589         mem_base = xmlMemBlocks();
9590         hash = gen_xmlHashTablePtr(n_hash, 0);
9591         key = gen_const_xmlChar_ptr(n_key, 1);
9592 
9593         ret_val = xmlHashLookup(hash, key);
9594         desret_void_ptr(ret_val);
9595         call_tests++;
9596         des_xmlHashTablePtr(n_hash, hash, 0);
9597         des_const_xmlChar_ptr(n_key, key, 1);
9598         xmlResetLastError();
9599         if (mem_base != xmlMemBlocks()) {
9600             printf("Leak of %d blocks found in xmlHashLookup",
9601 	           xmlMemBlocks() - mem_base);
9602 	    test_ret++;
9603             printf(" %d", n_hash);
9604             printf(" %d", n_key);
9605             printf("\n");
9606         }
9607     }
9608     }
9609     function_tests++;
9610 
9611     return(test_ret);
9612 }
9613 
9614 
9615 static int
test_xmlHashLookup2(void)9616 test_xmlHashLookup2(void) {
9617     int test_ret = 0;
9618 
9619     int mem_base;
9620     void * ret_val;
9621     xmlHashTablePtr hash; /* hash table */
9622     int n_hash;
9623     const xmlChar * key; /* first string key */
9624     int n_key;
9625     const xmlChar * key2; /* second string key */
9626     int n_key2;
9627 
9628     for (n_hash = 0;n_hash < gen_nb_xmlHashTablePtr;n_hash++) {
9629     for (n_key = 0;n_key < gen_nb_const_xmlChar_ptr;n_key++) {
9630     for (n_key2 = 0;n_key2 < gen_nb_const_xmlChar_ptr;n_key2++) {
9631         mem_base = xmlMemBlocks();
9632         hash = gen_xmlHashTablePtr(n_hash, 0);
9633         key = gen_const_xmlChar_ptr(n_key, 1);
9634         key2 = gen_const_xmlChar_ptr(n_key2, 2);
9635 
9636         ret_val = xmlHashLookup2(hash, key, key2);
9637         desret_void_ptr(ret_val);
9638         call_tests++;
9639         des_xmlHashTablePtr(n_hash, hash, 0);
9640         des_const_xmlChar_ptr(n_key, key, 1);
9641         des_const_xmlChar_ptr(n_key2, key2, 2);
9642         xmlResetLastError();
9643         if (mem_base != xmlMemBlocks()) {
9644             printf("Leak of %d blocks found in xmlHashLookup2",
9645 	           xmlMemBlocks() - mem_base);
9646 	    test_ret++;
9647             printf(" %d", n_hash);
9648             printf(" %d", n_key);
9649             printf(" %d", n_key2);
9650             printf("\n");
9651         }
9652     }
9653     }
9654     }
9655     function_tests++;
9656 
9657     return(test_ret);
9658 }
9659 
9660 
9661 static int
test_xmlHashLookup3(void)9662 test_xmlHashLookup3(void) {
9663     int test_ret = 0;
9664 
9665     int mem_base;
9666     void * ret_val;
9667     xmlHashTablePtr hash; /* hash table */
9668     int n_hash;
9669     const xmlChar * key; /* first string key */
9670     int n_key;
9671     const xmlChar * key2; /* second string key */
9672     int n_key2;
9673     const xmlChar * key3; /* third string key */
9674     int n_key3;
9675 
9676     for (n_hash = 0;n_hash < gen_nb_xmlHashTablePtr;n_hash++) {
9677     for (n_key = 0;n_key < gen_nb_const_xmlChar_ptr;n_key++) {
9678     for (n_key2 = 0;n_key2 < gen_nb_const_xmlChar_ptr;n_key2++) {
9679     for (n_key3 = 0;n_key3 < gen_nb_const_xmlChar_ptr;n_key3++) {
9680         mem_base = xmlMemBlocks();
9681         hash = gen_xmlHashTablePtr(n_hash, 0);
9682         key = gen_const_xmlChar_ptr(n_key, 1);
9683         key2 = gen_const_xmlChar_ptr(n_key2, 2);
9684         key3 = gen_const_xmlChar_ptr(n_key3, 3);
9685 
9686         ret_val = xmlHashLookup3(hash, key, key2, key3);
9687         desret_void_ptr(ret_val);
9688         call_tests++;
9689         des_xmlHashTablePtr(n_hash, hash, 0);
9690         des_const_xmlChar_ptr(n_key, key, 1);
9691         des_const_xmlChar_ptr(n_key2, key2, 2);
9692         des_const_xmlChar_ptr(n_key3, key3, 3);
9693         xmlResetLastError();
9694         if (mem_base != xmlMemBlocks()) {
9695             printf("Leak of %d blocks found in xmlHashLookup3",
9696 	           xmlMemBlocks() - mem_base);
9697 	    test_ret++;
9698             printf(" %d", n_hash);
9699             printf(" %d", n_key);
9700             printf(" %d", n_key2);
9701             printf(" %d", n_key3);
9702             printf("\n");
9703         }
9704     }
9705     }
9706     }
9707     }
9708     function_tests++;
9709 
9710     return(test_ret);
9711 }
9712 
9713 
9714 static int
test_xmlHashQLookup(void)9715 test_xmlHashQLookup(void) {
9716     int test_ret = 0;
9717 
9718     int mem_base;
9719     void * ret_val;
9720     xmlHashTablePtr hash; /* hash table */
9721     int n_hash;
9722     const xmlChar * prefix; /* prefix of the string key */
9723     int n_prefix;
9724     const xmlChar * name; /* local name of the string key */
9725     int n_name;
9726 
9727     for (n_hash = 0;n_hash < gen_nb_xmlHashTablePtr;n_hash++) {
9728     for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
9729     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9730         mem_base = xmlMemBlocks();
9731         hash = gen_xmlHashTablePtr(n_hash, 0);
9732         prefix = gen_const_xmlChar_ptr(n_prefix, 1);
9733         name = gen_const_xmlChar_ptr(n_name, 2);
9734 
9735         ret_val = xmlHashQLookup(hash, prefix, name);
9736         desret_void_ptr(ret_val);
9737         call_tests++;
9738         des_xmlHashTablePtr(n_hash, hash, 0);
9739         des_const_xmlChar_ptr(n_prefix, prefix, 1);
9740         des_const_xmlChar_ptr(n_name, name, 2);
9741         xmlResetLastError();
9742         if (mem_base != xmlMemBlocks()) {
9743             printf("Leak of %d blocks found in xmlHashQLookup",
9744 	           xmlMemBlocks() - mem_base);
9745 	    test_ret++;
9746             printf(" %d", n_hash);
9747             printf(" %d", n_prefix);
9748             printf(" %d", n_name);
9749             printf("\n");
9750         }
9751     }
9752     }
9753     }
9754     function_tests++;
9755 
9756     return(test_ret);
9757 }
9758 
9759 
9760 static int
test_xmlHashQLookup2(void)9761 test_xmlHashQLookup2(void) {
9762     int test_ret = 0;
9763 
9764     int mem_base;
9765     void * ret_val;
9766     xmlHashTablePtr hash; /* hash table */
9767     int n_hash;
9768     const xmlChar * prefix; /* first prefix */
9769     int n_prefix;
9770     const xmlChar * name; /* first local name */
9771     int n_name;
9772     const xmlChar * prefix2; /* second prefix */
9773     int n_prefix2;
9774     const xmlChar * name2; /* second local name */
9775     int n_name2;
9776 
9777     for (n_hash = 0;n_hash < gen_nb_xmlHashTablePtr;n_hash++) {
9778     for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
9779     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9780     for (n_prefix2 = 0;n_prefix2 < gen_nb_const_xmlChar_ptr;n_prefix2++) {
9781     for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9782         mem_base = xmlMemBlocks();
9783         hash = gen_xmlHashTablePtr(n_hash, 0);
9784         prefix = gen_const_xmlChar_ptr(n_prefix, 1);
9785         name = gen_const_xmlChar_ptr(n_name, 2);
9786         prefix2 = gen_const_xmlChar_ptr(n_prefix2, 3);
9787         name2 = gen_const_xmlChar_ptr(n_name2, 4);
9788 
9789         ret_val = xmlHashQLookup2(hash, prefix, name, prefix2, name2);
9790         desret_void_ptr(ret_val);
9791         call_tests++;
9792         des_xmlHashTablePtr(n_hash, hash, 0);
9793         des_const_xmlChar_ptr(n_prefix, prefix, 1);
9794         des_const_xmlChar_ptr(n_name, name, 2);
9795         des_const_xmlChar_ptr(n_prefix2, prefix2, 3);
9796         des_const_xmlChar_ptr(n_name2, name2, 4);
9797         xmlResetLastError();
9798         if (mem_base != xmlMemBlocks()) {
9799             printf("Leak of %d blocks found in xmlHashQLookup2",
9800 	           xmlMemBlocks() - mem_base);
9801 	    test_ret++;
9802             printf(" %d", n_hash);
9803             printf(" %d", n_prefix);
9804             printf(" %d", n_name);
9805             printf(" %d", n_prefix2);
9806             printf(" %d", n_name2);
9807             printf("\n");
9808         }
9809     }
9810     }
9811     }
9812     }
9813     }
9814     function_tests++;
9815 
9816     return(test_ret);
9817 }
9818 
9819 
9820 static int
test_xmlHashQLookup3(void)9821 test_xmlHashQLookup3(void) {
9822     int test_ret = 0;
9823 
9824     int mem_base;
9825     void * ret_val;
9826     xmlHashTablePtr hash; /* hash table */
9827     int n_hash;
9828     const xmlChar * prefix; /* first prefix */
9829     int n_prefix;
9830     const xmlChar * name; /* first local name */
9831     int n_name;
9832     const xmlChar * prefix2; /* second prefix */
9833     int n_prefix2;
9834     const xmlChar * name2; /* second local name */
9835     int n_name2;
9836     const xmlChar * prefix3; /* third prefix */
9837     int n_prefix3;
9838     const xmlChar * name3; /* third local name */
9839     int n_name3;
9840 
9841     for (n_hash = 0;n_hash < gen_nb_xmlHashTablePtr;n_hash++) {
9842     for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
9843     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9844     for (n_prefix2 = 0;n_prefix2 < gen_nb_const_xmlChar_ptr;n_prefix2++) {
9845     for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9846     for (n_prefix3 = 0;n_prefix3 < gen_nb_const_xmlChar_ptr;n_prefix3++) {
9847     for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
9848         mem_base = xmlMemBlocks();
9849         hash = gen_xmlHashTablePtr(n_hash, 0);
9850         prefix = gen_const_xmlChar_ptr(n_prefix, 1);
9851         name = gen_const_xmlChar_ptr(n_name, 2);
9852         prefix2 = gen_const_xmlChar_ptr(n_prefix2, 3);
9853         name2 = gen_const_xmlChar_ptr(n_name2, 4);
9854         prefix3 = gen_const_xmlChar_ptr(n_prefix3, 5);
9855         name3 = gen_const_xmlChar_ptr(n_name3, 6);
9856 
9857         ret_val = xmlHashQLookup3(hash, prefix, name, prefix2, name2, prefix3, name3);
9858         desret_void_ptr(ret_val);
9859         call_tests++;
9860         des_xmlHashTablePtr(n_hash, hash, 0);
9861         des_const_xmlChar_ptr(n_prefix, prefix, 1);
9862         des_const_xmlChar_ptr(n_name, name, 2);
9863         des_const_xmlChar_ptr(n_prefix2, prefix2, 3);
9864         des_const_xmlChar_ptr(n_name2, name2, 4);
9865         des_const_xmlChar_ptr(n_prefix3, prefix3, 5);
9866         des_const_xmlChar_ptr(n_name3, name3, 6);
9867         xmlResetLastError();
9868         if (mem_base != xmlMemBlocks()) {
9869             printf("Leak of %d blocks found in xmlHashQLookup3",
9870 	           xmlMemBlocks() - mem_base);
9871 	    test_ret++;
9872             printf(" %d", n_hash);
9873             printf(" %d", n_prefix);
9874             printf(" %d", n_name);
9875             printf(" %d", n_prefix2);
9876             printf(" %d", n_name2);
9877             printf(" %d", n_prefix3);
9878             printf(" %d", n_name3);
9879             printf("\n");
9880         }
9881     }
9882     }
9883     }
9884     }
9885     }
9886     }
9887     }
9888     function_tests++;
9889 
9890     return(test_ret);
9891 }
9892 
9893 
9894 static int
test_xmlHashRemoveEntry(void)9895 test_xmlHashRemoveEntry(void) {
9896     int test_ret = 0;
9897 
9898     int mem_base;
9899     int ret_val;
9900     xmlHashTablePtr hash; /* hash table */
9901     int n_hash;
9902     const xmlChar * key; /* string key */
9903     int n_key;
9904     xmlHashDeallocator dealloc; /* deallocator function for removed item or NULL */
9905     int n_dealloc;
9906 
9907     for (n_hash = 0;n_hash < gen_nb_xmlHashTablePtr;n_hash++) {
9908     for (n_key = 0;n_key < gen_nb_const_xmlChar_ptr;n_key++) {
9909     for (n_dealloc = 0;n_dealloc < gen_nb_xmlHashDeallocator;n_dealloc++) {
9910         mem_base = xmlMemBlocks();
9911         hash = gen_xmlHashTablePtr(n_hash, 0);
9912         key = gen_const_xmlChar_ptr(n_key, 1);
9913         dealloc = gen_xmlHashDeallocator(n_dealloc, 2);
9914 
9915         ret_val = xmlHashRemoveEntry(hash, key, dealloc);
9916         desret_int(ret_val);
9917         call_tests++;
9918         des_xmlHashTablePtr(n_hash, hash, 0);
9919         des_const_xmlChar_ptr(n_key, key, 1);
9920         des_xmlHashDeallocator(n_dealloc, dealloc, 2);
9921         xmlResetLastError();
9922         if (mem_base != xmlMemBlocks()) {
9923             printf("Leak of %d blocks found in xmlHashRemoveEntry",
9924 	           xmlMemBlocks() - mem_base);
9925 	    test_ret++;
9926             printf(" %d", n_hash);
9927             printf(" %d", n_key);
9928             printf(" %d", n_dealloc);
9929             printf("\n");
9930         }
9931     }
9932     }
9933     }
9934     function_tests++;
9935 
9936     return(test_ret);
9937 }
9938 
9939 
9940 static int
test_xmlHashRemoveEntry2(void)9941 test_xmlHashRemoveEntry2(void) {
9942     int test_ret = 0;
9943 
9944     int mem_base;
9945     int ret_val;
9946     xmlHashTablePtr hash; /* hash table */
9947     int n_hash;
9948     const xmlChar * key; /* first string key */
9949     int n_key;
9950     const xmlChar * key2; /* second string key */
9951     int n_key2;
9952     xmlHashDeallocator dealloc; /* deallocator function for removed item or NULL */
9953     int n_dealloc;
9954 
9955     for (n_hash = 0;n_hash < gen_nb_xmlHashTablePtr;n_hash++) {
9956     for (n_key = 0;n_key < gen_nb_const_xmlChar_ptr;n_key++) {
9957     for (n_key2 = 0;n_key2 < gen_nb_const_xmlChar_ptr;n_key2++) {
9958     for (n_dealloc = 0;n_dealloc < gen_nb_xmlHashDeallocator;n_dealloc++) {
9959         mem_base = xmlMemBlocks();
9960         hash = gen_xmlHashTablePtr(n_hash, 0);
9961         key = gen_const_xmlChar_ptr(n_key, 1);
9962         key2 = gen_const_xmlChar_ptr(n_key2, 2);
9963         dealloc = gen_xmlHashDeallocator(n_dealloc, 3);
9964 
9965         ret_val = xmlHashRemoveEntry2(hash, key, key2, dealloc);
9966         desret_int(ret_val);
9967         call_tests++;
9968         des_xmlHashTablePtr(n_hash, hash, 0);
9969         des_const_xmlChar_ptr(n_key, key, 1);
9970         des_const_xmlChar_ptr(n_key2, key2, 2);
9971         des_xmlHashDeallocator(n_dealloc, dealloc, 3);
9972         xmlResetLastError();
9973         if (mem_base != xmlMemBlocks()) {
9974             printf("Leak of %d blocks found in xmlHashRemoveEntry2",
9975 	           xmlMemBlocks() - mem_base);
9976 	    test_ret++;
9977             printf(" %d", n_hash);
9978             printf(" %d", n_key);
9979             printf(" %d", n_key2);
9980             printf(" %d", n_dealloc);
9981             printf("\n");
9982         }
9983     }
9984     }
9985     }
9986     }
9987     function_tests++;
9988 
9989     return(test_ret);
9990 }
9991 
9992 
9993 static int
test_xmlHashRemoveEntry3(void)9994 test_xmlHashRemoveEntry3(void) {
9995     int test_ret = 0;
9996 
9997     int mem_base;
9998     int ret_val;
9999     xmlHashTablePtr hash; /* hash table */
10000     int n_hash;
10001     const xmlChar * key; /* first string key */
10002     int n_key;
10003     const xmlChar * key2; /* second string key */
10004     int n_key2;
10005     const xmlChar * key3; /* third string key */
10006     int n_key3;
10007     xmlHashDeallocator dealloc; /* deallocator function for removed item or NULL */
10008     int n_dealloc;
10009 
10010     for (n_hash = 0;n_hash < gen_nb_xmlHashTablePtr;n_hash++) {
10011     for (n_key = 0;n_key < gen_nb_const_xmlChar_ptr;n_key++) {
10012     for (n_key2 = 0;n_key2 < gen_nb_const_xmlChar_ptr;n_key2++) {
10013     for (n_key3 = 0;n_key3 < gen_nb_const_xmlChar_ptr;n_key3++) {
10014     for (n_dealloc = 0;n_dealloc < gen_nb_xmlHashDeallocator;n_dealloc++) {
10015         mem_base = xmlMemBlocks();
10016         hash = gen_xmlHashTablePtr(n_hash, 0);
10017         key = gen_const_xmlChar_ptr(n_key, 1);
10018         key2 = gen_const_xmlChar_ptr(n_key2, 2);
10019         key3 = gen_const_xmlChar_ptr(n_key3, 3);
10020         dealloc = gen_xmlHashDeallocator(n_dealloc, 4);
10021 
10022         ret_val = xmlHashRemoveEntry3(hash, key, key2, key3, dealloc);
10023         desret_int(ret_val);
10024         call_tests++;
10025         des_xmlHashTablePtr(n_hash, hash, 0);
10026         des_const_xmlChar_ptr(n_key, key, 1);
10027         des_const_xmlChar_ptr(n_key2, key2, 2);
10028         des_const_xmlChar_ptr(n_key3, key3, 3);
10029         des_xmlHashDeallocator(n_dealloc, dealloc, 4);
10030         xmlResetLastError();
10031         if (mem_base != xmlMemBlocks()) {
10032             printf("Leak of %d blocks found in xmlHashRemoveEntry3",
10033 	           xmlMemBlocks() - mem_base);
10034 	    test_ret++;
10035             printf(" %d", n_hash);
10036             printf(" %d", n_key);
10037             printf(" %d", n_key2);
10038             printf(" %d", n_key3);
10039             printf(" %d", n_dealloc);
10040             printf("\n");
10041         }
10042     }
10043     }
10044     }
10045     }
10046     }
10047     function_tests++;
10048 
10049     return(test_ret);
10050 }
10051 
10052 
10053 static int
test_xmlHashScan(void)10054 test_xmlHashScan(void) {
10055     int test_ret = 0;
10056 
10057 
10058     /* missing type support */
10059     return(test_ret);
10060 }
10061 
10062 
10063 static int
test_xmlHashScan3(void)10064 test_xmlHashScan3(void) {
10065     int test_ret = 0;
10066 
10067 
10068     /* missing type support */
10069     return(test_ret);
10070 }
10071 
10072 
10073 static int
test_xmlHashScanFull(void)10074 test_xmlHashScanFull(void) {
10075     int test_ret = 0;
10076 
10077 
10078     /* missing type support */
10079     return(test_ret);
10080 }
10081 
10082 
10083 static int
test_xmlHashScanFull3(void)10084 test_xmlHashScanFull3(void) {
10085     int test_ret = 0;
10086 
10087 
10088     /* missing type support */
10089     return(test_ret);
10090 }
10091 
10092 
10093 static int
test_xmlHashSize(void)10094 test_xmlHashSize(void) {
10095     int test_ret = 0;
10096 
10097     int mem_base;
10098     int ret_val;
10099     xmlHashTablePtr hash; /* hash table */
10100     int n_hash;
10101 
10102     for (n_hash = 0;n_hash < gen_nb_xmlHashTablePtr;n_hash++) {
10103         mem_base = xmlMemBlocks();
10104         hash = gen_xmlHashTablePtr(n_hash, 0);
10105 
10106         ret_val = xmlHashSize(hash);
10107         desret_int(ret_val);
10108         call_tests++;
10109         des_xmlHashTablePtr(n_hash, hash, 0);
10110         xmlResetLastError();
10111         if (mem_base != xmlMemBlocks()) {
10112             printf("Leak of %d blocks found in xmlHashSize",
10113 	           xmlMemBlocks() - mem_base);
10114 	    test_ret++;
10115             printf(" %d", n_hash);
10116             printf("\n");
10117         }
10118     }
10119     function_tests++;
10120 
10121     return(test_ret);
10122 }
10123 
10124 
10125 static int
test_xmlHashUpdateEntry(void)10126 test_xmlHashUpdateEntry(void) {
10127     int test_ret = 0;
10128 
10129     int mem_base;
10130     int ret_val;
10131     xmlHashTablePtr hash; /* hash table */
10132     int n_hash;
10133     const xmlChar * key; /* string key */
10134     int n_key;
10135     void * payload; /* pointer to the payload */
10136     int n_payload;
10137     xmlHashDeallocator dealloc; /* deallocator function for replaced item or NULL */
10138     int n_dealloc;
10139 
10140     for (n_hash = 0;n_hash < gen_nb_xmlHashTablePtr;n_hash++) {
10141     for (n_key = 0;n_key < gen_nb_const_xmlChar_ptr;n_key++) {
10142     for (n_payload = 0;n_payload < gen_nb_void_ptr;n_payload++) {
10143     for (n_dealloc = 0;n_dealloc < gen_nb_xmlHashDeallocator;n_dealloc++) {
10144         mem_base = xmlMemBlocks();
10145         hash = gen_xmlHashTablePtr(n_hash, 0);
10146         key = gen_const_xmlChar_ptr(n_key, 1);
10147         payload = gen_void_ptr(n_payload, 2);
10148         dealloc = gen_xmlHashDeallocator(n_dealloc, 3);
10149 
10150         ret_val = xmlHashUpdateEntry(hash, key, payload, dealloc);
10151         desret_int(ret_val);
10152         call_tests++;
10153         des_xmlHashTablePtr(n_hash, hash, 0);
10154         des_const_xmlChar_ptr(n_key, key, 1);
10155         des_void_ptr(n_payload, payload, 2);
10156         des_xmlHashDeallocator(n_dealloc, dealloc, 3);
10157         xmlResetLastError();
10158         if (mem_base != xmlMemBlocks()) {
10159             printf("Leak of %d blocks found in xmlHashUpdateEntry",
10160 	           xmlMemBlocks() - mem_base);
10161 	    test_ret++;
10162             printf(" %d", n_hash);
10163             printf(" %d", n_key);
10164             printf(" %d", n_payload);
10165             printf(" %d", n_dealloc);
10166             printf("\n");
10167         }
10168     }
10169     }
10170     }
10171     }
10172     function_tests++;
10173 
10174     return(test_ret);
10175 }
10176 
10177 
10178 static int
test_xmlHashUpdateEntry2(void)10179 test_xmlHashUpdateEntry2(void) {
10180     int test_ret = 0;
10181 
10182     int mem_base;
10183     int ret_val;
10184     xmlHashTablePtr hash; /* hash table */
10185     int n_hash;
10186     const xmlChar * key; /* first string key */
10187     int n_key;
10188     const xmlChar * key2; /* second string key */
10189     int n_key2;
10190     void * payload; /* pointer to the payload */
10191     int n_payload;
10192     xmlHashDeallocator dealloc; /* deallocator function for replaced item or NULL */
10193     int n_dealloc;
10194 
10195     for (n_hash = 0;n_hash < gen_nb_xmlHashTablePtr;n_hash++) {
10196     for (n_key = 0;n_key < gen_nb_const_xmlChar_ptr;n_key++) {
10197     for (n_key2 = 0;n_key2 < gen_nb_const_xmlChar_ptr;n_key2++) {
10198     for (n_payload = 0;n_payload < gen_nb_void_ptr;n_payload++) {
10199     for (n_dealloc = 0;n_dealloc < gen_nb_xmlHashDeallocator;n_dealloc++) {
10200         mem_base = xmlMemBlocks();
10201         hash = gen_xmlHashTablePtr(n_hash, 0);
10202         key = gen_const_xmlChar_ptr(n_key, 1);
10203         key2 = gen_const_xmlChar_ptr(n_key2, 2);
10204         payload = gen_void_ptr(n_payload, 3);
10205         dealloc = gen_xmlHashDeallocator(n_dealloc, 4);
10206 
10207         ret_val = xmlHashUpdateEntry2(hash, key, key2, payload, dealloc);
10208         desret_int(ret_val);
10209         call_tests++;
10210         des_xmlHashTablePtr(n_hash, hash, 0);
10211         des_const_xmlChar_ptr(n_key, key, 1);
10212         des_const_xmlChar_ptr(n_key2, key2, 2);
10213         des_void_ptr(n_payload, payload, 3);
10214         des_xmlHashDeallocator(n_dealloc, dealloc, 4);
10215         xmlResetLastError();
10216         if (mem_base != xmlMemBlocks()) {
10217             printf("Leak of %d blocks found in xmlHashUpdateEntry2",
10218 	           xmlMemBlocks() - mem_base);
10219 	    test_ret++;
10220             printf(" %d", n_hash);
10221             printf(" %d", n_key);
10222             printf(" %d", n_key2);
10223             printf(" %d", n_payload);
10224             printf(" %d", n_dealloc);
10225             printf("\n");
10226         }
10227     }
10228     }
10229     }
10230     }
10231     }
10232     function_tests++;
10233 
10234     return(test_ret);
10235 }
10236 
10237 
10238 static int
test_xmlHashUpdateEntry3(void)10239 test_xmlHashUpdateEntry3(void) {
10240     int test_ret = 0;
10241 
10242     int mem_base;
10243     int ret_val;
10244     xmlHashTablePtr hash; /* hash table */
10245     int n_hash;
10246     const xmlChar * key; /* first string key */
10247     int n_key;
10248     const xmlChar * key2; /* second string key */
10249     int n_key2;
10250     const xmlChar * key3; /* third string key */
10251     int n_key3;
10252     void * payload; /* pointer to the payload */
10253     int n_payload;
10254     xmlHashDeallocator dealloc; /* deallocator function for replaced item or NULL */
10255     int n_dealloc;
10256 
10257     for (n_hash = 0;n_hash < gen_nb_xmlHashTablePtr;n_hash++) {
10258     for (n_key = 0;n_key < gen_nb_const_xmlChar_ptr;n_key++) {
10259     for (n_key2 = 0;n_key2 < gen_nb_const_xmlChar_ptr;n_key2++) {
10260     for (n_key3 = 0;n_key3 < gen_nb_const_xmlChar_ptr;n_key3++) {
10261     for (n_payload = 0;n_payload < gen_nb_void_ptr;n_payload++) {
10262     for (n_dealloc = 0;n_dealloc < gen_nb_xmlHashDeallocator;n_dealloc++) {
10263         mem_base = xmlMemBlocks();
10264         hash = gen_xmlHashTablePtr(n_hash, 0);
10265         key = gen_const_xmlChar_ptr(n_key, 1);
10266         key2 = gen_const_xmlChar_ptr(n_key2, 2);
10267         key3 = gen_const_xmlChar_ptr(n_key3, 3);
10268         payload = gen_void_ptr(n_payload, 4);
10269         dealloc = gen_xmlHashDeallocator(n_dealloc, 5);
10270 
10271         ret_val = xmlHashUpdateEntry3(hash, key, key2, key3, payload, dealloc);
10272         desret_int(ret_val);
10273         call_tests++;
10274         des_xmlHashTablePtr(n_hash, hash, 0);
10275         des_const_xmlChar_ptr(n_key, key, 1);
10276         des_const_xmlChar_ptr(n_key2, key2, 2);
10277         des_const_xmlChar_ptr(n_key3, key3, 3);
10278         des_void_ptr(n_payload, payload, 4);
10279         des_xmlHashDeallocator(n_dealloc, dealloc, 5);
10280         xmlResetLastError();
10281         if (mem_base != xmlMemBlocks()) {
10282             printf("Leak of %d blocks found in xmlHashUpdateEntry3",
10283 	           xmlMemBlocks() - mem_base);
10284 	    test_ret++;
10285             printf(" %d", n_hash);
10286             printf(" %d", n_key);
10287             printf(" %d", n_key2);
10288             printf(" %d", n_key3);
10289             printf(" %d", n_payload);
10290             printf(" %d", n_dealloc);
10291             printf("\n");
10292         }
10293     }
10294     }
10295     }
10296     }
10297     }
10298     }
10299     function_tests++;
10300 
10301     return(test_ret);
10302 }
10303 
10304 static int
test_hash(void)10305 test_hash(void) {
10306     int test_ret = 0;
10307 
10308     if (quiet == 0) printf("Testing hash : 20 of 29 functions ...\n");
10309     test_ret += test_xmlHashAdd();
10310     test_ret += test_xmlHashAdd2();
10311     test_ret += test_xmlHashAdd3();
10312     test_ret += test_xmlHashAddEntry();
10313     test_ret += test_xmlHashAddEntry2();
10314     test_ret += test_xmlHashAddEntry3();
10315     test_ret += test_xmlHashCopy();
10316     test_ret += test_xmlHashCopySafe();
10317     test_ret += test_xmlHashCreate();
10318     test_ret += test_xmlHashCreateDict();
10319     test_ret += test_xmlHashDefaultDeallocator();
10320     test_ret += test_xmlHashLookup();
10321     test_ret += test_xmlHashLookup2();
10322     test_ret += test_xmlHashLookup3();
10323     test_ret += test_xmlHashQLookup();
10324     test_ret += test_xmlHashQLookup2();
10325     test_ret += test_xmlHashQLookup3();
10326     test_ret += test_xmlHashRemoveEntry();
10327     test_ret += test_xmlHashRemoveEntry2();
10328     test_ret += test_xmlHashRemoveEntry3();
10329     test_ret += test_xmlHashScan();
10330     test_ret += test_xmlHashScan3();
10331     test_ret += test_xmlHashScanFull();
10332     test_ret += test_xmlHashScanFull3();
10333     test_ret += test_xmlHashSize();
10334     test_ret += test_xmlHashUpdateEntry();
10335     test_ret += test_xmlHashUpdateEntry2();
10336     test_ret += test_xmlHashUpdateEntry3();
10337 
10338     if (test_ret != 0)
10339 	printf("Module hash: %d errors\n", test_ret);
10340     return(test_ret);
10341 }
10342 
10343 #define gen_nb_xmlLinkPtr 1
10344 #define gen_xmlLinkPtr(no, nr) NULL
10345 #define des_xmlLinkPtr(no, val, nr)
10346 
10347 static int
test_xmlLinkGetData(void)10348 test_xmlLinkGetData(void) {
10349     int test_ret = 0;
10350 
10351     int mem_base;
10352     void * ret_val;
10353     xmlLinkPtr lk; /* a link */
10354     int n_lk;
10355 
10356     for (n_lk = 0;n_lk < gen_nb_xmlLinkPtr;n_lk++) {
10357         mem_base = xmlMemBlocks();
10358         lk = gen_xmlLinkPtr(n_lk, 0);
10359 
10360         ret_val = xmlLinkGetData(lk);
10361         desret_void_ptr(ret_val);
10362         call_tests++;
10363         des_xmlLinkPtr(n_lk, lk, 0);
10364         xmlResetLastError();
10365         if (mem_base != xmlMemBlocks()) {
10366             printf("Leak of %d blocks found in xmlLinkGetData",
10367 	           xmlMemBlocks() - mem_base);
10368 	    test_ret++;
10369             printf(" %d", n_lk);
10370             printf("\n");
10371         }
10372     }
10373     function_tests++;
10374 
10375     return(test_ret);
10376 }
10377 
10378 
10379 static int
test_xmlListAppend(void)10380 test_xmlListAppend(void) {
10381     int test_ret = 0;
10382 
10383     int mem_base;
10384     int ret_val;
10385     xmlListPtr l; /* a list */
10386     int n_l;
10387     void * data; /* the data */
10388     int n_data;
10389 
10390     for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10391     for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10392         mem_base = xmlMemBlocks();
10393         l = gen_xmlListPtr(n_l, 0);
10394         data = gen_userdata(n_data, 1);
10395 
10396         ret_val = xmlListAppend(l, data);
10397         desret_int(ret_val);
10398         call_tests++;
10399         des_xmlListPtr(n_l, l, 0);
10400         des_userdata(n_data, data, 1);
10401         xmlResetLastError();
10402         if (mem_base != xmlMemBlocks()) {
10403             printf("Leak of %d blocks found in xmlListAppend",
10404 	           xmlMemBlocks() - mem_base);
10405 	    test_ret++;
10406             printf(" %d", n_l);
10407             printf(" %d", n_data);
10408             printf("\n");
10409         }
10410     }
10411     }
10412     function_tests++;
10413 
10414     return(test_ret);
10415 }
10416 
10417 
10418 static int
test_xmlListClear(void)10419 test_xmlListClear(void) {
10420     int test_ret = 0;
10421 
10422     int mem_base;
10423     xmlListPtr l; /* a list */
10424     int n_l;
10425 
10426     for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10427         mem_base = xmlMemBlocks();
10428         l = gen_xmlListPtr(n_l, 0);
10429 
10430         xmlListClear(l);
10431         call_tests++;
10432         des_xmlListPtr(n_l, l, 0);
10433         xmlResetLastError();
10434         if (mem_base != xmlMemBlocks()) {
10435             printf("Leak of %d blocks found in xmlListClear",
10436 	           xmlMemBlocks() - mem_base);
10437 	    test_ret++;
10438             printf(" %d", n_l);
10439             printf("\n");
10440         }
10441     }
10442     function_tests++;
10443 
10444     return(test_ret);
10445 }
10446 
10447 
10448 static int
test_xmlListCopy(void)10449 test_xmlListCopy(void) {
10450     int test_ret = 0;
10451 
10452     int mem_base;
10453     int ret_val;
10454     xmlListPtr cur; /* the new list */
10455     int n_cur;
10456     xmlListPtr old; /* the old list */
10457     int n_old;
10458 
10459     for (n_cur = 0;n_cur < gen_nb_xmlListPtr;n_cur++) {
10460     for (n_old = 0;n_old < gen_nb_xmlListPtr;n_old++) {
10461         mem_base = xmlMemBlocks();
10462         cur = gen_xmlListPtr(n_cur, 0);
10463         old = gen_xmlListPtr(n_old, 1);
10464 
10465         ret_val = xmlListCopy(cur, old);
10466         desret_int(ret_val);
10467         call_tests++;
10468         des_xmlListPtr(n_cur, cur, 0);
10469         des_xmlListPtr(n_old, old, 1);
10470         xmlResetLastError();
10471         if (mem_base != xmlMemBlocks()) {
10472             printf("Leak of %d blocks found in xmlListCopy",
10473 	           xmlMemBlocks() - mem_base);
10474 	    test_ret++;
10475             printf(" %d", n_cur);
10476             printf(" %d", n_old);
10477             printf("\n");
10478         }
10479     }
10480     }
10481     function_tests++;
10482 
10483     return(test_ret);
10484 }
10485 
10486 
10487 static int
test_xmlListCreate(void)10488 test_xmlListCreate(void) {
10489     int test_ret = 0;
10490 
10491 
10492     /* missing type support */
10493     return(test_ret);
10494 }
10495 
10496 
10497 static int
test_xmlListDup(void)10498 test_xmlListDup(void) {
10499     int test_ret = 0;
10500 
10501 
10502     /* missing type support */
10503     return(test_ret);
10504 }
10505 
10506 
10507 static int
test_xmlListEmpty(void)10508 test_xmlListEmpty(void) {
10509     int test_ret = 0;
10510 
10511     int mem_base;
10512     int ret_val;
10513     xmlListPtr l; /* a list */
10514     int n_l;
10515 
10516     for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10517         mem_base = xmlMemBlocks();
10518         l = gen_xmlListPtr(n_l, 0);
10519 
10520         ret_val = xmlListEmpty(l);
10521         desret_int(ret_val);
10522         call_tests++;
10523         des_xmlListPtr(n_l, l, 0);
10524         xmlResetLastError();
10525         if (mem_base != xmlMemBlocks()) {
10526             printf("Leak of %d blocks found in xmlListEmpty",
10527 	           xmlMemBlocks() - mem_base);
10528 	    test_ret++;
10529             printf(" %d", n_l);
10530             printf("\n");
10531         }
10532     }
10533     function_tests++;
10534 
10535     return(test_ret);
10536 }
10537 
10538 
10539 static int
test_xmlListEnd(void)10540 test_xmlListEnd(void) {
10541     int test_ret = 0;
10542 
10543 
10544     /* missing type support */
10545     return(test_ret);
10546 }
10547 
10548 
10549 static int
test_xmlListFront(void)10550 test_xmlListFront(void) {
10551     int test_ret = 0;
10552 
10553 
10554     /* missing type support */
10555     return(test_ret);
10556 }
10557 
10558 
10559 static int
test_xmlListInsert(void)10560 test_xmlListInsert(void) {
10561     int test_ret = 0;
10562 
10563     int mem_base;
10564     int ret_val;
10565     xmlListPtr l; /* a list */
10566     int n_l;
10567     void * data; /* the data */
10568     int n_data;
10569 
10570     for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10571     for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10572         mem_base = xmlMemBlocks();
10573         l = gen_xmlListPtr(n_l, 0);
10574         data = gen_userdata(n_data, 1);
10575 
10576         ret_val = xmlListInsert(l, data);
10577         desret_int(ret_val);
10578         call_tests++;
10579         des_xmlListPtr(n_l, l, 0);
10580         des_userdata(n_data, data, 1);
10581         xmlResetLastError();
10582         if (mem_base != xmlMemBlocks()) {
10583             printf("Leak of %d blocks found in xmlListInsert",
10584 	           xmlMemBlocks() - mem_base);
10585 	    test_ret++;
10586             printf(" %d", n_l);
10587             printf(" %d", n_data);
10588             printf("\n");
10589         }
10590     }
10591     }
10592     function_tests++;
10593 
10594     return(test_ret);
10595 }
10596 
10597 
10598 static int
test_xmlListMerge(void)10599 test_xmlListMerge(void) {
10600     int test_ret = 0;
10601 
10602     int mem_base;
10603     xmlListPtr l1; /* the original list */
10604     int n_l1;
10605     xmlListPtr l2; /* the new list */
10606     int n_l2;
10607 
10608     for (n_l1 = 0;n_l1 < gen_nb_xmlListPtr;n_l1++) {
10609     for (n_l2 = 0;n_l2 < gen_nb_xmlListPtr;n_l2++) {
10610         mem_base = xmlMemBlocks();
10611         l1 = gen_xmlListPtr(n_l1, 0);
10612         l2 = gen_xmlListPtr(n_l2, 1);
10613 
10614         xmlListMerge(l1, l2);
10615         call_tests++;
10616         des_xmlListPtr(n_l1, l1, 0);
10617         des_xmlListPtr(n_l2, l2, 1);
10618         xmlResetLastError();
10619         if (mem_base != xmlMemBlocks()) {
10620             printf("Leak of %d blocks found in xmlListMerge",
10621 	           xmlMemBlocks() - mem_base);
10622 	    test_ret++;
10623             printf(" %d", n_l1);
10624             printf(" %d", n_l2);
10625             printf("\n");
10626         }
10627     }
10628     }
10629     function_tests++;
10630 
10631     return(test_ret);
10632 }
10633 
10634 
10635 static int
test_xmlListPopBack(void)10636 test_xmlListPopBack(void) {
10637     int test_ret = 0;
10638 
10639     int mem_base;
10640     xmlListPtr l; /* a list */
10641     int n_l;
10642 
10643     for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10644         mem_base = xmlMemBlocks();
10645         l = gen_xmlListPtr(n_l, 0);
10646 
10647         xmlListPopBack(l);
10648         call_tests++;
10649         des_xmlListPtr(n_l, l, 0);
10650         xmlResetLastError();
10651         if (mem_base != xmlMemBlocks()) {
10652             printf("Leak of %d blocks found in xmlListPopBack",
10653 	           xmlMemBlocks() - mem_base);
10654 	    test_ret++;
10655             printf(" %d", n_l);
10656             printf("\n");
10657         }
10658     }
10659     function_tests++;
10660 
10661     return(test_ret);
10662 }
10663 
10664 
10665 static int
test_xmlListPopFront(void)10666 test_xmlListPopFront(void) {
10667     int test_ret = 0;
10668 
10669     int mem_base;
10670     xmlListPtr l; /* a list */
10671     int n_l;
10672 
10673     for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10674         mem_base = xmlMemBlocks();
10675         l = gen_xmlListPtr(n_l, 0);
10676 
10677         xmlListPopFront(l);
10678         call_tests++;
10679         des_xmlListPtr(n_l, l, 0);
10680         xmlResetLastError();
10681         if (mem_base != xmlMemBlocks()) {
10682             printf("Leak of %d blocks found in xmlListPopFront",
10683 	           xmlMemBlocks() - mem_base);
10684 	    test_ret++;
10685             printf(" %d", n_l);
10686             printf("\n");
10687         }
10688     }
10689     function_tests++;
10690 
10691     return(test_ret);
10692 }
10693 
10694 
10695 static int
test_xmlListPushBack(void)10696 test_xmlListPushBack(void) {
10697     int test_ret = 0;
10698 
10699     int mem_base;
10700     int ret_val;
10701     xmlListPtr l; /* a list */
10702     int n_l;
10703     void * data; /* new data */
10704     int n_data;
10705 
10706     for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10707     for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10708         mem_base = xmlMemBlocks();
10709         l = gen_xmlListPtr(n_l, 0);
10710         data = gen_userdata(n_data, 1);
10711 
10712         ret_val = xmlListPushBack(l, data);
10713         desret_int(ret_val);
10714         call_tests++;
10715         des_xmlListPtr(n_l, l, 0);
10716         des_userdata(n_data, data, 1);
10717         xmlResetLastError();
10718         if (mem_base != xmlMemBlocks()) {
10719             printf("Leak of %d blocks found in xmlListPushBack",
10720 	           xmlMemBlocks() - mem_base);
10721 	    test_ret++;
10722             printf(" %d", n_l);
10723             printf(" %d", n_data);
10724             printf("\n");
10725         }
10726     }
10727     }
10728     function_tests++;
10729 
10730     return(test_ret);
10731 }
10732 
10733 
10734 static int
test_xmlListPushFront(void)10735 test_xmlListPushFront(void) {
10736     int test_ret = 0;
10737 
10738     int mem_base;
10739     int ret_val;
10740     xmlListPtr l; /* a list */
10741     int n_l;
10742     void * data; /* new data */
10743     int n_data;
10744 
10745     for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10746     for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10747         mem_base = xmlMemBlocks();
10748         l = gen_xmlListPtr(n_l, 0);
10749         data = gen_userdata(n_data, 1);
10750 
10751         ret_val = xmlListPushFront(l, data);
10752         desret_int(ret_val);
10753         call_tests++;
10754         des_xmlListPtr(n_l, l, 0);
10755         des_userdata(n_data, data, 1);
10756         xmlResetLastError();
10757         if (mem_base != xmlMemBlocks()) {
10758             printf("Leak of %d blocks found in xmlListPushFront",
10759 	           xmlMemBlocks() - mem_base);
10760 	    test_ret++;
10761             printf(" %d", n_l);
10762             printf(" %d", n_data);
10763             printf("\n");
10764         }
10765     }
10766     }
10767     function_tests++;
10768 
10769     return(test_ret);
10770 }
10771 
10772 
10773 static int
test_xmlListRemoveAll(void)10774 test_xmlListRemoveAll(void) {
10775     int test_ret = 0;
10776 
10777     int mem_base;
10778     int ret_val;
10779     xmlListPtr l; /* a list */
10780     int n_l;
10781     void * data; /* list data */
10782     int n_data;
10783 
10784     for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10785     for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10786         mem_base = xmlMemBlocks();
10787         l = gen_xmlListPtr(n_l, 0);
10788         data = gen_userdata(n_data, 1);
10789 
10790         ret_val = xmlListRemoveAll(l, data);
10791         desret_int(ret_val);
10792         call_tests++;
10793         des_xmlListPtr(n_l, l, 0);
10794         des_userdata(n_data, data, 1);
10795         xmlResetLastError();
10796         if (mem_base != xmlMemBlocks()) {
10797             printf("Leak of %d blocks found in xmlListRemoveAll",
10798 	           xmlMemBlocks() - mem_base);
10799 	    test_ret++;
10800             printf(" %d", n_l);
10801             printf(" %d", n_data);
10802             printf("\n");
10803         }
10804     }
10805     }
10806     function_tests++;
10807 
10808     return(test_ret);
10809 }
10810 
10811 
10812 static int
test_xmlListRemoveFirst(void)10813 test_xmlListRemoveFirst(void) {
10814     int test_ret = 0;
10815 
10816     int mem_base;
10817     int ret_val;
10818     xmlListPtr l; /* a list */
10819     int n_l;
10820     void * data; /* list data */
10821     int n_data;
10822 
10823     for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10824     for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10825         mem_base = xmlMemBlocks();
10826         l = gen_xmlListPtr(n_l, 0);
10827         data = gen_userdata(n_data, 1);
10828 
10829         ret_val = xmlListRemoveFirst(l, data);
10830         desret_int(ret_val);
10831         call_tests++;
10832         des_xmlListPtr(n_l, l, 0);
10833         des_userdata(n_data, data, 1);
10834         xmlResetLastError();
10835         if (mem_base != xmlMemBlocks()) {
10836             printf("Leak of %d blocks found in xmlListRemoveFirst",
10837 	           xmlMemBlocks() - mem_base);
10838 	    test_ret++;
10839             printf(" %d", n_l);
10840             printf(" %d", n_data);
10841             printf("\n");
10842         }
10843     }
10844     }
10845     function_tests++;
10846 
10847     return(test_ret);
10848 }
10849 
10850 
10851 static int
test_xmlListRemoveLast(void)10852 test_xmlListRemoveLast(void) {
10853     int test_ret = 0;
10854 
10855     int mem_base;
10856     int ret_val;
10857     xmlListPtr l; /* a list */
10858     int n_l;
10859     void * data; /* list data */
10860     int n_data;
10861 
10862     for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10863     for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10864         mem_base = xmlMemBlocks();
10865         l = gen_xmlListPtr(n_l, 0);
10866         data = gen_userdata(n_data, 1);
10867 
10868         ret_val = xmlListRemoveLast(l, data);
10869         desret_int(ret_val);
10870         call_tests++;
10871         des_xmlListPtr(n_l, l, 0);
10872         des_userdata(n_data, data, 1);
10873         xmlResetLastError();
10874         if (mem_base != xmlMemBlocks()) {
10875             printf("Leak of %d blocks found in xmlListRemoveLast",
10876 	           xmlMemBlocks() - mem_base);
10877 	    test_ret++;
10878             printf(" %d", n_l);
10879             printf(" %d", n_data);
10880             printf("\n");
10881         }
10882     }
10883     }
10884     function_tests++;
10885 
10886     return(test_ret);
10887 }
10888 
10889 
10890 static int
test_xmlListReverse(void)10891 test_xmlListReverse(void) {
10892     int test_ret = 0;
10893 
10894     int mem_base;
10895     xmlListPtr l; /* a list */
10896     int n_l;
10897 
10898     for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10899         mem_base = xmlMemBlocks();
10900         l = gen_xmlListPtr(n_l, 0);
10901 
10902         xmlListReverse(l);
10903         call_tests++;
10904         des_xmlListPtr(n_l, l, 0);
10905         xmlResetLastError();
10906         if (mem_base != xmlMemBlocks()) {
10907             printf("Leak of %d blocks found in xmlListReverse",
10908 	           xmlMemBlocks() - mem_base);
10909 	    test_ret++;
10910             printf(" %d", n_l);
10911             printf("\n");
10912         }
10913     }
10914     function_tests++;
10915 
10916     return(test_ret);
10917 }
10918 
10919 
10920 static int
test_xmlListReverseSearch(void)10921 test_xmlListReverseSearch(void) {
10922     int test_ret = 0;
10923 
10924     int mem_base;
10925     void * ret_val;
10926     xmlListPtr l; /* a list */
10927     int n_l;
10928     void * data; /* a search value */
10929     int n_data;
10930 
10931     for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10932     for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10933         mem_base = xmlMemBlocks();
10934         l = gen_xmlListPtr(n_l, 0);
10935         data = gen_userdata(n_data, 1);
10936 
10937         ret_val = xmlListReverseSearch(l, data);
10938         desret_void_ptr(ret_val);
10939         call_tests++;
10940         des_xmlListPtr(n_l, l, 0);
10941         des_userdata(n_data, data, 1);
10942         xmlResetLastError();
10943         if (mem_base != xmlMemBlocks()) {
10944             printf("Leak of %d blocks found in xmlListReverseSearch",
10945 	           xmlMemBlocks() - mem_base);
10946 	    test_ret++;
10947             printf(" %d", n_l);
10948             printf(" %d", n_data);
10949             printf("\n");
10950         }
10951     }
10952     }
10953     function_tests++;
10954 
10955     return(test_ret);
10956 }
10957 
10958 
10959 static int
test_xmlListReverseWalk(void)10960 test_xmlListReverseWalk(void) {
10961     int test_ret = 0;
10962 
10963 
10964     /* missing type support */
10965     return(test_ret);
10966 }
10967 
10968 
10969 static int
test_xmlListSearch(void)10970 test_xmlListSearch(void) {
10971     int test_ret = 0;
10972 
10973     int mem_base;
10974     void * ret_val;
10975     xmlListPtr l; /* a list */
10976     int n_l;
10977     void * data; /* a search value */
10978     int n_data;
10979 
10980     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();
10983         l = gen_xmlListPtr(n_l, 0);
10984         data = gen_userdata(n_data, 1);
10985 
10986         ret_val = xmlListSearch(l, data);
10987         desret_void_ptr(ret_val);
10988         call_tests++;
10989         des_xmlListPtr(n_l, l, 0);
10990         des_userdata(n_data, data, 1);
10991         xmlResetLastError();
10992         if (mem_base != xmlMemBlocks()) {
10993             printf("Leak of %d blocks found in xmlListSearch",
10994 	           xmlMemBlocks() - mem_base);
10995 	    test_ret++;
10996             printf(" %d", n_l);
10997             printf(" %d", n_data);
10998             printf("\n");
10999         }
11000     }
11001     }
11002     function_tests++;
11003 
11004     return(test_ret);
11005 }
11006 
11007 
11008 static int
test_xmlListSize(void)11009 test_xmlListSize(void) {
11010     int test_ret = 0;
11011 
11012     int mem_base;
11013     int ret_val;
11014     xmlListPtr l; /* a list */
11015     int n_l;
11016 
11017     for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11018         mem_base = xmlMemBlocks();
11019         l = gen_xmlListPtr(n_l, 0);
11020 
11021         ret_val = xmlListSize(l);
11022         desret_int(ret_val);
11023         call_tests++;
11024         des_xmlListPtr(n_l, l, 0);
11025         xmlResetLastError();
11026         if (mem_base != xmlMemBlocks()) {
11027             printf("Leak of %d blocks found in xmlListSize",
11028 	           xmlMemBlocks() - mem_base);
11029 	    test_ret++;
11030             printf(" %d", n_l);
11031             printf("\n");
11032         }
11033     }
11034     function_tests++;
11035 
11036     return(test_ret);
11037 }
11038 
11039 
11040 static int
test_xmlListSort(void)11041 test_xmlListSort(void) {
11042     int test_ret = 0;
11043 
11044     int mem_base;
11045     xmlListPtr l; /* a list */
11046     int n_l;
11047 
11048     for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11049         mem_base = xmlMemBlocks();
11050         l = gen_xmlListPtr(n_l, 0);
11051 
11052         xmlListSort(l);
11053         call_tests++;
11054         des_xmlListPtr(n_l, l, 0);
11055         xmlResetLastError();
11056         if (mem_base != xmlMemBlocks()) {
11057             printf("Leak of %d blocks found in xmlListSort",
11058 	           xmlMemBlocks() - mem_base);
11059 	    test_ret++;
11060             printf(" %d", n_l);
11061             printf("\n");
11062         }
11063     }
11064     function_tests++;
11065 
11066     return(test_ret);
11067 }
11068 
11069 
11070 static int
test_xmlListWalk(void)11071 test_xmlListWalk(void) {
11072     int test_ret = 0;
11073 
11074 
11075     /* missing type support */
11076     return(test_ret);
11077 }
11078 
11079 static int
test_list(void)11080 test_list(void) {
11081     int test_ret = 0;
11082 
11083     if (quiet == 0) printf("Testing list : 19 of 26 functions ...\n");
11084     test_ret += test_xmlLinkGetData();
11085     test_ret += test_xmlListAppend();
11086     test_ret += test_xmlListClear();
11087     test_ret += test_xmlListCopy();
11088     test_ret += test_xmlListCreate();
11089     test_ret += test_xmlListDup();
11090     test_ret += test_xmlListEmpty();
11091     test_ret += test_xmlListEnd();
11092     test_ret += test_xmlListFront();
11093     test_ret += test_xmlListInsert();
11094     test_ret += test_xmlListMerge();
11095     test_ret += test_xmlListPopBack();
11096     test_ret += test_xmlListPopFront();
11097     test_ret += test_xmlListPushBack();
11098     test_ret += test_xmlListPushFront();
11099     test_ret += test_xmlListRemoveAll();
11100     test_ret += test_xmlListRemoveFirst();
11101     test_ret += test_xmlListRemoveLast();
11102     test_ret += test_xmlListReverse();
11103     test_ret += test_xmlListReverseSearch();
11104     test_ret += test_xmlListReverseWalk();
11105     test_ret += test_xmlListSearch();
11106     test_ret += test_xmlListSize();
11107     test_ret += test_xmlListSort();
11108     test_ret += test_xmlListWalk();
11109 
11110     if (test_ret != 0)
11111 	printf("Module list: %d errors\n", test_ret);
11112     return(test_ret);
11113 }
11114 
11115 static int
test_xmlNanoHTTPAuthHeader(void)11116 test_xmlNanoHTTPAuthHeader(void) {
11117     int test_ret = 0;
11118 
11119 #if defined(LIBXML_HTTP_ENABLED)
11120     int mem_base;
11121     const char * ret_val;
11122     void * ctx; /* the HTTP context */
11123     int n_ctx;
11124 
11125     for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
11126         mem_base = xmlMemBlocks();
11127         ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
11128 
11129         ret_val = xmlNanoHTTPAuthHeader(ctx);
11130         desret_const_char_ptr(ret_val);
11131         call_tests++;
11132         des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
11133         xmlResetLastError();
11134         if (mem_base != xmlMemBlocks()) {
11135             printf("Leak of %d blocks found in xmlNanoHTTPAuthHeader",
11136 	           xmlMemBlocks() - mem_base);
11137 	    test_ret++;
11138             printf(" %d", n_ctx);
11139             printf("\n");
11140         }
11141     }
11142     function_tests++;
11143 #endif
11144 
11145     return(test_ret);
11146 }
11147 
11148 
11149 static int
test_xmlNanoHTTPCleanup(void)11150 test_xmlNanoHTTPCleanup(void) {
11151     int test_ret = 0;
11152 
11153 #if defined(LIBXML_HTTP_ENABLED)
11154     int mem_base;
11155 
11156         mem_base = xmlMemBlocks();
11157 
11158         xmlNanoHTTPCleanup();
11159         call_tests++;
11160         xmlResetLastError();
11161         if (mem_base != xmlMemBlocks()) {
11162             printf("Leak of %d blocks found in xmlNanoHTTPCleanup",
11163 	           xmlMemBlocks() - mem_base);
11164 	    test_ret++;
11165             printf("\n");
11166         }
11167     function_tests++;
11168 #endif
11169 
11170     return(test_ret);
11171 }
11172 
11173 
11174 static int
test_xmlNanoHTTPContentLength(void)11175 test_xmlNanoHTTPContentLength(void) {
11176     int test_ret = 0;
11177 
11178 #if defined(LIBXML_HTTP_ENABLED)
11179     int mem_base;
11180     int ret_val;
11181     void * ctx; /* the HTTP context */
11182     int n_ctx;
11183 
11184     for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
11185         mem_base = xmlMemBlocks();
11186         ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
11187 
11188         ret_val = xmlNanoHTTPContentLength(ctx);
11189         desret_int(ret_val);
11190         call_tests++;
11191         des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
11192         xmlResetLastError();
11193         if (mem_base != xmlMemBlocks()) {
11194             printf("Leak of %d blocks found in xmlNanoHTTPContentLength",
11195 	           xmlMemBlocks() - mem_base);
11196 	    test_ret++;
11197             printf(" %d", n_ctx);
11198             printf("\n");
11199         }
11200     }
11201     function_tests++;
11202 #endif
11203 
11204     return(test_ret);
11205 }
11206 
11207 
11208 static int
test_xmlNanoHTTPEncoding(void)11209 test_xmlNanoHTTPEncoding(void) {
11210     int test_ret = 0;
11211 
11212 #if defined(LIBXML_HTTP_ENABLED)
11213     int mem_base;
11214     const char * ret_val;
11215     void * ctx; /* the HTTP context */
11216     int n_ctx;
11217 
11218     for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
11219         mem_base = xmlMemBlocks();
11220         ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
11221 
11222         ret_val = xmlNanoHTTPEncoding(ctx);
11223         desret_const_char_ptr(ret_val);
11224         call_tests++;
11225         des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
11226         xmlResetLastError();
11227         if (mem_base != xmlMemBlocks()) {
11228             printf("Leak of %d blocks found in xmlNanoHTTPEncoding",
11229 	           xmlMemBlocks() - mem_base);
11230 	    test_ret++;
11231             printf(" %d", n_ctx);
11232             printf("\n");
11233         }
11234     }
11235     function_tests++;
11236 #endif
11237 
11238     return(test_ret);
11239 }
11240 
11241 
11242 #define gen_nb_char_ptr_ptr 1
11243 #define gen_char_ptr_ptr(no, nr) NULL
11244 #define des_char_ptr_ptr(no, val, nr)
11245 
11246 static int
test_xmlNanoHTTPFetch(void)11247 test_xmlNanoHTTPFetch(void) {
11248     int test_ret = 0;
11249 
11250 #if defined(LIBXML_HTTP_ENABLED)
11251     int mem_base;
11252     int ret_val;
11253     const char * URL; /* The URL to load */
11254     int n_URL;
11255     const char * filename; /* the filename where the content should be saved */
11256     int n_filename;
11257     char ** contentType; /* if available the Content-Type information will be returned at that location */
11258     int n_contentType;
11259 
11260     for (n_URL = 0;n_URL < gen_nb_fileoutput;n_URL++) {
11261     for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
11262     for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
11263         mem_base = xmlMemBlocks();
11264         URL = gen_fileoutput(n_URL, 0);
11265         filename = gen_fileoutput(n_filename, 1);
11266         contentType = gen_char_ptr_ptr(n_contentType, 2);
11267 
11268         ret_val = xmlNanoHTTPFetch(URL, filename, contentType);
11269         desret_int(ret_val);
11270         call_tests++;
11271         des_fileoutput(n_URL, URL, 0);
11272         des_fileoutput(n_filename, filename, 1);
11273         des_char_ptr_ptr(n_contentType, contentType, 2);
11274         xmlResetLastError();
11275         if (mem_base != xmlMemBlocks()) {
11276             printf("Leak of %d blocks found in xmlNanoHTTPFetch",
11277 	           xmlMemBlocks() - mem_base);
11278 	    test_ret++;
11279             printf(" %d", n_URL);
11280             printf(" %d", n_filename);
11281             printf(" %d", n_contentType);
11282             printf("\n");
11283         }
11284     }
11285     }
11286     }
11287     function_tests++;
11288 #endif
11289 
11290     return(test_ret);
11291 }
11292 
11293 
11294 static int
test_xmlNanoHTTPInit(void)11295 test_xmlNanoHTTPInit(void) {
11296     int test_ret = 0;
11297 
11298 #if defined(LIBXML_HTTP_ENABLED)
11299     int mem_base;
11300 
11301         mem_base = xmlMemBlocks();
11302 
11303         xmlNanoHTTPInit();
11304         call_tests++;
11305         xmlResetLastError();
11306         if (mem_base != xmlMemBlocks()) {
11307             printf("Leak of %d blocks found in xmlNanoHTTPInit",
11308 	           xmlMemBlocks() - mem_base);
11309 	    test_ret++;
11310             printf("\n");
11311         }
11312     function_tests++;
11313 #endif
11314 
11315     return(test_ret);
11316 }
11317 
11318 
11319 static int
test_xmlNanoHTTPMimeType(void)11320 test_xmlNanoHTTPMimeType(void) {
11321     int test_ret = 0;
11322 
11323 #if defined(LIBXML_HTTP_ENABLED)
11324     int mem_base;
11325     const char * ret_val;
11326     void * ctx; /* the HTTP context */
11327     int n_ctx;
11328 
11329     for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
11330         mem_base = xmlMemBlocks();
11331         ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
11332 
11333         ret_val = xmlNanoHTTPMimeType(ctx);
11334         desret_const_char_ptr(ret_val);
11335         call_tests++;
11336         des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
11337         xmlResetLastError();
11338         if (mem_base != xmlMemBlocks()) {
11339             printf("Leak of %d blocks found in xmlNanoHTTPMimeType",
11340 	           xmlMemBlocks() - mem_base);
11341 	    test_ret++;
11342             printf(" %d", n_ctx);
11343             printf("\n");
11344         }
11345     }
11346     function_tests++;
11347 #endif
11348 
11349     return(test_ret);
11350 }
11351 
11352 
11353 static int
test_xmlNanoHTTPOpen(void)11354 test_xmlNanoHTTPOpen(void) {
11355     int test_ret = 0;
11356 
11357 #if defined(LIBXML_HTTP_ENABLED)
11358     int mem_base;
11359     void * ret_val;
11360     const char * URL; /* The URL to load */
11361     int n_URL;
11362     char ** contentType; /* if available the Content-Type information will be returned at that location */
11363     int n_contentType;
11364 
11365     for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
11366     for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
11367         mem_base = xmlMemBlocks();
11368         URL = gen_filepath(n_URL, 0);
11369         contentType = gen_char_ptr_ptr(n_contentType, 1);
11370 
11371         ret_val = xmlNanoHTTPOpen(URL, contentType);
11372         desret_xmlNanoHTTPCtxtPtr(ret_val);
11373         call_tests++;
11374         des_filepath(n_URL, URL, 0);
11375         des_char_ptr_ptr(n_contentType, contentType, 1);
11376         xmlResetLastError();
11377         if (mem_base != xmlMemBlocks()) {
11378             printf("Leak of %d blocks found in xmlNanoHTTPOpen",
11379 	           xmlMemBlocks() - mem_base);
11380 	    test_ret++;
11381             printf(" %d", n_URL);
11382             printf(" %d", n_contentType);
11383             printf("\n");
11384         }
11385     }
11386     }
11387     function_tests++;
11388 #endif
11389 
11390     return(test_ret);
11391 }
11392 
11393 
11394 static int
test_xmlNanoHTTPOpenRedir(void)11395 test_xmlNanoHTTPOpenRedir(void) {
11396     int test_ret = 0;
11397 
11398 #if defined(LIBXML_HTTP_ENABLED)
11399     int mem_base;
11400     void * ret_val;
11401     const char * URL; /* The URL to load */
11402     int n_URL;
11403     char ** contentType; /* if available the Content-Type information will be returned at that location */
11404     int n_contentType;
11405     char ** redir; /* if available the redirected URL will be returned */
11406     int n_redir;
11407 
11408     for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
11409     for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
11410     for (n_redir = 0;n_redir < gen_nb_char_ptr_ptr;n_redir++) {
11411         mem_base = xmlMemBlocks();
11412         URL = gen_filepath(n_URL, 0);
11413         contentType = gen_char_ptr_ptr(n_contentType, 1);
11414         redir = gen_char_ptr_ptr(n_redir, 2);
11415 
11416         ret_val = xmlNanoHTTPOpenRedir(URL, contentType, redir);
11417         desret_xmlNanoHTTPCtxtPtr(ret_val);
11418         call_tests++;
11419         des_filepath(n_URL, URL, 0);
11420         des_char_ptr_ptr(n_contentType, contentType, 1);
11421         des_char_ptr_ptr(n_redir, redir, 2);
11422         xmlResetLastError();
11423         if (mem_base != xmlMemBlocks()) {
11424             printf("Leak of %d blocks found in xmlNanoHTTPOpenRedir",
11425 	           xmlMemBlocks() - mem_base);
11426 	    test_ret++;
11427             printf(" %d", n_URL);
11428             printf(" %d", n_contentType);
11429             printf(" %d", n_redir);
11430             printf("\n");
11431         }
11432     }
11433     }
11434     }
11435     function_tests++;
11436 #endif
11437 
11438     return(test_ret);
11439 }
11440 
11441 
11442 static int
test_xmlNanoHTTPRead(void)11443 test_xmlNanoHTTPRead(void) {
11444     int test_ret = 0;
11445 
11446 #if defined(LIBXML_HTTP_ENABLED)
11447     int mem_base;
11448     int ret_val;
11449     void * ctx; /* the HTTP context */
11450     int n_ctx;
11451     void * dest; /* a buffer */
11452     int n_dest;
11453     int len; /* the buffer length */
11454     int n_len;
11455 
11456     for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
11457     for (n_dest = 0;n_dest < gen_nb_void_ptr;n_dest++) {
11458     for (n_len = 0;n_len < gen_nb_int;n_len++) {
11459         mem_base = xmlMemBlocks();
11460         ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
11461         dest = gen_void_ptr(n_dest, 1);
11462         len = gen_int(n_len, 2);
11463 
11464         ret_val = xmlNanoHTTPRead(ctx, dest, len);
11465         desret_int(ret_val);
11466         call_tests++;
11467         des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
11468         des_void_ptr(n_dest, dest, 1);
11469         des_int(n_len, len, 2);
11470         xmlResetLastError();
11471         if (mem_base != xmlMemBlocks()) {
11472             printf("Leak of %d blocks found in xmlNanoHTTPRead",
11473 	           xmlMemBlocks() - mem_base);
11474 	    test_ret++;
11475             printf(" %d", n_ctx);
11476             printf(" %d", n_dest);
11477             printf(" %d", n_len);
11478             printf("\n");
11479         }
11480     }
11481     }
11482     }
11483     function_tests++;
11484 #endif
11485 
11486     return(test_ret);
11487 }
11488 
11489 
11490 static int
test_xmlNanoHTTPRedir(void)11491 test_xmlNanoHTTPRedir(void) {
11492     int test_ret = 0;
11493 
11494 
11495     /* missing type support */
11496     return(test_ret);
11497 }
11498 
11499 
11500 static int
test_xmlNanoHTTPReturnCode(void)11501 test_xmlNanoHTTPReturnCode(void) {
11502     int test_ret = 0;
11503 
11504 #if defined(LIBXML_HTTP_ENABLED)
11505     int mem_base;
11506     int ret_val;
11507     void * ctx; /* the HTTP context */
11508     int n_ctx;
11509 
11510     for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
11511         mem_base = xmlMemBlocks();
11512         ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
11513 
11514         ret_val = xmlNanoHTTPReturnCode(ctx);
11515         desret_int(ret_val);
11516         call_tests++;
11517         des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
11518         xmlResetLastError();
11519         if (mem_base != xmlMemBlocks()) {
11520             printf("Leak of %d blocks found in xmlNanoHTTPReturnCode",
11521 	           xmlMemBlocks() - mem_base);
11522 	    test_ret++;
11523             printf(" %d", n_ctx);
11524             printf("\n");
11525         }
11526     }
11527     function_tests++;
11528 #endif
11529 
11530     return(test_ret);
11531 }
11532 
11533 
11534 static int
test_xmlNanoHTTPSave(void)11535 test_xmlNanoHTTPSave(void) {
11536     int test_ret = 0;
11537 
11538 #if defined(LIBXML_HTTP_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
11539     int mem_base;
11540     int ret_val;
11541     void * ctxt; /* the HTTP context */
11542     int n_ctxt;
11543     const char * filename; /* the filename where the content should be saved */
11544     int n_filename;
11545 
11546     for (n_ctxt = 0;n_ctxt < gen_nb_void_ptr;n_ctxt++) {
11547     for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
11548         mem_base = xmlMemBlocks();
11549         ctxt = gen_void_ptr(n_ctxt, 0);
11550         filename = gen_fileoutput(n_filename, 1);
11551 
11552         ret_val = xmlNanoHTTPSave(ctxt, filename);
11553         desret_int(ret_val);
11554         call_tests++;
11555         des_void_ptr(n_ctxt, ctxt, 0);
11556         des_fileoutput(n_filename, filename, 1);
11557         xmlResetLastError();
11558         if (mem_base != xmlMemBlocks()) {
11559             printf("Leak of %d blocks found in xmlNanoHTTPSave",
11560 	           xmlMemBlocks() - mem_base);
11561 	    test_ret++;
11562             printf(" %d", n_ctxt);
11563             printf(" %d", n_filename);
11564             printf("\n");
11565         }
11566     }
11567     }
11568     function_tests++;
11569 #endif
11570 
11571     return(test_ret);
11572 }
11573 
11574 
11575 static int
test_xmlNanoHTTPScanProxy(void)11576 test_xmlNanoHTTPScanProxy(void) {
11577     int test_ret = 0;
11578 
11579 #if defined(LIBXML_HTTP_ENABLED)
11580     const char * URL; /* The proxy URL used to initialize the proxy context */
11581     int n_URL;
11582 
11583     for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
11584         URL = gen_filepath(n_URL, 0);
11585 
11586         xmlNanoHTTPScanProxy(URL);
11587         call_tests++;
11588         des_filepath(n_URL, URL, 0);
11589         xmlResetLastError();
11590     }
11591     function_tests++;
11592 #endif
11593 
11594     return(test_ret);
11595 }
11596 
11597 static int
test_nanohttp(void)11598 test_nanohttp(void) {
11599     int test_ret = 0;
11600 
11601     if (quiet == 0) printf("Testing nanohttp : 13 of 17 functions ...\n");
11602     test_ret += test_xmlNanoHTTPAuthHeader();
11603     test_ret += test_xmlNanoHTTPCleanup();
11604     test_ret += test_xmlNanoHTTPContentLength();
11605     test_ret += test_xmlNanoHTTPEncoding();
11606     test_ret += test_xmlNanoHTTPFetch();
11607     test_ret += test_xmlNanoHTTPInit();
11608     test_ret += test_xmlNanoHTTPMimeType();
11609     test_ret += test_xmlNanoHTTPOpen();
11610     test_ret += test_xmlNanoHTTPOpenRedir();
11611     test_ret += test_xmlNanoHTTPRead();
11612     test_ret += test_xmlNanoHTTPRedir();
11613     test_ret += test_xmlNanoHTTPReturnCode();
11614     test_ret += test_xmlNanoHTTPSave();
11615     test_ret += test_xmlNanoHTTPScanProxy();
11616 
11617     if (test_ret != 0)
11618 	printf("Module nanohttp: %d errors\n", test_ret);
11619     return(test_ret);
11620 }
11621 
11622 static int
test_xmlByteConsumed(void)11623 test_xmlByteConsumed(void) {
11624     int test_ret = 0;
11625 
11626     int mem_base;
11627     long ret_val;
11628     xmlParserCtxtPtr ctxt; /* an XML parser context */
11629     int n_ctxt;
11630 
11631     for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
11632         mem_base = xmlMemBlocks();
11633         ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
11634 
11635         ret_val = xmlByteConsumed(ctxt);
11636         desret_long(ret_val);
11637         call_tests++;
11638         des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
11639         xmlResetLastError();
11640         if (mem_base != xmlMemBlocks()) {
11641             printf("Leak of %d blocks found in xmlByteConsumed",
11642 	           xmlMemBlocks() - mem_base);
11643 	    test_ret++;
11644             printf(" %d", n_ctxt);
11645             printf("\n");
11646         }
11647     }
11648     function_tests++;
11649 
11650     return(test_ret);
11651 }
11652 
11653 
11654 static int
test_xmlCleanupGlobals(void)11655 test_xmlCleanupGlobals(void) {
11656     int test_ret = 0;
11657 
11658     int mem_base;
11659 
11660         mem_base = xmlMemBlocks();
11661 
11662         xmlCleanupGlobals();
11663         call_tests++;
11664         xmlResetLastError();
11665         if (mem_base != xmlMemBlocks()) {
11666             printf("Leak of %d blocks found in xmlCleanupGlobals",
11667 	           xmlMemBlocks() - mem_base);
11668 	    test_ret++;
11669             printf("\n");
11670         }
11671     function_tests++;
11672 
11673     return(test_ret);
11674 }
11675 
11676 
11677 static int
test_xmlClearNodeInfoSeq(void)11678 test_xmlClearNodeInfoSeq(void) {
11679     int test_ret = 0;
11680 
11681     int mem_base;
11682     xmlParserNodeInfoSeqPtr seq; /* a node info sequence pointer */
11683     int n_seq;
11684 
11685     for (n_seq = 0;n_seq < gen_nb_xmlParserNodeInfoSeqPtr;n_seq++) {
11686         mem_base = xmlMemBlocks();
11687         seq = gen_xmlParserNodeInfoSeqPtr(n_seq, 0);
11688 
11689         xmlClearNodeInfoSeq(seq);
11690         call_tests++;
11691         des_xmlParserNodeInfoSeqPtr(n_seq, seq, 0);
11692         xmlResetLastError();
11693         if (mem_base != xmlMemBlocks()) {
11694             printf("Leak of %d blocks found in xmlClearNodeInfoSeq",
11695 	           xmlMemBlocks() - mem_base);
11696 	    test_ret++;
11697             printf(" %d", n_seq);
11698             printf("\n");
11699         }
11700     }
11701     function_tests++;
11702 
11703     return(test_ret);
11704 }
11705 
11706 
11707 static int
test_xmlClearParserCtxt(void)11708 test_xmlClearParserCtxt(void) {
11709     int test_ret = 0;
11710 
11711     int mem_base;
11712     xmlParserCtxtPtr ctxt; /* an XML parser context */
11713     int n_ctxt;
11714 
11715     for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
11716         mem_base = xmlMemBlocks();
11717         ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
11718 
11719         xmlClearParserCtxt(ctxt);
11720         call_tests++;
11721         des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
11722         xmlResetLastError();
11723         if (mem_base != xmlMemBlocks()) {
11724             printf("Leak of %d blocks found in xmlClearParserCtxt",
11725 	           xmlMemBlocks() - mem_base);
11726 	    test_ret++;
11727             printf(" %d", n_ctxt);
11728             printf("\n");
11729         }
11730     }
11731     function_tests++;
11732 
11733     return(test_ret);
11734 }
11735 
11736 
11737 static int
test_xmlCreateDocParserCtxt(void)11738 test_xmlCreateDocParserCtxt(void) {
11739     int test_ret = 0;
11740 
11741     int mem_base;
11742     xmlParserCtxtPtr ret_val;
11743     const xmlChar * str; /* a pointer to an array of xmlChar */
11744     int n_str;
11745 
11746     for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
11747         mem_base = xmlMemBlocks();
11748         str = gen_const_xmlChar_ptr(n_str, 0);
11749 
11750         ret_val = xmlCreateDocParserCtxt(str);
11751         desret_xmlParserCtxtPtr(ret_val);
11752         call_tests++;
11753         des_const_xmlChar_ptr(n_str, str, 0);
11754         xmlResetLastError();
11755         if (mem_base != xmlMemBlocks()) {
11756             printf("Leak of %d blocks found in xmlCreateDocParserCtxt",
11757 	           xmlMemBlocks() - mem_base);
11758 	    test_ret++;
11759             printf(" %d", n_str);
11760             printf("\n");
11761         }
11762     }
11763     function_tests++;
11764 
11765     return(test_ret);
11766 }
11767 
11768 
11769 static int
test_xmlCreatePushParserCtxt(void)11770 test_xmlCreatePushParserCtxt(void) {
11771     int test_ret = 0;
11772 
11773 #if defined(LIBXML_PUSH_ENABLED)
11774     int mem_base;
11775     xmlParserCtxtPtr ret_val;
11776     xmlSAXHandlerPtr sax; /* a SAX handler (optional) */
11777     int n_sax;
11778     void * user_data; /* user data for SAX callbacks (optional) */
11779     int n_user_data;
11780     const char * chunk; /* initial chunk (optional, deprecated) */
11781     int n_chunk;
11782     int size; /* size of initial chunk in bytes */
11783     int n_size;
11784     const char * filename; /* file name or URI (optional) */
11785     int n_filename;
11786 
11787     for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
11788     for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
11789     for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
11790     for (n_size = 0;n_size < gen_nb_int;n_size++) {
11791     for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
11792         mem_base = xmlMemBlocks();
11793         sax = gen_xmlSAXHandlerPtr(n_sax, 0);
11794         user_data = gen_userdata(n_user_data, 1);
11795         chunk = gen_const_char_ptr(n_chunk, 2);
11796         size = gen_int(n_size, 3);
11797         filename = gen_fileoutput(n_filename, 4);
11798         if ((chunk != NULL) &&
11799             (size > xmlStrlen(BAD_CAST chunk)))
11800             size = 0;
11801 
11802         ret_val = xmlCreatePushParserCtxt(sax, user_data, chunk, size, filename);
11803         desret_xmlParserCtxtPtr(ret_val);
11804         call_tests++;
11805         des_xmlSAXHandlerPtr(n_sax, sax, 0);
11806         des_userdata(n_user_data, user_data, 1);
11807         des_const_char_ptr(n_chunk, chunk, 2);
11808         des_int(n_size, size, 3);
11809         des_fileoutput(n_filename, filename, 4);
11810         xmlResetLastError();
11811         if (mem_base != xmlMemBlocks()) {
11812             printf("Leak of %d blocks found in xmlCreatePushParserCtxt",
11813 	           xmlMemBlocks() - mem_base);
11814 	    test_ret++;
11815             printf(" %d", n_sax);
11816             printf(" %d", n_user_data);
11817             printf(" %d", n_chunk);
11818             printf(" %d", n_size);
11819             printf(" %d", n_filename);
11820             printf("\n");
11821         }
11822     }
11823     }
11824     }
11825     }
11826     }
11827     function_tests++;
11828 #endif
11829 
11830     return(test_ret);
11831 }
11832 
11833 
11834 static int
test_xmlCtxtGetCatalogs(void)11835 test_xmlCtxtGetCatalogs(void) {
11836     int test_ret = 0;
11837 
11838     int mem_base;
11839     void * ret_val;
11840     xmlParserCtxtPtr ctxt; /*  */
11841     int n_ctxt;
11842 
11843     for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
11844         mem_base = xmlMemBlocks();
11845         ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
11846 
11847         ret_val = xmlCtxtGetCatalogs(ctxt);
11848         desret_void_ptr(ret_val);
11849         call_tests++;
11850         des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
11851         xmlResetLastError();
11852         if (mem_base != xmlMemBlocks()) {
11853             printf("Leak of %d blocks found in xmlCtxtGetCatalogs",
11854 	           xmlMemBlocks() - mem_base);
11855 	    test_ret++;
11856             printf(" %d", n_ctxt);
11857             printf("\n");
11858         }
11859     }
11860     function_tests++;
11861 
11862     return(test_ret);
11863 }
11864 
11865 
11866 static int
test_xmlCtxtGetDeclaredEncoding(void)11867 test_xmlCtxtGetDeclaredEncoding(void) {
11868     int test_ret = 0;
11869 
11870     int mem_base;
11871     const xmlChar * ret_val;
11872     xmlParserCtxtPtr ctxt; /*  */
11873     int n_ctxt;
11874 
11875     for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
11876         mem_base = xmlMemBlocks();
11877         ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
11878 
11879         ret_val = xmlCtxtGetDeclaredEncoding(ctxt);
11880         desret_const_xmlChar_ptr(ret_val);
11881         call_tests++;
11882         des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
11883         xmlResetLastError();
11884         if (mem_base != xmlMemBlocks()) {
11885             printf("Leak of %d blocks found in xmlCtxtGetDeclaredEncoding",
11886 	           xmlMemBlocks() - mem_base);
11887 	    test_ret++;
11888             printf(" %d", n_ctxt);
11889             printf("\n");
11890         }
11891     }
11892     function_tests++;
11893 
11894     return(test_ret);
11895 }
11896 
11897 
11898 static int
test_xmlCtxtGetOptions(void)11899 test_xmlCtxtGetOptions(void) {
11900     int test_ret = 0;
11901 
11902     int mem_base;
11903     int ret_val;
11904     xmlParserCtxtPtr ctxt; /* an XML parser context */
11905     int n_ctxt;
11906 
11907     for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
11908         mem_base = xmlMemBlocks();
11909         ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
11910 
11911         ret_val = xmlCtxtGetOptions(ctxt);
11912         desret_int(ret_val);
11913         call_tests++;
11914         des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
11915         xmlResetLastError();
11916         if (mem_base != xmlMemBlocks()) {
11917             printf("Leak of %d blocks found in xmlCtxtGetOptions",
11918 	           xmlMemBlocks() - mem_base);
11919 	    test_ret++;
11920             printf(" %d", n_ctxt);
11921             printf("\n");
11922         }
11923     }
11924     function_tests++;
11925 
11926     return(test_ret);
11927 }
11928 
11929 
11930 static int
test_xmlCtxtGetPrivate(void)11931 test_xmlCtxtGetPrivate(void) {
11932     int test_ret = 0;
11933 
11934     int mem_base;
11935     void * ret_val;
11936     xmlParserCtxtPtr ctxt; /*  */
11937     int n_ctxt;
11938 
11939     for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
11940         mem_base = xmlMemBlocks();
11941         ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
11942 
11943         ret_val = xmlCtxtGetPrivate(ctxt);
11944         desret_void_ptr(ret_val);
11945         call_tests++;
11946         des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
11947         xmlResetLastError();
11948         if (mem_base != xmlMemBlocks()) {
11949             printf("Leak of %d blocks found in xmlCtxtGetPrivate",
11950 	           xmlMemBlocks() - mem_base);
11951 	    test_ret++;
11952             printf(" %d", n_ctxt);
11953             printf("\n");
11954         }
11955     }
11956     function_tests++;
11957 
11958     return(test_ret);
11959 }
11960 
11961 
11962 static int
test_xmlCtxtGetStandalone(void)11963 test_xmlCtxtGetStandalone(void) {
11964     int test_ret = 0;
11965 
11966     int mem_base;
11967     int ret_val;
11968     xmlParserCtxtPtr ctxt; /*  */
11969     int n_ctxt;
11970 
11971     for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
11972         mem_base = xmlMemBlocks();
11973         ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
11974 
11975         ret_val = xmlCtxtGetStandalone(ctxt);
11976         desret_int(ret_val);
11977         call_tests++;
11978         des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
11979         xmlResetLastError();
11980         if (mem_base != xmlMemBlocks()) {
11981             printf("Leak of %d blocks found in xmlCtxtGetStandalone",
11982 	           xmlMemBlocks() - mem_base);
11983 	    test_ret++;
11984             printf(" %d", n_ctxt);
11985             printf("\n");
11986         }
11987     }
11988     function_tests++;
11989 
11990     return(test_ret);
11991 }
11992 
11993 
11994 #define gen_nb_xmlParserCtxt_ptr 1
11995 #define gen_xmlParserCtxt_ptr(no, nr) NULL
11996 #define des_xmlParserCtxt_ptr(no, val, nr)
11997 
11998 static int
test_xmlCtxtGetStatus(void)11999 test_xmlCtxtGetStatus(void) {
12000     int test_ret = 0;
12001 
12002     int mem_base;
12003     int ret_val;
12004     xmlParserCtxt * ctxt; /* an XML parser context */
12005     int n_ctxt;
12006 
12007     for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxt_ptr;n_ctxt++) {
12008         mem_base = xmlMemBlocks();
12009         ctxt = gen_xmlParserCtxt_ptr(n_ctxt, 0);
12010 
12011         ret_val = xmlCtxtGetStatus(ctxt);
12012         desret_int(ret_val);
12013         call_tests++;
12014         des_xmlParserCtxt_ptr(n_ctxt, ctxt, 0);
12015         xmlResetLastError();
12016         if (mem_base != xmlMemBlocks()) {
12017             printf("Leak of %d blocks found in xmlCtxtGetStatus",
12018 	           xmlMemBlocks() - mem_base);
12019 	    test_ret++;
12020             printf(" %d", n_ctxt);
12021             printf("\n");
12022         }
12023     }
12024     function_tests++;
12025 
12026     return(test_ret);
12027 }
12028 
12029 
12030 static int
test_xmlCtxtGetVersion(void)12031 test_xmlCtxtGetVersion(void) {
12032     int test_ret = 0;
12033 
12034     int mem_base;
12035     const xmlChar * ret_val;
12036     xmlParserCtxtPtr ctxt; /*  */
12037     int n_ctxt;
12038 
12039     for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12040         mem_base = xmlMemBlocks();
12041         ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12042 
12043         ret_val = xmlCtxtGetVersion(ctxt);
12044         desret_const_xmlChar_ptr(ret_val);
12045         call_tests++;
12046         des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
12047         xmlResetLastError();
12048         if (mem_base != xmlMemBlocks()) {
12049             printf("Leak of %d blocks found in xmlCtxtGetVersion",
12050 	           xmlMemBlocks() - mem_base);
12051 	    test_ret++;
12052             printf(" %d", n_ctxt);
12053             printf("\n");
12054         }
12055     }
12056     function_tests++;
12057 
12058     return(test_ret);
12059 }
12060 
12061 
12062 static int
test_xmlCtxtParseContent(void)12063 test_xmlCtxtParseContent(void) {
12064     int test_ret = 0;
12065 
12066     int mem_base;
12067     xmlNodePtr ret_val;
12068     xmlParserCtxtPtr ctxt; /* parser context */
12069     int n_ctxt;
12070     xmlParserInputPtr input; /* parser input */
12071     int n_input;
12072     xmlNodePtr node; /* target node or document */
12073     int n_node;
12074     int hasTextDecl; /* whether to parse text declaration */
12075     int n_hasTextDecl;
12076 
12077     for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12078     for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) {
12079     for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
12080     for (n_hasTextDecl = 0;n_hasTextDecl < gen_nb_int;n_hasTextDecl++) {
12081         mem_base = xmlMemBlocks();
12082         ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12083         input = gen_xmlParserInputPtr(n_input, 1);
12084         node = gen_xmlNodePtr(n_node, 2);
12085         hasTextDecl = gen_int(n_hasTextDecl, 3);
12086 
12087         ret_val = xmlCtxtParseContent(ctxt, input, node, hasTextDecl);
12088         desret_xmlNodePtr(ret_val);
12089         call_tests++;
12090         des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
12091         des_xmlParserInputPtr(n_input, input, 1);
12092         des_xmlNodePtr(n_node, node, 2);
12093         des_int(n_hasTextDecl, hasTextDecl, 3);
12094         xmlResetLastError();
12095         if (mem_base != xmlMemBlocks()) {
12096             printf("Leak of %d blocks found in xmlCtxtParseContent",
12097 	           xmlMemBlocks() - mem_base);
12098 	    test_ret++;
12099             printf(" %d", n_ctxt);
12100             printf(" %d", n_input);
12101             printf(" %d", n_node);
12102             printf(" %d", n_hasTextDecl);
12103             printf("\n");
12104         }
12105     }
12106     }
12107     }
12108     }
12109     function_tests++;
12110 
12111     return(test_ret);
12112 }
12113 
12114 
12115 static int
test_xmlCtxtParseDocument(void)12116 test_xmlCtxtParseDocument(void) {
12117     int test_ret = 0;
12118 
12119     int mem_base;
12120     xmlDocPtr ret_val;
12121     xmlParserCtxtPtr ctxt; /* an XML parser context */
12122     int n_ctxt;
12123     xmlParserInputPtr input; /* parser input */
12124     int n_input;
12125 
12126     for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12127     for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) {
12128         mem_base = xmlMemBlocks();
12129         ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12130         input = gen_xmlParserInputPtr(n_input, 1);
12131 
12132         ret_val = xmlCtxtParseDocument(ctxt, input);
12133         desret_xmlDocPtr(ret_val);
12134         call_tests++;
12135         des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
12136         des_xmlParserInputPtr(n_input, input, 1);
12137         xmlResetLastError();
12138         if (mem_base != xmlMemBlocks()) {
12139             printf("Leak of %d blocks found in xmlCtxtParseDocument",
12140 	           xmlMemBlocks() - mem_base);
12141 	    test_ret++;
12142             printf(" %d", n_ctxt);
12143             printf(" %d", n_input);
12144             printf("\n");
12145         }
12146     }
12147     }
12148     function_tests++;
12149 
12150     return(test_ret);
12151 }
12152 
12153 
12154 static int
test_xmlCtxtReadDoc(void)12155 test_xmlCtxtReadDoc(void) {
12156     int test_ret = 0;
12157 
12158     int mem_base;
12159     xmlDocPtr ret_val;
12160     xmlParserCtxtPtr ctxt; /* an XML parser context */
12161     int n_ctxt;
12162     const xmlChar * str; /* a pointer to a zero terminated string */
12163     int n_str;
12164     const char * URL; /* base URL (optional) */
12165     int n_URL;
12166     const char * encoding; /* the document encoding (optional) */
12167     int n_encoding;
12168     int options; /* a combination of xmlParserOption */
12169     int n_options;
12170 
12171     for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12172     for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
12173     for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12174     for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
12175     for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
12176         mem_base = xmlMemBlocks();
12177         ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12178         str = gen_const_xmlChar_ptr(n_str, 1);
12179         URL = gen_filepath(n_URL, 2);
12180         encoding = gen_const_char_ptr(n_encoding, 3);
12181         options = gen_parseroptions(n_options, 4);
12182 
12183         ret_val = xmlCtxtReadDoc(ctxt, str, URL, encoding, options);
12184         desret_xmlDocPtr(ret_val);
12185         call_tests++;
12186         des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
12187         des_const_xmlChar_ptr(n_str, str, 1);
12188         des_filepath(n_URL, URL, 2);
12189         des_const_char_ptr(n_encoding, encoding, 3);
12190         des_parseroptions(n_options, options, 4);
12191         xmlResetLastError();
12192         if (mem_base != xmlMemBlocks()) {
12193             printf("Leak of %d blocks found in xmlCtxtReadDoc",
12194 	           xmlMemBlocks() - mem_base);
12195 	    test_ret++;
12196             printf(" %d", n_ctxt);
12197             printf(" %d", n_str);
12198             printf(" %d", n_URL);
12199             printf(" %d", n_encoding);
12200             printf(" %d", n_options);
12201             printf("\n");
12202         }
12203     }
12204     }
12205     }
12206     }
12207     }
12208     function_tests++;
12209 
12210     return(test_ret);
12211 }
12212 
12213 
12214 static int
test_xmlCtxtReadFile(void)12215 test_xmlCtxtReadFile(void) {
12216     int test_ret = 0;
12217 
12218     int mem_base;
12219     xmlDocPtr ret_val;
12220     xmlParserCtxtPtr ctxt; /* an XML parser context */
12221     int n_ctxt;
12222     const char * filename; /* a file or URL */
12223     int n_filename;
12224     const char * encoding; /* the document encoding (optional) */
12225     int n_encoding;
12226     int options; /* a combination of xmlParserOption */
12227     int n_options;
12228 
12229     for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12230     for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
12231     for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
12232     for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
12233         mem_base = xmlMemBlocks();
12234         ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12235         filename = gen_filepath(n_filename, 1);
12236         encoding = gen_const_char_ptr(n_encoding, 2);
12237         options = gen_parseroptions(n_options, 3);
12238 
12239         ret_val = xmlCtxtReadFile(ctxt, filename, encoding, options);
12240         desret_xmlDocPtr(ret_val);
12241         call_tests++;
12242         des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
12243         des_filepath(n_filename, filename, 1);
12244         des_const_char_ptr(n_encoding, encoding, 2);
12245         des_parseroptions(n_options, options, 3);
12246         xmlResetLastError();
12247         if (mem_base != xmlMemBlocks()) {
12248             printf("Leak of %d blocks found in xmlCtxtReadFile",
12249 	           xmlMemBlocks() - mem_base);
12250 	    test_ret++;
12251             printf(" %d", n_ctxt);
12252             printf(" %d", n_filename);
12253             printf(" %d", n_encoding);
12254             printf(" %d", n_options);
12255             printf("\n");
12256         }
12257     }
12258     }
12259     }
12260     }
12261     function_tests++;
12262 
12263     return(test_ret);
12264 }
12265 
12266 
12267 static int
test_xmlCtxtReadMemory(void)12268 test_xmlCtxtReadMemory(void) {
12269     int test_ret = 0;
12270 
12271     int mem_base;
12272     xmlDocPtr ret_val;
12273     xmlParserCtxtPtr ctxt; /* an XML parser context */
12274     int n_ctxt;
12275     const char * buffer; /* a pointer to a char array */
12276     int n_buffer;
12277     int size; /* the size of the array */
12278     int n_size;
12279     const char * URL; /* base URL (optional) */
12280     int n_URL;
12281     const char * encoding; /* the document encoding (optional) */
12282     int n_encoding;
12283     int options; /* a combination of xmlParserOption */
12284     int n_options;
12285 
12286     for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12287     for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
12288     for (n_size = 0;n_size < gen_nb_int;n_size++) {
12289     for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12290     for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
12291     for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
12292         mem_base = xmlMemBlocks();
12293         ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12294         buffer = gen_const_char_ptr(n_buffer, 1);
12295         size = gen_int(n_size, 2);
12296         URL = gen_filepath(n_URL, 3);
12297         encoding = gen_const_char_ptr(n_encoding, 4);
12298         options = gen_parseroptions(n_options, 5);
12299         if ((buffer != NULL) &&
12300             (size > xmlStrlen(BAD_CAST buffer)))
12301             size = 0;
12302 
12303         ret_val = xmlCtxtReadMemory(ctxt, buffer, size, URL, encoding, options);
12304         desret_xmlDocPtr(ret_val);
12305         call_tests++;
12306         des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
12307         des_const_char_ptr(n_buffer, buffer, 1);
12308         des_int(n_size, size, 2);
12309         des_filepath(n_URL, URL, 3);
12310         des_const_char_ptr(n_encoding, encoding, 4);
12311         des_parseroptions(n_options, options, 5);
12312         xmlResetLastError();
12313         if (mem_base != xmlMemBlocks()) {
12314             printf("Leak of %d blocks found in xmlCtxtReadMemory",
12315 	           xmlMemBlocks() - mem_base);
12316 	    test_ret++;
12317             printf(" %d", n_ctxt);
12318             printf(" %d", n_buffer);
12319             printf(" %d", n_size);
12320             printf(" %d", n_URL);
12321             printf(" %d", n_encoding);
12322             printf(" %d", n_options);
12323             printf("\n");
12324         }
12325     }
12326     }
12327     }
12328     }
12329     }
12330     }
12331     function_tests++;
12332 
12333     return(test_ret);
12334 }
12335 
12336 
12337 static int
test_xmlCtxtReset(void)12338 test_xmlCtxtReset(void) {
12339     int test_ret = 0;
12340 
12341     int mem_base;
12342     xmlParserCtxtPtr ctxt; /* an XML parser context */
12343     int n_ctxt;
12344 
12345     for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12346         mem_base = xmlMemBlocks();
12347         ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12348 
12349         xmlCtxtReset(ctxt);
12350         call_tests++;
12351         des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
12352         xmlResetLastError();
12353         if (mem_base != xmlMemBlocks()) {
12354             printf("Leak of %d blocks found in xmlCtxtReset",
12355 	           xmlMemBlocks() - mem_base);
12356 	    test_ret++;
12357             printf(" %d", n_ctxt);
12358             printf("\n");
12359         }
12360     }
12361     function_tests++;
12362 
12363     return(test_ret);
12364 }
12365 
12366 
12367 static int
test_xmlCtxtResetPush(void)12368 test_xmlCtxtResetPush(void) {
12369     int test_ret = 0;
12370 
12371     int mem_base;
12372     int ret_val;
12373     xmlParserCtxtPtr ctxt; /* an XML parser context */
12374     int n_ctxt;
12375     const char * chunk; /* a pointer to an array of chars */
12376     int n_chunk;
12377     int size; /* number of chars in the array */
12378     int n_size;
12379     const char * filename; /* an optional file name or URI */
12380     int n_filename;
12381     const char * encoding; /* the document encoding, or NULL */
12382     int n_encoding;
12383 
12384     for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12385     for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
12386     for (n_size = 0;n_size < gen_nb_int;n_size++) {
12387     for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
12388     for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
12389         mem_base = xmlMemBlocks();
12390         ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12391         chunk = gen_const_char_ptr(n_chunk, 1);
12392         size = gen_int(n_size, 2);
12393         filename = gen_filepath(n_filename, 3);
12394         encoding = gen_const_char_ptr(n_encoding, 4);
12395         if ((chunk != NULL) &&
12396             (size > xmlStrlen(BAD_CAST chunk)))
12397             size = 0;
12398 
12399         ret_val = xmlCtxtResetPush(ctxt, chunk, size, filename, encoding);
12400         desret_int(ret_val);
12401         call_tests++;
12402         des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
12403         des_const_char_ptr(n_chunk, chunk, 1);
12404         des_int(n_size, size, 2);
12405         des_filepath(n_filename, filename, 3);
12406         des_const_char_ptr(n_encoding, encoding, 4);
12407         xmlResetLastError();
12408         if (mem_base != xmlMemBlocks()) {
12409             printf("Leak of %d blocks found in xmlCtxtResetPush",
12410 	           xmlMemBlocks() - mem_base);
12411 	    test_ret++;
12412             printf(" %d", n_ctxt);
12413             printf(" %d", n_chunk);
12414             printf(" %d", n_size);
12415             printf(" %d", n_filename);
12416             printf(" %d", n_encoding);
12417             printf("\n");
12418         }
12419     }
12420     }
12421     }
12422     }
12423     }
12424     function_tests++;
12425 
12426     return(test_ret);
12427 }
12428 
12429 
12430 static int
test_xmlCtxtSetCatalogs(void)12431 test_xmlCtxtSetCatalogs(void) {
12432     int test_ret = 0;
12433 
12434     int mem_base;
12435     xmlParserCtxtPtr ctxt; /*  */
12436     int n_ctxt;
12437     void * catalogs; /*  */
12438     int n_catalogs;
12439 
12440     for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12441     for (n_catalogs = 0;n_catalogs < gen_nb_void_ptr;n_catalogs++) {
12442         mem_base = xmlMemBlocks();
12443         ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12444         catalogs = gen_void_ptr(n_catalogs, 1);
12445 
12446         xmlCtxtSetCatalogs(ctxt, catalogs);
12447         call_tests++;
12448         des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
12449         des_void_ptr(n_catalogs, catalogs, 1);
12450         xmlResetLastError();
12451         if (mem_base != xmlMemBlocks()) {
12452             printf("Leak of %d blocks found in xmlCtxtSetCatalogs",
12453 	           xmlMemBlocks() - mem_base);
12454 	    test_ret++;
12455             printf(" %d", n_ctxt);
12456             printf(" %d", n_catalogs);
12457             printf("\n");
12458         }
12459     }
12460     }
12461     function_tests++;
12462 
12463     return(test_ret);
12464 }
12465 
12466 
12467 static int
test_xmlCtxtSetCharEncConvImpl(void)12468 test_xmlCtxtSetCharEncConvImpl(void) {
12469     int test_ret = 0;
12470 
12471 
12472     /* missing type support */
12473     return(test_ret);
12474 }
12475 
12476 
12477 static int
test_xmlCtxtSetDict(void)12478 test_xmlCtxtSetDict(void) {
12479     int test_ret = 0;
12480 
12481     int mem_base;
12482     xmlParserCtxtPtr ctxt; /*  */
12483     int n_ctxt;
12484     xmlDictPtr dict; /*  */
12485     int n_dict;
12486 
12487     for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12488     for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
12489         mem_base = xmlMemBlocks();
12490         ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12491         dict = gen_xmlDictPtr(n_dict, 1);
12492 
12493         xmlCtxtSetDict(ctxt, dict);
12494         call_tests++;
12495         des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
12496         des_xmlDictPtr(n_dict, dict, 1);
12497         xmlResetLastError();
12498         if (mem_base != xmlMemBlocks()) {
12499             printf("Leak of %d blocks found in xmlCtxtSetDict",
12500 	           xmlMemBlocks() - mem_base);
12501 	    test_ret++;
12502             printf(" %d", n_ctxt);
12503             printf(" %d", n_dict);
12504             printf("\n");
12505         }
12506     }
12507     }
12508     function_tests++;
12509 
12510     return(test_ret);
12511 }
12512 
12513 
12514 static int
test_xmlCtxtSetErrorHandler(void)12515 test_xmlCtxtSetErrorHandler(void) {
12516     int test_ret = 0;
12517 
12518 
12519     /* missing type support */
12520     return(test_ret);
12521 }
12522 
12523 
12524 static int
test_xmlCtxtSetMaxAmplification(void)12525 test_xmlCtxtSetMaxAmplification(void) {
12526     int test_ret = 0;
12527 
12528 
12529     /* missing type support */
12530     return(test_ret);
12531 }
12532 
12533 
12534 static int
test_xmlCtxtSetOptions(void)12535 test_xmlCtxtSetOptions(void) {
12536     int test_ret = 0;
12537 
12538     int mem_base;
12539     int ret_val;
12540     xmlParserCtxtPtr ctxt; /* an XML parser context */
12541     int n_ctxt;
12542     int options; /* a bitmask of xmlParserOption values */
12543     int n_options;
12544 
12545     for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12546     for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
12547         mem_base = xmlMemBlocks();
12548         ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12549         options = gen_parseroptions(n_options, 1);
12550 
12551         ret_val = xmlCtxtSetOptions(ctxt, options);
12552         desret_int(ret_val);
12553         call_tests++;
12554         des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
12555         des_parseroptions(n_options, options, 1);
12556         xmlResetLastError();
12557         if (mem_base != xmlMemBlocks()) {
12558             printf("Leak of %d blocks found in xmlCtxtSetOptions",
12559 	           xmlMemBlocks() - mem_base);
12560 	    test_ret++;
12561             printf(" %d", n_ctxt);
12562             printf(" %d", n_options);
12563             printf("\n");
12564         }
12565     }
12566     }
12567     function_tests++;
12568 
12569     return(test_ret);
12570 }
12571 
12572 
12573 static int
test_xmlCtxtSetPrivate(void)12574 test_xmlCtxtSetPrivate(void) {
12575     int test_ret = 0;
12576 
12577     int mem_base;
12578     xmlParserCtxtPtr ctxt; /*  */
12579     int n_ctxt;
12580     void * priv; /*  */
12581     int n_priv;
12582 
12583     for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12584     for (n_priv = 0;n_priv < gen_nb_void_ptr;n_priv++) {
12585         mem_base = xmlMemBlocks();
12586         ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12587         priv = gen_void_ptr(n_priv, 1);
12588 
12589         xmlCtxtSetPrivate(ctxt, priv);
12590         call_tests++;
12591         des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
12592         des_void_ptr(n_priv, priv, 1);
12593         xmlResetLastError();
12594         if (mem_base != xmlMemBlocks()) {
12595             printf("Leak of %d blocks found in xmlCtxtSetPrivate",
12596 	           xmlMemBlocks() - mem_base);
12597 	    test_ret++;
12598             printf(" %d", n_ctxt);
12599             printf(" %d", n_priv);
12600             printf("\n");
12601         }
12602     }
12603     }
12604     function_tests++;
12605 
12606     return(test_ret);
12607 }
12608 
12609 
12610 static int
test_xmlCtxtSetResourceLoader(void)12611 test_xmlCtxtSetResourceLoader(void) {
12612     int test_ret = 0;
12613 
12614 
12615     /* missing type support */
12616     return(test_ret);
12617 }
12618 
12619 
12620 static int
test_xmlCtxtUseOptions(void)12621 test_xmlCtxtUseOptions(void) {
12622     int test_ret = 0;
12623 
12624     int mem_base;
12625     int ret_val;
12626     xmlParserCtxtPtr ctxt; /* an XML parser context */
12627     int n_ctxt;
12628     int options; /* a combination of xmlParserOption */
12629     int n_options;
12630 
12631     for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12632     for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
12633         mem_base = xmlMemBlocks();
12634         ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12635         options = gen_parseroptions(n_options, 1);
12636 
12637         ret_val = xmlCtxtUseOptions(ctxt, options);
12638         desret_int(ret_val);
12639         call_tests++;
12640         des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
12641         des_parseroptions(n_options, options, 1);
12642         xmlResetLastError();
12643         if (mem_base != xmlMemBlocks()) {
12644             printf("Leak of %d blocks found in xmlCtxtUseOptions",
12645 	           xmlMemBlocks() - mem_base);
12646 	    test_ret++;
12647             printf(" %d", n_ctxt);
12648             printf(" %d", n_options);
12649             printf("\n");
12650         }
12651     }
12652     }
12653     function_tests++;
12654 
12655     return(test_ret);
12656 }
12657 
12658 
12659 static int
test_xmlGetExternalEntityLoader(void)12660 test_xmlGetExternalEntityLoader(void) {
12661     int test_ret = 0;
12662 
12663 
12664     /* missing type support */
12665     return(test_ret);
12666 }
12667 
12668 
12669 static int
test_xmlHasFeature(void)12670 test_xmlHasFeature(void) {
12671     int test_ret = 0;
12672 
12673     int mem_base;
12674     int ret_val;
12675     xmlFeature feature; /* the feature to be examined */
12676     int n_feature;
12677 
12678     for (n_feature = 0;n_feature < gen_nb_xmlFeature;n_feature++) {
12679         mem_base = xmlMemBlocks();
12680         feature = gen_xmlFeature(n_feature, 0);
12681 
12682         ret_val = xmlHasFeature(feature);
12683         desret_int(ret_val);
12684         call_tests++;
12685         des_xmlFeature(n_feature, feature, 0);
12686         xmlResetLastError();
12687         if (mem_base != xmlMemBlocks()) {
12688             printf("Leak of %d blocks found in xmlHasFeature",
12689 	           xmlMemBlocks() - mem_base);
12690 	    test_ret++;
12691             printf(" %d", n_feature);
12692             printf("\n");
12693         }
12694     }
12695     function_tests++;
12696 
12697     return(test_ret);
12698 }
12699 
12700 
12701 static int
test_xmlIOParseDTD(void)12702 test_xmlIOParseDTD(void) {
12703     int test_ret = 0;
12704 
12705 #if defined(LIBXML_VALID_ENABLED)
12706 #ifdef LIBXML_VALID_ENABLED
12707     xmlDtdPtr ret_val;
12708     xmlSAXHandlerPtr sax; /* the SAX handler block or NULL */
12709     int n_sax;
12710     xmlParserInputBufferPtr input; /* an Input Buffer */
12711     int n_input;
12712     xmlCharEncoding enc; /* the charset encoding if known */
12713     int n_enc;
12714 
12715     for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
12716     for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
12717     for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
12718         sax = gen_xmlSAXHandlerPtr(n_sax, 0);
12719         input = gen_xmlParserInputBufferPtr(n_input, 1);
12720         enc = gen_xmlCharEncoding(n_enc, 2);
12721 
12722         ret_val = xmlIOParseDTD(sax, input, enc);
12723         input = NULL;
12724         desret_xmlDtdPtr(ret_val);
12725         call_tests++;
12726         des_xmlSAXHandlerPtr(n_sax, sax, 0);
12727         des_xmlParserInputBufferPtr(n_input, input, 1);
12728         des_xmlCharEncoding(n_enc, enc, 2);
12729         xmlResetLastError();
12730     }
12731     }
12732     }
12733     function_tests++;
12734 #endif
12735 #endif
12736 
12737     return(test_ret);
12738 }
12739 
12740 
12741 static int
test_xmlInitGlobals(void)12742 test_xmlInitGlobals(void) {
12743     int test_ret = 0;
12744 
12745     int mem_base;
12746 
12747         mem_base = xmlMemBlocks();
12748 
12749         xmlInitGlobals();
12750         call_tests++;
12751         xmlResetLastError();
12752         if (mem_base != xmlMemBlocks()) {
12753             printf("Leak of %d blocks found in xmlInitGlobals",
12754 	           xmlMemBlocks() - mem_base);
12755 	    test_ret++;
12756             printf("\n");
12757         }
12758     function_tests++;
12759 
12760     return(test_ret);
12761 }
12762 
12763 
12764 static int
test_xmlInitNodeInfoSeq(void)12765 test_xmlInitNodeInfoSeq(void) {
12766     int test_ret = 0;
12767 
12768     int mem_base;
12769     xmlParserNodeInfoSeqPtr seq; /* a node info sequence pointer */
12770     int n_seq;
12771 
12772     for (n_seq = 0;n_seq < gen_nb_xmlParserNodeInfoSeqPtr;n_seq++) {
12773         mem_base = xmlMemBlocks();
12774         seq = gen_xmlParserNodeInfoSeqPtr(n_seq, 0);
12775 
12776         xmlInitNodeInfoSeq(seq);
12777         call_tests++;
12778         des_xmlParserNodeInfoSeqPtr(n_seq, seq, 0);
12779         xmlResetLastError();
12780         if (mem_base != xmlMemBlocks()) {
12781             printf("Leak of %d blocks found in xmlInitNodeInfoSeq",
12782 	           xmlMemBlocks() - mem_base);
12783 	    test_ret++;
12784             printf(" %d", n_seq);
12785             printf("\n");
12786         }
12787     }
12788     function_tests++;
12789 
12790     return(test_ret);
12791 }
12792 
12793 
12794 static int
test_xmlInitParser(void)12795 test_xmlInitParser(void) {
12796     int test_ret = 0;
12797 
12798     int mem_base;
12799 
12800         mem_base = xmlMemBlocks();
12801 
12802         xmlInitParser();
12803         call_tests++;
12804         xmlResetLastError();
12805         if (mem_base != xmlMemBlocks()) {
12806             printf("Leak of %d blocks found in xmlInitParser",
12807 	           xmlMemBlocks() - mem_base);
12808 	    test_ret++;
12809             printf("\n");
12810         }
12811     function_tests++;
12812 
12813     return(test_ret);
12814 }
12815 
12816 
12817 static int
test_xmlInitParserCtxt(void)12818 test_xmlInitParserCtxt(void) {
12819     int test_ret = 0;
12820 
12821     int mem_base;
12822     int ret_val;
12823     xmlParserCtxtPtr ctxt; /* an XML parser context */
12824     int n_ctxt;
12825 
12826     for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12827         mem_base = xmlMemBlocks();
12828         ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12829 
12830         ret_val = xmlInitParserCtxt(ctxt);
12831         desret_int(ret_val);
12832         call_tests++;
12833         des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
12834         xmlResetLastError();
12835         if (mem_base != xmlMemBlocks()) {
12836             printf("Leak of %d blocks found in xmlInitParserCtxt",
12837 	           xmlMemBlocks() - mem_base);
12838 	    test_ret++;
12839             printf(" %d", n_ctxt);
12840             printf("\n");
12841         }
12842     }
12843     function_tests++;
12844 
12845     return(test_ret);
12846 }
12847 
12848 
12849 static int
test_xmlInputSetEncodingHandler(void)12850 test_xmlInputSetEncodingHandler(void) {
12851     int test_ret = 0;
12852 
12853     int mem_base;
12854     int ret_val;
12855     xmlParserInputPtr input; /* the input stream */
12856     int n_input;
12857     xmlCharEncodingHandlerPtr handler; /* the encoding handler */
12858     int n_handler;
12859 
12860     for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) {
12861     for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandlerPtr;n_handler++) {
12862         mem_base = xmlMemBlocks();
12863         input = gen_xmlParserInputPtr(n_input, 0);
12864         handler = gen_xmlCharEncodingHandlerPtr(n_handler, 1);
12865 
12866         ret_val = xmlInputSetEncodingHandler(input, handler);
12867         desret_int(ret_val);
12868         call_tests++;
12869         des_xmlParserInputPtr(n_input, input, 0);
12870         des_xmlCharEncodingHandlerPtr(n_handler, handler, 1);
12871         xmlResetLastError();
12872         if (mem_base != xmlMemBlocks()) {
12873             printf("Leak of %d blocks found in xmlInputSetEncodingHandler",
12874 	           xmlMemBlocks() - mem_base);
12875 	    test_ret++;
12876             printf(" %d", n_input);
12877             printf(" %d", n_handler);
12878             printf("\n");
12879         }
12880     }
12881     }
12882     function_tests++;
12883 
12884     return(test_ret);
12885 }
12886 
12887 
12888 static int
test_xmlKeepBlanksDefault(void)12889 test_xmlKeepBlanksDefault(void) {
12890     int test_ret = 0;
12891 
12892     int mem_base;
12893     int ret_val;
12894     int val; /* int 0 or 1 */
12895     int n_val;
12896 
12897     for (n_val = 0;n_val < gen_nb_int;n_val++) {
12898         mem_base = xmlMemBlocks();
12899         val = gen_int(n_val, 0);
12900 
12901         ret_val = xmlKeepBlanksDefault(val);
12902         desret_int(ret_val);
12903         call_tests++;
12904         des_int(n_val, val, 0);
12905         xmlResetLastError();
12906         if (mem_base != xmlMemBlocks()) {
12907             printf("Leak of %d blocks found in xmlKeepBlanksDefault",
12908 	           xmlMemBlocks() - mem_base);
12909 	    test_ret++;
12910             printf(" %d", n_val);
12911             printf("\n");
12912         }
12913     }
12914     function_tests++;
12915 
12916     return(test_ret);
12917 }
12918 
12919 
12920 static int
test_xmlLineNumbersDefault(void)12921 test_xmlLineNumbersDefault(void) {
12922     int test_ret = 0;
12923 
12924     int mem_base;
12925     int ret_val;
12926     int val; /* int 0 or 1 */
12927     int n_val;
12928 
12929     for (n_val = 0;n_val < gen_nb_int;n_val++) {
12930         mem_base = xmlMemBlocks();
12931         val = gen_int(n_val, 0);
12932 
12933         ret_val = xmlLineNumbersDefault(val);
12934         desret_int(ret_val);
12935         call_tests++;
12936         des_int(n_val, val, 0);
12937         xmlResetLastError();
12938         if (mem_base != xmlMemBlocks()) {
12939             printf("Leak of %d blocks found in xmlLineNumbersDefault",
12940 	           xmlMemBlocks() - mem_base);
12941 	    test_ret++;
12942             printf(" %d", n_val);
12943             printf("\n");
12944         }
12945     }
12946     function_tests++;
12947 
12948     return(test_ret);
12949 }
12950 
12951 
12952 static int
test_xmlLoadExternalEntity(void)12953 test_xmlLoadExternalEntity(void) {
12954     int test_ret = 0;
12955 
12956     int mem_base;
12957     xmlParserInputPtr ret_val;
12958     const char * URL; /* the URL for the entity to load */
12959     int n_URL;
12960     const char * ID; /* the Public ID for the entity to load */
12961     int n_ID;
12962     xmlParserCtxtPtr ctxt; /* the context in which the entity is called or NULL */
12963     int n_ctxt;
12964 
12965     for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12966     for (n_ID = 0;n_ID < gen_nb_const_char_ptr;n_ID++) {
12967     for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12968         mem_base = xmlMemBlocks();
12969         URL = gen_filepath(n_URL, 0);
12970         ID = gen_const_char_ptr(n_ID, 1);
12971         ctxt = gen_xmlParserCtxtPtr(n_ctxt, 2);
12972 
12973         ret_val = xmlLoadExternalEntity(URL, ID, ctxt);
12974         desret_xmlParserInputPtr(ret_val);
12975         call_tests++;
12976         des_filepath(n_URL, URL, 0);
12977         des_const_char_ptr(n_ID, ID, 1);
12978         des_xmlParserCtxtPtr(n_ctxt, ctxt, 2);
12979         xmlResetLastError();
12980         if (mem_base != xmlMemBlocks()) {
12981             printf("Leak of %d blocks found in xmlLoadExternalEntity",
12982 	           xmlMemBlocks() - mem_base);
12983 	    test_ret++;
12984             printf(" %d", n_URL);
12985             printf(" %d", n_ID);
12986             printf(" %d", n_ctxt);
12987             printf("\n");
12988         }
12989     }
12990     }
12991     }
12992     function_tests++;
12993 
12994     return(test_ret);
12995 }
12996 
12997 
12998 static int
test_xmlNewIOInputStream(void)12999 test_xmlNewIOInputStream(void) {
13000     int test_ret = 0;
13001 
13002     int mem_base;
13003     xmlParserInputPtr ret_val;
13004     xmlParserCtxtPtr ctxt; /* an XML parser context */
13005     int n_ctxt;
13006     xmlParserInputBufferPtr buf; /* an input buffer */
13007     int n_buf;
13008     xmlCharEncoding enc; /* the charset encoding if known */
13009     int n_enc;
13010 
13011     for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13012     for (n_buf = 0;n_buf < gen_nb_xmlParserInputBufferPtr;n_buf++) {
13013     for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
13014         mem_base = xmlMemBlocks();
13015         ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
13016         buf = gen_xmlParserInputBufferPtr(n_buf, 1);
13017         enc = gen_xmlCharEncoding(n_enc, 2);
13018 
13019         ret_val = xmlNewIOInputStream(ctxt, buf, enc);
13020         if (ret_val != NULL) buf = NULL;
13021         desret_xmlParserInputPtr(ret_val);
13022         call_tests++;
13023         des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
13024         des_xmlParserInputBufferPtr(n_buf, buf, 1);
13025         des_xmlCharEncoding(n_enc, enc, 2);
13026         xmlResetLastError();
13027         if (mem_base != xmlMemBlocks()) {
13028             printf("Leak of %d blocks found in xmlNewIOInputStream",
13029 	           xmlMemBlocks() - mem_base);
13030 	    test_ret++;
13031             printf(" %d", n_ctxt);
13032             printf(" %d", n_buf);
13033             printf(" %d", n_enc);
13034             printf("\n");
13035         }
13036     }
13037     }
13038     }
13039     function_tests++;
13040 
13041     return(test_ret);
13042 }
13043 
13044 
13045 static int
test_xmlNewInputFromFd(void)13046 test_xmlNewInputFromFd(void) {
13047     int test_ret = 0;
13048 
13049     int mem_base;
13050     xmlParserInputPtr ret_val;
13051     const char * url; /* base URL (optional) */
13052     int n_url;
13053     int fd; /* file descriptor */
13054     int n_fd;
13055     int flags; /* unused, pass 0 */
13056     int n_flags;
13057 
13058     for (n_url = 0;n_url < gen_nb_filepath;n_url++) {
13059     for (n_fd = 0;n_fd < gen_nb_int;n_fd++) {
13060     for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
13061         mem_base = xmlMemBlocks();
13062         url = gen_filepath(n_url, 0);
13063         fd = gen_int(n_fd, 1);
13064         flags = gen_int(n_flags, 2);
13065 
13066         ret_val = xmlNewInputFromFd(url, fd, flags);
13067         desret_xmlParserInputPtr(ret_val);
13068         call_tests++;
13069         des_filepath(n_url, url, 0);
13070         des_int(n_fd, fd, 1);
13071         des_int(n_flags, flags, 2);
13072         xmlResetLastError();
13073         if (mem_base != xmlMemBlocks()) {
13074             printf("Leak of %d blocks found in xmlNewInputFromFd",
13075 	           xmlMemBlocks() - mem_base);
13076 	    test_ret++;
13077             printf(" %d", n_url);
13078             printf(" %d", n_fd);
13079             printf(" %d", n_flags);
13080             printf("\n");
13081         }
13082     }
13083     }
13084     }
13085     function_tests++;
13086 
13087     return(test_ret);
13088 }
13089 
13090 
13091 static int
test_xmlNewInputFromIO(void)13092 test_xmlNewInputFromIO(void) {
13093     int test_ret = 0;
13094 
13095 
13096     /* missing type support */
13097     return(test_ret);
13098 }
13099 
13100 
13101 static int
test_xmlNewInputFromMemory(void)13102 test_xmlNewInputFromMemory(void) {
13103     int test_ret = 0;
13104 
13105 
13106     /* missing type support */
13107     return(test_ret);
13108 }
13109 
13110 
13111 static int
test_xmlNewInputFromString(void)13112 test_xmlNewInputFromString(void) {
13113     int test_ret = 0;
13114 
13115     int mem_base;
13116     xmlParserInputPtr ret_val;
13117     const char * url; /* base URL (optional) */
13118     int n_url;
13119     const char * str; /* zero-terminated string */
13120     int n_str;
13121     int flags; /* optimization hints */
13122     int n_flags;
13123 
13124     for (n_url = 0;n_url < gen_nb_filepath;n_url++) {
13125     for (n_str = 0;n_str < gen_nb_const_char_ptr;n_str++) {
13126     for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
13127         mem_base = xmlMemBlocks();
13128         url = gen_filepath(n_url, 0);
13129         str = gen_const_char_ptr(n_str, 1);
13130         flags = gen_int(n_flags, 2);
13131 
13132         ret_val = xmlNewInputFromString(url, str, flags);
13133         desret_xmlParserInputPtr(ret_val);
13134         call_tests++;
13135         des_filepath(n_url, url, 0);
13136         des_const_char_ptr(n_str, str, 1);
13137         des_int(n_flags, flags, 2);
13138         xmlResetLastError();
13139         if (mem_base != xmlMemBlocks()) {
13140             printf("Leak of %d blocks found in xmlNewInputFromString",
13141 	           xmlMemBlocks() - mem_base);
13142 	    test_ret++;
13143             printf(" %d", n_url);
13144             printf(" %d", n_str);
13145             printf(" %d", n_flags);
13146             printf("\n");
13147         }
13148     }
13149     }
13150     }
13151     function_tests++;
13152 
13153     return(test_ret);
13154 }
13155 
13156 
13157 #define gen_nb_xmlParserInputPtr_ptr 1
13158 #define gen_xmlParserInputPtr_ptr(no, nr) NULL
13159 #define des_xmlParserInputPtr_ptr(no, val, nr)
13160 
13161 static int
test_xmlNewInputFromUrl(void)13162 test_xmlNewInputFromUrl(void) {
13163     int test_ret = 0;
13164 
13165     int mem_base;
13166     int ret_val;
13167     const char * filename; /* the filename to use as entity */
13168     int n_filename;
13169     int flags; /* XML_INPUT flags */
13170     int n_flags;
13171     xmlParserInputPtr * out; /* pointer to new parser input */
13172     int n_out;
13173 
13174     for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
13175     for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
13176     for (n_out = 0;n_out < gen_nb_xmlParserInputPtr_ptr;n_out++) {
13177         mem_base = xmlMemBlocks();
13178         filename = gen_filepath(n_filename, 0);
13179         flags = gen_int(n_flags, 1);
13180         out = gen_xmlParserInputPtr_ptr(n_out, 2);
13181 
13182         ret_val = xmlNewInputFromUrl(filename, flags, out);
13183         desret_int(ret_val);
13184         call_tests++;
13185         des_filepath(n_filename, filename, 0);
13186         des_int(n_flags, flags, 1);
13187         des_xmlParserInputPtr_ptr(n_out, out, 2);
13188         xmlResetLastError();
13189         if (mem_base != xmlMemBlocks()) {
13190             printf("Leak of %d blocks found in xmlNewInputFromUrl",
13191 	           xmlMemBlocks() - mem_base);
13192 	    test_ret++;
13193             printf(" %d", n_filename);
13194             printf(" %d", n_flags);
13195             printf(" %d", n_out);
13196             printf("\n");
13197         }
13198     }
13199     }
13200     }
13201     function_tests++;
13202 
13203     return(test_ret);
13204 }
13205 
13206 
13207 static int
test_xmlNewParserCtxt(void)13208 test_xmlNewParserCtxt(void) {
13209     int test_ret = 0;
13210 
13211     int mem_base;
13212     xmlParserCtxtPtr ret_val;
13213 
13214         mem_base = xmlMemBlocks();
13215 
13216         ret_val = xmlNewParserCtxt();
13217         desret_xmlParserCtxtPtr(ret_val);
13218         call_tests++;
13219         xmlResetLastError();
13220         if (mem_base != xmlMemBlocks()) {
13221             printf("Leak of %d blocks found in xmlNewParserCtxt",
13222 	           xmlMemBlocks() - mem_base);
13223 	    test_ret++;
13224             printf("\n");
13225         }
13226     function_tests++;
13227 
13228     return(test_ret);
13229 }
13230 
13231 
13232 #define gen_nb_const_xmlSAXHandler_ptr 1
13233 #define gen_const_xmlSAXHandler_ptr(no, nr) NULL
13234 #define des_const_xmlSAXHandler_ptr(no, val, nr)
13235 
13236 static int
test_xmlNewSAXParserCtxt(void)13237 test_xmlNewSAXParserCtxt(void) {
13238     int test_ret = 0;
13239 
13240     int mem_base;
13241     xmlParserCtxtPtr ret_val;
13242     const xmlSAXHandler * sax; /* SAX handler */
13243     int n_sax;
13244     void * userData; /* user data */
13245     int n_userData;
13246 
13247     for (n_sax = 0;n_sax < gen_nb_const_xmlSAXHandler_ptr;n_sax++) {
13248     for (n_userData = 0;n_userData < gen_nb_userdata;n_userData++) {
13249         mem_base = xmlMemBlocks();
13250         sax = gen_const_xmlSAXHandler_ptr(n_sax, 0);
13251         userData = gen_userdata(n_userData, 1);
13252 
13253         ret_val = xmlNewSAXParserCtxt(sax, userData);
13254         desret_xmlParserCtxtPtr(ret_val);
13255         call_tests++;
13256         des_const_xmlSAXHandler_ptr(n_sax, sax, 0);
13257         des_userdata(n_userData, userData, 1);
13258         xmlResetLastError();
13259         if (mem_base != xmlMemBlocks()) {
13260             printf("Leak of %d blocks found in xmlNewSAXParserCtxt",
13261 	           xmlMemBlocks() - mem_base);
13262 	    test_ret++;
13263             printf(" %d", n_sax);
13264             printf(" %d", n_userData);
13265             printf("\n");
13266         }
13267     }
13268     }
13269     function_tests++;
13270 
13271     return(test_ret);
13272 }
13273 
13274 
13275 #define gen_nb_xmlNodePtr_ptr 1
13276 #define gen_xmlNodePtr_ptr(no, nr) NULL
13277 #define des_xmlNodePtr_ptr(no, val, nr)
13278 
13279 static int
test_xmlParseBalancedChunkMemory(void)13280 test_xmlParseBalancedChunkMemory(void) {
13281     int test_ret = 0;
13282 
13283 #if defined(LIBXML_SAX1_ENABLED)
13284 #ifdef LIBXML_SAX1_ENABLED
13285     int mem_base;
13286     int ret_val;
13287     xmlDocPtr doc; /* the document the chunk pertains to (must not be NULL) */
13288     int n_doc;
13289     xmlSAXHandlerPtr sax; /* the SAX handler block (possibly NULL) */
13290     int n_sax;
13291     void * user_data; /* The user data returned on SAX callbacks (possibly NULL) */
13292     int n_user_data;
13293     int depth; /* Used for loop detection, use 0 */
13294     int n_depth;
13295     const xmlChar * string; /* the input string in UTF8 or ISO-Latin (zero terminated) */
13296     int n_string;
13297     xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13298     int n_lst;
13299 
13300     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
13301     for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
13302     for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
13303     for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
13304     for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
13305     for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13306         mem_base = xmlMemBlocks();
13307         doc = gen_xmlDocPtr(n_doc, 0);
13308         sax = gen_xmlSAXHandlerPtr(n_sax, 1);
13309         user_data = gen_userdata(n_user_data, 2);
13310         depth = gen_int(n_depth, 3);
13311         string = gen_const_xmlChar_ptr(n_string, 4);
13312         lst = gen_xmlNodePtr_ptr(n_lst, 5);
13313 
13314 #ifdef LIBXML_SAX1_ENABLED
13315         if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
13316 #endif
13317 
13318 
13319         ret_val = xmlParseBalancedChunkMemory(doc, sax, user_data, depth, string, lst);
13320         desret_int(ret_val);
13321         call_tests++;
13322         des_xmlDocPtr(n_doc, doc, 0);
13323         des_xmlSAXHandlerPtr(n_sax, sax, 1);
13324         des_userdata(n_user_data, user_data, 2);
13325         des_int(n_depth, depth, 3);
13326         des_const_xmlChar_ptr(n_string, string, 4);
13327         des_xmlNodePtr_ptr(n_lst, lst, 5);
13328         xmlResetLastError();
13329         if (mem_base != xmlMemBlocks()) {
13330             printf("Leak of %d blocks found in xmlParseBalancedChunkMemory",
13331 	           xmlMemBlocks() - mem_base);
13332 	    test_ret++;
13333             printf(" %d", n_doc);
13334             printf(" %d", n_sax);
13335             printf(" %d", n_user_data);
13336             printf(" %d", n_depth);
13337             printf(" %d", n_string);
13338             printf(" %d", n_lst);
13339             printf("\n");
13340         }
13341     }
13342     }
13343     }
13344     }
13345     }
13346     }
13347     function_tests++;
13348 #endif
13349 #endif
13350 
13351     return(test_ret);
13352 }
13353 
13354 
13355 static int
test_xmlParseBalancedChunkMemoryRecover(void)13356 test_xmlParseBalancedChunkMemoryRecover(void) {
13357     int test_ret = 0;
13358 
13359 #if defined(LIBXML_SAX1_ENABLED)
13360 #ifdef LIBXML_SAX1_ENABLED
13361     int mem_base;
13362     int ret_val;
13363     xmlDocPtr doc; /* the document the chunk pertains to (must not be NULL) */
13364     int n_doc;
13365     xmlSAXHandlerPtr sax; /* the SAX handler block (possibly NULL) */
13366     int n_sax;
13367     void * user_data; /* The user data returned on SAX callbacks (possibly NULL) */
13368     int n_user_data;
13369     int depth; /* Used for loop detection, use 0 */
13370     int n_depth;
13371     const xmlChar * string; /* the input string in UTF8 or ISO-Latin (zero terminated) */
13372     int n_string;
13373     xmlNodePtr * listOut; /* the return value for the set of parsed nodes */
13374     int n_listOut;
13375     int recover; /* return nodes even if the data is broken (use 0) */
13376     int n_recover;
13377 
13378     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
13379     for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
13380     for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
13381     for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
13382     for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
13383     for (n_listOut = 0;n_listOut < gen_nb_xmlNodePtr_ptr;n_listOut++) {
13384     for (n_recover = 0;n_recover < gen_nb_int;n_recover++) {
13385         mem_base = xmlMemBlocks();
13386         doc = gen_xmlDocPtr(n_doc, 0);
13387         sax = gen_xmlSAXHandlerPtr(n_sax, 1);
13388         user_data = gen_userdata(n_user_data, 2);
13389         depth = gen_int(n_depth, 3);
13390         string = gen_const_xmlChar_ptr(n_string, 4);
13391         listOut = gen_xmlNodePtr_ptr(n_listOut, 5);
13392         recover = gen_int(n_recover, 6);
13393 
13394 #ifdef LIBXML_SAX1_ENABLED
13395         if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
13396 #endif
13397 
13398 
13399         ret_val = xmlParseBalancedChunkMemoryRecover(doc, sax, user_data, depth, string, listOut, recover);
13400         desret_int(ret_val);
13401         call_tests++;
13402         des_xmlDocPtr(n_doc, doc, 0);
13403         des_xmlSAXHandlerPtr(n_sax, sax, 1);
13404         des_userdata(n_user_data, user_data, 2);
13405         des_int(n_depth, depth, 3);
13406         des_const_xmlChar_ptr(n_string, string, 4);
13407         des_xmlNodePtr_ptr(n_listOut, listOut, 5);
13408         des_int(n_recover, recover, 6);
13409         xmlResetLastError();
13410         if (mem_base != xmlMemBlocks()) {
13411             printf("Leak of %d blocks found in xmlParseBalancedChunkMemoryRecover",
13412 	           xmlMemBlocks() - mem_base);
13413 	    test_ret++;
13414             printf(" %d", n_doc);
13415             printf(" %d", n_sax);
13416             printf(" %d", n_user_data);
13417             printf(" %d", n_depth);
13418             printf(" %d", n_string);
13419             printf(" %d", n_listOut);
13420             printf(" %d", n_recover);
13421             printf("\n");
13422         }
13423     }
13424     }
13425     }
13426     }
13427     }
13428     }
13429     }
13430     function_tests++;
13431 #endif
13432 #endif
13433 
13434     return(test_ret);
13435 }
13436 
13437 
13438 static int
test_xmlParseChunk(void)13439 test_xmlParseChunk(void) {
13440     int test_ret = 0;
13441 
13442 #if defined(LIBXML_PUSH_ENABLED)
13443     int mem_base;
13444     int ret_val;
13445     xmlParserCtxtPtr ctxt; /* an XML parser context */
13446     int n_ctxt;
13447     const char * chunk; /* chunk of memory */
13448     int n_chunk;
13449     int size; /* size of chunk in bytes */
13450     int n_size;
13451     int terminate; /* last chunk indicator */
13452     int n_terminate;
13453 
13454     for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13455     for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
13456     for (n_size = 0;n_size < gen_nb_int;n_size++) {
13457     for (n_terminate = 0;n_terminate < gen_nb_int;n_terminate++) {
13458         mem_base = xmlMemBlocks();
13459         ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
13460         chunk = gen_const_char_ptr(n_chunk, 1);
13461         size = gen_int(n_size, 2);
13462         terminate = gen_int(n_terminate, 3);
13463         if ((chunk != NULL) &&
13464             (size > xmlStrlen(BAD_CAST chunk)))
13465             size = 0;
13466 
13467         ret_val = xmlParseChunk(ctxt, chunk, size, terminate);
13468         if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
13469         desret_int(ret_val);
13470         call_tests++;
13471         des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
13472         des_const_char_ptr(n_chunk, chunk, 1);
13473         des_int(n_size, size, 2);
13474         des_int(n_terminate, terminate, 3);
13475         xmlResetLastError();
13476         if (mem_base != xmlMemBlocks()) {
13477             printf("Leak of %d blocks found in xmlParseChunk",
13478 	           xmlMemBlocks() - mem_base);
13479 	    test_ret++;
13480             printf(" %d", n_ctxt);
13481             printf(" %d", n_chunk);
13482             printf(" %d", n_size);
13483             printf(" %d", n_terminate);
13484             printf("\n");
13485         }
13486     }
13487     }
13488     }
13489     }
13490     function_tests++;
13491 #endif
13492 
13493     return(test_ret);
13494 }
13495 
13496 
13497 static int
test_xmlParseCtxtExternalEntity(void)13498 test_xmlParseCtxtExternalEntity(void) {
13499     int test_ret = 0;
13500 
13501     int mem_base;
13502     int ret_val;
13503     xmlParserCtxtPtr ctxt; /* the existing parsing context */
13504     int n_ctxt;
13505     const xmlChar * URL; /* the URL for the entity to load */
13506     int n_URL;
13507     const xmlChar * ID; /* the System ID for the entity to load */
13508     int n_ID;
13509     xmlNodePtr * listOut; /* the return value for the set of parsed nodes */
13510     int n_listOut;
13511 
13512     for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13513     for (n_URL = 0;n_URL < gen_nb_const_xmlChar_ptr;n_URL++) {
13514     for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) {
13515     for (n_listOut = 0;n_listOut < gen_nb_xmlNodePtr_ptr;n_listOut++) {
13516         mem_base = xmlMemBlocks();
13517         ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
13518         URL = gen_const_xmlChar_ptr(n_URL, 1);
13519         ID = gen_const_xmlChar_ptr(n_ID, 2);
13520         listOut = gen_xmlNodePtr_ptr(n_listOut, 3);
13521 
13522         ret_val = xmlParseCtxtExternalEntity(ctxt, URL, ID, listOut);
13523         desret_int(ret_val);
13524         call_tests++;
13525         des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
13526         des_const_xmlChar_ptr(n_URL, URL, 1);
13527         des_const_xmlChar_ptr(n_ID, ID, 2);
13528         des_xmlNodePtr_ptr(n_listOut, listOut, 3);
13529         xmlResetLastError();
13530         if (mem_base != xmlMemBlocks()) {
13531             printf("Leak of %d blocks found in xmlParseCtxtExternalEntity",
13532 	           xmlMemBlocks() - mem_base);
13533 	    test_ret++;
13534             printf(" %d", n_ctxt);
13535             printf(" %d", n_URL);
13536             printf(" %d", n_ID);
13537             printf(" %d", n_listOut);
13538             printf("\n");
13539         }
13540     }
13541     }
13542     }
13543     }
13544     function_tests++;
13545 
13546     return(test_ret);
13547 }
13548 
13549 
13550 static int
test_xmlParseDTD(void)13551 test_xmlParseDTD(void) {
13552     int test_ret = 0;
13553 
13554 #if defined(LIBXML_VALID_ENABLED)
13555 #ifdef LIBXML_VALID_ENABLED
13556     int mem_base;
13557     xmlDtdPtr ret_val;
13558     const xmlChar * ExternalID; /* a NAME* containing the External ID of the DTD */
13559     int n_ExternalID;
13560     const xmlChar * SystemID; /* a NAME* containing the URL to the DTD */
13561     int n_SystemID;
13562 
13563     for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
13564     for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
13565         mem_base = xmlMemBlocks();
13566         ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 0);
13567         SystemID = gen_const_xmlChar_ptr(n_SystemID, 1);
13568 
13569         ret_val = xmlParseDTD(ExternalID, SystemID);
13570         desret_xmlDtdPtr(ret_val);
13571         call_tests++;
13572         des_const_xmlChar_ptr(n_ExternalID, ExternalID, 0);
13573         des_const_xmlChar_ptr(n_SystemID, SystemID, 1);
13574         xmlResetLastError();
13575         if (mem_base != xmlMemBlocks()) {
13576             printf("Leak of %d blocks found in xmlParseDTD",
13577 	           xmlMemBlocks() - mem_base);
13578 	    test_ret++;
13579             printf(" %d", n_ExternalID);
13580             printf(" %d", n_SystemID);
13581             printf("\n");
13582         }
13583     }
13584     }
13585     function_tests++;
13586 #endif
13587 #endif
13588 
13589     return(test_ret);
13590 }
13591 
13592 
13593 static int
test_xmlParseDoc(void)13594 test_xmlParseDoc(void) {
13595     int test_ret = 0;
13596 
13597 #if defined(LIBXML_SAX1_ENABLED)
13598 #ifdef LIBXML_SAX1_ENABLED
13599     int mem_base;
13600     xmlDocPtr ret_val;
13601     const xmlChar * cur; /* a pointer to an array of xmlChar */
13602     int n_cur;
13603 
13604     for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
13605         mem_base = xmlMemBlocks();
13606         cur = gen_const_xmlChar_ptr(n_cur, 0);
13607 
13608         ret_val = xmlParseDoc(cur);
13609         desret_xmlDocPtr(ret_val);
13610         call_tests++;
13611         des_const_xmlChar_ptr(n_cur, cur, 0);
13612         xmlResetLastError();
13613         if (mem_base != xmlMemBlocks()) {
13614             printf("Leak of %d blocks found in xmlParseDoc",
13615 	           xmlMemBlocks() - mem_base);
13616 	    test_ret++;
13617             printf(" %d", n_cur);
13618             printf("\n");
13619         }
13620     }
13621     function_tests++;
13622 #endif
13623 #endif
13624 
13625     return(test_ret);
13626 }
13627 
13628 
13629 static int
test_xmlParseDocument(void)13630 test_xmlParseDocument(void) {
13631     int test_ret = 0;
13632 
13633     int mem_base;
13634     int ret_val;
13635     xmlParserCtxtPtr ctxt; /* an XML parser context */
13636     int n_ctxt;
13637 
13638     for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13639         mem_base = xmlMemBlocks();
13640         ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
13641 
13642         ret_val = xmlParseDocument(ctxt);
13643         if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
13644         desret_int(ret_val);
13645         call_tests++;
13646         des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
13647         xmlResetLastError();
13648         if (mem_base != xmlMemBlocks()) {
13649             printf("Leak of %d blocks found in xmlParseDocument",
13650 	           xmlMemBlocks() - mem_base);
13651 	    test_ret++;
13652             printf(" %d", n_ctxt);
13653             printf("\n");
13654         }
13655     }
13656     function_tests++;
13657 
13658     return(test_ret);
13659 }
13660 
13661 
13662 static int
test_xmlParseEntity(void)13663 test_xmlParseEntity(void) {
13664     int test_ret = 0;
13665 
13666 #if defined(LIBXML_SAX1_ENABLED)
13667 #ifdef LIBXML_SAX1_ENABLED
13668     int mem_base;
13669     xmlDocPtr ret_val;
13670     const char * filename; /* the filename */
13671     int n_filename;
13672 
13673     for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
13674         mem_base = xmlMemBlocks();
13675         filename = gen_filepath(n_filename, 0);
13676 
13677         ret_val = xmlParseEntity(filename);
13678         desret_xmlDocPtr(ret_val);
13679         call_tests++;
13680         des_filepath(n_filename, filename, 0);
13681         xmlResetLastError();
13682         if (mem_base != xmlMemBlocks()) {
13683             printf("Leak of %d blocks found in xmlParseEntity",
13684 	           xmlMemBlocks() - mem_base);
13685 	    test_ret++;
13686             printf(" %d", n_filename);
13687             printf("\n");
13688         }
13689     }
13690     function_tests++;
13691 #endif
13692 #endif
13693 
13694     return(test_ret);
13695 }
13696 
13697 
13698 static int
test_xmlParseExtParsedEnt(void)13699 test_xmlParseExtParsedEnt(void) {
13700     int test_ret = 0;
13701 
13702     int mem_base;
13703     int ret_val;
13704     xmlParserCtxtPtr ctxt; /* an XML parser context */
13705     int n_ctxt;
13706 
13707     for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13708         mem_base = xmlMemBlocks();
13709         ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
13710 
13711         ret_val = xmlParseExtParsedEnt(ctxt);
13712         if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
13713         desret_int(ret_val);
13714         call_tests++;
13715         des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
13716         xmlResetLastError();
13717         if (mem_base != xmlMemBlocks()) {
13718             printf("Leak of %d blocks found in xmlParseExtParsedEnt",
13719 	           xmlMemBlocks() - mem_base);
13720 	    test_ret++;
13721             printf(" %d", n_ctxt);
13722             printf("\n");
13723         }
13724     }
13725     function_tests++;
13726 
13727     return(test_ret);
13728 }
13729 
13730 
13731 static int
test_xmlParseExternalEntity(void)13732 test_xmlParseExternalEntity(void) {
13733     int test_ret = 0;
13734 
13735 #if defined(LIBXML_SAX1_ENABLED)
13736 #ifdef LIBXML_SAX1_ENABLED
13737     int mem_base;
13738     int ret_val;
13739     xmlDocPtr doc; /* the document the chunk pertains to */
13740     int n_doc;
13741     xmlSAXHandlerPtr sax; /* the SAX handler block (possibly NULL) */
13742     int n_sax;
13743     void * user_data; /* The user data returned on SAX callbacks (possibly NULL) */
13744     int n_user_data;
13745     int depth; /* Used for loop detection, use 0 */
13746     int n_depth;
13747     const xmlChar * URL; /* the URL for the entity to load */
13748     int n_URL;
13749     const xmlChar * ID; /* the System ID for the entity to load */
13750     int n_ID;
13751     xmlNodePtr * list; /* the return value for the set of parsed nodes */
13752     int n_list;
13753 
13754     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
13755     for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
13756     for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
13757     for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
13758     for (n_URL = 0;n_URL < gen_nb_const_xmlChar_ptr;n_URL++) {
13759     for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) {
13760     for (n_list = 0;n_list < gen_nb_xmlNodePtr_ptr;n_list++) {
13761         mem_base = xmlMemBlocks();
13762         doc = gen_xmlDocPtr(n_doc, 0);
13763         sax = gen_xmlSAXHandlerPtr(n_sax, 1);
13764         user_data = gen_userdata(n_user_data, 2);
13765         depth = gen_int(n_depth, 3);
13766         URL = gen_const_xmlChar_ptr(n_URL, 4);
13767         ID = gen_const_xmlChar_ptr(n_ID, 5);
13768         list = gen_xmlNodePtr_ptr(n_list, 6);
13769 
13770         ret_val = xmlParseExternalEntity(doc, sax, user_data, depth, URL, ID, list);
13771         desret_int(ret_val);
13772         call_tests++;
13773         des_xmlDocPtr(n_doc, doc, 0);
13774         des_xmlSAXHandlerPtr(n_sax, sax, 1);
13775         des_userdata(n_user_data, user_data, 2);
13776         des_int(n_depth, depth, 3);
13777         des_const_xmlChar_ptr(n_URL, URL, 4);
13778         des_const_xmlChar_ptr(n_ID, ID, 5);
13779         des_xmlNodePtr_ptr(n_list, list, 6);
13780         xmlResetLastError();
13781         if (mem_base != xmlMemBlocks()) {
13782             printf("Leak of %d blocks found in xmlParseExternalEntity",
13783 	           xmlMemBlocks() - mem_base);
13784 	    test_ret++;
13785             printf(" %d", n_doc);
13786             printf(" %d", n_sax);
13787             printf(" %d", n_user_data);
13788             printf(" %d", n_depth);
13789             printf(" %d", n_URL);
13790             printf(" %d", n_ID);
13791             printf(" %d", n_list);
13792             printf("\n");
13793         }
13794     }
13795     }
13796     }
13797     }
13798     }
13799     }
13800     }
13801     function_tests++;
13802 #endif
13803 #endif
13804 
13805     return(test_ret);
13806 }
13807 
13808 
13809 static int
test_xmlParseFile(void)13810 test_xmlParseFile(void) {
13811     int test_ret = 0;
13812 
13813 #if defined(LIBXML_SAX1_ENABLED)
13814 #ifdef LIBXML_SAX1_ENABLED
13815     int mem_base;
13816     xmlDocPtr ret_val;
13817     const char * filename; /* the filename */
13818     int n_filename;
13819 
13820     for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
13821         mem_base = xmlMemBlocks();
13822         filename = gen_filepath(n_filename, 0);
13823 
13824         ret_val = xmlParseFile(filename);
13825         desret_xmlDocPtr(ret_val);
13826         call_tests++;
13827         des_filepath(n_filename, filename, 0);
13828         xmlResetLastError();
13829         if (mem_base != xmlMemBlocks()) {
13830             printf("Leak of %d blocks found in xmlParseFile",
13831 	           xmlMemBlocks() - mem_base);
13832 	    test_ret++;
13833             printf(" %d", n_filename);
13834             printf("\n");
13835         }
13836     }
13837     function_tests++;
13838 #endif
13839 #endif
13840 
13841     return(test_ret);
13842 }
13843 
13844 
13845 static int
test_xmlParseInNodeContext(void)13846 test_xmlParseInNodeContext(void) {
13847     int test_ret = 0;
13848 
13849     int mem_base;
13850     xmlParserErrors ret_val;
13851     xmlNodePtr node; /* the context node */
13852     int n_node;
13853     const char * data; /* the input string */
13854     int n_data;
13855     int datalen; /* the input string length in bytes */
13856     int n_datalen;
13857     int options; /* a combination of xmlParserOption */
13858     int n_options;
13859     xmlNodePtr * listOut; /* the return value for the set of parsed nodes */
13860     int n_listOut;
13861 
13862     for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
13863     for (n_data = 0;n_data < gen_nb_const_char_ptr;n_data++) {
13864     for (n_datalen = 0;n_datalen < gen_nb_int;n_datalen++) {
13865     for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
13866     for (n_listOut = 0;n_listOut < gen_nb_xmlNodePtr_ptr;n_listOut++) {
13867         mem_base = xmlMemBlocks();
13868         node = gen_xmlNodePtr(n_node, 0);
13869         data = gen_const_char_ptr(n_data, 1);
13870         datalen = gen_int(n_datalen, 2);
13871         options = gen_parseroptions(n_options, 3);
13872         listOut = gen_xmlNodePtr_ptr(n_listOut, 4);
13873 
13874         ret_val = xmlParseInNodeContext(node, data, datalen, options, listOut);
13875         desret_xmlParserErrors(ret_val);
13876         call_tests++;
13877         des_xmlNodePtr(n_node, node, 0);
13878         des_const_char_ptr(n_data, data, 1);
13879         des_int(n_datalen, datalen, 2);
13880         des_parseroptions(n_options, options, 3);
13881         des_xmlNodePtr_ptr(n_listOut, listOut, 4);
13882         xmlResetLastError();
13883         if (mem_base != xmlMemBlocks()) {
13884             printf("Leak of %d blocks found in xmlParseInNodeContext",
13885 	           xmlMemBlocks() - mem_base);
13886 	    test_ret++;
13887             printf(" %d", n_node);
13888             printf(" %d", n_data);
13889             printf(" %d", n_datalen);
13890             printf(" %d", n_options);
13891             printf(" %d", n_listOut);
13892             printf("\n");
13893         }
13894     }
13895     }
13896     }
13897     }
13898     }
13899     function_tests++;
13900 
13901     return(test_ret);
13902 }
13903 
13904 
13905 static int
test_xmlParseMemory(void)13906 test_xmlParseMemory(void) {
13907     int test_ret = 0;
13908 
13909 #if defined(LIBXML_SAX1_ENABLED)
13910 #ifdef LIBXML_SAX1_ENABLED
13911     int mem_base;
13912     xmlDocPtr ret_val;
13913     const char * buffer; /* an pointer to a char array */
13914     int n_buffer;
13915     int size; /* the size of the array */
13916     int n_size;
13917 
13918     for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
13919     for (n_size = 0;n_size < gen_nb_int;n_size++) {
13920         mem_base = xmlMemBlocks();
13921         buffer = gen_const_char_ptr(n_buffer, 0);
13922         size = gen_int(n_size, 1);
13923         if ((buffer != NULL) &&
13924             (size > xmlStrlen(BAD_CAST buffer)))
13925             size = 0;
13926 
13927         ret_val = xmlParseMemory(buffer, size);
13928         desret_xmlDocPtr(ret_val);
13929         call_tests++;
13930         des_const_char_ptr(n_buffer, buffer, 0);
13931         des_int(n_size, size, 1);
13932         xmlResetLastError();
13933         if (mem_base != xmlMemBlocks()) {
13934             printf("Leak of %d blocks found in xmlParseMemory",
13935 	           xmlMemBlocks() - mem_base);
13936 	    test_ret++;
13937             printf(" %d", n_buffer);
13938             printf(" %d", n_size);
13939             printf("\n");
13940         }
13941     }
13942     }
13943     function_tests++;
13944 #endif
13945 #endif
13946 
13947     return(test_ret);
13948 }
13949 
13950 
13951 #define gen_nb_xmlParserNodeInfoPtr 1
13952 #define gen_xmlParserNodeInfoPtr(no, nr) NULL
13953 #define des_xmlParserNodeInfoPtr(no, val, nr)
13954 
13955 static int
test_xmlParserAddNodeInfo(void)13956 test_xmlParserAddNodeInfo(void) {
13957     int test_ret = 0;
13958 
13959     int mem_base;
13960     xmlParserCtxtPtr ctxt; /* an XML parser context */
13961     int n_ctxt;
13962     xmlParserNodeInfoPtr info; /* a node info sequence pointer */
13963     int n_info;
13964 
13965     for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13966     for (n_info = 0;n_info < gen_nb_xmlParserNodeInfoPtr;n_info++) {
13967         mem_base = xmlMemBlocks();
13968         ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
13969         info = gen_xmlParserNodeInfoPtr(n_info, 1);
13970 
13971         xmlParserAddNodeInfo(ctxt, info);
13972         call_tests++;
13973         des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
13974         des_xmlParserNodeInfoPtr(n_info, info, 1);
13975         xmlResetLastError();
13976         if (mem_base != xmlMemBlocks()) {
13977             printf("Leak of %d blocks found in xmlParserAddNodeInfo",
13978 	           xmlMemBlocks() - mem_base);
13979 	    test_ret++;
13980             printf(" %d", n_ctxt);
13981             printf(" %d", n_info);
13982             printf("\n");
13983         }
13984     }
13985     }
13986     function_tests++;
13987 
13988     return(test_ret);
13989 }
13990 
13991 
13992 static int
test_xmlParserFindNodeInfo(void)13993 test_xmlParserFindNodeInfo(void) {
13994     int test_ret = 0;
13995 
13996     int mem_base;
13997     const xmlParserNodeInfo * ret_val;
13998     xmlParserCtxtPtr ctx; /* an XML parser context */
13999     int n_ctx;
14000     xmlNodePtr node; /* an XML node within the tree */
14001     int n_node;
14002 
14003     for (n_ctx = 0;n_ctx < gen_nb_xmlParserCtxtPtr;n_ctx++) {
14004     for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
14005         mem_base = xmlMemBlocks();
14006         ctx = gen_xmlParserCtxtPtr(n_ctx, 0);
14007         node = gen_xmlNodePtr(n_node, 1);
14008 
14009         ret_val = xmlParserFindNodeInfo(ctx, node);
14010         desret_const_xmlParserNodeInfo_ptr(ret_val);
14011         call_tests++;
14012         des_xmlParserCtxtPtr(n_ctx, ctx, 0);
14013         des_xmlNodePtr(n_node, node, 1);
14014         xmlResetLastError();
14015         if (mem_base != xmlMemBlocks()) {
14016             printf("Leak of %d blocks found in xmlParserFindNodeInfo",
14017 	           xmlMemBlocks() - mem_base);
14018 	    test_ret++;
14019             printf(" %d", n_ctx);
14020             printf(" %d", n_node);
14021             printf("\n");
14022         }
14023     }
14024     }
14025     function_tests++;
14026 
14027     return(test_ret);
14028 }
14029 
14030 
14031 static int
test_xmlParserFindNodeInfoIndex(void)14032 test_xmlParserFindNodeInfoIndex(void) {
14033     int test_ret = 0;
14034 
14035     int mem_base;
14036     unsigned long ret_val;
14037     xmlParserNodeInfoSeqPtr seq; /* a node info sequence pointer */
14038     int n_seq;
14039     xmlNodePtr node; /* an XML node pointer */
14040     int n_node;
14041 
14042     for (n_seq = 0;n_seq < gen_nb_xmlParserNodeInfoSeqPtr;n_seq++) {
14043     for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
14044         mem_base = xmlMemBlocks();
14045         seq = gen_xmlParserNodeInfoSeqPtr(n_seq, 0);
14046         node = gen_xmlNodePtr(n_node, 1);
14047 
14048         ret_val = xmlParserFindNodeInfoIndex(seq, node);
14049         desret_unsigned_long(ret_val);
14050         call_tests++;
14051         des_xmlParserNodeInfoSeqPtr(n_seq, seq, 0);
14052         des_xmlNodePtr(n_node, node, 1);
14053         xmlResetLastError();
14054         if (mem_base != xmlMemBlocks()) {
14055             printf("Leak of %d blocks found in xmlParserFindNodeInfoIndex",
14056 	           xmlMemBlocks() - mem_base);
14057 	    test_ret++;
14058             printf(" %d", n_seq);
14059             printf(" %d", n_node);
14060             printf("\n");
14061         }
14062     }
14063     }
14064     function_tests++;
14065 
14066     return(test_ret);
14067 }
14068 
14069 
14070 static int
test_xmlParserInputGrow(void)14071 test_xmlParserInputGrow(void) {
14072     int test_ret = 0;
14073 
14074     int mem_base;
14075     int ret_val;
14076     xmlParserInputPtr in; /* an XML parser input */
14077     int n_in;
14078     int len; /* an indicative size for the lookahead */
14079     int n_len;
14080 
14081     for (n_in = 0;n_in < gen_nb_xmlParserInputPtr;n_in++) {
14082     for (n_len = 0;n_len < gen_nb_int;n_len++) {
14083         mem_base = xmlMemBlocks();
14084         in = gen_xmlParserInputPtr(n_in, 0);
14085         len = gen_int(n_len, 1);
14086 
14087         ret_val = xmlParserInputGrow(in, len);
14088         desret_int(ret_val);
14089         call_tests++;
14090         des_xmlParserInputPtr(n_in, in, 0);
14091         des_int(n_len, len, 1);
14092         xmlResetLastError();
14093         if (mem_base != xmlMemBlocks()) {
14094             printf("Leak of %d blocks found in xmlParserInputGrow",
14095 	           xmlMemBlocks() - mem_base);
14096 	    test_ret++;
14097             printf(" %d", n_in);
14098             printf(" %d", n_len);
14099             printf("\n");
14100         }
14101     }
14102     }
14103     function_tests++;
14104 
14105     return(test_ret);
14106 }
14107 
14108 
14109 static int
test_xmlParserInputRead(void)14110 test_xmlParserInputRead(void) {
14111     int test_ret = 0;
14112 
14113     int mem_base;
14114     int ret_val;
14115     xmlParserInputPtr in; /* an XML parser input */
14116     int n_in;
14117     int len; /* an indicative size for the lookahead */
14118     int n_len;
14119 
14120     for (n_in = 0;n_in < gen_nb_xmlParserInputPtr;n_in++) {
14121     for (n_len = 0;n_len < gen_nb_int;n_len++) {
14122         mem_base = xmlMemBlocks();
14123         in = gen_xmlParserInputPtr(n_in, 0);
14124         len = gen_int(n_len, 1);
14125 
14126         ret_val = xmlParserInputRead(in, len);
14127         desret_int(ret_val);
14128         call_tests++;
14129         des_xmlParserInputPtr(n_in, in, 0);
14130         des_int(n_len, len, 1);
14131         xmlResetLastError();
14132         if (mem_base != xmlMemBlocks()) {
14133             printf("Leak of %d blocks found in xmlParserInputRead",
14134 	           xmlMemBlocks() - mem_base);
14135 	    test_ret++;
14136             printf(" %d", n_in);
14137             printf(" %d", n_len);
14138             printf("\n");
14139         }
14140     }
14141     }
14142     function_tests++;
14143 
14144     return(test_ret);
14145 }
14146 
14147 
14148 static int
test_xmlPedanticParserDefault(void)14149 test_xmlPedanticParserDefault(void) {
14150     int test_ret = 0;
14151 
14152     int mem_base;
14153     int ret_val;
14154     int val; /* int 0 or 1 */
14155     int n_val;
14156 
14157     for (n_val = 0;n_val < gen_nb_int;n_val++) {
14158         mem_base = xmlMemBlocks();
14159         val = gen_int(n_val, 0);
14160 
14161         ret_val = xmlPedanticParserDefault(val);
14162         desret_int(ret_val);
14163         call_tests++;
14164         des_int(n_val, val, 0);
14165         xmlResetLastError();
14166         if (mem_base != xmlMemBlocks()) {
14167             printf("Leak of %d blocks found in xmlPedanticParserDefault",
14168 	           xmlMemBlocks() - mem_base);
14169 	    test_ret++;
14170             printf(" %d", n_val);
14171             printf("\n");
14172         }
14173     }
14174     function_tests++;
14175 
14176     return(test_ret);
14177 }
14178 
14179 
14180 static int
test_xmlReadDoc(void)14181 test_xmlReadDoc(void) {
14182     int test_ret = 0;
14183 
14184     int mem_base;
14185     xmlDocPtr ret_val;
14186     const xmlChar * cur; /* a pointer to a zero terminated string */
14187     int n_cur;
14188     const char * URL; /* base URL (optional) */
14189     int n_URL;
14190     const char * encoding; /* the document encoding (optional) */
14191     int n_encoding;
14192     int options; /* a combination of xmlParserOption */
14193     int n_options;
14194 
14195     for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
14196     for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
14197     for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
14198     for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
14199         mem_base = xmlMemBlocks();
14200         cur = gen_const_xmlChar_ptr(n_cur, 0);
14201         URL = gen_filepath(n_URL, 1);
14202         encoding = gen_const_char_ptr(n_encoding, 2);
14203         options = gen_parseroptions(n_options, 3);
14204 
14205         ret_val = xmlReadDoc(cur, URL, encoding, options);
14206         desret_xmlDocPtr(ret_val);
14207         call_tests++;
14208         des_const_xmlChar_ptr(n_cur, cur, 0);
14209         des_filepath(n_URL, URL, 1);
14210         des_const_char_ptr(n_encoding, encoding, 2);
14211         des_parseroptions(n_options, options, 3);
14212         xmlResetLastError();
14213         if (mem_base != xmlMemBlocks()) {
14214             printf("Leak of %d blocks found in xmlReadDoc",
14215 	           xmlMemBlocks() - mem_base);
14216 	    test_ret++;
14217             printf(" %d", n_cur);
14218             printf(" %d", n_URL);
14219             printf(" %d", n_encoding);
14220             printf(" %d", n_options);
14221             printf("\n");
14222         }
14223     }
14224     }
14225     }
14226     }
14227     function_tests++;
14228 
14229     return(test_ret);
14230 }
14231 
14232 
14233 static int
test_xmlReadFile(void)14234 test_xmlReadFile(void) {
14235     int test_ret = 0;
14236 
14237     int mem_base;
14238     xmlDocPtr ret_val;
14239     const char * filename; /* a file or URL */
14240     int n_filename;
14241     const char * encoding; /* the document encoding (optional) */
14242     int n_encoding;
14243     int options; /* a combination of xmlParserOption */
14244     int n_options;
14245 
14246     for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14247     for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
14248     for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
14249         mem_base = xmlMemBlocks();
14250         filename = gen_filepath(n_filename, 0);
14251         encoding = gen_const_char_ptr(n_encoding, 1);
14252         options = gen_parseroptions(n_options, 2);
14253 
14254         ret_val = xmlReadFile(filename, encoding, options);
14255         desret_xmlDocPtr(ret_val);
14256         call_tests++;
14257         des_filepath(n_filename, filename, 0);
14258         des_const_char_ptr(n_encoding, encoding, 1);
14259         des_parseroptions(n_options, options, 2);
14260         xmlResetLastError();
14261         if (mem_base != xmlMemBlocks()) {
14262             printf("Leak of %d blocks found in xmlReadFile",
14263 	           xmlMemBlocks() - mem_base);
14264 	    test_ret++;
14265             printf(" %d", n_filename);
14266             printf(" %d", n_encoding);
14267             printf(" %d", n_options);
14268             printf("\n");
14269         }
14270     }
14271     }
14272     }
14273     function_tests++;
14274 
14275     return(test_ret);
14276 }
14277 
14278 
14279 static int
test_xmlReadMemory(void)14280 test_xmlReadMemory(void) {
14281     int test_ret = 0;
14282 
14283     int mem_base;
14284     xmlDocPtr ret_val;
14285     const char * buffer; /* a pointer to a char array */
14286     int n_buffer;
14287     int size; /* the size of the array */
14288     int n_size;
14289     const char * url; /* base URL (optional) */
14290     int n_url;
14291     const char * encoding; /* the document encoding (optional) */
14292     int n_encoding;
14293     int options; /* a combination of xmlParserOption */
14294     int n_options;
14295 
14296     for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14297     for (n_size = 0;n_size < gen_nb_int;n_size++) {
14298     for (n_url = 0;n_url < gen_nb_filepath;n_url++) {
14299     for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
14300     for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
14301         mem_base = xmlMemBlocks();
14302         buffer = gen_const_char_ptr(n_buffer, 0);
14303         size = gen_int(n_size, 1);
14304         url = gen_filepath(n_url, 2);
14305         encoding = gen_const_char_ptr(n_encoding, 3);
14306         options = gen_parseroptions(n_options, 4);
14307         if ((buffer != NULL) &&
14308             (size > xmlStrlen(BAD_CAST buffer)))
14309             size = 0;
14310 
14311         ret_val = xmlReadMemory(buffer, size, url, encoding, options);
14312         desret_xmlDocPtr(ret_val);
14313         call_tests++;
14314         des_const_char_ptr(n_buffer, buffer, 0);
14315         des_int(n_size, size, 1);
14316         des_filepath(n_url, url, 2);
14317         des_const_char_ptr(n_encoding, encoding, 3);
14318         des_parseroptions(n_options, options, 4);
14319         xmlResetLastError();
14320         if (mem_base != xmlMemBlocks()) {
14321             printf("Leak of %d blocks found in xmlReadMemory",
14322 	           xmlMemBlocks() - mem_base);
14323 	    test_ret++;
14324             printf(" %d", n_buffer);
14325             printf(" %d", n_size);
14326             printf(" %d", n_url);
14327             printf(" %d", n_encoding);
14328             printf(" %d", n_options);
14329             printf("\n");
14330         }
14331     }
14332     }
14333     }
14334     }
14335     }
14336     function_tests++;
14337 
14338     return(test_ret);
14339 }
14340 
14341 
14342 static int
test_xmlRecoverDoc(void)14343 test_xmlRecoverDoc(void) {
14344     int test_ret = 0;
14345 
14346 #if defined(LIBXML_SAX1_ENABLED)
14347 #ifdef LIBXML_SAX1_ENABLED
14348     int mem_base;
14349     xmlDocPtr ret_val;
14350     const xmlChar * cur; /* a pointer to an array of xmlChar */
14351     int n_cur;
14352 
14353     for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
14354         mem_base = xmlMemBlocks();
14355         cur = gen_const_xmlChar_ptr(n_cur, 0);
14356 
14357         ret_val = xmlRecoverDoc(cur);
14358         desret_xmlDocPtr(ret_val);
14359         call_tests++;
14360         des_const_xmlChar_ptr(n_cur, cur, 0);
14361         xmlResetLastError();
14362         if (mem_base != xmlMemBlocks()) {
14363             printf("Leak of %d blocks found in xmlRecoverDoc",
14364 	           xmlMemBlocks() - mem_base);
14365 	    test_ret++;
14366             printf(" %d", n_cur);
14367             printf("\n");
14368         }
14369     }
14370     function_tests++;
14371 #endif
14372 #endif
14373 
14374     return(test_ret);
14375 }
14376 
14377 
14378 static int
test_xmlRecoverFile(void)14379 test_xmlRecoverFile(void) {
14380     int test_ret = 0;
14381 
14382 #if defined(LIBXML_SAX1_ENABLED)
14383 #ifdef LIBXML_SAX1_ENABLED
14384     int mem_base;
14385     xmlDocPtr ret_val;
14386     const char * filename; /* the filename */
14387     int n_filename;
14388 
14389     for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14390         mem_base = xmlMemBlocks();
14391         filename = gen_filepath(n_filename, 0);
14392 
14393         ret_val = xmlRecoverFile(filename);
14394         desret_xmlDocPtr(ret_val);
14395         call_tests++;
14396         des_filepath(n_filename, filename, 0);
14397         xmlResetLastError();
14398         if (mem_base != xmlMemBlocks()) {
14399             printf("Leak of %d blocks found in xmlRecoverFile",
14400 	           xmlMemBlocks() - mem_base);
14401 	    test_ret++;
14402             printf(" %d", n_filename);
14403             printf("\n");
14404         }
14405     }
14406     function_tests++;
14407 #endif
14408 #endif
14409 
14410     return(test_ret);
14411 }
14412 
14413 
14414 static int
test_xmlRecoverMemory(void)14415 test_xmlRecoverMemory(void) {
14416     int test_ret = 0;
14417 
14418 #if defined(LIBXML_SAX1_ENABLED)
14419 #ifdef LIBXML_SAX1_ENABLED
14420     int mem_base;
14421     xmlDocPtr ret_val;
14422     const char * buffer; /* an pointer to a char array */
14423     int n_buffer;
14424     int size; /* the size of the array */
14425     int n_size;
14426 
14427     for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14428     for (n_size = 0;n_size < gen_nb_int;n_size++) {
14429         mem_base = xmlMemBlocks();
14430         buffer = gen_const_char_ptr(n_buffer, 0);
14431         size = gen_int(n_size, 1);
14432         if ((buffer != NULL) &&
14433             (size > xmlStrlen(BAD_CAST buffer)))
14434             size = 0;
14435 
14436         ret_val = xmlRecoverMemory(buffer, size);
14437         desret_xmlDocPtr(ret_val);
14438         call_tests++;
14439         des_const_char_ptr(n_buffer, buffer, 0);
14440         des_int(n_size, size, 1);
14441         xmlResetLastError();
14442         if (mem_base != xmlMemBlocks()) {
14443             printf("Leak of %d blocks found in xmlRecoverMemory",
14444 	           xmlMemBlocks() - mem_base);
14445 	    test_ret++;
14446             printf(" %d", n_buffer);
14447             printf(" %d", n_size);
14448             printf("\n");
14449         }
14450     }
14451     }
14452     function_tests++;
14453 #endif
14454 #endif
14455 
14456     return(test_ret);
14457 }
14458 
14459 
14460 static int
test_xmlSAXParseDTD(void)14461 test_xmlSAXParseDTD(void) {
14462     int test_ret = 0;
14463 
14464 #if defined(LIBXML_VALID_ENABLED)
14465 #ifdef LIBXML_SAX1_ENABLED
14466     int mem_base;
14467     xmlDtdPtr ret_val;
14468     xmlSAXHandlerPtr sax; /* the SAX handler block */
14469     int n_sax;
14470     const xmlChar * ExternalID; /* a NAME* containing the External ID of the DTD */
14471     int n_ExternalID;
14472     const xmlChar * SystemID; /* a NAME* containing the URL to the DTD */
14473     int n_SystemID;
14474 
14475     for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14476     for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
14477     for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
14478         mem_base = xmlMemBlocks();
14479         sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14480         ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 1);
14481         SystemID = gen_const_xmlChar_ptr(n_SystemID, 2);
14482 
14483         ret_val = xmlSAXParseDTD(sax, ExternalID, SystemID);
14484         desret_xmlDtdPtr(ret_val);
14485         call_tests++;
14486         des_xmlSAXHandlerPtr(n_sax, sax, 0);
14487         des_const_xmlChar_ptr(n_ExternalID, ExternalID, 1);
14488         des_const_xmlChar_ptr(n_SystemID, SystemID, 2);
14489         xmlResetLastError();
14490         if (mem_base != xmlMemBlocks()) {
14491             printf("Leak of %d blocks found in xmlSAXParseDTD",
14492 	           xmlMemBlocks() - mem_base);
14493 	    test_ret++;
14494             printf(" %d", n_sax);
14495             printf(" %d", n_ExternalID);
14496             printf(" %d", n_SystemID);
14497             printf("\n");
14498         }
14499     }
14500     }
14501     }
14502     function_tests++;
14503 #endif
14504 #endif
14505 
14506     return(test_ret);
14507 }
14508 
14509 
14510 static int
test_xmlSAXParseDoc(void)14511 test_xmlSAXParseDoc(void) {
14512     int test_ret = 0;
14513 
14514 #if defined(LIBXML_SAX1_ENABLED)
14515 #ifdef LIBXML_SAX1_ENABLED
14516     int mem_base;
14517     xmlDocPtr ret_val;
14518     xmlSAXHandlerPtr sax; /* the SAX handler block */
14519     int n_sax;
14520     const xmlChar * cur; /* a pointer to an array of xmlChar */
14521     int n_cur;
14522     int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */
14523     int n_recovery;
14524 
14525     for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14526     for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
14527     for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14528         mem_base = xmlMemBlocks();
14529         sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14530         cur = gen_const_xmlChar_ptr(n_cur, 1);
14531         recovery = gen_int(n_recovery, 2);
14532 
14533         ret_val = xmlSAXParseDoc(sax, cur, recovery);
14534         desret_xmlDocPtr(ret_val);
14535         call_tests++;
14536         des_xmlSAXHandlerPtr(n_sax, sax, 0);
14537         des_const_xmlChar_ptr(n_cur, cur, 1);
14538         des_int(n_recovery, recovery, 2);
14539         xmlResetLastError();
14540         if (mem_base != xmlMemBlocks()) {
14541             printf("Leak of %d blocks found in xmlSAXParseDoc",
14542 	           xmlMemBlocks() - mem_base);
14543 	    test_ret++;
14544             printf(" %d", n_sax);
14545             printf(" %d", n_cur);
14546             printf(" %d", n_recovery);
14547             printf("\n");
14548         }
14549     }
14550     }
14551     }
14552     function_tests++;
14553 #endif
14554 #endif
14555 
14556     return(test_ret);
14557 }
14558 
14559 
14560 static int
test_xmlSAXParseEntity(void)14561 test_xmlSAXParseEntity(void) {
14562     int test_ret = 0;
14563 
14564 #if defined(LIBXML_SAX1_ENABLED)
14565 #ifdef LIBXML_SAX1_ENABLED
14566     int mem_base;
14567     xmlDocPtr ret_val;
14568     xmlSAXHandlerPtr sax; /* the SAX handler block */
14569     int n_sax;
14570     const char * filename; /* the filename */
14571     int n_filename;
14572 
14573     for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14574     for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14575         mem_base = xmlMemBlocks();
14576         sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14577         filename = gen_filepath(n_filename, 1);
14578 
14579         ret_val = xmlSAXParseEntity(sax, filename);
14580         desret_xmlDocPtr(ret_val);
14581         call_tests++;
14582         des_xmlSAXHandlerPtr(n_sax, sax, 0);
14583         des_filepath(n_filename, filename, 1);
14584         xmlResetLastError();
14585         if (mem_base != xmlMemBlocks()) {
14586             printf("Leak of %d blocks found in xmlSAXParseEntity",
14587 	           xmlMemBlocks() - mem_base);
14588 	    test_ret++;
14589             printf(" %d", n_sax);
14590             printf(" %d", n_filename);
14591             printf("\n");
14592         }
14593     }
14594     }
14595     function_tests++;
14596 #endif
14597 #endif
14598 
14599     return(test_ret);
14600 }
14601 
14602 
14603 static int
test_xmlSAXParseFile(void)14604 test_xmlSAXParseFile(void) {
14605     int test_ret = 0;
14606 
14607 #if defined(LIBXML_SAX1_ENABLED)
14608 #ifdef LIBXML_SAX1_ENABLED
14609     int mem_base;
14610     xmlDocPtr ret_val;
14611     xmlSAXHandlerPtr sax; /* the SAX handler block */
14612     int n_sax;
14613     const char * filename; /* the filename */
14614     int n_filename;
14615     int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */
14616     int n_recovery;
14617 
14618     for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14619     for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14620     for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14621         mem_base = xmlMemBlocks();
14622         sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14623         filename = gen_filepath(n_filename, 1);
14624         recovery = gen_int(n_recovery, 2);
14625 
14626         ret_val = xmlSAXParseFile(sax, filename, recovery);
14627         desret_xmlDocPtr(ret_val);
14628         call_tests++;
14629         des_xmlSAXHandlerPtr(n_sax, sax, 0);
14630         des_filepath(n_filename, filename, 1);
14631         des_int(n_recovery, recovery, 2);
14632         xmlResetLastError();
14633         if (mem_base != xmlMemBlocks()) {
14634             printf("Leak of %d blocks found in xmlSAXParseFile",
14635 	           xmlMemBlocks() - mem_base);
14636 	    test_ret++;
14637             printf(" %d", n_sax);
14638             printf(" %d", n_filename);
14639             printf(" %d", n_recovery);
14640             printf("\n");
14641         }
14642     }
14643     }
14644     }
14645     function_tests++;
14646 #endif
14647 #endif
14648 
14649     return(test_ret);
14650 }
14651 
14652 
14653 static int
test_xmlSAXParseFileWithData(void)14654 test_xmlSAXParseFileWithData(void) {
14655     int test_ret = 0;
14656 
14657 #if defined(LIBXML_SAX1_ENABLED)
14658 #ifdef LIBXML_SAX1_ENABLED
14659     int mem_base;
14660     xmlDocPtr ret_val;
14661     xmlSAXHandlerPtr sax; /* the SAX handler block */
14662     int n_sax;
14663     const char * filename; /* the filename */
14664     int n_filename;
14665     int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */
14666     int n_recovery;
14667     void * data; /* the userdata */
14668     int n_data;
14669 
14670     for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14671     for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14672     for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14673     for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
14674         mem_base = xmlMemBlocks();
14675         sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14676         filename = gen_filepath(n_filename, 1);
14677         recovery = gen_int(n_recovery, 2);
14678         data = gen_userdata(n_data, 3);
14679 
14680         ret_val = xmlSAXParseFileWithData(sax, filename, recovery, data);
14681         desret_xmlDocPtr(ret_val);
14682         call_tests++;
14683         des_xmlSAXHandlerPtr(n_sax, sax, 0);
14684         des_filepath(n_filename, filename, 1);
14685         des_int(n_recovery, recovery, 2);
14686         des_userdata(n_data, data, 3);
14687         xmlResetLastError();
14688         if (mem_base != xmlMemBlocks()) {
14689             printf("Leak of %d blocks found in xmlSAXParseFileWithData",
14690 	           xmlMemBlocks() - mem_base);
14691 	    test_ret++;
14692             printf(" %d", n_sax);
14693             printf(" %d", n_filename);
14694             printf(" %d", n_recovery);
14695             printf(" %d", n_data);
14696             printf("\n");
14697         }
14698     }
14699     }
14700     }
14701     }
14702     function_tests++;
14703 #endif
14704 #endif
14705 
14706     return(test_ret);
14707 }
14708 
14709 
14710 static int
test_xmlSAXParseMemory(void)14711 test_xmlSAXParseMemory(void) {
14712     int test_ret = 0;
14713 
14714 #if defined(LIBXML_SAX1_ENABLED)
14715 #ifdef LIBXML_SAX1_ENABLED
14716     int mem_base;
14717     xmlDocPtr ret_val;
14718     xmlSAXHandlerPtr sax; /* the SAX handler block */
14719     int n_sax;
14720     const char * buffer; /* an pointer to a char array */
14721     int n_buffer;
14722     int size; /* the size of the array */
14723     int n_size;
14724     int recovery; /* work in recovery mode, i.e. tries to read not Well Formed documents */
14725     int n_recovery;
14726 
14727     for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14728     for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14729     for (n_size = 0;n_size < gen_nb_int;n_size++) {
14730     for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14731         mem_base = xmlMemBlocks();
14732         sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14733         buffer = gen_const_char_ptr(n_buffer, 1);
14734         size = gen_int(n_size, 2);
14735         recovery = gen_int(n_recovery, 3);
14736         if ((buffer != NULL) &&
14737             (size > xmlStrlen(BAD_CAST buffer)))
14738             size = 0;
14739 
14740         ret_val = xmlSAXParseMemory(sax, buffer, size, recovery);
14741         desret_xmlDocPtr(ret_val);
14742         call_tests++;
14743         des_xmlSAXHandlerPtr(n_sax, sax, 0);
14744         des_const_char_ptr(n_buffer, buffer, 1);
14745         des_int(n_size, size, 2);
14746         des_int(n_recovery, recovery, 3);
14747         xmlResetLastError();
14748         if (mem_base != xmlMemBlocks()) {
14749             printf("Leak of %d blocks found in xmlSAXParseMemory",
14750 	           xmlMemBlocks() - mem_base);
14751 	    test_ret++;
14752             printf(" %d", n_sax);
14753             printf(" %d", n_buffer);
14754             printf(" %d", n_size);
14755             printf(" %d", n_recovery);
14756             printf("\n");
14757         }
14758     }
14759     }
14760     }
14761     }
14762     function_tests++;
14763 #endif
14764 #endif
14765 
14766     return(test_ret);
14767 }
14768 
14769 
14770 static int
test_xmlSAXParseMemoryWithData(void)14771 test_xmlSAXParseMemoryWithData(void) {
14772     int test_ret = 0;
14773 
14774 #if defined(LIBXML_SAX1_ENABLED)
14775 #ifdef LIBXML_SAX1_ENABLED
14776     int mem_base;
14777     xmlDocPtr ret_val;
14778     xmlSAXHandlerPtr sax; /* the SAX handler block */
14779     int n_sax;
14780     const char * buffer; /* an pointer to a char array */
14781     int n_buffer;
14782     int size; /* the size of the array */
14783     int n_size;
14784     int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */
14785     int n_recovery;
14786     void * data; /* the userdata */
14787     int n_data;
14788 
14789     for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14790     for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14791     for (n_size = 0;n_size < gen_nb_int;n_size++) {
14792     for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14793     for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
14794         mem_base = xmlMemBlocks();
14795         sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14796         buffer = gen_const_char_ptr(n_buffer, 1);
14797         size = gen_int(n_size, 2);
14798         recovery = gen_int(n_recovery, 3);
14799         data = gen_userdata(n_data, 4);
14800         if ((buffer != NULL) &&
14801             (size > xmlStrlen(BAD_CAST buffer)))
14802             size = 0;
14803 
14804         ret_val = xmlSAXParseMemoryWithData(sax, buffer, size, recovery, data);
14805         desret_xmlDocPtr(ret_val);
14806         call_tests++;
14807         des_xmlSAXHandlerPtr(n_sax, sax, 0);
14808         des_const_char_ptr(n_buffer, buffer, 1);
14809         des_int(n_size, size, 2);
14810         des_int(n_recovery, recovery, 3);
14811         des_userdata(n_data, data, 4);
14812         xmlResetLastError();
14813         if (mem_base != xmlMemBlocks()) {
14814             printf("Leak of %d blocks found in xmlSAXParseMemoryWithData",
14815 	           xmlMemBlocks() - mem_base);
14816 	    test_ret++;
14817             printf(" %d", n_sax);
14818             printf(" %d", n_buffer);
14819             printf(" %d", n_size);
14820             printf(" %d", n_recovery);
14821             printf(" %d", n_data);
14822             printf("\n");
14823         }
14824     }
14825     }
14826     }
14827     }
14828     }
14829     function_tests++;
14830 #endif
14831 #endif
14832 
14833     return(test_ret);
14834 }
14835 
14836 
14837 static int
test_xmlSAXUserParseFile(void)14838 test_xmlSAXUserParseFile(void) {
14839     int test_ret = 0;
14840 
14841 #if defined(LIBXML_SAX1_ENABLED)
14842 #ifdef LIBXML_SAX1_ENABLED
14843     int mem_base;
14844     int ret_val;
14845     xmlSAXHandlerPtr sax; /* a SAX handler */
14846     int n_sax;
14847     void * user_data; /* The user data returned on SAX callbacks */
14848     int n_user_data;
14849     const char * filename; /* a file name */
14850     int n_filename;
14851 
14852     for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14853     for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
14854     for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14855         mem_base = xmlMemBlocks();
14856         sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14857         user_data = gen_userdata(n_user_data, 1);
14858         filename = gen_filepath(n_filename, 2);
14859 
14860 #ifdef LIBXML_SAX1_ENABLED
14861         if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
14862 #endif
14863 
14864 
14865         ret_val = xmlSAXUserParseFile(sax, user_data, filename);
14866         desret_int(ret_val);
14867         call_tests++;
14868         des_xmlSAXHandlerPtr(n_sax, sax, 0);
14869         des_userdata(n_user_data, user_data, 1);
14870         des_filepath(n_filename, filename, 2);
14871         xmlResetLastError();
14872         if (mem_base != xmlMemBlocks()) {
14873             printf("Leak of %d blocks found in xmlSAXUserParseFile",
14874 	           xmlMemBlocks() - mem_base);
14875 	    test_ret++;
14876             printf(" %d", n_sax);
14877             printf(" %d", n_user_data);
14878             printf(" %d", n_filename);
14879             printf("\n");
14880         }
14881     }
14882     }
14883     }
14884     function_tests++;
14885 #endif
14886 #endif
14887 
14888     return(test_ret);
14889 }
14890 
14891 
14892 static int
test_xmlSAXUserParseMemory(void)14893 test_xmlSAXUserParseMemory(void) {
14894     int test_ret = 0;
14895 
14896 #if defined(LIBXML_SAX1_ENABLED)
14897 #ifdef LIBXML_SAX1_ENABLED
14898     int mem_base;
14899     int ret_val;
14900     xmlSAXHandlerPtr sax; /* a SAX handler */
14901     int n_sax;
14902     void * user_data; /* The user data returned on SAX callbacks */
14903     int n_user_data;
14904     const char * buffer; /* an in-memory XML document input */
14905     int n_buffer;
14906     int size; /* the length of the XML document in bytes */
14907     int n_size;
14908 
14909     for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14910     for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
14911     for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14912     for (n_size = 0;n_size < gen_nb_int;n_size++) {
14913         mem_base = xmlMemBlocks();
14914         sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14915         user_data = gen_userdata(n_user_data, 1);
14916         buffer = gen_const_char_ptr(n_buffer, 2);
14917         size = gen_int(n_size, 3);
14918         if ((buffer != NULL) &&
14919             (size > xmlStrlen(BAD_CAST buffer)))
14920             size = 0;
14921 
14922 #ifdef LIBXML_SAX1_ENABLED
14923         if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
14924 #endif
14925 
14926 
14927         ret_val = xmlSAXUserParseMemory(sax, user_data, buffer, size);
14928         desret_int(ret_val);
14929         call_tests++;
14930         des_xmlSAXHandlerPtr(n_sax, sax, 0);
14931         des_userdata(n_user_data, user_data, 1);
14932         des_const_char_ptr(n_buffer, buffer, 2);
14933         des_int(n_size, size, 3);
14934         xmlResetLastError();
14935         if (mem_base != xmlMemBlocks()) {
14936             printf("Leak of %d blocks found in xmlSAXUserParseMemory",
14937 	           xmlMemBlocks() - mem_base);
14938 	    test_ret++;
14939             printf(" %d", n_sax);
14940             printf(" %d", n_user_data);
14941             printf(" %d", n_buffer);
14942             printf(" %d", n_size);
14943             printf("\n");
14944         }
14945     }
14946     }
14947     }
14948     }
14949     function_tests++;
14950 #endif
14951 #endif
14952 
14953     return(test_ret);
14954 }
14955 
14956 
14957 static int
test_xmlSetExternalEntityLoader(void)14958 test_xmlSetExternalEntityLoader(void) {
14959     int test_ret = 0;
14960 
14961 
14962     /* missing type support */
14963     return(test_ret);
14964 }
14965 
14966 
14967 static int
test_xmlSetupParserForBuffer(void)14968 test_xmlSetupParserForBuffer(void) {
14969     int test_ret = 0;
14970 
14971 #if defined(LIBXML_SAX1_ENABLED)
14972 #ifdef LIBXML_SAX1_ENABLED
14973     int mem_base;
14974     xmlParserCtxtPtr ctxt; /* an XML parser context */
14975     int n_ctxt;
14976     const xmlChar * buffer; /* a xmlChar * buffer */
14977     int n_buffer;
14978     const char * filename; /* a file name */
14979     int n_filename;
14980 
14981     for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
14982     for (n_buffer = 0;n_buffer < gen_nb_const_xmlChar_ptr;n_buffer++) {
14983     for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14984         mem_base = xmlMemBlocks();
14985         ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
14986         buffer = gen_const_xmlChar_ptr(n_buffer, 1);
14987         filename = gen_filepath(n_filename, 2);
14988 
14989         xmlSetupParserForBuffer(ctxt, buffer, filename);
14990         call_tests++;
14991         des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
14992         des_const_xmlChar_ptr(n_buffer, buffer, 1);
14993         des_filepath(n_filename, filename, 2);
14994         xmlResetLastError();
14995         if (mem_base != xmlMemBlocks()) {
14996             printf("Leak of %d blocks found in xmlSetupParserForBuffer",
14997 	           xmlMemBlocks() - mem_base);
14998 	    test_ret++;
14999             printf(" %d", n_ctxt);
15000             printf(" %d", n_buffer);
15001             printf(" %d", n_filename);
15002             printf("\n");
15003         }
15004     }
15005     }
15006     }
15007     function_tests++;
15008 #endif
15009 #endif
15010 
15011     return(test_ret);
15012 }
15013 
15014 
15015 static int
test_xmlStopParser(void)15016 test_xmlStopParser(void) {
15017     int test_ret = 0;
15018 
15019 #ifdef LIBXML_PUSH_ENABLED
15020     int mem_base;
15021     xmlParserCtxtPtr ctxt; /* an XML parser context */
15022     int n_ctxt;
15023 
15024     for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15025         mem_base = xmlMemBlocks();
15026         ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15027 
15028         xmlStopParser(ctxt);
15029         call_tests++;
15030         des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15031         xmlResetLastError();
15032         if (mem_base != xmlMemBlocks()) {
15033             printf("Leak of %d blocks found in xmlStopParser",
15034 	           xmlMemBlocks() - mem_base);
15035 	    test_ret++;
15036             printf(" %d", n_ctxt);
15037             printf("\n");
15038         }
15039     }
15040     function_tests++;
15041 #endif
15042 
15043     return(test_ret);
15044 }
15045 
15046 
15047 static int
test_xmlSubstituteEntitiesDefault(void)15048 test_xmlSubstituteEntitiesDefault(void) {
15049     int test_ret = 0;
15050 
15051     int mem_base;
15052     int ret_val;
15053     int val; /* int 0 or 1 */
15054     int n_val;
15055 
15056     for (n_val = 0;n_val < gen_nb_int;n_val++) {
15057         mem_base = xmlMemBlocks();
15058         val = gen_int(n_val, 0);
15059 
15060         ret_val = xmlSubstituteEntitiesDefault(val);
15061         desret_int(ret_val);
15062         call_tests++;
15063         des_int(n_val, val, 0);
15064         xmlResetLastError();
15065         if (mem_base != xmlMemBlocks()) {
15066             printf("Leak of %d blocks found in xmlSubstituteEntitiesDefault",
15067 	           xmlMemBlocks() - mem_base);
15068 	    test_ret++;
15069             printf(" %d", n_val);
15070             printf("\n");
15071         }
15072     }
15073     function_tests++;
15074 
15075     return(test_ret);
15076 }
15077 
15078 
15079 static int
test_xmlThrDefDoValidityCheckingDefaultValue(void)15080 test_xmlThrDefDoValidityCheckingDefaultValue(void) {
15081     int test_ret = 0;
15082 
15083     int mem_base;
15084     int ret_val;
15085     int v; /*  */
15086     int n_v;
15087 
15088     for (n_v = 0;n_v < gen_nb_int;n_v++) {
15089         mem_base = xmlMemBlocks();
15090         v = gen_int(n_v, 0);
15091 
15092         ret_val = xmlThrDefDoValidityCheckingDefaultValue(v);
15093         desret_int(ret_val);
15094         call_tests++;
15095         des_int(n_v, v, 0);
15096         xmlResetLastError();
15097         if (mem_base != xmlMemBlocks()) {
15098             printf("Leak of %d blocks found in xmlThrDefDoValidityCheckingDefaultValue",
15099 	           xmlMemBlocks() - mem_base);
15100 	    test_ret++;
15101             printf(" %d", n_v);
15102             printf("\n");
15103         }
15104     }
15105     function_tests++;
15106 
15107     return(test_ret);
15108 }
15109 
15110 
15111 static int
test_xmlThrDefGetWarningsDefaultValue(void)15112 test_xmlThrDefGetWarningsDefaultValue(void) {
15113     int test_ret = 0;
15114 
15115     int mem_base;
15116     int ret_val;
15117     int v; /*  */
15118     int n_v;
15119 
15120     for (n_v = 0;n_v < gen_nb_int;n_v++) {
15121         mem_base = xmlMemBlocks();
15122         v = gen_int(n_v, 0);
15123 
15124         ret_val = xmlThrDefGetWarningsDefaultValue(v);
15125         desret_int(ret_val);
15126         call_tests++;
15127         des_int(n_v, v, 0);
15128         xmlResetLastError();
15129         if (mem_base != xmlMemBlocks()) {
15130             printf("Leak of %d blocks found in xmlThrDefGetWarningsDefaultValue",
15131 	           xmlMemBlocks() - mem_base);
15132 	    test_ret++;
15133             printf(" %d", n_v);
15134             printf("\n");
15135         }
15136     }
15137     function_tests++;
15138 
15139     return(test_ret);
15140 }
15141 
15142 
15143 static int
test_xmlThrDefKeepBlanksDefaultValue(void)15144 test_xmlThrDefKeepBlanksDefaultValue(void) {
15145     int test_ret = 0;
15146 
15147     int mem_base;
15148     int ret_val;
15149     int v; /*  */
15150     int n_v;
15151 
15152     for (n_v = 0;n_v < gen_nb_int;n_v++) {
15153         mem_base = xmlMemBlocks();
15154         v = gen_int(n_v, 0);
15155 
15156         ret_val = xmlThrDefKeepBlanksDefaultValue(v);
15157         desret_int(ret_val);
15158         call_tests++;
15159         des_int(n_v, v, 0);
15160         xmlResetLastError();
15161         if (mem_base != xmlMemBlocks()) {
15162             printf("Leak of %d blocks found in xmlThrDefKeepBlanksDefaultValue",
15163 	           xmlMemBlocks() - mem_base);
15164 	    test_ret++;
15165             printf(" %d", n_v);
15166             printf("\n");
15167         }
15168     }
15169     function_tests++;
15170 
15171     return(test_ret);
15172 }
15173 
15174 
15175 static int
test_xmlThrDefLineNumbersDefaultValue(void)15176 test_xmlThrDefLineNumbersDefaultValue(void) {
15177     int test_ret = 0;
15178 
15179     int mem_base;
15180     int ret_val;
15181     int v; /*  */
15182     int n_v;
15183 
15184     for (n_v = 0;n_v < gen_nb_int;n_v++) {
15185         mem_base = xmlMemBlocks();
15186         v = gen_int(n_v, 0);
15187 
15188         ret_val = xmlThrDefLineNumbersDefaultValue(v);
15189         desret_int(ret_val);
15190         call_tests++;
15191         des_int(n_v, v, 0);
15192         xmlResetLastError();
15193         if (mem_base != xmlMemBlocks()) {
15194             printf("Leak of %d blocks found in xmlThrDefLineNumbersDefaultValue",
15195 	           xmlMemBlocks() - mem_base);
15196 	    test_ret++;
15197             printf(" %d", n_v);
15198             printf("\n");
15199         }
15200     }
15201     function_tests++;
15202 
15203     return(test_ret);
15204 }
15205 
15206 
15207 static int
test_xmlThrDefLoadExtDtdDefaultValue(void)15208 test_xmlThrDefLoadExtDtdDefaultValue(void) {
15209     int test_ret = 0;
15210 
15211     int mem_base;
15212     int ret_val;
15213     int v; /*  */
15214     int n_v;
15215 
15216     for (n_v = 0;n_v < gen_nb_int;n_v++) {
15217         mem_base = xmlMemBlocks();
15218         v = gen_int(n_v, 0);
15219 
15220         ret_val = xmlThrDefLoadExtDtdDefaultValue(v);
15221         desret_int(ret_val);
15222         call_tests++;
15223         des_int(n_v, v, 0);
15224         xmlResetLastError();
15225         if (mem_base != xmlMemBlocks()) {
15226             printf("Leak of %d blocks found in xmlThrDefLoadExtDtdDefaultValue",
15227 	           xmlMemBlocks() - mem_base);
15228 	    test_ret++;
15229             printf(" %d", n_v);
15230             printf("\n");
15231         }
15232     }
15233     function_tests++;
15234 
15235     return(test_ret);
15236 }
15237 
15238 
15239 static int
test_xmlThrDefParserDebugEntities(void)15240 test_xmlThrDefParserDebugEntities(void) {
15241     int test_ret = 0;
15242 
15243     int mem_base;
15244     int ret_val;
15245     int v; /*  */
15246     int n_v;
15247 
15248     for (n_v = 0;n_v < gen_nb_int;n_v++) {
15249         mem_base = xmlMemBlocks();
15250         v = gen_int(n_v, 0);
15251 
15252         ret_val = xmlThrDefParserDebugEntities(v);
15253         desret_int(ret_val);
15254         call_tests++;
15255         des_int(n_v, v, 0);
15256         xmlResetLastError();
15257         if (mem_base != xmlMemBlocks()) {
15258             printf("Leak of %d blocks found in xmlThrDefParserDebugEntities",
15259 	           xmlMemBlocks() - mem_base);
15260 	    test_ret++;
15261             printf(" %d", n_v);
15262             printf("\n");
15263         }
15264     }
15265     function_tests++;
15266 
15267     return(test_ret);
15268 }
15269 
15270 
15271 static int
test_xmlThrDefPedanticParserDefaultValue(void)15272 test_xmlThrDefPedanticParserDefaultValue(void) {
15273     int test_ret = 0;
15274 
15275     int mem_base;
15276     int ret_val;
15277     int v; /*  */
15278     int n_v;
15279 
15280     for (n_v = 0;n_v < gen_nb_int;n_v++) {
15281         mem_base = xmlMemBlocks();
15282         v = gen_int(n_v, 0);
15283 
15284         ret_val = xmlThrDefPedanticParserDefaultValue(v);
15285         desret_int(ret_val);
15286         call_tests++;
15287         des_int(n_v, v, 0);
15288         xmlResetLastError();
15289         if (mem_base != xmlMemBlocks()) {
15290             printf("Leak of %d blocks found in xmlThrDefPedanticParserDefaultValue",
15291 	           xmlMemBlocks() - mem_base);
15292 	    test_ret++;
15293             printf(" %d", n_v);
15294             printf("\n");
15295         }
15296     }
15297     function_tests++;
15298 
15299     return(test_ret);
15300 }
15301 
15302 
15303 static int
test_xmlThrDefSubstituteEntitiesDefaultValue(void)15304 test_xmlThrDefSubstituteEntitiesDefaultValue(void) {
15305     int test_ret = 0;
15306 
15307     int mem_base;
15308     int ret_val;
15309     int v; /*  */
15310     int n_v;
15311 
15312     for (n_v = 0;n_v < gen_nb_int;n_v++) {
15313         mem_base = xmlMemBlocks();
15314         v = gen_int(n_v, 0);
15315 
15316         ret_val = xmlThrDefSubstituteEntitiesDefaultValue(v);
15317         desret_int(ret_val);
15318         call_tests++;
15319         des_int(n_v, v, 0);
15320         xmlResetLastError();
15321         if (mem_base != xmlMemBlocks()) {
15322             printf("Leak of %d blocks found in xmlThrDefSubstituteEntitiesDefaultValue",
15323 	           xmlMemBlocks() - mem_base);
15324 	    test_ret++;
15325             printf(" %d", n_v);
15326             printf("\n");
15327         }
15328     }
15329     function_tests++;
15330 
15331     return(test_ret);
15332 }
15333 
15334 static int
test_parser(void)15335 test_parser(void) {
15336     int test_ret = 0;
15337 
15338     if (quiet == 0) printf("Testing parser : 86 of 102 functions ...\n");
15339     test_ret += test_xmlByteConsumed();
15340     test_ret += test_xmlCleanupGlobals();
15341     test_ret += test_xmlClearNodeInfoSeq();
15342     test_ret += test_xmlClearParserCtxt();
15343     test_ret += test_xmlCreateDocParserCtxt();
15344     test_ret += test_xmlCreatePushParserCtxt();
15345     test_ret += test_xmlCtxtGetCatalogs();
15346     test_ret += test_xmlCtxtGetDeclaredEncoding();
15347     test_ret += test_xmlCtxtGetOptions();
15348     test_ret += test_xmlCtxtGetPrivate();
15349     test_ret += test_xmlCtxtGetStandalone();
15350     test_ret += test_xmlCtxtGetStatus();
15351     test_ret += test_xmlCtxtGetVersion();
15352     test_ret += test_xmlCtxtParseContent();
15353     test_ret += test_xmlCtxtParseDocument();
15354     test_ret += test_xmlCtxtReadDoc();
15355     test_ret += test_xmlCtxtReadFile();
15356     test_ret += test_xmlCtxtReadMemory();
15357     test_ret += test_xmlCtxtReset();
15358     test_ret += test_xmlCtxtResetPush();
15359     test_ret += test_xmlCtxtSetCatalogs();
15360     test_ret += test_xmlCtxtSetCharEncConvImpl();
15361     test_ret += test_xmlCtxtSetDict();
15362     test_ret += test_xmlCtxtSetErrorHandler();
15363     test_ret += test_xmlCtxtSetMaxAmplification();
15364     test_ret += test_xmlCtxtSetOptions();
15365     test_ret += test_xmlCtxtSetPrivate();
15366     test_ret += test_xmlCtxtSetResourceLoader();
15367     test_ret += test_xmlCtxtUseOptions();
15368     test_ret += test_xmlGetExternalEntityLoader();
15369     test_ret += test_xmlHasFeature();
15370     test_ret += test_xmlIOParseDTD();
15371     test_ret += test_xmlInitGlobals();
15372     test_ret += test_xmlInitNodeInfoSeq();
15373     test_ret += test_xmlInitParser();
15374     test_ret += test_xmlInitParserCtxt();
15375     test_ret += test_xmlInputSetEncodingHandler();
15376     test_ret += test_xmlKeepBlanksDefault();
15377     test_ret += test_xmlLineNumbersDefault();
15378     test_ret += test_xmlLoadExternalEntity();
15379     test_ret += test_xmlNewIOInputStream();
15380     test_ret += test_xmlNewInputFromFd();
15381     test_ret += test_xmlNewInputFromIO();
15382     test_ret += test_xmlNewInputFromMemory();
15383     test_ret += test_xmlNewInputFromString();
15384     test_ret += test_xmlNewInputFromUrl();
15385     test_ret += test_xmlNewParserCtxt();
15386     test_ret += test_xmlNewSAXParserCtxt();
15387     test_ret += test_xmlParseBalancedChunkMemory();
15388     test_ret += test_xmlParseBalancedChunkMemoryRecover();
15389     test_ret += test_xmlParseChunk();
15390     test_ret += test_xmlParseCtxtExternalEntity();
15391     test_ret += test_xmlParseDTD();
15392     test_ret += test_xmlParseDoc();
15393     test_ret += test_xmlParseDocument();
15394     test_ret += test_xmlParseEntity();
15395     test_ret += test_xmlParseExtParsedEnt();
15396     test_ret += test_xmlParseExternalEntity();
15397     test_ret += test_xmlParseFile();
15398     test_ret += test_xmlParseInNodeContext();
15399     test_ret += test_xmlParseMemory();
15400     test_ret += test_xmlParserAddNodeInfo();
15401     test_ret += test_xmlParserFindNodeInfo();
15402     test_ret += test_xmlParserFindNodeInfoIndex();
15403     test_ret += test_xmlParserInputGrow();
15404     test_ret += test_xmlParserInputRead();
15405     test_ret += test_xmlPedanticParserDefault();
15406     test_ret += test_xmlReadDoc();
15407     test_ret += test_xmlReadFile();
15408     test_ret += test_xmlReadMemory();
15409     test_ret += test_xmlRecoverDoc();
15410     test_ret += test_xmlRecoverFile();
15411     test_ret += test_xmlRecoverMemory();
15412     test_ret += test_xmlSAXParseDTD();
15413     test_ret += test_xmlSAXParseDoc();
15414     test_ret += test_xmlSAXParseEntity();
15415     test_ret += test_xmlSAXParseFile();
15416     test_ret += test_xmlSAXParseFileWithData();
15417     test_ret += test_xmlSAXParseMemory();
15418     test_ret += test_xmlSAXParseMemoryWithData();
15419     test_ret += test_xmlSAXUserParseFile();
15420     test_ret += test_xmlSAXUserParseMemory();
15421     test_ret += test_xmlSetExternalEntityLoader();
15422     test_ret += test_xmlSetupParserForBuffer();
15423     test_ret += test_xmlStopParser();
15424     test_ret += test_xmlSubstituteEntitiesDefault();
15425     test_ret += test_xmlThrDefDoValidityCheckingDefaultValue();
15426     test_ret += test_xmlThrDefGetWarningsDefaultValue();
15427     test_ret += test_xmlThrDefKeepBlanksDefaultValue();
15428     test_ret += test_xmlThrDefLineNumbersDefaultValue();
15429     test_ret += test_xmlThrDefLoadExtDtdDefaultValue();
15430     test_ret += test_xmlThrDefParserDebugEntities();
15431     test_ret += test_xmlThrDefPedanticParserDefaultValue();
15432     test_ret += test_xmlThrDefSubstituteEntitiesDefaultValue();
15433 
15434     if (test_ret != 0)
15435 	printf("Module parser: %d errors\n", test_ret);
15436     return(test_ret);
15437 }
15438 
15439 static int
test_inputPop(void)15440 test_inputPop(void) {
15441     int test_ret = 0;
15442 
15443     int mem_base;
15444     xmlParserInputPtr ret_val;
15445     xmlParserCtxtPtr ctxt; /* an XML parser context */
15446     int n_ctxt;
15447 
15448     for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15449         mem_base = xmlMemBlocks();
15450         ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15451 
15452         ret_val = inputPop(ctxt);
15453         desret_xmlParserInputPtr(ret_val);
15454         call_tests++;
15455         des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15456         xmlResetLastError();
15457         if (mem_base != xmlMemBlocks()) {
15458             printf("Leak of %d blocks found in inputPop",
15459 	           xmlMemBlocks() - mem_base);
15460 	    test_ret++;
15461             printf(" %d", n_ctxt);
15462             printf("\n");
15463         }
15464     }
15465     function_tests++;
15466 
15467     return(test_ret);
15468 }
15469 
15470 
15471 static int
test_inputPush(void)15472 test_inputPush(void) {
15473     int test_ret = 0;
15474 
15475     int mem_base;
15476     int ret_val;
15477     xmlParserCtxtPtr ctxt; /* an XML parser context */
15478     int n_ctxt;
15479     xmlParserInputPtr value; /* the parser input */
15480     int n_value;
15481 
15482     for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15483     for (n_value = 0;n_value < gen_nb_xmlParserInputPtr;n_value++) {
15484         mem_base = xmlMemBlocks();
15485         ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15486         value = gen_xmlParserInputPtr(n_value, 1);
15487 
15488         ret_val = inputPush(ctxt, value);
15489         desret_int(ret_val);
15490         call_tests++;
15491         des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15492         des_xmlParserInputPtr(n_value, value, 1);
15493         xmlResetLastError();
15494         if (mem_base != xmlMemBlocks()) {
15495             printf("Leak of %d blocks found in inputPush",
15496 	           xmlMemBlocks() - mem_base);
15497 	    test_ret++;
15498             printf(" %d", n_ctxt);
15499             printf(" %d", n_value);
15500             printf("\n");
15501         }
15502     }
15503     }
15504     function_tests++;
15505 
15506     return(test_ret);
15507 }
15508 
15509 
15510 static int
test_namePop(void)15511 test_namePop(void) {
15512     int test_ret = 0;
15513 
15514     int mem_base;
15515     const xmlChar * ret_val;
15516     xmlParserCtxtPtr ctxt; /* an XML parser context */
15517     int n_ctxt;
15518 
15519     for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15520         mem_base = xmlMemBlocks();
15521         ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15522 
15523         ret_val = namePop(ctxt);
15524         desret_const_xmlChar_ptr(ret_val);
15525         call_tests++;
15526         des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15527         xmlResetLastError();
15528         if (mem_base != xmlMemBlocks()) {
15529             printf("Leak of %d blocks found in namePop",
15530 	           xmlMemBlocks() - mem_base);
15531 	    test_ret++;
15532             printf(" %d", n_ctxt);
15533             printf("\n");
15534         }
15535     }
15536     function_tests++;
15537 
15538     return(test_ret);
15539 }
15540 
15541 
15542 static int
test_namePush(void)15543 test_namePush(void) {
15544     int test_ret = 0;
15545 
15546     int mem_base;
15547     int ret_val;
15548     xmlParserCtxtPtr ctxt; /* an XML parser context */
15549     int n_ctxt;
15550     const xmlChar * value; /* the element name */
15551     int n_value;
15552 
15553     for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15554     for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
15555         mem_base = xmlMemBlocks();
15556         ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15557         value = gen_const_xmlChar_ptr(n_value, 1);
15558 
15559         ret_val = namePush(ctxt, value);
15560         desret_int(ret_val);
15561         call_tests++;
15562         des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15563         des_const_xmlChar_ptr(n_value, value, 1);
15564         xmlResetLastError();
15565         if (mem_base != xmlMemBlocks()) {
15566             printf("Leak of %d blocks found in namePush",
15567 	           xmlMemBlocks() - mem_base);
15568 	    test_ret++;
15569             printf(" %d", n_ctxt);
15570             printf(" %d", n_value);
15571             printf("\n");
15572         }
15573     }
15574     }
15575     function_tests++;
15576 
15577     return(test_ret);
15578 }
15579 
15580 
15581 static int
test_nodePop(void)15582 test_nodePop(void) {
15583     int test_ret = 0;
15584 
15585     int mem_base;
15586     xmlNodePtr ret_val;
15587     xmlParserCtxtPtr ctxt; /* an XML parser context */
15588     int n_ctxt;
15589 
15590     for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15591         mem_base = xmlMemBlocks();
15592         ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15593 
15594         ret_val = nodePop(ctxt);
15595         desret_xmlNodePtr(ret_val);
15596         call_tests++;
15597         des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15598         xmlResetLastError();
15599         if (mem_base != xmlMemBlocks()) {
15600             printf("Leak of %d blocks found in nodePop",
15601 	           xmlMemBlocks() - mem_base);
15602 	    test_ret++;
15603             printf(" %d", n_ctxt);
15604             printf("\n");
15605         }
15606     }
15607     function_tests++;
15608 
15609     return(test_ret);
15610 }
15611 
15612 
15613 static int
test_nodePush(void)15614 test_nodePush(void) {
15615     int test_ret = 0;
15616 
15617     int mem_base;
15618     int ret_val;
15619     xmlParserCtxtPtr ctxt; /* an XML parser context */
15620     int n_ctxt;
15621     xmlNodePtr value; /* the element node */
15622     int n_value;
15623 
15624     for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15625     for (n_value = 0;n_value < gen_nb_xmlNodePtr;n_value++) {
15626         mem_base = xmlMemBlocks();
15627         ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15628         value = gen_xmlNodePtr(n_value, 1);
15629 
15630         ret_val = nodePush(ctxt, value);
15631         desret_int(ret_val);
15632         call_tests++;
15633         des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15634         des_xmlNodePtr(n_value, value, 1);
15635         xmlResetLastError();
15636         if (mem_base != xmlMemBlocks()) {
15637             printf("Leak of %d blocks found in nodePush",
15638 	           xmlMemBlocks() - mem_base);
15639 	    test_ret++;
15640             printf(" %d", n_ctxt);
15641             printf(" %d", n_value);
15642             printf("\n");
15643         }
15644     }
15645     }
15646     function_tests++;
15647 
15648     return(test_ret);
15649 }
15650 
15651 
15652 static int
test_xmlCheckLanguageID(void)15653 test_xmlCheckLanguageID(void) {
15654     int test_ret = 0;
15655 
15656     int mem_base;
15657     int ret_val;
15658     const xmlChar * lang; /* pointer to the string value */
15659     int n_lang;
15660 
15661     for (n_lang = 0;n_lang < gen_nb_const_xmlChar_ptr;n_lang++) {
15662         mem_base = xmlMemBlocks();
15663         lang = gen_const_xmlChar_ptr(n_lang, 0);
15664 
15665         ret_val = xmlCheckLanguageID(lang);
15666         desret_int(ret_val);
15667         call_tests++;
15668         des_const_xmlChar_ptr(n_lang, lang, 0);
15669         xmlResetLastError();
15670         if (mem_base != xmlMemBlocks()) {
15671             printf("Leak of %d blocks found in xmlCheckLanguageID",
15672 	           xmlMemBlocks() - mem_base);
15673 	    test_ret++;
15674             printf(" %d", n_lang);
15675             printf("\n");
15676         }
15677     }
15678     function_tests++;
15679 
15680     return(test_ret);
15681 }
15682 
15683 
15684 static int
test_xmlCopyChar(void)15685 test_xmlCopyChar(void) {
15686     int test_ret = 0;
15687 
15688     int mem_base;
15689     int ret_val;
15690     int len; /* Ignored, compatibility */
15691     int n_len;
15692     xmlChar * out; /* pointer to an array of xmlChar */
15693     int n_out;
15694     int val; /* the char value */
15695     int n_val;
15696 
15697     for (n_len = 0;n_len < gen_nb_int;n_len++) {
15698     for (n_out = 0;n_out < gen_nb_xmlChar_ptr;n_out++) {
15699     for (n_val = 0;n_val < gen_nb_int;n_val++) {
15700         mem_base = xmlMemBlocks();
15701         len = gen_int(n_len, 0);
15702         out = gen_xmlChar_ptr(n_out, 1);
15703         val = gen_int(n_val, 2);
15704 
15705         ret_val = xmlCopyChar(len, out, val);
15706         desret_int(ret_val);
15707         call_tests++;
15708         des_int(n_len, len, 0);
15709         des_xmlChar_ptr(n_out, out, 1);
15710         des_int(n_val, val, 2);
15711         xmlResetLastError();
15712         if (mem_base != xmlMemBlocks()) {
15713             printf("Leak of %d blocks found in xmlCopyChar",
15714 	           xmlMemBlocks() - mem_base);
15715 	    test_ret++;
15716             printf(" %d", n_len);
15717             printf(" %d", n_out);
15718             printf(" %d", n_val);
15719             printf("\n");
15720         }
15721     }
15722     }
15723     }
15724     function_tests++;
15725 
15726     return(test_ret);
15727 }
15728 
15729 
15730 static int
test_xmlCopyCharMultiByte(void)15731 test_xmlCopyCharMultiByte(void) {
15732     int test_ret = 0;
15733 
15734     int mem_base;
15735     int ret_val;
15736     xmlChar * out; /* pointer to an array of xmlChar */
15737     int n_out;
15738     int val; /* the char value */
15739     int n_val;
15740 
15741     for (n_out = 0;n_out < gen_nb_xmlChar_ptr;n_out++) {
15742     for (n_val = 0;n_val < gen_nb_int;n_val++) {
15743         mem_base = xmlMemBlocks();
15744         out = gen_xmlChar_ptr(n_out, 0);
15745         val = gen_int(n_val, 1);
15746 
15747         ret_val = xmlCopyCharMultiByte(out, val);
15748         desret_int(ret_val);
15749         call_tests++;
15750         des_xmlChar_ptr(n_out, out, 0);
15751         des_int(n_val, val, 1);
15752         xmlResetLastError();
15753         if (mem_base != xmlMemBlocks()) {
15754             printf("Leak of %d blocks found in xmlCopyCharMultiByte",
15755 	           xmlMemBlocks() - mem_base);
15756 	    test_ret++;
15757             printf(" %d", n_out);
15758             printf(" %d", n_val);
15759             printf("\n");
15760         }
15761     }
15762     }
15763     function_tests++;
15764 
15765     return(test_ret);
15766 }
15767 
15768 
15769 static int
test_xmlCreateEntityParserCtxt(void)15770 test_xmlCreateEntityParserCtxt(void) {
15771     int test_ret = 0;
15772 
15773     int mem_base;
15774     xmlParserCtxtPtr ret_val;
15775     const xmlChar * URL; /* the entity URL */
15776     int n_URL;
15777     const xmlChar * ID; /* the entity PUBLIC ID */
15778     int n_ID;
15779     const xmlChar * base; /* a possible base for the target URI */
15780     int n_base;
15781 
15782     for (n_URL = 0;n_URL < gen_nb_const_xmlChar_ptr;n_URL++) {
15783     for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) {
15784     for (n_base = 0;n_base < gen_nb_const_xmlChar_ptr;n_base++) {
15785         mem_base = xmlMemBlocks();
15786         URL = gen_const_xmlChar_ptr(n_URL, 0);
15787         ID = gen_const_xmlChar_ptr(n_ID, 1);
15788         base = gen_const_xmlChar_ptr(n_base, 2);
15789 
15790         ret_val = xmlCreateEntityParserCtxt(URL, ID, base);
15791         desret_xmlParserCtxtPtr(ret_val);
15792         call_tests++;
15793         des_const_xmlChar_ptr(n_URL, URL, 0);
15794         des_const_xmlChar_ptr(n_ID, ID, 1);
15795         des_const_xmlChar_ptr(n_base, base, 2);
15796         xmlResetLastError();
15797         if (mem_base != xmlMemBlocks()) {
15798             printf("Leak of %d blocks found in xmlCreateEntityParserCtxt",
15799 	           xmlMemBlocks() - mem_base);
15800 	    test_ret++;
15801             printf(" %d", n_URL);
15802             printf(" %d", n_ID);
15803             printf(" %d", n_base);
15804             printf("\n");
15805         }
15806     }
15807     }
15808     }
15809     function_tests++;
15810 
15811     return(test_ret);
15812 }
15813 
15814 
15815 static int
test_xmlCreateFileParserCtxt(void)15816 test_xmlCreateFileParserCtxt(void) {
15817     int test_ret = 0;
15818 
15819     int mem_base;
15820     xmlParserCtxtPtr ret_val;
15821     const char * filename; /* the filename */
15822     int n_filename;
15823 
15824     for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
15825         mem_base = xmlMemBlocks();
15826         filename = gen_fileoutput(n_filename, 0);
15827 
15828         ret_val = xmlCreateFileParserCtxt(filename);
15829         desret_xmlParserCtxtPtr(ret_val);
15830         call_tests++;
15831         des_fileoutput(n_filename, filename, 0);
15832         xmlResetLastError();
15833         if (mem_base != xmlMemBlocks()) {
15834             printf("Leak of %d blocks found in xmlCreateFileParserCtxt",
15835 	           xmlMemBlocks() - mem_base);
15836 	    test_ret++;
15837             printf(" %d", n_filename);
15838             printf("\n");
15839         }
15840     }
15841     function_tests++;
15842 
15843     return(test_ret);
15844 }
15845 
15846 
15847 static int
test_xmlCreateMemoryParserCtxt(void)15848 test_xmlCreateMemoryParserCtxt(void) {
15849     int test_ret = 0;
15850 
15851     int mem_base;
15852     xmlParserCtxtPtr ret_val;
15853     const char * buffer; /* a pointer to a char array */
15854     int n_buffer;
15855     int size; /* the size of the array */
15856     int n_size;
15857 
15858     for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
15859     for (n_size = 0;n_size < gen_nb_int;n_size++) {
15860         mem_base = xmlMemBlocks();
15861         buffer = gen_const_char_ptr(n_buffer, 0);
15862         size = gen_int(n_size, 1);
15863         if ((buffer != NULL) &&
15864             (size > xmlStrlen(BAD_CAST buffer)))
15865             size = 0;
15866 
15867         ret_val = xmlCreateMemoryParserCtxt(buffer, size);
15868         desret_xmlParserCtxtPtr(ret_val);
15869         call_tests++;
15870         des_const_char_ptr(n_buffer, buffer, 0);
15871         des_int(n_size, size, 1);
15872         xmlResetLastError();
15873         if (mem_base != xmlMemBlocks()) {
15874             printf("Leak of %d blocks found in xmlCreateMemoryParserCtxt",
15875 	           xmlMemBlocks() - mem_base);
15876 	    test_ret++;
15877             printf(" %d", n_buffer);
15878             printf(" %d", n_size);
15879             printf("\n");
15880         }
15881     }
15882     }
15883     function_tests++;
15884 
15885     return(test_ret);
15886 }
15887 
15888 
15889 static int
test_xmlCreateURLParserCtxt(void)15890 test_xmlCreateURLParserCtxt(void) {
15891     int test_ret = 0;
15892 
15893     int mem_base;
15894     xmlParserCtxtPtr ret_val;
15895     const char * filename; /* the filename or URL */
15896     int n_filename;
15897     int options; /* a combination of xmlParserOption */
15898     int n_options;
15899 
15900     for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
15901     for (n_options = 0;n_options < gen_nb_int;n_options++) {
15902         mem_base = xmlMemBlocks();
15903         filename = gen_fileoutput(n_filename, 0);
15904         options = gen_int(n_options, 1);
15905 
15906         ret_val = xmlCreateURLParserCtxt(filename, options);
15907         desret_xmlParserCtxtPtr(ret_val);
15908         call_tests++;
15909         des_fileoutput(n_filename, filename, 0);
15910         des_int(n_options, options, 1);
15911         xmlResetLastError();
15912         if (mem_base != xmlMemBlocks()) {
15913             printf("Leak of %d blocks found in xmlCreateURLParserCtxt",
15914 	           xmlMemBlocks() - mem_base);
15915 	    test_ret++;
15916             printf(" %d", n_filename);
15917             printf(" %d", n_options);
15918             printf("\n");
15919         }
15920     }
15921     }
15922     function_tests++;
15923 
15924     return(test_ret);
15925 }
15926 
15927 
15928 static int
test_xmlCtxtErrMemory(void)15929 test_xmlCtxtErrMemory(void) {
15930     int test_ret = 0;
15931 
15932     int mem_base;
15933     xmlParserCtxtPtr ctxt; /* an XML parser context */
15934     int n_ctxt;
15935 
15936     for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15937         mem_base = xmlMemBlocks();
15938         ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15939 
15940         xmlCtxtErrMemory(ctxt);
15941         call_tests++;
15942         des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15943         xmlResetLastError();
15944         if (mem_base != xmlMemBlocks()) {
15945             printf("Leak of %d blocks found in xmlCtxtErrMemory",
15946 	           xmlMemBlocks() - mem_base);
15947 	    test_ret++;
15948             printf(" %d", n_ctxt);
15949             printf("\n");
15950         }
15951     }
15952     function_tests++;
15953 
15954     return(test_ret);
15955 }
15956 
15957 
15958 static int
test_xmlCurrentChar(void)15959 test_xmlCurrentChar(void) {
15960     int test_ret = 0;
15961 
15962     int mem_base;
15963     int ret_val;
15964     xmlParserCtxtPtr ctxt; /* the XML parser context */
15965     int n_ctxt;
15966     int * len; /* pointer to the length of the char read */
15967     int n_len;
15968 
15969     for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15970     for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
15971         mem_base = xmlMemBlocks();
15972         ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15973         len = gen_int_ptr(n_len, 1);
15974 
15975         ret_val = xmlCurrentChar(ctxt, len);
15976         desret_int(ret_val);
15977         call_tests++;
15978         des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15979         des_int_ptr(n_len, len, 1);
15980         xmlResetLastError();
15981         if (mem_base != xmlMemBlocks()) {
15982             printf("Leak of %d blocks found in xmlCurrentChar",
15983 	           xmlMemBlocks() - mem_base);
15984 	    test_ret++;
15985             printf(" %d", n_ctxt);
15986             printf(" %d", n_len);
15987             printf("\n");
15988         }
15989     }
15990     }
15991     function_tests++;
15992 
15993     return(test_ret);
15994 }
15995 
15996 
15997 static int
test_xmlIsLetter(void)15998 test_xmlIsLetter(void) {
15999     int test_ret = 0;
16000 
16001     int mem_base;
16002     int ret_val;
16003     int c; /* an unicode character (int) */
16004     int n_c;
16005 
16006     for (n_c = 0;n_c < gen_nb_int;n_c++) {
16007         mem_base = xmlMemBlocks();
16008         c = gen_int(n_c, 0);
16009 
16010         ret_val = xmlIsLetter(c);
16011         desret_int(ret_val);
16012         call_tests++;
16013         des_int(n_c, c, 0);
16014         xmlResetLastError();
16015         if (mem_base != xmlMemBlocks()) {
16016             printf("Leak of %d blocks found in xmlIsLetter",
16017 	           xmlMemBlocks() - mem_base);
16018 	    test_ret++;
16019             printf(" %d", n_c);
16020             printf("\n");
16021         }
16022     }
16023     function_tests++;
16024 
16025     return(test_ret);
16026 }
16027 
16028 
16029 static int
test_xmlNewEntityInputStream(void)16030 test_xmlNewEntityInputStream(void) {
16031     int test_ret = 0;
16032 
16033     int mem_base;
16034     xmlParserInputPtr ret_val;
16035     xmlParserCtxtPtr ctxt; /* an XML parser context */
16036     int n_ctxt;
16037     xmlEntityPtr ent; /* an Entity pointer */
16038     int n_ent;
16039 
16040     for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16041     for (n_ent = 0;n_ent < gen_nb_xmlEntityPtr;n_ent++) {
16042         mem_base = xmlMemBlocks();
16043         ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16044         ent = gen_xmlEntityPtr(n_ent, 1);
16045 
16046         ret_val = xmlNewEntityInputStream(ctxt, ent);
16047         desret_xmlParserInputPtr(ret_val);
16048         call_tests++;
16049         des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16050         des_xmlEntityPtr(n_ent, ent, 1);
16051         xmlResetLastError();
16052         if (mem_base != xmlMemBlocks()) {
16053             printf("Leak of %d blocks found in xmlNewEntityInputStream",
16054 	           xmlMemBlocks() - mem_base);
16055 	    test_ret++;
16056             printf(" %d", n_ctxt);
16057             printf(" %d", n_ent);
16058             printf("\n");
16059         }
16060     }
16061     }
16062     function_tests++;
16063 
16064     return(test_ret);
16065 }
16066 
16067 
16068 static int
test_xmlNewInputFromFile(void)16069 test_xmlNewInputFromFile(void) {
16070     int test_ret = 0;
16071 
16072     int mem_base;
16073     xmlParserInputPtr ret_val;
16074     xmlParserCtxtPtr ctxt; /* an XML parser context */
16075     int n_ctxt;
16076     const char * filename; /* the filename to use as entity */
16077     int n_filename;
16078 
16079     for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16080     for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
16081         mem_base = xmlMemBlocks();
16082         ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16083         filename = gen_filepath(n_filename, 1);
16084 
16085         ret_val = xmlNewInputFromFile(ctxt, filename);
16086         desret_xmlParserInputPtr(ret_val);
16087         call_tests++;
16088         des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16089         des_filepath(n_filename, filename, 1);
16090         xmlResetLastError();
16091         if (mem_base != xmlMemBlocks()) {
16092             printf("Leak of %d blocks found in xmlNewInputFromFile",
16093 	           xmlMemBlocks() - mem_base);
16094 	    test_ret++;
16095             printf(" %d", n_ctxt);
16096             printf(" %d", n_filename);
16097             printf("\n");
16098         }
16099     }
16100     }
16101     function_tests++;
16102 
16103     return(test_ret);
16104 }
16105 
16106 
16107 static int
test_xmlNewInputStream(void)16108 test_xmlNewInputStream(void) {
16109     int test_ret = 0;
16110 
16111     int mem_base;
16112     xmlParserInputPtr ret_val;
16113     xmlParserCtxtPtr ctxt; /* an XML parser context */
16114     int n_ctxt;
16115 
16116     for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16117         mem_base = xmlMemBlocks();
16118         ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16119 
16120         ret_val = xmlNewInputStream(ctxt);
16121         desret_xmlParserInputPtr(ret_val);
16122         call_tests++;
16123         des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16124         xmlResetLastError();
16125         if (mem_base != xmlMemBlocks()) {
16126             printf("Leak of %d blocks found in xmlNewInputStream",
16127 	           xmlMemBlocks() - mem_base);
16128 	    test_ret++;
16129             printf(" %d", n_ctxt);
16130             printf("\n");
16131         }
16132     }
16133     function_tests++;
16134 
16135     return(test_ret);
16136 }
16137 
16138 
16139 static int
test_xmlNewStringInputStream(void)16140 test_xmlNewStringInputStream(void) {
16141     int test_ret = 0;
16142 
16143     int mem_base;
16144     xmlParserInputPtr ret_val;
16145     xmlParserCtxtPtr ctxt; /* an XML parser context */
16146     int n_ctxt;
16147     const xmlChar * buffer; /* an memory buffer */
16148     int n_buffer;
16149 
16150     for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16151     for (n_buffer = 0;n_buffer < gen_nb_const_xmlChar_ptr;n_buffer++) {
16152         mem_base = xmlMemBlocks();
16153         ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16154         buffer = gen_const_xmlChar_ptr(n_buffer, 1);
16155 
16156         ret_val = xmlNewStringInputStream(ctxt, buffer);
16157         desret_xmlParserInputPtr(ret_val);
16158         call_tests++;
16159         des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16160         des_const_xmlChar_ptr(n_buffer, buffer, 1);
16161         xmlResetLastError();
16162         if (mem_base != xmlMemBlocks()) {
16163             printf("Leak of %d blocks found in xmlNewStringInputStream",
16164 	           xmlMemBlocks() - mem_base);
16165 	    test_ret++;
16166             printf(" %d", n_ctxt);
16167             printf(" %d", n_buffer);
16168             printf("\n");
16169         }
16170     }
16171     }
16172     function_tests++;
16173 
16174     return(test_ret);
16175 }
16176 
16177 
16178 static int
test_xmlNextChar(void)16179 test_xmlNextChar(void) {
16180     int test_ret = 0;
16181 
16182     int mem_base;
16183     xmlParserCtxtPtr ctxt; /* the XML parser context */
16184     int n_ctxt;
16185 
16186     for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16187         mem_base = xmlMemBlocks();
16188         ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16189 
16190         xmlNextChar(ctxt);
16191         call_tests++;
16192         des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16193         xmlResetLastError();
16194         if (mem_base != xmlMemBlocks()) {
16195             printf("Leak of %d blocks found in xmlNextChar",
16196 	           xmlMemBlocks() - mem_base);
16197 	    test_ret++;
16198             printf(" %d", n_ctxt);
16199             printf("\n");
16200         }
16201     }
16202     function_tests++;
16203 
16204     return(test_ret);
16205 }
16206 
16207 
16208 static int
test_xmlParserInputShrink(void)16209 test_xmlParserInputShrink(void) {
16210     int test_ret = 0;
16211 
16212     int mem_base;
16213     xmlParserInputPtr in; /* an XML parser input */
16214     int n_in;
16215 
16216     for (n_in = 0;n_in < gen_nb_xmlParserInputPtr;n_in++) {
16217         mem_base = xmlMemBlocks();
16218         in = gen_xmlParserInputPtr(n_in, 0);
16219 
16220         xmlParserInputShrink(in);
16221         call_tests++;
16222         des_xmlParserInputPtr(n_in, in, 0);
16223         xmlResetLastError();
16224         if (mem_base != xmlMemBlocks()) {
16225             printf("Leak of %d blocks found in xmlParserInputShrink",
16226 	           xmlMemBlocks() - mem_base);
16227 	    test_ret++;
16228             printf(" %d", n_in);
16229             printf("\n");
16230         }
16231     }
16232     function_tests++;
16233 
16234     return(test_ret);
16235 }
16236 
16237 
16238 static int
test_xmlPopInput(void)16239 test_xmlPopInput(void) {
16240     int test_ret = 0;
16241 
16242     int mem_base;
16243     xmlChar ret_val;
16244     xmlParserCtxtPtr ctxt; /* an XML parser context */
16245     int n_ctxt;
16246 
16247     for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16248         mem_base = xmlMemBlocks();
16249         ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16250 
16251         ret_val = xmlPopInput(ctxt);
16252         desret_xmlChar(ret_val);
16253         call_tests++;
16254         des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16255         xmlResetLastError();
16256         if (mem_base != xmlMemBlocks()) {
16257             printf("Leak of %d blocks found in xmlPopInput",
16258 	           xmlMemBlocks() - mem_base);
16259 	    test_ret++;
16260             printf(" %d", n_ctxt);
16261             printf("\n");
16262         }
16263     }
16264     function_tests++;
16265 
16266     return(test_ret);
16267 }
16268 
16269 
16270 static int
test_xmlPushInput(void)16271 test_xmlPushInput(void) {
16272     int test_ret = 0;
16273 
16274     int mem_base;
16275     int ret_val;
16276     xmlParserCtxtPtr ctxt; /* an XML parser context */
16277     int n_ctxt;
16278     xmlParserInputPtr input; /* an XML parser input fragment (entity, XML fragment ...). */
16279     int n_input;
16280 
16281     for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16282     for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) {
16283         mem_base = xmlMemBlocks();
16284         ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16285         input = gen_xmlParserInputPtr(n_input, 1);
16286 
16287         ret_val = xmlPushInput(ctxt, input);
16288         desret_int(ret_val);
16289         call_tests++;
16290         des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16291         des_xmlParserInputPtr(n_input, input, 1);
16292         xmlResetLastError();
16293         if (mem_base != xmlMemBlocks()) {
16294             printf("Leak of %d blocks found in xmlPushInput",
16295 	           xmlMemBlocks() - mem_base);
16296 	    test_ret++;
16297             printf(" %d", n_ctxt);
16298             printf(" %d", n_input);
16299             printf("\n");
16300         }
16301     }
16302     }
16303     function_tests++;
16304 
16305     return(test_ret);
16306 }
16307 
16308 
16309 static int
test_xmlSplitQName(void)16310 test_xmlSplitQName(void) {
16311     int test_ret = 0;
16312 
16313     int mem_base;
16314     xmlChar * ret_val;
16315     xmlParserCtxtPtr ctxt; /* an XML parser context */
16316     int n_ctxt;
16317     const xmlChar * name; /* an XML parser context */
16318     int n_name;
16319     xmlChar ** prefixOut; /* a xmlChar ** */
16320     int n_prefixOut;
16321 
16322     for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16323     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
16324     for (n_prefixOut = 0;n_prefixOut < gen_nb_xmlChar_ptr_ptr;n_prefixOut++) {
16325         mem_base = xmlMemBlocks();
16326         ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16327         name = gen_const_xmlChar_ptr(n_name, 1);
16328         prefixOut = gen_xmlChar_ptr_ptr(n_prefixOut, 2);
16329 
16330         ret_val = xmlSplitQName(ctxt, name, prefixOut);
16331         desret_xmlChar_ptr(ret_val);
16332         call_tests++;
16333         des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16334         des_const_xmlChar_ptr(n_name, name, 1);
16335         des_xmlChar_ptr_ptr(n_prefixOut, prefixOut, 2);
16336         xmlResetLastError();
16337         if (mem_base != xmlMemBlocks()) {
16338             printf("Leak of %d blocks found in xmlSplitQName",
16339 	           xmlMemBlocks() - mem_base);
16340 	    test_ret++;
16341             printf(" %d", n_ctxt);
16342             printf(" %d", n_name);
16343             printf(" %d", n_prefixOut);
16344             printf("\n");
16345         }
16346     }
16347     }
16348     }
16349     function_tests++;
16350 
16351     return(test_ret);
16352 }
16353 
16354 
16355 static int
test_xmlStringCurrentChar(void)16356 test_xmlStringCurrentChar(void) {
16357     int test_ret = 0;
16358 
16359     int mem_base;
16360     int ret_val;
16361     xmlParserCtxtPtr ctxt; /* the XML parser context */
16362     int n_ctxt;
16363     const xmlChar * cur; /* pointer to the beginning of the char */
16364     int n_cur;
16365     int * len; /* pointer to the length of the char read */
16366     int n_len;
16367 
16368     for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16369     for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
16370     for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
16371         mem_base = xmlMemBlocks();
16372         ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16373         cur = gen_const_xmlChar_ptr(n_cur, 1);
16374         len = gen_int_ptr(n_len, 2);
16375 
16376         ret_val = xmlStringCurrentChar(ctxt, cur, len);
16377         desret_int(ret_val);
16378         call_tests++;
16379         des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16380         des_const_xmlChar_ptr(n_cur, cur, 1);
16381         des_int_ptr(n_len, len, 2);
16382         xmlResetLastError();
16383         if (mem_base != xmlMemBlocks()) {
16384             printf("Leak of %d blocks found in xmlStringCurrentChar",
16385 	           xmlMemBlocks() - mem_base);
16386 	    test_ret++;
16387             printf(" %d", n_ctxt);
16388             printf(" %d", n_cur);
16389             printf(" %d", n_len);
16390             printf("\n");
16391         }
16392     }
16393     }
16394     }
16395     function_tests++;
16396 
16397     return(test_ret);
16398 }
16399 
16400 
16401 static int
test_xmlStringDecodeEntities(void)16402 test_xmlStringDecodeEntities(void) {
16403     int test_ret = 0;
16404 
16405     int mem_base;
16406     xmlChar * ret_val;
16407     xmlParserCtxtPtr ctxt; /* the parser context */
16408     int n_ctxt;
16409     const xmlChar * str; /* the input string */
16410     int n_str;
16411     int what; /* combination of XML_SUBSTITUTE_REF and XML_SUBSTITUTE_PEREF */
16412     int n_what;
16413     xmlChar end; /* an end marker xmlChar, 0 if none */
16414     int n_end;
16415     xmlChar end2; /* an end marker xmlChar, 0 if none */
16416     int n_end2;
16417     xmlChar end3; /* an end marker xmlChar, 0 if none */
16418     int n_end3;
16419 
16420     for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16421     for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
16422     for (n_what = 0;n_what < gen_nb_int;n_what++) {
16423     for (n_end = 0;n_end < gen_nb_xmlChar;n_end++) {
16424     for (n_end2 = 0;n_end2 < gen_nb_xmlChar;n_end2++) {
16425     for (n_end3 = 0;n_end3 < gen_nb_xmlChar;n_end3++) {
16426         mem_base = xmlMemBlocks();
16427         ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16428         str = gen_const_xmlChar_ptr(n_str, 1);
16429         what = gen_int(n_what, 2);
16430         end = gen_xmlChar(n_end, 3);
16431         end2 = gen_xmlChar(n_end2, 4);
16432         end3 = gen_xmlChar(n_end3, 5);
16433 
16434         ret_val = xmlStringDecodeEntities(ctxt, str, what, end, end2, end3);
16435         desret_xmlChar_ptr(ret_val);
16436         call_tests++;
16437         des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16438         des_const_xmlChar_ptr(n_str, str, 1);
16439         des_int(n_what, what, 2);
16440         des_xmlChar(n_end, end, 3);
16441         des_xmlChar(n_end2, end2, 4);
16442         des_xmlChar(n_end3, end3, 5);
16443         xmlResetLastError();
16444         if (mem_base != xmlMemBlocks()) {
16445             printf("Leak of %d blocks found in xmlStringDecodeEntities",
16446 	           xmlMemBlocks() - mem_base);
16447 	    test_ret++;
16448             printf(" %d", n_ctxt);
16449             printf(" %d", n_str);
16450             printf(" %d", n_what);
16451             printf(" %d", n_end);
16452             printf(" %d", n_end2);
16453             printf(" %d", n_end3);
16454             printf("\n");
16455         }
16456     }
16457     }
16458     }
16459     }
16460     }
16461     }
16462     function_tests++;
16463 
16464     return(test_ret);
16465 }
16466 
16467 
16468 static int
test_xmlStringLenDecodeEntities(void)16469 test_xmlStringLenDecodeEntities(void) {
16470     int test_ret = 0;
16471 
16472     int mem_base;
16473     xmlChar * ret_val;
16474     xmlParserCtxtPtr ctxt; /* the parser context */
16475     int n_ctxt;
16476     const xmlChar * str; /* the input string */
16477     int n_str;
16478     int len; /* the string length */
16479     int n_len;
16480     int what; /* combination of XML_SUBSTITUTE_REF and XML_SUBSTITUTE_PEREF */
16481     int n_what;
16482     xmlChar end; /* an end marker xmlChar, 0 if none */
16483     int n_end;
16484     xmlChar end2; /* an end marker xmlChar, 0 if none */
16485     int n_end2;
16486     xmlChar end3; /* an end marker xmlChar, 0 if none */
16487     int n_end3;
16488 
16489     for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16490     for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
16491     for (n_len = 0;n_len < gen_nb_int;n_len++) {
16492     for (n_what = 0;n_what < gen_nb_int;n_what++) {
16493     for (n_end = 0;n_end < gen_nb_xmlChar;n_end++) {
16494     for (n_end2 = 0;n_end2 < gen_nb_xmlChar;n_end2++) {
16495     for (n_end3 = 0;n_end3 < gen_nb_xmlChar;n_end3++) {
16496         mem_base = xmlMemBlocks();
16497         ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16498         str = gen_const_xmlChar_ptr(n_str, 1);
16499         len = gen_int(n_len, 2);
16500         what = gen_int(n_what, 3);
16501         end = gen_xmlChar(n_end, 4);
16502         end2 = gen_xmlChar(n_end2, 5);
16503         end3 = gen_xmlChar(n_end3, 6);
16504         if ((str != NULL) &&
16505             (len > xmlStrlen(BAD_CAST str)))
16506             len = 0;
16507 
16508         ret_val = xmlStringLenDecodeEntities(ctxt, str, len, what, end, end2, end3);
16509         desret_xmlChar_ptr(ret_val);
16510         call_tests++;
16511         des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16512         des_const_xmlChar_ptr(n_str, str, 1);
16513         des_int(n_len, len, 2);
16514         des_int(n_what, what, 3);
16515         des_xmlChar(n_end, end, 4);
16516         des_xmlChar(n_end2, end2, 5);
16517         des_xmlChar(n_end3, end3, 6);
16518         xmlResetLastError();
16519         if (mem_base != xmlMemBlocks()) {
16520             printf("Leak of %d blocks found in xmlStringLenDecodeEntities",
16521 	           xmlMemBlocks() - mem_base);
16522 	    test_ret++;
16523             printf(" %d", n_ctxt);
16524             printf(" %d", n_str);
16525             printf(" %d", n_len);
16526             printf(" %d", n_what);
16527             printf(" %d", n_end);
16528             printf(" %d", n_end2);
16529             printf(" %d", n_end3);
16530             printf("\n");
16531         }
16532     }
16533     }
16534     }
16535     }
16536     }
16537     }
16538     }
16539     function_tests++;
16540 
16541     return(test_ret);
16542 }
16543 
16544 
16545 static int
test_xmlSwitchEncoding(void)16546 test_xmlSwitchEncoding(void) {
16547     int test_ret = 0;
16548 
16549     int mem_base;
16550     int ret_val;
16551     xmlParserCtxtPtr ctxt; /* the parser context */
16552     int n_ctxt;
16553     xmlCharEncoding enc; /* the encoding value (number) */
16554     int n_enc;
16555 
16556     for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16557     for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
16558         mem_base = xmlMemBlocks();
16559         ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16560         enc = gen_xmlCharEncoding(n_enc, 1);
16561 
16562         ret_val = xmlSwitchEncoding(ctxt, enc);
16563         desret_int(ret_val);
16564         call_tests++;
16565         des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16566         des_xmlCharEncoding(n_enc, enc, 1);
16567         xmlResetLastError();
16568         if (mem_base != xmlMemBlocks()) {
16569             printf("Leak of %d blocks found in xmlSwitchEncoding",
16570 	           xmlMemBlocks() - mem_base);
16571 	    test_ret++;
16572             printf(" %d", n_ctxt);
16573             printf(" %d", n_enc);
16574             printf("\n");
16575         }
16576     }
16577     }
16578     function_tests++;
16579 
16580     return(test_ret);
16581 }
16582 
16583 
16584 static int
test_xmlSwitchEncodingName(void)16585 test_xmlSwitchEncodingName(void) {
16586     int test_ret = 0;
16587 
16588     int mem_base;
16589     int ret_val;
16590     xmlParserCtxtPtr ctxt; /* the parser context */
16591     int n_ctxt;
16592     const char * encoding; /* the encoding name */
16593     int n_encoding;
16594 
16595     for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16596     for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
16597         mem_base = xmlMemBlocks();
16598         ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16599         encoding = gen_const_char_ptr(n_encoding, 1);
16600 
16601         ret_val = xmlSwitchEncodingName(ctxt, encoding);
16602         desret_int(ret_val);
16603         call_tests++;
16604         des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16605         des_const_char_ptr(n_encoding, encoding, 1);
16606         xmlResetLastError();
16607         if (mem_base != xmlMemBlocks()) {
16608             printf("Leak of %d blocks found in xmlSwitchEncodingName",
16609 	           xmlMemBlocks() - mem_base);
16610 	    test_ret++;
16611             printf(" %d", n_ctxt);
16612             printf(" %d", n_encoding);
16613             printf("\n");
16614         }
16615     }
16616     }
16617     function_tests++;
16618 
16619     return(test_ret);
16620 }
16621 
16622 
16623 static int
test_xmlSwitchInputEncoding(void)16624 test_xmlSwitchInputEncoding(void) {
16625     int test_ret = 0;
16626 
16627     int mem_base;
16628     int ret_val;
16629     xmlParserCtxtPtr ctxt; /* the parser context, only for error reporting */
16630     int n_ctxt;
16631     xmlParserInputPtr input; /* the input stream */
16632     int n_input;
16633     xmlCharEncodingHandlerPtr handler; /* the encoding handler */
16634     int n_handler;
16635 
16636     for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16637     for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) {
16638     for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandlerPtr;n_handler++) {
16639         mem_base = xmlMemBlocks();
16640         ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16641         input = gen_xmlParserInputPtr(n_input, 1);
16642         handler = gen_xmlCharEncodingHandlerPtr(n_handler, 2);
16643 
16644         ret_val = xmlSwitchInputEncoding(ctxt, input, handler);
16645         desret_int(ret_val);
16646         call_tests++;
16647         des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16648         des_xmlParserInputPtr(n_input, input, 1);
16649         des_xmlCharEncodingHandlerPtr(n_handler, handler, 2);
16650         xmlResetLastError();
16651         if (mem_base != xmlMemBlocks()) {
16652             printf("Leak of %d blocks found in xmlSwitchInputEncoding",
16653 	           xmlMemBlocks() - mem_base);
16654 	    test_ret++;
16655             printf(" %d", n_ctxt);
16656             printf(" %d", n_input);
16657             printf(" %d", n_handler);
16658             printf("\n");
16659         }
16660     }
16661     }
16662     }
16663     function_tests++;
16664 
16665     return(test_ret);
16666 }
16667 
16668 
16669 static int
test_xmlSwitchToEncoding(void)16670 test_xmlSwitchToEncoding(void) {
16671     int test_ret = 0;
16672 
16673     int mem_base;
16674     int ret_val;
16675     xmlParserCtxtPtr ctxt; /* the parser context */
16676     int n_ctxt;
16677     xmlCharEncodingHandlerPtr handler; /* the encoding handler */
16678     int n_handler;
16679 
16680     for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16681     for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandlerPtr;n_handler++) {
16682         mem_base = xmlMemBlocks();
16683         ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16684         handler = gen_xmlCharEncodingHandlerPtr(n_handler, 1);
16685 
16686         ret_val = xmlSwitchToEncoding(ctxt, handler);
16687         desret_int(ret_val);
16688         call_tests++;
16689         des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16690         des_xmlCharEncodingHandlerPtr(n_handler, handler, 1);
16691         xmlResetLastError();
16692         if (mem_base != xmlMemBlocks()) {
16693             printf("Leak of %d blocks found in xmlSwitchToEncoding",
16694 	           xmlMemBlocks() - mem_base);
16695 	    test_ret++;
16696             printf(" %d", n_ctxt);
16697             printf(" %d", n_handler);
16698             printf("\n");
16699         }
16700     }
16701     }
16702     function_tests++;
16703 
16704     return(test_ret);
16705 }
16706 
16707 static int
test_parserInternals(void)16708 test_parserInternals(void) {
16709     int test_ret = 0;
16710 
16711     if (quiet == 0) printf("Testing parserInternals : 32 of 79 functions ...\n");
16712     test_ret += test_inputPop();
16713     test_ret += test_inputPush();
16714     test_ret += test_namePop();
16715     test_ret += test_namePush();
16716     test_ret += test_nodePop();
16717     test_ret += test_nodePush();
16718     test_ret += test_xmlCheckLanguageID();
16719     test_ret += test_xmlCopyChar();
16720     test_ret += test_xmlCopyCharMultiByte();
16721     test_ret += test_xmlCreateEntityParserCtxt();
16722     test_ret += test_xmlCreateFileParserCtxt();
16723     test_ret += test_xmlCreateMemoryParserCtxt();
16724     test_ret += test_xmlCreateURLParserCtxt();
16725     test_ret += test_xmlCtxtErrMemory();
16726     test_ret += test_xmlCurrentChar();
16727     test_ret += test_xmlIsLetter();
16728     test_ret += test_xmlNewEntityInputStream();
16729     test_ret += test_xmlNewInputFromFile();
16730     test_ret += test_xmlNewInputStream();
16731     test_ret += test_xmlNewStringInputStream();
16732     test_ret += test_xmlNextChar();
16733     test_ret += test_xmlParserInputShrink();
16734     test_ret += test_xmlPopInput();
16735     test_ret += test_xmlPushInput();
16736     test_ret += test_xmlSplitQName();
16737     test_ret += test_xmlStringCurrentChar();
16738     test_ret += test_xmlStringDecodeEntities();
16739     test_ret += test_xmlStringLenDecodeEntities();
16740     test_ret += test_xmlSwitchEncoding();
16741     test_ret += test_xmlSwitchEncodingName();
16742     test_ret += test_xmlSwitchInputEncoding();
16743     test_ret += test_xmlSwitchToEncoding();
16744 
16745     if (test_ret != 0)
16746 	printf("Module parserInternals: %d errors\n", test_ret);
16747     return(test_ret);
16748 }
16749 #ifdef LIBXML_PATTERN_ENABLED
16750 
16751 #define gen_nb_xmlPatternPtr_ptr 1
16752 #define gen_xmlPatternPtr_ptr(no, nr) NULL
16753 #define des_xmlPatternPtr_ptr(no, val, nr)
16754 #endif
16755 
16756 
16757 static int
test_xmlPatternCompileSafe(void)16758 test_xmlPatternCompileSafe(void) {
16759     int test_ret = 0;
16760 
16761 #if defined(LIBXML_PATTERN_ENABLED)
16762     int mem_base;
16763     int ret_val;
16764     const xmlChar * pattern; /* the pattern to compile */
16765     int n_pattern;
16766     xmlDict * dict; /* an optional dictionary for interned strings */
16767     int n_dict;
16768     int flags; /* compilation flags, see xmlPatternFlags */
16769     int n_flags;
16770     const xmlChar ** namespaces; /* the prefix definitions, array of [URI, prefix] or NULL */
16771     int n_namespaces;
16772     xmlPatternPtr * patternOut; /* output pattern */
16773     int n_patternOut;
16774 
16775     for (n_pattern = 0;n_pattern < gen_nb_const_xmlChar_ptr;n_pattern++) {
16776     for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
16777     for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
16778     for (n_namespaces = 0;n_namespaces < gen_nb_const_xmlChar_ptr_ptr;n_namespaces++) {
16779     for (n_patternOut = 0;n_patternOut < gen_nb_xmlPatternPtr_ptr;n_patternOut++) {
16780         mem_base = xmlMemBlocks();
16781         pattern = gen_const_xmlChar_ptr(n_pattern, 0);
16782         dict = gen_xmlDictPtr(n_dict, 1);
16783         flags = gen_int(n_flags, 2);
16784         namespaces = gen_const_xmlChar_ptr_ptr(n_namespaces, 3);
16785         patternOut = gen_xmlPatternPtr_ptr(n_patternOut, 4);
16786 
16787         ret_val = xmlPatternCompileSafe(pattern, dict, flags, namespaces, patternOut);
16788         desret_int(ret_val);
16789         call_tests++;
16790         des_const_xmlChar_ptr(n_pattern, pattern, 0);
16791         des_xmlDictPtr(n_dict, dict, 1);
16792         des_int(n_flags, flags, 2);
16793         des_const_xmlChar_ptr_ptr(n_namespaces, namespaces, 3);
16794         des_xmlPatternPtr_ptr(n_patternOut, patternOut, 4);
16795         xmlResetLastError();
16796         if (mem_base != xmlMemBlocks()) {
16797             printf("Leak of %d blocks found in xmlPatternCompileSafe",
16798 	           xmlMemBlocks() - mem_base);
16799 	    test_ret++;
16800             printf(" %d", n_pattern);
16801             printf(" %d", n_dict);
16802             printf(" %d", n_flags);
16803             printf(" %d", n_namespaces);
16804             printf(" %d", n_patternOut);
16805             printf("\n");
16806         }
16807     }
16808     }
16809     }
16810     }
16811     }
16812     function_tests++;
16813 #endif
16814 
16815     return(test_ret);
16816 }
16817 
16818 
16819 static int
test_xmlPatternFromRoot(void)16820 test_xmlPatternFromRoot(void) {
16821     int test_ret = 0;
16822 
16823 #if defined(LIBXML_PATTERN_ENABLED)
16824     int mem_base;
16825     int ret_val;
16826     xmlPatternPtr comp; /* the precompiled pattern */
16827     int n_comp;
16828 
16829     for (n_comp = 0;n_comp < gen_nb_xmlPatternPtr;n_comp++) {
16830         mem_base = xmlMemBlocks();
16831         comp = gen_xmlPatternPtr(n_comp, 0);
16832 
16833         ret_val = xmlPatternFromRoot(comp);
16834         desret_int(ret_val);
16835         call_tests++;
16836         des_xmlPatternPtr(n_comp, comp, 0);
16837         xmlResetLastError();
16838         if (mem_base != xmlMemBlocks()) {
16839             printf("Leak of %d blocks found in xmlPatternFromRoot",
16840 	           xmlMemBlocks() - mem_base);
16841 	    test_ret++;
16842             printf(" %d", n_comp);
16843             printf("\n");
16844         }
16845     }
16846     function_tests++;
16847 #endif
16848 
16849     return(test_ret);
16850 }
16851 
16852 
16853 static int
test_xmlPatternGetStreamCtxt(void)16854 test_xmlPatternGetStreamCtxt(void) {
16855     int test_ret = 0;
16856 
16857 
16858     /* missing type support */
16859     return(test_ret);
16860 }
16861 
16862 
16863 static int
test_xmlPatternMatch(void)16864 test_xmlPatternMatch(void) {
16865     int test_ret = 0;
16866 
16867 #if defined(LIBXML_PATTERN_ENABLED)
16868     int mem_base;
16869     int ret_val;
16870     xmlPatternPtr comp; /* the precompiled pattern */
16871     int n_comp;
16872     xmlNodePtr node; /* a node */
16873     int n_node;
16874 
16875     for (n_comp = 0;n_comp < gen_nb_xmlPatternPtr;n_comp++) {
16876     for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
16877         mem_base = xmlMemBlocks();
16878         comp = gen_xmlPatternPtr(n_comp, 0);
16879         node = gen_xmlNodePtr(n_node, 1);
16880 
16881         ret_val = xmlPatternMatch(comp, node);
16882         desret_int(ret_val);
16883         call_tests++;
16884         des_xmlPatternPtr(n_comp, comp, 0);
16885         des_xmlNodePtr(n_node, node, 1);
16886         xmlResetLastError();
16887         if (mem_base != xmlMemBlocks()) {
16888             printf("Leak of %d blocks found in xmlPatternMatch",
16889 	           xmlMemBlocks() - mem_base);
16890 	    test_ret++;
16891             printf(" %d", n_comp);
16892             printf(" %d", n_node);
16893             printf("\n");
16894         }
16895     }
16896     }
16897     function_tests++;
16898 #endif
16899 
16900     return(test_ret);
16901 }
16902 
16903 
16904 static int
test_xmlPatternMaxDepth(void)16905 test_xmlPatternMaxDepth(void) {
16906     int test_ret = 0;
16907 
16908 #if defined(LIBXML_PATTERN_ENABLED)
16909     int mem_base;
16910     int ret_val;
16911     xmlPatternPtr comp; /* the precompiled pattern */
16912     int n_comp;
16913 
16914     for (n_comp = 0;n_comp < gen_nb_xmlPatternPtr;n_comp++) {
16915         mem_base = xmlMemBlocks();
16916         comp = gen_xmlPatternPtr(n_comp, 0);
16917 
16918         ret_val = xmlPatternMaxDepth(comp);
16919         desret_int(ret_val);
16920         call_tests++;
16921         des_xmlPatternPtr(n_comp, comp, 0);
16922         xmlResetLastError();
16923         if (mem_base != xmlMemBlocks()) {
16924             printf("Leak of %d blocks found in xmlPatternMaxDepth",
16925 	           xmlMemBlocks() - mem_base);
16926 	    test_ret++;
16927             printf(" %d", n_comp);
16928             printf("\n");
16929         }
16930     }
16931     function_tests++;
16932 #endif
16933 
16934     return(test_ret);
16935 }
16936 
16937 
16938 static int
test_xmlPatternMinDepth(void)16939 test_xmlPatternMinDepth(void) {
16940     int test_ret = 0;
16941 
16942 #if defined(LIBXML_PATTERN_ENABLED)
16943     int mem_base;
16944     int ret_val;
16945     xmlPatternPtr comp; /* the precompiled pattern */
16946     int n_comp;
16947 
16948     for (n_comp = 0;n_comp < gen_nb_xmlPatternPtr;n_comp++) {
16949         mem_base = xmlMemBlocks();
16950         comp = gen_xmlPatternPtr(n_comp, 0);
16951 
16952         ret_val = xmlPatternMinDepth(comp);
16953         desret_int(ret_val);
16954         call_tests++;
16955         des_xmlPatternPtr(n_comp, comp, 0);
16956         xmlResetLastError();
16957         if (mem_base != xmlMemBlocks()) {
16958             printf("Leak of %d blocks found in xmlPatternMinDepth",
16959 	           xmlMemBlocks() - mem_base);
16960 	    test_ret++;
16961             printf(" %d", n_comp);
16962             printf("\n");
16963         }
16964     }
16965     function_tests++;
16966 #endif
16967 
16968     return(test_ret);
16969 }
16970 
16971 
16972 static int
test_xmlPatternStreamable(void)16973 test_xmlPatternStreamable(void) {
16974     int test_ret = 0;
16975 
16976 #if defined(LIBXML_PATTERN_ENABLED)
16977     int mem_base;
16978     int ret_val;
16979     xmlPatternPtr comp; /* the precompiled pattern */
16980     int n_comp;
16981 
16982     for (n_comp = 0;n_comp < gen_nb_xmlPatternPtr;n_comp++) {
16983         mem_base = xmlMemBlocks();
16984         comp = gen_xmlPatternPtr(n_comp, 0);
16985 
16986         ret_val = xmlPatternStreamable(comp);
16987         desret_int(ret_val);
16988         call_tests++;
16989         des_xmlPatternPtr(n_comp, comp, 0);
16990         xmlResetLastError();
16991         if (mem_base != xmlMemBlocks()) {
16992             printf("Leak of %d blocks found in xmlPatternStreamable",
16993 	           xmlMemBlocks() - mem_base);
16994 	    test_ret++;
16995             printf(" %d", n_comp);
16996             printf("\n");
16997         }
16998     }
16999     function_tests++;
17000 #endif
17001 
17002     return(test_ret);
17003 }
17004 
17005 
17006 static int
test_xmlPatterncompile(void)17007 test_xmlPatterncompile(void) {
17008     int test_ret = 0;
17009 
17010 
17011     /* missing type support */
17012     return(test_ret);
17013 }
17014 
17015 #ifdef LIBXML_PATTERN_ENABLED
17016 
17017 #define gen_nb_xmlStreamCtxtPtr 1
17018 #define gen_xmlStreamCtxtPtr(no, nr) NULL
17019 #define des_xmlStreamCtxtPtr(no, val, nr)
17020 #endif
17021 
17022 
17023 static int
test_xmlStreamPop(void)17024 test_xmlStreamPop(void) {
17025     int test_ret = 0;
17026 
17027 #if defined(LIBXML_PATTERN_ENABLED)
17028     int mem_base;
17029     int ret_val;
17030     xmlStreamCtxtPtr stream; /* the stream context */
17031     int n_stream;
17032 
17033     for (n_stream = 0;n_stream < gen_nb_xmlStreamCtxtPtr;n_stream++) {
17034         mem_base = xmlMemBlocks();
17035         stream = gen_xmlStreamCtxtPtr(n_stream, 0);
17036 
17037         ret_val = xmlStreamPop(stream);
17038         desret_int(ret_val);
17039         call_tests++;
17040         des_xmlStreamCtxtPtr(n_stream, stream, 0);
17041         xmlResetLastError();
17042         if (mem_base != xmlMemBlocks()) {
17043             printf("Leak of %d blocks found in xmlStreamPop",
17044 	           xmlMemBlocks() - mem_base);
17045 	    test_ret++;
17046             printf(" %d", n_stream);
17047             printf("\n");
17048         }
17049     }
17050     function_tests++;
17051 #endif
17052 
17053     return(test_ret);
17054 }
17055 
17056 
17057 static int
test_xmlStreamPush(void)17058 test_xmlStreamPush(void) {
17059     int test_ret = 0;
17060 
17061 #if defined(LIBXML_PATTERN_ENABLED)
17062     int mem_base;
17063     int ret_val;
17064     xmlStreamCtxtPtr stream; /* the stream context */
17065     int n_stream;
17066     const xmlChar * name; /* the current name */
17067     int n_name;
17068     const xmlChar * ns; /* the namespace name */
17069     int n_ns;
17070 
17071     for (n_stream = 0;n_stream < gen_nb_xmlStreamCtxtPtr;n_stream++) {
17072     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
17073     for (n_ns = 0;n_ns < gen_nb_const_xmlChar_ptr;n_ns++) {
17074         mem_base = xmlMemBlocks();
17075         stream = gen_xmlStreamCtxtPtr(n_stream, 0);
17076         name = gen_const_xmlChar_ptr(n_name, 1);
17077         ns = gen_const_xmlChar_ptr(n_ns, 2);
17078 
17079         ret_val = xmlStreamPush(stream, name, ns);
17080         desret_int(ret_val);
17081         call_tests++;
17082         des_xmlStreamCtxtPtr(n_stream, stream, 0);
17083         des_const_xmlChar_ptr(n_name, name, 1);
17084         des_const_xmlChar_ptr(n_ns, ns, 2);
17085         xmlResetLastError();
17086         if (mem_base != xmlMemBlocks()) {
17087             printf("Leak of %d blocks found in xmlStreamPush",
17088 	           xmlMemBlocks() - mem_base);
17089 	    test_ret++;
17090             printf(" %d", n_stream);
17091             printf(" %d", n_name);
17092             printf(" %d", n_ns);
17093             printf("\n");
17094         }
17095     }
17096     }
17097     }
17098     function_tests++;
17099 #endif
17100 
17101     return(test_ret);
17102 }
17103 
17104 
17105 static int
test_xmlStreamPushAttr(void)17106 test_xmlStreamPushAttr(void) {
17107     int test_ret = 0;
17108 
17109 #if defined(LIBXML_PATTERN_ENABLED)
17110     int mem_base;
17111     int ret_val;
17112     xmlStreamCtxtPtr stream; /* the stream context */
17113     int n_stream;
17114     const xmlChar * name; /* the current name */
17115     int n_name;
17116     const xmlChar * ns; /* the namespace name */
17117     int n_ns;
17118 
17119     for (n_stream = 0;n_stream < gen_nb_xmlStreamCtxtPtr;n_stream++) {
17120     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
17121     for (n_ns = 0;n_ns < gen_nb_const_xmlChar_ptr;n_ns++) {
17122         mem_base = xmlMemBlocks();
17123         stream = gen_xmlStreamCtxtPtr(n_stream, 0);
17124         name = gen_const_xmlChar_ptr(n_name, 1);
17125         ns = gen_const_xmlChar_ptr(n_ns, 2);
17126 
17127         ret_val = xmlStreamPushAttr(stream, name, ns);
17128         desret_int(ret_val);
17129         call_tests++;
17130         des_xmlStreamCtxtPtr(n_stream, stream, 0);
17131         des_const_xmlChar_ptr(n_name, name, 1);
17132         des_const_xmlChar_ptr(n_ns, ns, 2);
17133         xmlResetLastError();
17134         if (mem_base != xmlMemBlocks()) {
17135             printf("Leak of %d blocks found in xmlStreamPushAttr",
17136 	           xmlMemBlocks() - mem_base);
17137 	    test_ret++;
17138             printf(" %d", n_stream);
17139             printf(" %d", n_name);
17140             printf(" %d", n_ns);
17141             printf("\n");
17142         }
17143     }
17144     }
17145     }
17146     function_tests++;
17147 #endif
17148 
17149     return(test_ret);
17150 }
17151 
17152 
17153 static int
test_xmlStreamPushNode(void)17154 test_xmlStreamPushNode(void) {
17155     int test_ret = 0;
17156 
17157 #if defined(LIBXML_PATTERN_ENABLED)
17158     int mem_base;
17159     int ret_val;
17160     xmlStreamCtxtPtr stream; /* the stream context */
17161     int n_stream;
17162     const xmlChar * name; /* the current name */
17163     int n_name;
17164     const xmlChar * ns; /* the namespace name */
17165     int n_ns;
17166     int nodeType; /* the type of the node being pushed */
17167     int n_nodeType;
17168 
17169     for (n_stream = 0;n_stream < gen_nb_xmlStreamCtxtPtr;n_stream++) {
17170     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
17171     for (n_ns = 0;n_ns < gen_nb_const_xmlChar_ptr;n_ns++) {
17172     for (n_nodeType = 0;n_nodeType < gen_nb_int;n_nodeType++) {
17173         mem_base = xmlMemBlocks();
17174         stream = gen_xmlStreamCtxtPtr(n_stream, 0);
17175         name = gen_const_xmlChar_ptr(n_name, 1);
17176         ns = gen_const_xmlChar_ptr(n_ns, 2);
17177         nodeType = gen_int(n_nodeType, 3);
17178 
17179         ret_val = xmlStreamPushNode(stream, name, ns, nodeType);
17180         desret_int(ret_val);
17181         call_tests++;
17182         des_xmlStreamCtxtPtr(n_stream, stream, 0);
17183         des_const_xmlChar_ptr(n_name, name, 1);
17184         des_const_xmlChar_ptr(n_ns, ns, 2);
17185         des_int(n_nodeType, nodeType, 3);
17186         xmlResetLastError();
17187         if (mem_base != xmlMemBlocks()) {
17188             printf("Leak of %d blocks found in xmlStreamPushNode",
17189 	           xmlMemBlocks() - mem_base);
17190 	    test_ret++;
17191             printf(" %d", n_stream);
17192             printf(" %d", n_name);
17193             printf(" %d", n_ns);
17194             printf(" %d", n_nodeType);
17195             printf("\n");
17196         }
17197     }
17198     }
17199     }
17200     }
17201     function_tests++;
17202 #endif
17203 
17204     return(test_ret);
17205 }
17206 
17207 
17208 static int
test_xmlStreamWantsAnyNode(void)17209 test_xmlStreamWantsAnyNode(void) {
17210     int test_ret = 0;
17211 
17212 #if defined(LIBXML_PATTERN_ENABLED)
17213     int mem_base;
17214     int ret_val;
17215     xmlStreamCtxtPtr streamCtxt; /* the stream context */
17216     int n_streamCtxt;
17217 
17218     for (n_streamCtxt = 0;n_streamCtxt < gen_nb_xmlStreamCtxtPtr;n_streamCtxt++) {
17219         mem_base = xmlMemBlocks();
17220         streamCtxt = gen_xmlStreamCtxtPtr(n_streamCtxt, 0);
17221 
17222         ret_val = xmlStreamWantsAnyNode(streamCtxt);
17223         desret_int(ret_val);
17224         call_tests++;
17225         des_xmlStreamCtxtPtr(n_streamCtxt, streamCtxt, 0);
17226         xmlResetLastError();
17227         if (mem_base != xmlMemBlocks()) {
17228             printf("Leak of %d blocks found in xmlStreamWantsAnyNode",
17229 	           xmlMemBlocks() - mem_base);
17230 	    test_ret++;
17231             printf(" %d", n_streamCtxt);
17232             printf("\n");
17233         }
17234     }
17235     function_tests++;
17236 #endif
17237 
17238     return(test_ret);
17239 }
17240 
17241 static int
test_pattern(void)17242 test_pattern(void) {
17243     int test_ret = 0;
17244 
17245     if (quiet == 0) printf("Testing pattern : 11 of 16 functions ...\n");
17246     test_ret += test_xmlPatternCompileSafe();
17247     test_ret += test_xmlPatternFromRoot();
17248     test_ret += test_xmlPatternGetStreamCtxt();
17249     test_ret += test_xmlPatternMatch();
17250     test_ret += test_xmlPatternMaxDepth();
17251     test_ret += test_xmlPatternMinDepth();
17252     test_ret += test_xmlPatternStreamable();
17253     test_ret += test_xmlPatterncompile();
17254     test_ret += test_xmlStreamPop();
17255     test_ret += test_xmlStreamPush();
17256     test_ret += test_xmlStreamPushAttr();
17257     test_ret += test_xmlStreamPushNode();
17258     test_ret += test_xmlStreamWantsAnyNode();
17259 
17260     if (test_ret != 0)
17261 	printf("Module pattern: %d errors\n", test_ret);
17262     return(test_ret);
17263 }
17264 #ifdef LIBXML_SCHEMAS_ENABLED
17265 
17266 #define gen_nb_xmlRelaxNGPtr 1
17267 #define gen_xmlRelaxNGPtr(no, nr) NULL
17268 #define des_xmlRelaxNGPtr(no, val, nr)
17269 #endif
17270 
17271 
17272 static int
test_xmlRelaxNGDump(void)17273 test_xmlRelaxNGDump(void) {
17274     int test_ret = 0;
17275 
17276 #if defined(LIBXML_SCHEMAS_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
17277     int mem_base;
17278     FILE * output; /* the file output */
17279     int n_output;
17280     xmlRelaxNGPtr schema; /* a schema structure */
17281     int n_schema;
17282 
17283     for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
17284     for (n_schema = 0;n_schema < gen_nb_xmlRelaxNGPtr;n_schema++) {
17285         mem_base = xmlMemBlocks();
17286         output = gen_FILE_ptr(n_output, 0);
17287         schema = gen_xmlRelaxNGPtr(n_schema, 1);
17288 
17289         xmlRelaxNGDump(output, schema);
17290         call_tests++;
17291         des_FILE_ptr(n_output, output, 0);
17292         des_xmlRelaxNGPtr(n_schema, schema, 1);
17293         xmlResetLastError();
17294         if (mem_base != xmlMemBlocks()) {
17295             printf("Leak of %d blocks found in xmlRelaxNGDump",
17296 	           xmlMemBlocks() - mem_base);
17297 	    test_ret++;
17298             printf(" %d", n_output);
17299             printf(" %d", n_schema);
17300             printf("\n");
17301         }
17302     }
17303     }
17304     function_tests++;
17305 #endif
17306 
17307     return(test_ret);
17308 }
17309 
17310 
17311 static int
test_xmlRelaxNGDumpTree(void)17312 test_xmlRelaxNGDumpTree(void) {
17313     int test_ret = 0;
17314 
17315 #if defined(LIBXML_SCHEMAS_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
17316     int mem_base;
17317     FILE * output; /* the file output */
17318     int n_output;
17319     xmlRelaxNGPtr schema; /* a schema structure */
17320     int n_schema;
17321 
17322     for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
17323     for (n_schema = 0;n_schema < gen_nb_xmlRelaxNGPtr;n_schema++) {
17324         mem_base = xmlMemBlocks();
17325         output = gen_FILE_ptr(n_output, 0);
17326         schema = gen_xmlRelaxNGPtr(n_schema, 1);
17327 
17328         xmlRelaxNGDumpTree(output, schema);
17329         call_tests++;
17330         des_FILE_ptr(n_output, output, 0);
17331         des_xmlRelaxNGPtr(n_schema, schema, 1);
17332         xmlResetLastError();
17333         if (mem_base != xmlMemBlocks()) {
17334             printf("Leak of %d blocks found in xmlRelaxNGDumpTree",
17335 	           xmlMemBlocks() - mem_base);
17336 	    test_ret++;
17337             printf(" %d", n_output);
17338             printf(" %d", n_schema);
17339             printf("\n");
17340         }
17341     }
17342     }
17343     function_tests++;
17344 #endif
17345 
17346     return(test_ret);
17347 }
17348 
17349 #ifdef LIBXML_SCHEMAS_ENABLED
17350 
17351 #define gen_nb_xmlRelaxNGParserCtxtPtr 1
17352 #define gen_xmlRelaxNGParserCtxtPtr(no, nr) NULL
17353 #define des_xmlRelaxNGParserCtxtPtr(no, val, nr)
17354 #endif
17355 
17356 #ifdef LIBXML_SCHEMAS_ENABLED
17357 
17358 #define gen_nb_xmlRelaxNGValidityErrorFunc_ptr 1
17359 #define gen_xmlRelaxNGValidityErrorFunc_ptr(no, nr) NULL
17360 #define des_xmlRelaxNGValidityErrorFunc_ptr(no, val, nr)
17361 #endif
17362 
17363 #ifdef LIBXML_SCHEMAS_ENABLED
17364 
17365 #define gen_nb_xmlRelaxNGValidityWarningFunc_ptr 1
17366 #define gen_xmlRelaxNGValidityWarningFunc_ptr(no, nr) NULL
17367 #define des_xmlRelaxNGValidityWarningFunc_ptr(no, val, nr)
17368 #endif
17369 
17370 
17371 static int
test_xmlRelaxNGGetParserErrors(void)17372 test_xmlRelaxNGGetParserErrors(void) {
17373     int test_ret = 0;
17374 
17375 #if defined(LIBXML_SCHEMAS_ENABLED)
17376     int mem_base;
17377     int ret_val;
17378     xmlRelaxNGParserCtxtPtr ctxt; /* a Relax-NG validation context */
17379     int n_ctxt;
17380     xmlRelaxNGValidityErrorFunc * err; /* the error callback result */
17381     int n_err;
17382     xmlRelaxNGValidityWarningFunc * warn; /* the warning callback result */
17383     int n_warn;
17384     void ** ctx; /* contextual data for the callbacks result */
17385     int n_ctx;
17386 
17387     for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGParserCtxtPtr;n_ctxt++) {
17388     for (n_err = 0;n_err < gen_nb_xmlRelaxNGValidityErrorFunc_ptr;n_err++) {
17389     for (n_warn = 0;n_warn < gen_nb_xmlRelaxNGValidityWarningFunc_ptr;n_warn++) {
17390     for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
17391         mem_base = xmlMemBlocks();
17392         ctxt = gen_xmlRelaxNGParserCtxtPtr(n_ctxt, 0);
17393         err = gen_xmlRelaxNGValidityErrorFunc_ptr(n_err, 1);
17394         warn = gen_xmlRelaxNGValidityWarningFunc_ptr(n_warn, 2);
17395         ctx = gen_void_ptr_ptr(n_ctx, 3);
17396 
17397         ret_val = xmlRelaxNGGetParserErrors(ctxt, err, warn, ctx);
17398         desret_int(ret_val);
17399         call_tests++;
17400         des_xmlRelaxNGParserCtxtPtr(n_ctxt, ctxt, 0);
17401         des_xmlRelaxNGValidityErrorFunc_ptr(n_err, err, 1);
17402         des_xmlRelaxNGValidityWarningFunc_ptr(n_warn, warn, 2);
17403         des_void_ptr_ptr(n_ctx, ctx, 3);
17404         xmlResetLastError();
17405         if (mem_base != xmlMemBlocks()) {
17406             printf("Leak of %d blocks found in xmlRelaxNGGetParserErrors",
17407 	           xmlMemBlocks() - mem_base);
17408 	    test_ret++;
17409             printf(" %d", n_ctxt);
17410             printf(" %d", n_err);
17411             printf(" %d", n_warn);
17412             printf(" %d", n_ctx);
17413             printf("\n");
17414         }
17415     }
17416     }
17417     }
17418     }
17419     function_tests++;
17420 #endif
17421 
17422     return(test_ret);
17423 }
17424 
17425 #ifdef LIBXML_SCHEMAS_ENABLED
17426 
17427 #define gen_nb_xmlRelaxNGValidCtxtPtr 1
17428 #define gen_xmlRelaxNGValidCtxtPtr(no, nr) NULL
17429 #define des_xmlRelaxNGValidCtxtPtr(no, val, nr)
17430 #endif
17431 
17432 
17433 static int
test_xmlRelaxNGGetValidErrors(void)17434 test_xmlRelaxNGGetValidErrors(void) {
17435     int test_ret = 0;
17436 
17437 #if defined(LIBXML_SCHEMAS_ENABLED)
17438     int mem_base;
17439     int ret_val;
17440     xmlRelaxNGValidCtxtPtr ctxt; /* a Relax-NG validation context */
17441     int n_ctxt;
17442     xmlRelaxNGValidityErrorFunc * err; /* the error function result */
17443     int n_err;
17444     xmlRelaxNGValidityWarningFunc * warn; /* the warning function result */
17445     int n_warn;
17446     void ** ctx; /* the functions context result */
17447     int n_ctx;
17448 
17449     for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17450     for (n_err = 0;n_err < gen_nb_xmlRelaxNGValidityErrorFunc_ptr;n_err++) {
17451     for (n_warn = 0;n_warn < gen_nb_xmlRelaxNGValidityWarningFunc_ptr;n_warn++) {
17452     for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
17453         mem_base = xmlMemBlocks();
17454         ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17455         err = gen_xmlRelaxNGValidityErrorFunc_ptr(n_err, 1);
17456         warn = gen_xmlRelaxNGValidityWarningFunc_ptr(n_warn, 2);
17457         ctx = gen_void_ptr_ptr(n_ctx, 3);
17458 
17459         ret_val = xmlRelaxNGGetValidErrors(ctxt, err, warn, ctx);
17460         desret_int(ret_val);
17461         call_tests++;
17462         des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17463         des_xmlRelaxNGValidityErrorFunc_ptr(n_err, err, 1);
17464         des_xmlRelaxNGValidityWarningFunc_ptr(n_warn, warn, 2);
17465         des_void_ptr_ptr(n_ctx, ctx, 3);
17466         xmlResetLastError();
17467         if (mem_base != xmlMemBlocks()) {
17468             printf("Leak of %d blocks found in xmlRelaxNGGetValidErrors",
17469 	           xmlMemBlocks() - mem_base);
17470 	    test_ret++;
17471             printf(" %d", n_ctxt);
17472             printf(" %d", n_err);
17473             printf(" %d", n_warn);
17474             printf(" %d", n_ctx);
17475             printf("\n");
17476         }
17477     }
17478     }
17479     }
17480     }
17481     function_tests++;
17482 #endif
17483 
17484     return(test_ret);
17485 }
17486 
17487 
17488 static int
test_xmlRelaxNGInitTypes(void)17489 test_xmlRelaxNGInitTypes(void) {
17490     int test_ret = 0;
17491 
17492 #if defined(LIBXML_SCHEMAS_ENABLED)
17493     int mem_base;
17494     int ret_val;
17495 
17496         mem_base = xmlMemBlocks();
17497 
17498         ret_val = xmlRelaxNGInitTypes();
17499         desret_int(ret_val);
17500         call_tests++;
17501         xmlResetLastError();
17502         if (mem_base != xmlMemBlocks()) {
17503             printf("Leak of %d blocks found in xmlRelaxNGInitTypes",
17504 	           xmlMemBlocks() - mem_base);
17505 	    test_ret++;
17506             printf("\n");
17507         }
17508     function_tests++;
17509 #endif
17510 
17511     return(test_ret);
17512 }
17513 
17514 
17515 static int
test_xmlRelaxNGNewDocParserCtxt(void)17516 test_xmlRelaxNGNewDocParserCtxt(void) {
17517     int test_ret = 0;
17518 
17519 #if defined(LIBXML_SCHEMAS_ENABLED)
17520     int mem_base;
17521     xmlRelaxNGParserCtxtPtr ret_val;
17522     xmlDocPtr doc; /* a preparsed document tree */
17523     int n_doc;
17524 
17525     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17526         mem_base = xmlMemBlocks();
17527         doc = gen_xmlDocPtr(n_doc, 0);
17528 
17529         ret_val = xmlRelaxNGNewDocParserCtxt(doc);
17530         desret_xmlRelaxNGParserCtxtPtr(ret_val);
17531         call_tests++;
17532         des_xmlDocPtr(n_doc, doc, 0);
17533         xmlResetLastError();
17534         if (mem_base != xmlMemBlocks()) {
17535             printf("Leak of %d blocks found in xmlRelaxNGNewDocParserCtxt",
17536 	           xmlMemBlocks() - mem_base);
17537 	    test_ret++;
17538             printf(" %d", n_doc);
17539             printf("\n");
17540         }
17541     }
17542     function_tests++;
17543 #endif
17544 
17545     return(test_ret);
17546 }
17547 
17548 
17549 static int
test_xmlRelaxNGNewMemParserCtxt(void)17550 test_xmlRelaxNGNewMemParserCtxt(void) {
17551     int test_ret = 0;
17552 
17553 #if defined(LIBXML_SCHEMAS_ENABLED)
17554     int mem_base;
17555     xmlRelaxNGParserCtxtPtr ret_val;
17556     const char * buffer; /* a pointer to a char array containing the schemas */
17557     int n_buffer;
17558     int size; /* the size of the array */
17559     int n_size;
17560 
17561     for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
17562     for (n_size = 0;n_size < gen_nb_int;n_size++) {
17563         mem_base = xmlMemBlocks();
17564         buffer = gen_const_char_ptr(n_buffer, 0);
17565         size = gen_int(n_size, 1);
17566         if ((buffer != NULL) &&
17567             (size > xmlStrlen(BAD_CAST buffer)))
17568             size = 0;
17569 
17570         ret_val = xmlRelaxNGNewMemParserCtxt(buffer, size);
17571         desret_xmlRelaxNGParserCtxtPtr(ret_val);
17572         call_tests++;
17573         des_const_char_ptr(n_buffer, buffer, 0);
17574         des_int(n_size, size, 1);
17575         xmlResetLastError();
17576         if (mem_base != xmlMemBlocks()) {
17577             printf("Leak of %d blocks found in xmlRelaxNGNewMemParserCtxt",
17578 	           xmlMemBlocks() - mem_base);
17579 	    test_ret++;
17580             printf(" %d", n_buffer);
17581             printf(" %d", n_size);
17582             printf("\n");
17583         }
17584     }
17585     }
17586     function_tests++;
17587 #endif
17588 
17589     return(test_ret);
17590 }
17591 
17592 
17593 static int
test_xmlRelaxNGNewParserCtxt(void)17594 test_xmlRelaxNGNewParserCtxt(void) {
17595     int test_ret = 0;
17596 
17597 #if defined(LIBXML_SCHEMAS_ENABLED)
17598     int mem_base;
17599     xmlRelaxNGParserCtxtPtr ret_val;
17600     const char * URL; /* the location of the schema */
17601     int n_URL;
17602 
17603     for (n_URL = 0;n_URL < gen_nb_const_char_ptr;n_URL++) {
17604         mem_base = xmlMemBlocks();
17605         URL = gen_const_char_ptr(n_URL, 0);
17606 
17607         ret_val = xmlRelaxNGNewParserCtxt(URL);
17608         desret_xmlRelaxNGParserCtxtPtr(ret_val);
17609         call_tests++;
17610         des_const_char_ptr(n_URL, URL, 0);
17611         xmlResetLastError();
17612         if (mem_base != xmlMemBlocks()) {
17613             printf("Leak of %d blocks found in xmlRelaxNGNewParserCtxt",
17614 	           xmlMemBlocks() - mem_base);
17615 	    test_ret++;
17616             printf(" %d", n_URL);
17617             printf("\n");
17618         }
17619     }
17620     function_tests++;
17621 #endif
17622 
17623     return(test_ret);
17624 }
17625 
17626 
17627 static int
test_xmlRelaxNGNewValidCtxt(void)17628 test_xmlRelaxNGNewValidCtxt(void) {
17629     int test_ret = 0;
17630 
17631 
17632     /* missing type support */
17633     return(test_ret);
17634 }
17635 
17636 
17637 static int
test_xmlRelaxNGParse(void)17638 test_xmlRelaxNGParse(void) {
17639     int test_ret = 0;
17640 
17641 
17642     /* missing type support */
17643     return(test_ret);
17644 }
17645 
17646 
17647 static int
test_xmlRelaxNGSetParserErrors(void)17648 test_xmlRelaxNGSetParserErrors(void) {
17649     int test_ret = 0;
17650 
17651 
17652     /* missing type support */
17653     return(test_ret);
17654 }
17655 
17656 
17657 static int
test_xmlRelaxNGSetParserStructuredErrors(void)17658 test_xmlRelaxNGSetParserStructuredErrors(void) {
17659     int test_ret = 0;
17660 
17661 
17662     /* missing type support */
17663     return(test_ret);
17664 }
17665 
17666 
17667 static int
test_xmlRelaxNGSetResourceLoader(void)17668 test_xmlRelaxNGSetResourceLoader(void) {
17669     int test_ret = 0;
17670 
17671 
17672     /* missing type support */
17673     return(test_ret);
17674 }
17675 
17676 
17677 static int
test_xmlRelaxNGSetValidErrors(void)17678 test_xmlRelaxNGSetValidErrors(void) {
17679     int test_ret = 0;
17680 
17681 
17682     /* missing type support */
17683     return(test_ret);
17684 }
17685 
17686 
17687 static int
test_xmlRelaxNGSetValidStructuredErrors(void)17688 test_xmlRelaxNGSetValidStructuredErrors(void) {
17689     int test_ret = 0;
17690 
17691 
17692     /* missing type support */
17693     return(test_ret);
17694 }
17695 
17696 
17697 static int
test_xmlRelaxNGValidateDoc(void)17698 test_xmlRelaxNGValidateDoc(void) {
17699     int test_ret = 0;
17700 
17701 #if defined(LIBXML_SCHEMAS_ENABLED)
17702     int mem_base;
17703     int ret_val;
17704     xmlRelaxNGValidCtxtPtr ctxt; /* a Relax-NG validation context */
17705     int n_ctxt;
17706     xmlDocPtr doc; /* a parsed document tree */
17707     int n_doc;
17708 
17709     for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17710     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17711         mem_base = xmlMemBlocks();
17712         ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17713         doc = gen_xmlDocPtr(n_doc, 1);
17714 
17715         ret_val = xmlRelaxNGValidateDoc(ctxt, doc);
17716         desret_int(ret_val);
17717         call_tests++;
17718         des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17719         des_xmlDocPtr(n_doc, doc, 1);
17720         xmlResetLastError();
17721         if (mem_base != xmlMemBlocks()) {
17722             printf("Leak of %d blocks found in xmlRelaxNGValidateDoc",
17723 	           xmlMemBlocks() - mem_base);
17724 	    test_ret++;
17725             printf(" %d", n_ctxt);
17726             printf(" %d", n_doc);
17727             printf("\n");
17728         }
17729     }
17730     }
17731     function_tests++;
17732 #endif
17733 
17734     return(test_ret);
17735 }
17736 
17737 
17738 static int
test_xmlRelaxNGValidateFullElement(void)17739 test_xmlRelaxNGValidateFullElement(void) {
17740     int test_ret = 0;
17741 
17742 #if defined(LIBXML_SCHEMAS_ENABLED)
17743     int mem_base;
17744     int ret_val;
17745     xmlRelaxNGValidCtxtPtr ctxt; /* the validation context */
17746     int n_ctxt;
17747     xmlDocPtr doc; /* a document instance */
17748     int n_doc;
17749     xmlNodePtr elem; /* an element instance */
17750     int n_elem;
17751 
17752     for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17753     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17754     for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
17755         mem_base = xmlMemBlocks();
17756         ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17757         doc = gen_xmlDocPtr(n_doc, 1);
17758         elem = gen_xmlNodePtr(n_elem, 2);
17759 
17760         ret_val = xmlRelaxNGValidateFullElement(ctxt, doc, elem);
17761         desret_int(ret_val);
17762         call_tests++;
17763         des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17764         des_xmlDocPtr(n_doc, doc, 1);
17765         des_xmlNodePtr(n_elem, elem, 2);
17766         xmlResetLastError();
17767         if (mem_base != xmlMemBlocks()) {
17768             printf("Leak of %d blocks found in xmlRelaxNGValidateFullElement",
17769 	           xmlMemBlocks() - mem_base);
17770 	    test_ret++;
17771             printf(" %d", n_ctxt);
17772             printf(" %d", n_doc);
17773             printf(" %d", n_elem);
17774             printf("\n");
17775         }
17776     }
17777     }
17778     }
17779     function_tests++;
17780 #endif
17781 
17782     return(test_ret);
17783 }
17784 
17785 
17786 static int
test_xmlRelaxNGValidatePopElement(void)17787 test_xmlRelaxNGValidatePopElement(void) {
17788     int test_ret = 0;
17789 
17790 #if defined(LIBXML_SCHEMAS_ENABLED)
17791     int mem_base;
17792     int ret_val;
17793     xmlRelaxNGValidCtxtPtr ctxt; /* the RelaxNG validation context */
17794     int n_ctxt;
17795     xmlDocPtr doc; /* a document instance */
17796     int n_doc;
17797     xmlNodePtr elem; /* an element instance */
17798     int n_elem;
17799 
17800     for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17801     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17802     for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
17803         mem_base = xmlMemBlocks();
17804         ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17805         doc = gen_xmlDocPtr(n_doc, 1);
17806         elem = gen_xmlNodePtr(n_elem, 2);
17807 
17808         ret_val = xmlRelaxNGValidatePopElement(ctxt, doc, elem);
17809         desret_int(ret_val);
17810         call_tests++;
17811         des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17812         des_xmlDocPtr(n_doc, doc, 1);
17813         des_xmlNodePtr(n_elem, elem, 2);
17814         xmlResetLastError();
17815         if (mem_base != xmlMemBlocks()) {
17816             printf("Leak of %d blocks found in xmlRelaxNGValidatePopElement",
17817 	           xmlMemBlocks() - mem_base);
17818 	    test_ret++;
17819             printf(" %d", n_ctxt);
17820             printf(" %d", n_doc);
17821             printf(" %d", n_elem);
17822             printf("\n");
17823         }
17824     }
17825     }
17826     }
17827     function_tests++;
17828 #endif
17829 
17830     return(test_ret);
17831 }
17832 
17833 
17834 static int
test_xmlRelaxNGValidatePushCData(void)17835 test_xmlRelaxNGValidatePushCData(void) {
17836     int test_ret = 0;
17837 
17838 #if defined(LIBXML_SCHEMAS_ENABLED)
17839     int mem_base;
17840     int ret_val;
17841     xmlRelaxNGValidCtxtPtr ctxt; /* the RelaxNG validation context */
17842     int n_ctxt;
17843     const xmlChar * data; /* some character data read */
17844     int n_data;
17845     int len; /* the length of the data */
17846     int n_len;
17847 
17848     for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17849     for (n_data = 0;n_data < gen_nb_const_xmlChar_ptr;n_data++) {
17850     for (n_len = 0;n_len < gen_nb_int;n_len++) {
17851         mem_base = xmlMemBlocks();
17852         ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17853         data = gen_const_xmlChar_ptr(n_data, 1);
17854         len = gen_int(n_len, 2);
17855         if ((data != NULL) &&
17856             (len > xmlStrlen(BAD_CAST data)))
17857             len = 0;
17858 
17859         ret_val = xmlRelaxNGValidatePushCData(ctxt, data, len);
17860         desret_int(ret_val);
17861         call_tests++;
17862         des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17863         des_const_xmlChar_ptr(n_data, data, 1);
17864         des_int(n_len, len, 2);
17865         xmlResetLastError();
17866         if (mem_base != xmlMemBlocks()) {
17867             printf("Leak of %d blocks found in xmlRelaxNGValidatePushCData",
17868 	           xmlMemBlocks() - mem_base);
17869 	    test_ret++;
17870             printf(" %d", n_ctxt);
17871             printf(" %d", n_data);
17872             printf(" %d", n_len);
17873             printf("\n");
17874         }
17875     }
17876     }
17877     }
17878     function_tests++;
17879 #endif
17880 
17881     return(test_ret);
17882 }
17883 
17884 
17885 static int
test_xmlRelaxNGValidatePushElement(void)17886 test_xmlRelaxNGValidatePushElement(void) {
17887     int test_ret = 0;
17888 
17889 #if defined(LIBXML_SCHEMAS_ENABLED)
17890     int mem_base;
17891     int ret_val;
17892     xmlRelaxNGValidCtxtPtr ctxt; /* the validation context */
17893     int n_ctxt;
17894     xmlDocPtr doc; /* a document instance */
17895     int n_doc;
17896     xmlNodePtr elem; /* an element instance */
17897     int n_elem;
17898 
17899     for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17900     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17901     for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
17902         mem_base = xmlMemBlocks();
17903         ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17904         doc = gen_xmlDocPtr(n_doc, 1);
17905         elem = gen_xmlNodePtr(n_elem, 2);
17906 
17907         ret_val = xmlRelaxNGValidatePushElement(ctxt, doc, elem);
17908         desret_int(ret_val);
17909         call_tests++;
17910         des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17911         des_xmlDocPtr(n_doc, doc, 1);
17912         des_xmlNodePtr(n_elem, elem, 2);
17913         xmlResetLastError();
17914         if (mem_base != xmlMemBlocks()) {
17915             printf("Leak of %d blocks found in xmlRelaxNGValidatePushElement",
17916 	           xmlMemBlocks() - mem_base);
17917 	    test_ret++;
17918             printf(" %d", n_ctxt);
17919             printf(" %d", n_doc);
17920             printf(" %d", n_elem);
17921             printf("\n");
17922         }
17923     }
17924     }
17925     }
17926     function_tests++;
17927 #endif
17928 
17929     return(test_ret);
17930 }
17931 
17932 
17933 static int
test_xmlRelaxParserSetFlag(void)17934 test_xmlRelaxParserSetFlag(void) {
17935     int test_ret = 0;
17936 
17937 #if defined(LIBXML_SCHEMAS_ENABLED)
17938     int mem_base;
17939     int ret_val;
17940     xmlRelaxNGParserCtxtPtr ctxt; /* a RelaxNG parser context */
17941     int n_ctxt;
17942     int flags; /* a set of flags values */
17943     int n_flags;
17944 
17945     for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGParserCtxtPtr;n_ctxt++) {
17946     for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
17947         mem_base = xmlMemBlocks();
17948         ctxt = gen_xmlRelaxNGParserCtxtPtr(n_ctxt, 0);
17949         flags = gen_int(n_flags, 1);
17950 
17951         ret_val = xmlRelaxParserSetFlag(ctxt, flags);
17952         desret_int(ret_val);
17953         call_tests++;
17954         des_xmlRelaxNGParserCtxtPtr(n_ctxt, ctxt, 0);
17955         des_int(n_flags, flags, 1);
17956         xmlResetLastError();
17957         if (mem_base != xmlMemBlocks()) {
17958             printf("Leak of %d blocks found in xmlRelaxParserSetFlag",
17959 	           xmlMemBlocks() - mem_base);
17960 	    test_ret++;
17961             printf(" %d", n_ctxt);
17962             printf(" %d", n_flags);
17963             printf("\n");
17964         }
17965     }
17966     }
17967     function_tests++;
17968 #endif
17969 
17970     return(test_ret);
17971 }
17972 
17973 static int
test_relaxng(void)17974 test_relaxng(void) {
17975     int test_ret = 0;
17976 
17977     if (quiet == 0) printf("Testing relaxng : 14 of 25 functions ...\n");
17978     test_ret += test_xmlRelaxNGDump();
17979     test_ret += test_xmlRelaxNGDumpTree();
17980     test_ret += test_xmlRelaxNGGetParserErrors();
17981     test_ret += test_xmlRelaxNGGetValidErrors();
17982     test_ret += test_xmlRelaxNGInitTypes();
17983     test_ret += test_xmlRelaxNGNewDocParserCtxt();
17984     test_ret += test_xmlRelaxNGNewMemParserCtxt();
17985     test_ret += test_xmlRelaxNGNewParserCtxt();
17986     test_ret += test_xmlRelaxNGNewValidCtxt();
17987     test_ret += test_xmlRelaxNGParse();
17988     test_ret += test_xmlRelaxNGSetParserErrors();
17989     test_ret += test_xmlRelaxNGSetParserStructuredErrors();
17990     test_ret += test_xmlRelaxNGSetResourceLoader();
17991     test_ret += test_xmlRelaxNGSetValidErrors();
17992     test_ret += test_xmlRelaxNGSetValidStructuredErrors();
17993     test_ret += test_xmlRelaxNGValidateDoc();
17994     test_ret += test_xmlRelaxNGValidateFullElement();
17995     test_ret += test_xmlRelaxNGValidatePopElement();
17996     test_ret += test_xmlRelaxNGValidatePushCData();
17997     test_ret += test_xmlRelaxNGValidatePushElement();
17998     test_ret += test_xmlRelaxParserSetFlag();
17999 
18000     if (test_ret != 0)
18001 	printf("Module relaxng: %d errors\n", test_ret);
18002     return(test_ret);
18003 }
18004 static int
test_schemasInternals(void)18005 test_schemasInternals(void) {
18006     int test_ret = 0;
18007 
18008     if (quiet == 0) printf("Testing schemasInternals : 0 of 2 functions ...\n");
18009 
18010     if (test_ret != 0)
18011 	printf("Module schemasInternals: %d errors\n", test_ret);
18012     return(test_ret);
18013 }
18014 
18015 static int
test_xmlSchematronNewDocParserCtxt(void)18016 test_xmlSchematronNewDocParserCtxt(void) {
18017     int test_ret = 0;
18018 
18019 
18020     /* missing type support */
18021     return(test_ret);
18022 }
18023 
18024 
18025 static int
test_xmlSchematronNewMemParserCtxt(void)18026 test_xmlSchematronNewMemParserCtxt(void) {
18027     int test_ret = 0;
18028 
18029 
18030     /* missing type support */
18031     return(test_ret);
18032 }
18033 
18034 
18035 static int
test_xmlSchematronNewParserCtxt(void)18036 test_xmlSchematronNewParserCtxt(void) {
18037     int test_ret = 0;
18038 
18039 
18040     /* missing type support */
18041     return(test_ret);
18042 }
18043 
18044 
18045 static int
test_xmlSchematronNewValidCtxt(void)18046 test_xmlSchematronNewValidCtxt(void) {
18047     int test_ret = 0;
18048 
18049 
18050     /* missing type support */
18051     return(test_ret);
18052 }
18053 
18054 
18055 static int
test_xmlSchematronParse(void)18056 test_xmlSchematronParse(void) {
18057     int test_ret = 0;
18058 
18059 
18060     /* missing type support */
18061     return(test_ret);
18062 }
18063 
18064 
18065 static int
test_xmlSchematronSetValidStructuredErrors(void)18066 test_xmlSchematronSetValidStructuredErrors(void) {
18067     int test_ret = 0;
18068 
18069 
18070     /* missing type support */
18071     return(test_ret);
18072 }
18073 
18074 #ifdef LIBXML_SCHEMATRON_ENABLED
18075 
18076 #define gen_nb_xmlSchematronValidCtxtPtr 1
18077 #define gen_xmlSchematronValidCtxtPtr(no, nr) NULL
18078 #define des_xmlSchematronValidCtxtPtr(no, val, nr)
18079 #endif
18080 
18081 
18082 static int
test_xmlSchematronValidateDoc(void)18083 test_xmlSchematronValidateDoc(void) {
18084     int test_ret = 0;
18085 
18086 #if defined(LIBXML_SCHEMATRON_ENABLED)
18087     int mem_base;
18088     int ret_val;
18089     xmlSchematronValidCtxtPtr ctxt; /* the schema validation context */
18090     int n_ctxt;
18091     xmlDocPtr instance; /* the document instance tree */
18092     int n_instance;
18093 
18094     for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchematronValidCtxtPtr;n_ctxt++) {
18095     for (n_instance = 0;n_instance < gen_nb_xmlDocPtr;n_instance++) {
18096         mem_base = xmlMemBlocks();
18097         ctxt = gen_xmlSchematronValidCtxtPtr(n_ctxt, 0);
18098         instance = gen_xmlDocPtr(n_instance, 1);
18099 
18100         ret_val = xmlSchematronValidateDoc(ctxt, instance);
18101         desret_int(ret_val);
18102         call_tests++;
18103         des_xmlSchematronValidCtxtPtr(n_ctxt, ctxt, 0);
18104         des_xmlDocPtr(n_instance, instance, 1);
18105         xmlResetLastError();
18106         if (mem_base != xmlMemBlocks()) {
18107             printf("Leak of %d blocks found in xmlSchematronValidateDoc",
18108 	           xmlMemBlocks() - mem_base);
18109 	    test_ret++;
18110             printf(" %d", n_ctxt);
18111             printf(" %d", n_instance);
18112             printf("\n");
18113         }
18114     }
18115     }
18116     function_tests++;
18117 #endif
18118 
18119     return(test_ret);
18120 }
18121 
18122 static int
test_schematron(void)18123 test_schematron(void) {
18124     int test_ret = 0;
18125 
18126     if (quiet == 0) printf("Testing schematron : 1 of 10 functions ...\n");
18127     test_ret += test_xmlSchematronNewDocParserCtxt();
18128     test_ret += test_xmlSchematronNewMemParserCtxt();
18129     test_ret += test_xmlSchematronNewParserCtxt();
18130     test_ret += test_xmlSchematronNewValidCtxt();
18131     test_ret += test_xmlSchematronParse();
18132     test_ret += test_xmlSchematronSetValidStructuredErrors();
18133     test_ret += test_xmlSchematronValidateDoc();
18134 
18135     if (test_ret != 0)
18136 	printf("Module schematron: %d errors\n", test_ret);
18137     return(test_ret);
18138 }
18139 
18140 static int
test_xmlAddChild(void)18141 test_xmlAddChild(void) {
18142     int test_ret = 0;
18143 
18144     int mem_base;
18145     xmlNodePtr ret_val;
18146     xmlNodePtr parent; /* the parent node */
18147     int n_parent;
18148     xmlNodePtr cur; /* the child node */
18149     int n_cur;
18150 
18151     for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
18152     for (n_cur = 0;n_cur < gen_nb_xmlNodePtr_in;n_cur++) {
18153         mem_base = xmlMemBlocks();
18154         parent = gen_xmlNodePtr(n_parent, 0);
18155         cur = gen_xmlNodePtr_in(n_cur, 1);
18156 
18157         ret_val = xmlAddChild(parent, cur);
18158         if (ret_val == NULL) { xmlFreeNode(cur) ; cur = NULL ; }
18159         desret_xmlNodePtr(ret_val);
18160         call_tests++;
18161         des_xmlNodePtr(n_parent, parent, 0);
18162         des_xmlNodePtr_in(n_cur, cur, 1);
18163         xmlResetLastError();
18164         if (mem_base != xmlMemBlocks()) {
18165             printf("Leak of %d blocks found in xmlAddChild",
18166 	           xmlMemBlocks() - mem_base);
18167 	    test_ret++;
18168             printf(" %d", n_parent);
18169             printf(" %d", n_cur);
18170             printf("\n");
18171         }
18172     }
18173     }
18174     function_tests++;
18175 
18176     return(test_ret);
18177 }
18178 
18179 
18180 static int
test_xmlAddChildList(void)18181 test_xmlAddChildList(void) {
18182     int test_ret = 0;
18183 
18184     int mem_base;
18185     xmlNodePtr ret_val;
18186     xmlNodePtr parent; /* the parent node */
18187     int n_parent;
18188     xmlNodePtr cur; /* the first node in the list */
18189     int n_cur;
18190 
18191     for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
18192     for (n_cur = 0;n_cur < gen_nb_xmlNodePtr_in;n_cur++) {
18193         mem_base = xmlMemBlocks();
18194         parent = gen_xmlNodePtr(n_parent, 0);
18195         cur = gen_xmlNodePtr_in(n_cur, 1);
18196 
18197         ret_val = xmlAddChildList(parent, cur);
18198         if (ret_val == NULL) { xmlFreeNodeList(cur) ; cur = NULL ; }
18199         desret_xmlNodePtr(ret_val);
18200         call_tests++;
18201         des_xmlNodePtr(n_parent, parent, 0);
18202         des_xmlNodePtr_in(n_cur, cur, 1);
18203         xmlResetLastError();
18204         if (mem_base != xmlMemBlocks()) {
18205             printf("Leak of %d blocks found in xmlAddChildList",
18206 	           xmlMemBlocks() - mem_base);
18207 	    test_ret++;
18208             printf(" %d", n_parent);
18209             printf(" %d", n_cur);
18210             printf("\n");
18211         }
18212     }
18213     }
18214     function_tests++;
18215 
18216     return(test_ret);
18217 }
18218 
18219 
18220 static int
test_xmlAddNextSibling(void)18221 test_xmlAddNextSibling(void) {
18222     int test_ret = 0;
18223 
18224     int mem_base;
18225     xmlNodePtr ret_val;
18226     xmlNodePtr prev; /* the target node */
18227     int n_prev;
18228     xmlNodePtr cur; /* the new node */
18229     int n_cur;
18230 
18231     for (n_prev = 0;n_prev < gen_nb_xmlNodePtr;n_prev++) {
18232     for (n_cur = 0;n_cur < gen_nb_xmlNodePtr_in;n_cur++) {
18233         mem_base = xmlMemBlocks();
18234         prev = gen_xmlNodePtr(n_prev, 0);
18235         cur = gen_xmlNodePtr_in(n_cur, 1);
18236 
18237         ret_val = xmlAddNextSibling(prev, cur);
18238         if (ret_val == NULL) { xmlFreeNode(cur) ; cur = NULL ; }
18239         desret_xmlNodePtr(ret_val);
18240         call_tests++;
18241         des_xmlNodePtr(n_prev, prev, 0);
18242         des_xmlNodePtr_in(n_cur, cur, 1);
18243         xmlResetLastError();
18244         if (mem_base != xmlMemBlocks()) {
18245             printf("Leak of %d blocks found in xmlAddNextSibling",
18246 	           xmlMemBlocks() - mem_base);
18247 	    test_ret++;
18248             printf(" %d", n_prev);
18249             printf(" %d", n_cur);
18250             printf("\n");
18251         }
18252     }
18253     }
18254     function_tests++;
18255 
18256     return(test_ret);
18257 }
18258 
18259 
18260 static int
test_xmlAddPrevSibling(void)18261 test_xmlAddPrevSibling(void) {
18262     int test_ret = 0;
18263 
18264     int mem_base;
18265     xmlNodePtr ret_val;
18266     xmlNodePtr next; /* the target node */
18267     int n_next;
18268     xmlNodePtr cur; /* the new node */
18269     int n_cur;
18270 
18271     for (n_next = 0;n_next < gen_nb_xmlNodePtr;n_next++) {
18272     for (n_cur = 0;n_cur < gen_nb_xmlNodePtr_in;n_cur++) {
18273         mem_base = xmlMemBlocks();
18274         next = gen_xmlNodePtr(n_next, 0);
18275         cur = gen_xmlNodePtr_in(n_cur, 1);
18276 
18277         ret_val = xmlAddPrevSibling(next, cur);
18278         if (ret_val == NULL) { xmlFreeNode(cur) ; cur = NULL ; }
18279         desret_xmlNodePtr(ret_val);
18280         call_tests++;
18281         des_xmlNodePtr(n_next, next, 0);
18282         des_xmlNodePtr_in(n_cur, cur, 1);
18283         xmlResetLastError();
18284         if (mem_base != xmlMemBlocks()) {
18285             printf("Leak of %d blocks found in xmlAddPrevSibling",
18286 	           xmlMemBlocks() - mem_base);
18287 	    test_ret++;
18288             printf(" %d", n_next);
18289             printf(" %d", n_cur);
18290             printf("\n");
18291         }
18292     }
18293     }
18294     function_tests++;
18295 
18296     return(test_ret);
18297 }
18298 
18299 
18300 static int
test_xmlAddSibling(void)18301 test_xmlAddSibling(void) {
18302     int test_ret = 0;
18303 
18304     int mem_base;
18305     xmlNodePtr ret_val;
18306     xmlNodePtr node; /* the target node */
18307     int n_node;
18308     xmlNodePtr cur; /* the new node */
18309     int n_cur;
18310 
18311     for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
18312     for (n_cur = 0;n_cur < gen_nb_xmlNodePtr_in;n_cur++) {
18313         mem_base = xmlMemBlocks();
18314         node = gen_xmlNodePtr(n_node, 0);
18315         cur = gen_xmlNodePtr_in(n_cur, 1);
18316 
18317         ret_val = xmlAddSibling(node, cur);
18318         if (ret_val == NULL) { xmlFreeNode(cur) ; cur = NULL ; }
18319         desret_xmlNodePtr(ret_val);
18320         call_tests++;
18321         des_xmlNodePtr(n_node, node, 0);
18322         des_xmlNodePtr_in(n_cur, cur, 1);
18323         xmlResetLastError();
18324         if (mem_base != xmlMemBlocks()) {
18325             printf("Leak of %d blocks found in xmlAddSibling",
18326 	           xmlMemBlocks() - mem_base);
18327 	    test_ret++;
18328             printf(" %d", n_node);
18329             printf(" %d", n_cur);
18330             printf("\n");
18331         }
18332     }
18333     }
18334     function_tests++;
18335 
18336     return(test_ret);
18337 }
18338 
18339 
18340 static int
test_xmlAttrSerializeTxtContent(void)18341 test_xmlAttrSerializeTxtContent(void) {
18342     int test_ret = 0;
18343 
18344 #if defined(LIBXML_OUTPUT_ENABLED)
18345 #ifdef LIBXML_OUTPUT_ENABLED
18346     int mem_base;
18347     xmlBufferPtr buf; /* the XML buffer output */
18348     int n_buf;
18349     xmlDocPtr doc; /* the document */
18350     int n_doc;
18351     xmlAttrPtr attr; /* the attribute node */
18352     int n_attr;
18353     const xmlChar * string; /* the text content */
18354     int n_string;
18355 
18356     for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18357     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
18358     for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
18359     for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
18360         mem_base = xmlMemBlocks();
18361         buf = gen_xmlBufferPtr(n_buf, 0);
18362         doc = gen_xmlDocPtr(n_doc, 1);
18363         attr = gen_xmlAttrPtr(n_attr, 2);
18364         string = gen_const_xmlChar_ptr(n_string, 3);
18365 
18366         xmlAttrSerializeTxtContent(buf, doc, attr, string);
18367         call_tests++;
18368         des_xmlBufferPtr(n_buf, buf, 0);
18369         des_xmlDocPtr(n_doc, doc, 1);
18370         des_xmlAttrPtr(n_attr, attr, 2);
18371         des_const_xmlChar_ptr(n_string, string, 3);
18372         xmlResetLastError();
18373         if (mem_base != xmlMemBlocks()) {
18374             printf("Leak of %d blocks found in xmlAttrSerializeTxtContent",
18375 	           xmlMemBlocks() - mem_base);
18376 	    test_ret++;
18377             printf(" %d", n_buf);
18378             printf(" %d", n_doc);
18379             printf(" %d", n_attr);
18380             printf(" %d", n_string);
18381             printf("\n");
18382         }
18383     }
18384     }
18385     }
18386     }
18387     function_tests++;
18388 #endif
18389 #endif
18390 
18391     return(test_ret);
18392 }
18393 
18394 
18395 #define gen_nb_const_xmlBuf_ptr 1
18396 #define gen_const_xmlBuf_ptr(no, nr) NULL
18397 #define des_const_xmlBuf_ptr(no, val, nr)
18398 
18399 static int
test_xmlBufContent(void)18400 test_xmlBufContent(void) {
18401     int test_ret = 0;
18402 
18403     int mem_base;
18404     xmlChar * ret_val;
18405     const xmlBuf * buf; /* the buffer */
18406     int n_buf;
18407 
18408     for (n_buf = 0;n_buf < gen_nb_const_xmlBuf_ptr;n_buf++) {
18409         mem_base = xmlMemBlocks();
18410         buf = gen_const_xmlBuf_ptr(n_buf, 0);
18411 
18412         ret_val = xmlBufContent(buf);
18413         desret_xmlChar_ptr(ret_val);
18414         call_tests++;
18415         des_const_xmlBuf_ptr(n_buf, buf, 0);
18416         xmlResetLastError();
18417         if (mem_base != xmlMemBlocks()) {
18418             printf("Leak of %d blocks found in xmlBufContent",
18419 	           xmlMemBlocks() - mem_base);
18420 	    test_ret++;
18421             printf(" %d", n_buf);
18422             printf("\n");
18423         }
18424     }
18425     function_tests++;
18426 
18427     return(test_ret);
18428 }
18429 
18430 
18431 #define gen_nb_xmlBufPtr 1
18432 #define gen_xmlBufPtr(no, nr) NULL
18433 #define des_xmlBufPtr(no, val, nr)
18434 
18435 static int
test_xmlBufEnd(void)18436 test_xmlBufEnd(void) {
18437     int test_ret = 0;
18438 
18439     int mem_base;
18440     xmlChar * ret_val;
18441     xmlBufPtr buf; /* the buffer */
18442     int n_buf;
18443 
18444     for (n_buf = 0;n_buf < gen_nb_xmlBufPtr;n_buf++) {
18445         mem_base = xmlMemBlocks();
18446         buf = gen_xmlBufPtr(n_buf, 0);
18447 
18448         ret_val = xmlBufEnd(buf);
18449         desret_xmlChar_ptr(ret_val);
18450         call_tests++;
18451         des_xmlBufPtr(n_buf, buf, 0);
18452         xmlResetLastError();
18453         if (mem_base != xmlMemBlocks()) {
18454             printf("Leak of %d blocks found in xmlBufEnd",
18455 	           xmlMemBlocks() - mem_base);
18456 	    test_ret++;
18457             printf(" %d", n_buf);
18458             printf("\n");
18459         }
18460     }
18461     function_tests++;
18462 
18463     return(test_ret);
18464 }
18465 
18466 
18467 #define gen_nb_const_xmlNode_ptr 1
18468 #define gen_const_xmlNode_ptr(no, nr) NULL
18469 #define des_const_xmlNode_ptr(no, val, nr)
18470 
18471 static int
test_xmlBufGetNodeContent(void)18472 test_xmlBufGetNodeContent(void) {
18473     int test_ret = 0;
18474 
18475     int mem_base;
18476     int ret_val;
18477     xmlBufPtr buf; /* a buffer xmlBufPtr */
18478     int n_buf;
18479     const xmlNode * cur; /* the node being read */
18480     int n_cur;
18481 
18482     for (n_buf = 0;n_buf < gen_nb_xmlBufPtr;n_buf++) {
18483     for (n_cur = 0;n_cur < gen_nb_const_xmlNode_ptr;n_cur++) {
18484         mem_base = xmlMemBlocks();
18485         buf = gen_xmlBufPtr(n_buf, 0);
18486         cur = gen_const_xmlNode_ptr(n_cur, 1);
18487 
18488         ret_val = xmlBufGetNodeContent(buf, cur);
18489         desret_int(ret_val);
18490         call_tests++;
18491         des_xmlBufPtr(n_buf, buf, 0);
18492         des_const_xmlNode_ptr(n_cur, cur, 1);
18493         xmlResetLastError();
18494         if (mem_base != xmlMemBlocks()) {
18495             printf("Leak of %d blocks found in xmlBufGetNodeContent",
18496 	           xmlMemBlocks() - mem_base);
18497 	    test_ret++;
18498             printf(" %d", n_buf);
18499             printf(" %d", n_cur);
18500             printf("\n");
18501         }
18502     }
18503     }
18504     function_tests++;
18505 
18506     return(test_ret);
18507 }
18508 
18509 
18510 static int
test_xmlBufNodeDump(void)18511 test_xmlBufNodeDump(void) {
18512     int test_ret = 0;
18513 
18514 
18515     /* missing type support */
18516     return(test_ret);
18517 }
18518 
18519 
18520 static int
test_xmlBufShrink(void)18521 test_xmlBufShrink(void) {
18522     int test_ret = 0;
18523 
18524 
18525     /* missing type support */
18526     return(test_ret);
18527 }
18528 
18529 
18530 static int
test_xmlBufUse(void)18531 test_xmlBufUse(void) {
18532     int test_ret = 0;
18533 
18534 
18535     /* missing type support */
18536     return(test_ret);
18537 }
18538 
18539 
18540 static int
test_xmlBufferAdd(void)18541 test_xmlBufferAdd(void) {
18542     int test_ret = 0;
18543 
18544     int mem_base;
18545     int ret_val;
18546     xmlBufferPtr buf; /* the buffer to dump */
18547     int n_buf;
18548     const xmlChar * str; /* the #xmlChar string */
18549     int n_str;
18550     int len; /* the number of #xmlChar to add */
18551     int n_len;
18552 
18553     for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18554     for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
18555     for (n_len = 0;n_len < gen_nb_int;n_len++) {
18556         mem_base = xmlMemBlocks();
18557         buf = gen_xmlBufferPtr(n_buf, 0);
18558         str = gen_const_xmlChar_ptr(n_str, 1);
18559         len = gen_int(n_len, 2);
18560         if ((str != NULL) &&
18561             (len > xmlStrlen(BAD_CAST str)))
18562             len = 0;
18563 
18564         ret_val = xmlBufferAdd(buf, str, len);
18565         desret_int(ret_val);
18566         call_tests++;
18567         des_xmlBufferPtr(n_buf, buf, 0);
18568         des_const_xmlChar_ptr(n_str, str, 1);
18569         des_int(n_len, len, 2);
18570         xmlResetLastError();
18571         if (mem_base != xmlMemBlocks()) {
18572             printf("Leak of %d blocks found in xmlBufferAdd",
18573 	           xmlMemBlocks() - mem_base);
18574 	    test_ret++;
18575             printf(" %d", n_buf);
18576             printf(" %d", n_str);
18577             printf(" %d", n_len);
18578             printf("\n");
18579         }
18580     }
18581     }
18582     }
18583     function_tests++;
18584 
18585     return(test_ret);
18586 }
18587 
18588 
18589 static int
test_xmlBufferAddHead(void)18590 test_xmlBufferAddHead(void) {
18591     int test_ret = 0;
18592 
18593     int mem_base;
18594     int ret_val;
18595     xmlBufferPtr buf; /* the buffer */
18596     int n_buf;
18597     const xmlChar * str; /* the #xmlChar string */
18598     int n_str;
18599     int len; /* the number of #xmlChar to add */
18600     int n_len;
18601 
18602     for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18603     for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
18604     for (n_len = 0;n_len < gen_nb_int;n_len++) {
18605         mem_base = xmlMemBlocks();
18606         buf = gen_xmlBufferPtr(n_buf, 0);
18607         str = gen_const_xmlChar_ptr(n_str, 1);
18608         len = gen_int(n_len, 2);
18609         if ((str != NULL) &&
18610             (len > xmlStrlen(BAD_CAST str)))
18611             len = 0;
18612 
18613         ret_val = xmlBufferAddHead(buf, str, len);
18614         desret_int(ret_val);
18615         call_tests++;
18616         des_xmlBufferPtr(n_buf, buf, 0);
18617         des_const_xmlChar_ptr(n_str, str, 1);
18618         des_int(n_len, len, 2);
18619         xmlResetLastError();
18620         if (mem_base != xmlMemBlocks()) {
18621             printf("Leak of %d blocks found in xmlBufferAddHead",
18622 	           xmlMemBlocks() - mem_base);
18623 	    test_ret++;
18624             printf(" %d", n_buf);
18625             printf(" %d", n_str);
18626             printf(" %d", n_len);
18627             printf("\n");
18628         }
18629     }
18630     }
18631     }
18632     function_tests++;
18633 
18634     return(test_ret);
18635 }
18636 
18637 
18638 static int
test_xmlBufferCCat(void)18639 test_xmlBufferCCat(void) {
18640     int test_ret = 0;
18641 
18642     int mem_base;
18643     int ret_val;
18644     xmlBufferPtr buf; /* the buffer to dump */
18645     int n_buf;
18646     const char * str; /* the C char string */
18647     int n_str;
18648 
18649     for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18650     for (n_str = 0;n_str < gen_nb_const_char_ptr;n_str++) {
18651         mem_base = xmlMemBlocks();
18652         buf = gen_xmlBufferPtr(n_buf, 0);
18653         str = gen_const_char_ptr(n_str, 1);
18654 
18655         ret_val = xmlBufferCCat(buf, str);
18656         desret_int(ret_val);
18657         call_tests++;
18658         des_xmlBufferPtr(n_buf, buf, 0);
18659         des_const_char_ptr(n_str, str, 1);
18660         xmlResetLastError();
18661         if (mem_base != xmlMemBlocks()) {
18662             printf("Leak of %d blocks found in xmlBufferCCat",
18663 	           xmlMemBlocks() - mem_base);
18664 	    test_ret++;
18665             printf(" %d", n_buf);
18666             printf(" %d", n_str);
18667             printf("\n");
18668         }
18669     }
18670     }
18671     function_tests++;
18672 
18673     return(test_ret);
18674 }
18675 
18676 
18677 static int
test_xmlBufferCat(void)18678 test_xmlBufferCat(void) {
18679     int test_ret = 0;
18680 
18681     int mem_base;
18682     int ret_val;
18683     xmlBufferPtr buf; /* the buffer to add to */
18684     int n_buf;
18685     const xmlChar * str; /* the #xmlChar string */
18686     int n_str;
18687 
18688     for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18689     for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
18690         mem_base = xmlMemBlocks();
18691         buf = gen_xmlBufferPtr(n_buf, 0);
18692         str = gen_const_xmlChar_ptr(n_str, 1);
18693 
18694         ret_val = xmlBufferCat(buf, str);
18695         desret_int(ret_val);
18696         call_tests++;
18697         des_xmlBufferPtr(n_buf, buf, 0);
18698         des_const_xmlChar_ptr(n_str, str, 1);
18699         xmlResetLastError();
18700         if (mem_base != xmlMemBlocks()) {
18701             printf("Leak of %d blocks found in xmlBufferCat",
18702 	           xmlMemBlocks() - mem_base);
18703 	    test_ret++;
18704             printf(" %d", n_buf);
18705             printf(" %d", n_str);
18706             printf("\n");
18707         }
18708     }
18709     }
18710     function_tests++;
18711 
18712     return(test_ret);
18713 }
18714 
18715 
18716 #define gen_nb_const_xmlBuffer_ptr 1
18717 #define gen_const_xmlBuffer_ptr(no, nr) NULL
18718 #define des_const_xmlBuffer_ptr(no, val, nr)
18719 
18720 static int
test_xmlBufferContent(void)18721 test_xmlBufferContent(void) {
18722     int test_ret = 0;
18723 
18724     int mem_base;
18725     const xmlChar * ret_val;
18726     const xmlBuffer * buf; /* the buffer */
18727     int n_buf;
18728 
18729     for (n_buf = 0;n_buf < gen_nb_const_xmlBuffer_ptr;n_buf++) {
18730         mem_base = xmlMemBlocks();
18731         buf = gen_const_xmlBuffer_ptr(n_buf, 0);
18732 
18733         ret_val = xmlBufferContent(buf);
18734         desret_const_xmlChar_ptr(ret_val);
18735         call_tests++;
18736         des_const_xmlBuffer_ptr(n_buf, buf, 0);
18737         xmlResetLastError();
18738         if (mem_base != xmlMemBlocks()) {
18739             printf("Leak of %d blocks found in xmlBufferContent",
18740 	           xmlMemBlocks() - mem_base);
18741 	    test_ret++;
18742             printf(" %d", n_buf);
18743             printf("\n");
18744         }
18745     }
18746     function_tests++;
18747 
18748     return(test_ret);
18749 }
18750 
18751 
18752 static int
test_xmlBufferCreate(void)18753 test_xmlBufferCreate(void) {
18754     int test_ret = 0;
18755 
18756     int mem_base;
18757     xmlBufferPtr ret_val;
18758 
18759         mem_base = xmlMemBlocks();
18760 
18761         ret_val = xmlBufferCreate();
18762         desret_xmlBufferPtr(ret_val);
18763         call_tests++;
18764         xmlResetLastError();
18765         if (mem_base != xmlMemBlocks()) {
18766             printf("Leak of %d blocks found in xmlBufferCreate",
18767 	           xmlMemBlocks() - mem_base);
18768 	    test_ret++;
18769             printf("\n");
18770         }
18771     function_tests++;
18772 
18773     return(test_ret);
18774 }
18775 
18776 
18777 static int
test_xmlBufferCreateSize(void)18778 test_xmlBufferCreateSize(void) {
18779     int test_ret = 0;
18780 
18781 
18782     /* missing type support */
18783     return(test_ret);
18784 }
18785 
18786 
18787 static int
test_xmlBufferCreateStatic(void)18788 test_xmlBufferCreateStatic(void) {
18789     int test_ret = 0;
18790 
18791 
18792     /* missing type support */
18793     return(test_ret);
18794 }
18795 
18796 
18797 static int
test_xmlBufferDetach(void)18798 test_xmlBufferDetach(void) {
18799     int test_ret = 0;
18800 
18801     int mem_base;
18802     xmlChar * ret_val;
18803     xmlBufferPtr buf; /* the buffer */
18804     int n_buf;
18805 
18806     for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18807         mem_base = xmlMemBlocks();
18808         buf = gen_xmlBufferPtr(n_buf, 0);
18809 
18810         ret_val = xmlBufferDetach(buf);
18811         desret_xmlChar_ptr(ret_val);
18812         call_tests++;
18813         des_xmlBufferPtr(n_buf, buf, 0);
18814         xmlResetLastError();
18815         if (mem_base != xmlMemBlocks()) {
18816             printf("Leak of %d blocks found in xmlBufferDetach",
18817 	           xmlMemBlocks() - mem_base);
18818 	    test_ret++;
18819             printf(" %d", n_buf);
18820             printf("\n");
18821         }
18822     }
18823     function_tests++;
18824 
18825     return(test_ret);
18826 }
18827 
18828 
18829 static int
test_xmlBufferEmpty(void)18830 test_xmlBufferEmpty(void) {
18831     int test_ret = 0;
18832 
18833     int mem_base;
18834     xmlBufferPtr buf; /* the buffer */
18835     int n_buf;
18836 
18837     for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18838         mem_base = xmlMemBlocks();
18839         buf = gen_xmlBufferPtr(n_buf, 0);
18840 
18841         xmlBufferEmpty(buf);
18842         call_tests++;
18843         des_xmlBufferPtr(n_buf, buf, 0);
18844         xmlResetLastError();
18845         if (mem_base != xmlMemBlocks()) {
18846             printf("Leak of %d blocks found in xmlBufferEmpty",
18847 	           xmlMemBlocks() - mem_base);
18848 	    test_ret++;
18849             printf(" %d", n_buf);
18850             printf("\n");
18851         }
18852     }
18853     function_tests++;
18854 
18855     return(test_ret);
18856 }
18857 
18858 
18859 static int
test_xmlBufferGrow(void)18860 test_xmlBufferGrow(void) {
18861     int test_ret = 0;
18862 
18863     int mem_base;
18864     int ret_val;
18865     xmlBufferPtr buf; /* the buffer */
18866     int n_buf;
18867     unsigned int len; /* the minimum free size to allocate */
18868     int n_len;
18869 
18870     for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18871     for (n_len = 0;n_len < gen_nb_unsigned_int;n_len++) {
18872         mem_base = xmlMemBlocks();
18873         buf = gen_xmlBufferPtr(n_buf, 0);
18874         len = gen_unsigned_int(n_len, 1);
18875 
18876         ret_val = xmlBufferGrow(buf, len);
18877         desret_int(ret_val);
18878         call_tests++;
18879         des_xmlBufferPtr(n_buf, buf, 0);
18880         des_unsigned_int(n_len, len, 1);
18881         xmlResetLastError();
18882         if (mem_base != xmlMemBlocks()) {
18883             printf("Leak of %d blocks found in xmlBufferGrow",
18884 	           xmlMemBlocks() - mem_base);
18885 	    test_ret++;
18886             printf(" %d", n_buf);
18887             printf(" %d", n_len);
18888             printf("\n");
18889         }
18890     }
18891     }
18892     function_tests++;
18893 
18894     return(test_ret);
18895 }
18896 
18897 
18898 static int
test_xmlBufferLength(void)18899 test_xmlBufferLength(void) {
18900     int test_ret = 0;
18901 
18902     int mem_base;
18903     int ret_val;
18904     const xmlBuffer * buf; /* the buffer */
18905     int n_buf;
18906 
18907     for (n_buf = 0;n_buf < gen_nb_const_xmlBuffer_ptr;n_buf++) {
18908         mem_base = xmlMemBlocks();
18909         buf = gen_const_xmlBuffer_ptr(n_buf, 0);
18910 
18911         ret_val = xmlBufferLength(buf);
18912         desret_int(ret_val);
18913         call_tests++;
18914         des_const_xmlBuffer_ptr(n_buf, buf, 0);
18915         xmlResetLastError();
18916         if (mem_base != xmlMemBlocks()) {
18917             printf("Leak of %d blocks found in xmlBufferLength",
18918 	           xmlMemBlocks() - mem_base);
18919 	    test_ret++;
18920             printf(" %d", n_buf);
18921             printf("\n");
18922         }
18923     }
18924     function_tests++;
18925 
18926     return(test_ret);
18927 }
18928 
18929 
18930 static int
test_xmlBufferResize(void)18931 test_xmlBufferResize(void) {
18932     int test_ret = 0;
18933 
18934     int mem_base;
18935     int ret_val;
18936     xmlBufferPtr buf; /* the buffer to resize */
18937     int n_buf;
18938     unsigned int size; /* the desired size */
18939     int n_size;
18940 
18941     for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18942     for (n_size = 0;n_size < gen_nb_unsigned_int;n_size++) {
18943         mem_base = xmlMemBlocks();
18944         buf = gen_xmlBufferPtr(n_buf, 0);
18945         size = gen_unsigned_int(n_size, 1);
18946 
18947         ret_val = xmlBufferResize(buf, size);
18948         desret_int(ret_val);
18949         call_tests++;
18950         des_xmlBufferPtr(n_buf, buf, 0);
18951         des_unsigned_int(n_size, size, 1);
18952         xmlResetLastError();
18953         if (mem_base != xmlMemBlocks()) {
18954             printf("Leak of %d blocks found in xmlBufferResize",
18955 	           xmlMemBlocks() - mem_base);
18956 	    test_ret++;
18957             printf(" %d", n_buf);
18958             printf(" %d", n_size);
18959             printf("\n");
18960         }
18961     }
18962     }
18963     function_tests++;
18964 
18965     return(test_ret);
18966 }
18967 
18968 
18969 static int
test_xmlBufferSetAllocationScheme(void)18970 test_xmlBufferSetAllocationScheme(void) {
18971     int test_ret = 0;
18972 
18973     int mem_base;
18974     xmlBufferPtr buf; /* the buffer to tune */
18975     int n_buf;
18976     xmlBufferAllocationScheme scheme; /* allocation scheme to use */
18977     int n_scheme;
18978 
18979     for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18980     for (n_scheme = 0;n_scheme < gen_nb_xmlBufferAllocationScheme;n_scheme++) {
18981         mem_base = xmlMemBlocks();
18982         buf = gen_xmlBufferPtr(n_buf, 0);
18983         scheme = gen_xmlBufferAllocationScheme(n_scheme, 1);
18984 
18985         xmlBufferSetAllocationScheme(buf, scheme);
18986         call_tests++;
18987         des_xmlBufferPtr(n_buf, buf, 0);
18988         des_xmlBufferAllocationScheme(n_scheme, scheme, 1);
18989         xmlResetLastError();
18990         if (mem_base != xmlMemBlocks()) {
18991             printf("Leak of %d blocks found in xmlBufferSetAllocationScheme",
18992 	           xmlMemBlocks() - mem_base);
18993 	    test_ret++;
18994             printf(" %d", n_buf);
18995             printf(" %d", n_scheme);
18996             printf("\n");
18997         }
18998     }
18999     }
19000     function_tests++;
19001 
19002     return(test_ret);
19003 }
19004 
19005 
19006 static int
test_xmlBufferShrink(void)19007 test_xmlBufferShrink(void) {
19008     int test_ret = 0;
19009 
19010     int mem_base;
19011     int ret_val;
19012     xmlBufferPtr buf; /* the buffer to dump */
19013     int n_buf;
19014     unsigned int len; /* the number of xmlChar to remove */
19015     int n_len;
19016 
19017     for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
19018     for (n_len = 0;n_len < gen_nb_unsigned_int;n_len++) {
19019         mem_base = xmlMemBlocks();
19020         buf = gen_xmlBufferPtr(n_buf, 0);
19021         len = gen_unsigned_int(n_len, 1);
19022 
19023         ret_val = xmlBufferShrink(buf, len);
19024         desret_int(ret_val);
19025         call_tests++;
19026         des_xmlBufferPtr(n_buf, buf, 0);
19027         des_unsigned_int(n_len, len, 1);
19028         xmlResetLastError();
19029         if (mem_base != xmlMemBlocks()) {
19030             printf("Leak of %d blocks found in xmlBufferShrink",
19031 	           xmlMemBlocks() - mem_base);
19032 	    test_ret++;
19033             printf(" %d", n_buf);
19034             printf(" %d", n_len);
19035             printf("\n");
19036         }
19037     }
19038     }
19039     function_tests++;
19040 
19041     return(test_ret);
19042 }
19043 
19044 
19045 static int
test_xmlBufferWriteCHAR(void)19046 test_xmlBufferWriteCHAR(void) {
19047     int test_ret = 0;
19048 
19049     int mem_base;
19050     xmlBufferPtr buf; /* the XML buffer */
19051     int n_buf;
19052     const xmlChar * string; /* the string to add */
19053     int n_string;
19054 
19055     for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
19056     for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
19057         mem_base = xmlMemBlocks();
19058         buf = gen_xmlBufferPtr(n_buf, 0);
19059         string = gen_const_xmlChar_ptr(n_string, 1);
19060 
19061         xmlBufferWriteCHAR(buf, string);
19062         call_tests++;
19063         des_xmlBufferPtr(n_buf, buf, 0);
19064         des_const_xmlChar_ptr(n_string, string, 1);
19065         xmlResetLastError();
19066         if (mem_base != xmlMemBlocks()) {
19067             printf("Leak of %d blocks found in xmlBufferWriteCHAR",
19068 	           xmlMemBlocks() - mem_base);
19069 	    test_ret++;
19070             printf(" %d", n_buf);
19071             printf(" %d", n_string);
19072             printf("\n");
19073         }
19074     }
19075     }
19076     function_tests++;
19077 
19078     return(test_ret);
19079 }
19080 
19081 
19082 static int
test_xmlBufferWriteChar(void)19083 test_xmlBufferWriteChar(void) {
19084     int test_ret = 0;
19085 
19086     int mem_base;
19087     xmlBufferPtr buf; /* the XML buffer output */
19088     int n_buf;
19089     const char * string; /* the string to add */
19090     int n_string;
19091 
19092     for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
19093     for (n_string = 0;n_string < gen_nb_const_char_ptr;n_string++) {
19094         mem_base = xmlMemBlocks();
19095         buf = gen_xmlBufferPtr(n_buf, 0);
19096         string = gen_const_char_ptr(n_string, 1);
19097 
19098         xmlBufferWriteChar(buf, string);
19099         call_tests++;
19100         des_xmlBufferPtr(n_buf, buf, 0);
19101         des_const_char_ptr(n_string, string, 1);
19102         xmlResetLastError();
19103         if (mem_base != xmlMemBlocks()) {
19104             printf("Leak of %d blocks found in xmlBufferWriteChar",
19105 	           xmlMemBlocks() - mem_base);
19106 	    test_ret++;
19107             printf(" %d", n_buf);
19108             printf(" %d", n_string);
19109             printf("\n");
19110         }
19111     }
19112     }
19113     function_tests++;
19114 
19115     return(test_ret);
19116 }
19117 
19118 
19119 static int
test_xmlBufferWriteQuotedString(void)19120 test_xmlBufferWriteQuotedString(void) {
19121     int test_ret = 0;
19122 
19123     int mem_base;
19124     xmlBufferPtr buf; /* the XML buffer output */
19125     int n_buf;
19126     const xmlChar * string; /* the string to add */
19127     int n_string;
19128 
19129     for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
19130     for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
19131         mem_base = xmlMemBlocks();
19132         buf = gen_xmlBufferPtr(n_buf, 0);
19133         string = gen_const_xmlChar_ptr(n_string, 1);
19134 
19135         xmlBufferWriteQuotedString(buf, string);
19136         call_tests++;
19137         des_xmlBufferPtr(n_buf, buf, 0);
19138         des_const_xmlChar_ptr(n_string, string, 1);
19139         xmlResetLastError();
19140         if (mem_base != xmlMemBlocks()) {
19141             printf("Leak of %d blocks found in xmlBufferWriteQuotedString",
19142 	           xmlMemBlocks() - mem_base);
19143 	    test_ret++;
19144             printf(" %d", n_buf);
19145             printf(" %d", n_string);
19146             printf("\n");
19147         }
19148     }
19149     }
19150     function_tests++;
19151 
19152     return(test_ret);
19153 }
19154 
19155 
19156 static int
test_xmlBuildQName(void)19157 test_xmlBuildQName(void) {
19158     int test_ret = 0;
19159 
19160     int mem_base;
19161     xmlChar * ret_val;
19162     const xmlChar * ncname; /* the Name */
19163     int n_ncname;
19164     const xmlChar * prefix; /* the prefix */
19165     int n_prefix;
19166     xmlChar * memory; /* preallocated memory */
19167     int n_memory;
19168     int len; /* preallocated memory length */
19169     int n_len;
19170 
19171     for (n_ncname = 0;n_ncname < gen_nb_const_xmlChar_ptr;n_ncname++) {
19172     for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
19173     for (n_memory = 0;n_memory < gen_nb_xmlChar_ptr;n_memory++) {
19174     for (n_len = 0;n_len < gen_nb_int;n_len++) {
19175         mem_base = xmlMemBlocks();
19176         ncname = gen_const_xmlChar_ptr(n_ncname, 0);
19177         prefix = gen_const_xmlChar_ptr(n_prefix, 1);
19178         memory = gen_xmlChar_ptr(n_memory, 2);
19179         len = gen_int(n_len, 3);
19180         if ((prefix != NULL) &&
19181             (len > xmlStrlen(BAD_CAST prefix)))
19182             len = 0;
19183 
19184         ret_val = xmlBuildQName(ncname, prefix, memory, len);
19185         if ((ret_val != NULL) && (ret_val != ncname) &&
19186               (ret_val != prefix) && (ret_val != memory))
19187               xmlFree(ret_val);
19188 	  ret_val = NULL;
19189         desret_xmlChar_ptr(ret_val);
19190         call_tests++;
19191         des_const_xmlChar_ptr(n_ncname, ncname, 0);
19192         des_const_xmlChar_ptr(n_prefix, prefix, 1);
19193         des_xmlChar_ptr(n_memory, memory, 2);
19194         des_int(n_len, len, 3);
19195         xmlResetLastError();
19196         if (mem_base != xmlMemBlocks()) {
19197             printf("Leak of %d blocks found in xmlBuildQName",
19198 	           xmlMemBlocks() - mem_base);
19199 	    test_ret++;
19200             printf(" %d", n_ncname);
19201             printf(" %d", n_prefix);
19202             printf(" %d", n_memory);
19203             printf(" %d", n_len);
19204             printf("\n");
19205         }
19206     }
19207     }
19208     }
19209     }
19210     function_tests++;
19211 
19212     return(test_ret);
19213 }
19214 
19215 
19216 static int
test_xmlChildElementCount(void)19217 test_xmlChildElementCount(void) {
19218     int test_ret = 0;
19219 
19220     int mem_base;
19221     unsigned long ret_val;
19222     xmlNodePtr parent; /* the parent node */
19223     int n_parent;
19224 
19225     for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
19226         mem_base = xmlMemBlocks();
19227         parent = gen_xmlNodePtr(n_parent, 0);
19228 
19229         ret_val = xmlChildElementCount(parent);
19230         desret_unsigned_long(ret_val);
19231         call_tests++;
19232         des_xmlNodePtr(n_parent, parent, 0);
19233         xmlResetLastError();
19234         if (mem_base != xmlMemBlocks()) {
19235             printf("Leak of %d blocks found in xmlChildElementCount",
19236 	           xmlMemBlocks() - mem_base);
19237 	    test_ret++;
19238             printf(" %d", n_parent);
19239             printf("\n");
19240         }
19241     }
19242     function_tests++;
19243 
19244     return(test_ret);
19245 }
19246 
19247 
19248 static int
test_xmlCopyDoc(void)19249 test_xmlCopyDoc(void) {
19250     int test_ret = 0;
19251 
19252     int mem_base;
19253     xmlDocPtr ret_val;
19254     xmlDocPtr doc; /* the document */
19255     int n_doc;
19256     int recursive; /* if not zero do a recursive copy. */
19257     int n_recursive;
19258 
19259     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19260     for (n_recursive = 0;n_recursive < gen_nb_int;n_recursive++) {
19261         mem_base = xmlMemBlocks();
19262         doc = gen_xmlDocPtr(n_doc, 0);
19263         recursive = gen_int(n_recursive, 1);
19264 
19265         ret_val = xmlCopyDoc(doc, recursive);
19266         desret_xmlDocPtr(ret_val);
19267         call_tests++;
19268         des_xmlDocPtr(n_doc, doc, 0);
19269         des_int(n_recursive, recursive, 1);
19270         xmlResetLastError();
19271         if (mem_base != xmlMemBlocks()) {
19272             printf("Leak of %d blocks found in xmlCopyDoc",
19273 	           xmlMemBlocks() - mem_base);
19274 	    test_ret++;
19275             printf(" %d", n_doc);
19276             printf(" %d", n_recursive);
19277             printf("\n");
19278         }
19279     }
19280     }
19281     function_tests++;
19282 
19283     return(test_ret);
19284 }
19285 
19286 
19287 static int
test_xmlCopyDtd(void)19288 test_xmlCopyDtd(void) {
19289     int test_ret = 0;
19290 
19291     int mem_base;
19292     xmlDtdPtr ret_val;
19293     xmlDtdPtr dtd; /* the DTD */
19294     int n_dtd;
19295 
19296     for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
19297         mem_base = xmlMemBlocks();
19298         dtd = gen_xmlDtdPtr(n_dtd, 0);
19299 
19300         ret_val = xmlCopyDtd(dtd);
19301         desret_xmlDtdPtr(ret_val);
19302         call_tests++;
19303         des_xmlDtdPtr(n_dtd, dtd, 0);
19304         xmlResetLastError();
19305         if (mem_base != xmlMemBlocks()) {
19306             printf("Leak of %d blocks found in xmlCopyDtd",
19307 	           xmlMemBlocks() - mem_base);
19308 	    test_ret++;
19309             printf(" %d", n_dtd);
19310             printf("\n");
19311         }
19312     }
19313     function_tests++;
19314 
19315     return(test_ret);
19316 }
19317 
19318 
19319 static int
test_xmlCopyNamespace(void)19320 test_xmlCopyNamespace(void) {
19321     int test_ret = 0;
19322 
19323     int mem_base;
19324     xmlNsPtr ret_val;
19325     xmlNsPtr cur; /* the namespace */
19326     int n_cur;
19327 
19328     for (n_cur = 0;n_cur < gen_nb_xmlNsPtr;n_cur++) {
19329         mem_base = xmlMemBlocks();
19330         cur = gen_xmlNsPtr(n_cur, 0);
19331 
19332         ret_val = xmlCopyNamespace(cur);
19333         if (ret_val != NULL) xmlFreeNs(ret_val);
19334         desret_xmlNsPtr(ret_val);
19335         call_tests++;
19336         des_xmlNsPtr(n_cur, cur, 0);
19337         xmlResetLastError();
19338         if (mem_base != xmlMemBlocks()) {
19339             printf("Leak of %d blocks found in xmlCopyNamespace",
19340 	           xmlMemBlocks() - mem_base);
19341 	    test_ret++;
19342             printf(" %d", n_cur);
19343             printf("\n");
19344         }
19345     }
19346     function_tests++;
19347 
19348     return(test_ret);
19349 }
19350 
19351 
19352 static int
test_xmlCopyNamespaceList(void)19353 test_xmlCopyNamespaceList(void) {
19354     int test_ret = 0;
19355 
19356     int mem_base;
19357     xmlNsPtr ret_val;
19358     xmlNsPtr cur; /* the first namespace */
19359     int n_cur;
19360 
19361     for (n_cur = 0;n_cur < gen_nb_xmlNsPtr;n_cur++) {
19362         mem_base = xmlMemBlocks();
19363         cur = gen_xmlNsPtr(n_cur, 0);
19364 
19365         ret_val = xmlCopyNamespaceList(cur);
19366         if (ret_val != NULL) xmlFreeNsList(ret_val);
19367         desret_xmlNsPtr(ret_val);
19368         call_tests++;
19369         des_xmlNsPtr(n_cur, cur, 0);
19370         xmlResetLastError();
19371         if (mem_base != xmlMemBlocks()) {
19372             printf("Leak of %d blocks found in xmlCopyNamespaceList",
19373 	           xmlMemBlocks() - mem_base);
19374 	    test_ret++;
19375             printf(" %d", n_cur);
19376             printf("\n");
19377         }
19378     }
19379     function_tests++;
19380 
19381     return(test_ret);
19382 }
19383 
19384 
19385 static int
test_xmlCopyNode(void)19386 test_xmlCopyNode(void) {
19387     int test_ret = 0;
19388 
19389     int mem_base;
19390     xmlNodePtr ret_val;
19391     xmlNodePtr node; /* the node */
19392     int n_node;
19393     int extended; /* if 1 do a recursive copy (properties, namespaces and children when applicable) if 2 copy properties and namespaces (when applicable) */
19394     int n_extended;
19395 
19396     for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19397     for (n_extended = 0;n_extended < gen_nb_int;n_extended++) {
19398         mem_base = xmlMemBlocks();
19399         node = gen_xmlNodePtr(n_node, 0);
19400         extended = gen_int(n_extended, 1);
19401 
19402         ret_val = xmlCopyNode(node, extended);
19403         desret_xmlNodePtr(ret_val);
19404         call_tests++;
19405         des_xmlNodePtr(n_node, node, 0);
19406         des_int(n_extended, extended, 1);
19407         xmlResetLastError();
19408         if (mem_base != xmlMemBlocks()) {
19409             printf("Leak of %d blocks found in xmlCopyNode",
19410 	           xmlMemBlocks() - mem_base);
19411 	    test_ret++;
19412             printf(" %d", n_node);
19413             printf(" %d", n_extended);
19414             printf("\n");
19415         }
19416     }
19417     }
19418     function_tests++;
19419 
19420     return(test_ret);
19421 }
19422 
19423 
19424 static int
test_xmlCopyNodeList(void)19425 test_xmlCopyNodeList(void) {
19426     int test_ret = 0;
19427 
19428     int mem_base;
19429     xmlNodePtr ret_val;
19430     xmlNodePtr node; /* the first node in the list. */
19431     int n_node;
19432 
19433     for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19434         mem_base = xmlMemBlocks();
19435         node = gen_xmlNodePtr(n_node, 0);
19436 
19437         ret_val = xmlCopyNodeList(node);
19438         desret_xmlNodePtr(ret_val);
19439         call_tests++;
19440         des_xmlNodePtr(n_node, node, 0);
19441         xmlResetLastError();
19442         if (mem_base != xmlMemBlocks()) {
19443             printf("Leak of %d blocks found in xmlCopyNodeList",
19444 	           xmlMemBlocks() - mem_base);
19445 	    test_ret++;
19446             printf(" %d", n_node);
19447             printf("\n");
19448         }
19449     }
19450     function_tests++;
19451 
19452     return(test_ret);
19453 }
19454 
19455 
19456 static int
test_xmlCopyProp(void)19457 test_xmlCopyProp(void) {
19458     int test_ret = 0;
19459 
19460     int mem_base;
19461     xmlAttrPtr ret_val;
19462     xmlNodePtr target; /* the element where the attribute will be grafted */
19463     int n_target;
19464     xmlAttrPtr cur; /* the attribute */
19465     int n_cur;
19466 
19467     for (n_target = 0;n_target < gen_nb_xmlNodePtr;n_target++) {
19468     for (n_cur = 0;n_cur < gen_nb_xmlAttrPtr;n_cur++) {
19469         mem_base = xmlMemBlocks();
19470         target = gen_xmlNodePtr(n_target, 0);
19471         cur = gen_xmlAttrPtr(n_cur, 1);
19472 
19473         ret_val = xmlCopyProp(target, cur);
19474         desret_xmlAttrPtr(ret_val);
19475         call_tests++;
19476         des_xmlNodePtr(n_target, target, 0);
19477         des_xmlAttrPtr(n_cur, cur, 1);
19478         xmlResetLastError();
19479         if (mem_base != xmlMemBlocks()) {
19480             printf("Leak of %d blocks found in xmlCopyProp",
19481 	           xmlMemBlocks() - mem_base);
19482 	    test_ret++;
19483             printf(" %d", n_target);
19484             printf(" %d", n_cur);
19485             printf("\n");
19486         }
19487     }
19488     }
19489     function_tests++;
19490 
19491     return(test_ret);
19492 }
19493 
19494 
19495 static int
test_xmlCopyPropList(void)19496 test_xmlCopyPropList(void) {
19497     int test_ret = 0;
19498 
19499     int mem_base;
19500     xmlAttrPtr ret_val;
19501     xmlNodePtr target; /* the element where the attributes will be grafted */
19502     int n_target;
19503     xmlAttrPtr cur; /* the first attribute */
19504     int n_cur;
19505 
19506     for (n_target = 0;n_target < gen_nb_xmlNodePtr;n_target++) {
19507     for (n_cur = 0;n_cur < gen_nb_xmlAttrPtr;n_cur++) {
19508         mem_base = xmlMemBlocks();
19509         target = gen_xmlNodePtr(n_target, 0);
19510         cur = gen_xmlAttrPtr(n_cur, 1);
19511 
19512         ret_val = xmlCopyPropList(target, cur);
19513         desret_xmlAttrPtr(ret_val);
19514         call_tests++;
19515         des_xmlNodePtr(n_target, target, 0);
19516         des_xmlAttrPtr(n_cur, cur, 1);
19517         xmlResetLastError();
19518         if (mem_base != xmlMemBlocks()) {
19519             printf("Leak of %d blocks found in xmlCopyPropList",
19520 	           xmlMemBlocks() - mem_base);
19521 	    test_ret++;
19522             printf(" %d", n_target);
19523             printf(" %d", n_cur);
19524             printf("\n");
19525         }
19526     }
19527     }
19528     function_tests++;
19529 
19530     return(test_ret);
19531 }
19532 
19533 
19534 static int
test_xmlCreateIntSubset(void)19535 test_xmlCreateIntSubset(void) {
19536     int test_ret = 0;
19537 
19538     int mem_base;
19539     xmlDtdPtr ret_val;
19540     xmlDocPtr doc; /* the document pointer (optional) */
19541     int n_doc;
19542     const xmlChar * name; /* the DTD name (optional) */
19543     int n_name;
19544     const xmlChar * ExternalID; /* the external (PUBLIC) ID (optional) */
19545     int n_ExternalID;
19546     const xmlChar * SystemID; /* the system ID (optional) */
19547     int n_SystemID;
19548 
19549     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19550     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19551     for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
19552     for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
19553         mem_base = xmlMemBlocks();
19554         doc = gen_xmlDocPtr(n_doc, 0);
19555         name = gen_const_xmlChar_ptr(n_name, 1);
19556         ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2);
19557         SystemID = gen_const_xmlChar_ptr(n_SystemID, 3);
19558 
19559         ret_val = xmlCreateIntSubset(doc, name, ExternalID, SystemID);
19560         desret_xmlDtdPtr(ret_val);
19561         call_tests++;
19562         des_xmlDocPtr(n_doc, doc, 0);
19563         des_const_xmlChar_ptr(n_name, name, 1);
19564         des_const_xmlChar_ptr(n_ExternalID, ExternalID, 2);
19565         des_const_xmlChar_ptr(n_SystemID, SystemID, 3);
19566         xmlResetLastError();
19567         if (mem_base != xmlMemBlocks()) {
19568             printf("Leak of %d blocks found in xmlCreateIntSubset",
19569 	           xmlMemBlocks() - mem_base);
19570 	    test_ret++;
19571             printf(" %d", n_doc);
19572             printf(" %d", n_name);
19573             printf(" %d", n_ExternalID);
19574             printf(" %d", n_SystemID);
19575             printf("\n");
19576         }
19577     }
19578     }
19579     }
19580     }
19581     function_tests++;
19582 
19583     return(test_ret);
19584 }
19585 
19586 
19587 #define gen_nb_xmlDOMWrapCtxtPtr 1
19588 #define gen_xmlDOMWrapCtxtPtr(no, nr) NULL
19589 #define des_xmlDOMWrapCtxtPtr(no, val, nr)
19590 
19591 static int
test_xmlDOMWrapAdoptNode(void)19592 test_xmlDOMWrapAdoptNode(void) {
19593     int test_ret = 0;
19594 
19595     int mem_base;
19596     int ret_val;
19597     xmlDOMWrapCtxtPtr ctxt; /* the optional context for custom processing */
19598     int n_ctxt;
19599     xmlDocPtr sourceDoc; /* the optional sourceDoc */
19600     int n_sourceDoc;
19601     xmlNodePtr node; /* the node to start with */
19602     int n_node;
19603     xmlDocPtr destDoc; /* the destination doc */
19604     int n_destDoc;
19605     xmlNodePtr destParent; /* the optional new parent of @node in @destDoc */
19606     int n_destParent;
19607     int options; /* option flags */
19608     int n_options;
19609 
19610     for (n_ctxt = 0;n_ctxt < gen_nb_xmlDOMWrapCtxtPtr;n_ctxt++) {
19611     for (n_sourceDoc = 0;n_sourceDoc < gen_nb_xmlDocPtr;n_sourceDoc++) {
19612     for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19613     for (n_destDoc = 0;n_destDoc < gen_nb_xmlDocPtr;n_destDoc++) {
19614     for (n_destParent = 0;n_destParent < gen_nb_xmlNodePtr;n_destParent++) {
19615     for (n_options = 0;n_options < gen_nb_int;n_options++) {
19616         mem_base = xmlMemBlocks();
19617         ctxt = gen_xmlDOMWrapCtxtPtr(n_ctxt, 0);
19618         sourceDoc = gen_xmlDocPtr(n_sourceDoc, 1);
19619         node = gen_xmlNodePtr(n_node, 2);
19620         destDoc = gen_xmlDocPtr(n_destDoc, 3);
19621         destParent = gen_xmlNodePtr(n_destParent, 4);
19622         options = gen_int(n_options, 5);
19623 
19624         ret_val = xmlDOMWrapAdoptNode(ctxt, sourceDoc, node, destDoc, destParent, options);
19625         if ((node != NULL) && (node->parent == NULL)) {xmlUnlinkNode(node);xmlFreeNode(node);node = NULL;}
19626         desret_int(ret_val);
19627         call_tests++;
19628         des_xmlDOMWrapCtxtPtr(n_ctxt, ctxt, 0);
19629         des_xmlDocPtr(n_sourceDoc, sourceDoc, 1);
19630         des_xmlNodePtr(n_node, node, 2);
19631         des_xmlDocPtr(n_destDoc, destDoc, 3);
19632         des_xmlNodePtr(n_destParent, destParent, 4);
19633         des_int(n_options, options, 5);
19634         xmlResetLastError();
19635         if (mem_base != xmlMemBlocks()) {
19636             printf("Leak of %d blocks found in xmlDOMWrapAdoptNode",
19637 	           xmlMemBlocks() - mem_base);
19638 	    test_ret++;
19639             printf(" %d", n_ctxt);
19640             printf(" %d", n_sourceDoc);
19641             printf(" %d", n_node);
19642             printf(" %d", n_destDoc);
19643             printf(" %d", n_destParent);
19644             printf(" %d", n_options);
19645             printf("\n");
19646         }
19647     }
19648     }
19649     }
19650     }
19651     }
19652     }
19653     function_tests++;
19654 
19655     return(test_ret);
19656 }
19657 
19658 
19659 static int
test_xmlDOMWrapCloneNode(void)19660 test_xmlDOMWrapCloneNode(void) {
19661     int test_ret = 0;
19662 
19663     int mem_base;
19664     int ret_val;
19665     xmlDOMWrapCtxtPtr ctxt; /* the optional context for custom processing */
19666     int n_ctxt;
19667     xmlDocPtr sourceDoc; /* the optional sourceDoc */
19668     int n_sourceDoc;
19669     xmlNodePtr node; /* the node to start with */
19670     int n_node;
19671     xmlNodePtr * resNode; /* the clone of the given @node */
19672     int n_resNode;
19673     xmlDocPtr destDoc; /* the destination doc */
19674     int n_destDoc;
19675     xmlNodePtr destParent; /* the optional new parent of @node in @destDoc */
19676     int n_destParent;
19677     int deep; /* descend into child if set */
19678     int n_deep;
19679     int options; /* option flags */
19680     int n_options;
19681 
19682     for (n_ctxt = 0;n_ctxt < gen_nb_xmlDOMWrapCtxtPtr;n_ctxt++) {
19683     for (n_sourceDoc = 0;n_sourceDoc < gen_nb_xmlDocPtr;n_sourceDoc++) {
19684     for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19685     for (n_resNode = 0;n_resNode < gen_nb_xmlNodePtr_ptr;n_resNode++) {
19686     for (n_destDoc = 0;n_destDoc < gen_nb_xmlDocPtr;n_destDoc++) {
19687     for (n_destParent = 0;n_destParent < gen_nb_xmlNodePtr;n_destParent++) {
19688     for (n_deep = 0;n_deep < gen_nb_int;n_deep++) {
19689     for (n_options = 0;n_options < gen_nb_int;n_options++) {
19690         mem_base = xmlMemBlocks();
19691         ctxt = gen_xmlDOMWrapCtxtPtr(n_ctxt, 0);
19692         sourceDoc = gen_xmlDocPtr(n_sourceDoc, 1);
19693         node = gen_xmlNodePtr(n_node, 2);
19694         resNode = gen_xmlNodePtr_ptr(n_resNode, 3);
19695         destDoc = gen_xmlDocPtr(n_destDoc, 4);
19696         destParent = gen_xmlNodePtr(n_destParent, 5);
19697         deep = gen_int(n_deep, 6);
19698         options = gen_int(n_options, 7);
19699 
19700         ret_val = xmlDOMWrapCloneNode(ctxt, sourceDoc, node, resNode, destDoc, destParent, deep, options);
19701         desret_int(ret_val);
19702         call_tests++;
19703         des_xmlDOMWrapCtxtPtr(n_ctxt, ctxt, 0);
19704         des_xmlDocPtr(n_sourceDoc, sourceDoc, 1);
19705         des_xmlNodePtr(n_node, node, 2);
19706         des_xmlNodePtr_ptr(n_resNode, resNode, 3);
19707         des_xmlDocPtr(n_destDoc, destDoc, 4);
19708         des_xmlNodePtr(n_destParent, destParent, 5);
19709         des_int(n_deep, deep, 6);
19710         des_int(n_options, options, 7);
19711         xmlResetLastError();
19712         if (mem_base != xmlMemBlocks()) {
19713             printf("Leak of %d blocks found in xmlDOMWrapCloneNode",
19714 	           xmlMemBlocks() - mem_base);
19715 	    test_ret++;
19716             printf(" %d", n_ctxt);
19717             printf(" %d", n_sourceDoc);
19718             printf(" %d", n_node);
19719             printf(" %d", n_resNode);
19720             printf(" %d", n_destDoc);
19721             printf(" %d", n_destParent);
19722             printf(" %d", n_deep);
19723             printf(" %d", n_options);
19724             printf("\n");
19725         }
19726     }
19727     }
19728     }
19729     }
19730     }
19731     }
19732     }
19733     }
19734     function_tests++;
19735 
19736     return(test_ret);
19737 }
19738 
19739 
19740 static int
test_xmlDOMWrapNewCtxt(void)19741 test_xmlDOMWrapNewCtxt(void) {
19742     int test_ret = 0;
19743 
19744 
19745     /* missing type support */
19746     return(test_ret);
19747 }
19748 
19749 
19750 static int
test_xmlDOMWrapReconcileNamespaces(void)19751 test_xmlDOMWrapReconcileNamespaces(void) {
19752     int test_ret = 0;
19753 
19754     int mem_base;
19755     int ret_val;
19756     xmlDOMWrapCtxtPtr ctxt; /* DOM wrapper context, unused at the moment */
19757     int n_ctxt;
19758     xmlNodePtr elem; /* the element-node */
19759     int n_elem;
19760     int options; /* option flags */
19761     int n_options;
19762 
19763     for (n_ctxt = 0;n_ctxt < gen_nb_xmlDOMWrapCtxtPtr;n_ctxt++) {
19764     for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
19765     for (n_options = 0;n_options < gen_nb_int;n_options++) {
19766         mem_base = xmlMemBlocks();
19767         ctxt = gen_xmlDOMWrapCtxtPtr(n_ctxt, 0);
19768         elem = gen_xmlNodePtr(n_elem, 1);
19769         options = gen_int(n_options, 2);
19770 
19771         ret_val = xmlDOMWrapReconcileNamespaces(ctxt, elem, options);
19772         desret_int(ret_val);
19773         call_tests++;
19774         des_xmlDOMWrapCtxtPtr(n_ctxt, ctxt, 0);
19775         des_xmlNodePtr(n_elem, elem, 1);
19776         des_int(n_options, options, 2);
19777         xmlResetLastError();
19778         if (mem_base != xmlMemBlocks()) {
19779             printf("Leak of %d blocks found in xmlDOMWrapReconcileNamespaces",
19780 	           xmlMemBlocks() - mem_base);
19781 	    test_ret++;
19782             printf(" %d", n_ctxt);
19783             printf(" %d", n_elem);
19784             printf(" %d", n_options);
19785             printf("\n");
19786         }
19787     }
19788     }
19789     }
19790     function_tests++;
19791 
19792     return(test_ret);
19793 }
19794 
19795 
19796 static int
test_xmlDOMWrapRemoveNode(void)19797 test_xmlDOMWrapRemoveNode(void) {
19798     int test_ret = 0;
19799 
19800     int mem_base;
19801     int ret_val;
19802     xmlDOMWrapCtxtPtr ctxt; /* a DOM wrapper context */
19803     int n_ctxt;
19804     xmlDocPtr doc; /* the doc */
19805     int n_doc;
19806     xmlNodePtr node; /* the node to be removed. */
19807     int n_node;
19808     int options; /* set of options, unused at the moment */
19809     int n_options;
19810 
19811     for (n_ctxt = 0;n_ctxt < gen_nb_xmlDOMWrapCtxtPtr;n_ctxt++) {
19812     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19813     for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19814     for (n_options = 0;n_options < gen_nb_int;n_options++) {
19815         mem_base = xmlMemBlocks();
19816         ctxt = gen_xmlDOMWrapCtxtPtr(n_ctxt, 0);
19817         doc = gen_xmlDocPtr(n_doc, 1);
19818         node = gen_xmlNodePtr(n_node, 2);
19819         options = gen_int(n_options, 3);
19820 
19821         ret_val = xmlDOMWrapRemoveNode(ctxt, doc, node, options);
19822         desret_int(ret_val);
19823         call_tests++;
19824         des_xmlDOMWrapCtxtPtr(n_ctxt, ctxt, 0);
19825         des_xmlDocPtr(n_doc, doc, 1);
19826         des_xmlNodePtr(n_node, node, 2);
19827         des_int(n_options, options, 3);
19828         xmlResetLastError();
19829         if (mem_base != xmlMemBlocks()) {
19830             printf("Leak of %d blocks found in xmlDOMWrapRemoveNode",
19831 	           xmlMemBlocks() - mem_base);
19832 	    test_ret++;
19833             printf(" %d", n_ctxt);
19834             printf(" %d", n_doc);
19835             printf(" %d", n_node);
19836             printf(" %d", n_options);
19837             printf("\n");
19838         }
19839     }
19840     }
19841     }
19842     }
19843     function_tests++;
19844 
19845     return(test_ret);
19846 }
19847 
19848 
19849 static int
test_xmlDeregisterNodeDefault(void)19850 test_xmlDeregisterNodeDefault(void) {
19851     int test_ret = 0;
19852 
19853 
19854     /* missing type support */
19855     return(test_ret);
19856 }
19857 
19858 
19859 static int
test_xmlDocCopyNode(void)19860 test_xmlDocCopyNode(void) {
19861     int test_ret = 0;
19862 
19863     int mem_base;
19864     xmlNodePtr ret_val;
19865     xmlNodePtr node; /* the node */
19866     int n_node;
19867     xmlDocPtr doc; /* the document */
19868     int n_doc;
19869     int extended; /* if 1 do a recursive copy (properties, namespaces and children when applicable) if 2 copy properties and namespaces (when applicable) */
19870     int n_extended;
19871 
19872     for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19873     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19874     for (n_extended = 0;n_extended < gen_nb_int;n_extended++) {
19875         mem_base = xmlMemBlocks();
19876         node = gen_xmlNodePtr(n_node, 0);
19877         doc = gen_xmlDocPtr(n_doc, 1);
19878         extended = gen_int(n_extended, 2);
19879 
19880         ret_val = xmlDocCopyNode(node, doc, extended);
19881         desret_xmlNodePtr(ret_val);
19882         call_tests++;
19883         des_xmlNodePtr(n_node, node, 0);
19884         des_xmlDocPtr(n_doc, doc, 1);
19885         des_int(n_extended, extended, 2);
19886         xmlResetLastError();
19887         if (mem_base != xmlMemBlocks()) {
19888             printf("Leak of %d blocks found in xmlDocCopyNode",
19889 	           xmlMemBlocks() - mem_base);
19890 	    test_ret++;
19891             printf(" %d", n_node);
19892             printf(" %d", n_doc);
19893             printf(" %d", n_extended);
19894             printf("\n");
19895         }
19896     }
19897     }
19898     }
19899     function_tests++;
19900 
19901     return(test_ret);
19902 }
19903 
19904 
19905 static int
test_xmlDocCopyNodeList(void)19906 test_xmlDocCopyNodeList(void) {
19907     int test_ret = 0;
19908 
19909     int mem_base;
19910     xmlNodePtr ret_val;
19911     xmlDocPtr doc; /* the target document */
19912     int n_doc;
19913     xmlNodePtr node; /* the first node in the list. */
19914     int n_node;
19915 
19916     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19917     for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19918         mem_base = xmlMemBlocks();
19919         doc = gen_xmlDocPtr(n_doc, 0);
19920         node = gen_xmlNodePtr(n_node, 1);
19921 
19922         ret_val = xmlDocCopyNodeList(doc, node);
19923         desret_xmlNodePtr(ret_val);
19924         call_tests++;
19925         des_xmlDocPtr(n_doc, doc, 0);
19926         des_xmlNodePtr(n_node, node, 1);
19927         xmlResetLastError();
19928         if (mem_base != xmlMemBlocks()) {
19929             printf("Leak of %d blocks found in xmlDocCopyNodeList",
19930 	           xmlMemBlocks() - mem_base);
19931 	    test_ret++;
19932             printf(" %d", n_doc);
19933             printf(" %d", n_node);
19934             printf("\n");
19935         }
19936     }
19937     }
19938     function_tests++;
19939 
19940     return(test_ret);
19941 }
19942 
19943 
19944 static int
test_xmlDocDump(void)19945 test_xmlDocDump(void) {
19946     int test_ret = 0;
19947 
19948 #if defined(LIBXML_OUTPUT_ENABLED)
19949     int mem_base;
19950     int ret_val;
19951     FILE * f; /* the FILE* */
19952     int n_f;
19953     xmlDocPtr cur; /* the document */
19954     int n_cur;
19955 
19956     for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) {
19957     for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
19958         mem_base = xmlMemBlocks();
19959         f = gen_FILE_ptr(n_f, 0);
19960         cur = gen_xmlDocPtr(n_cur, 1);
19961 
19962         ret_val = xmlDocDump(f, cur);
19963         desret_int(ret_val);
19964         call_tests++;
19965         des_FILE_ptr(n_f, f, 0);
19966         des_xmlDocPtr(n_cur, cur, 1);
19967         xmlResetLastError();
19968         if (mem_base != xmlMemBlocks()) {
19969             printf("Leak of %d blocks found in xmlDocDump",
19970 	           xmlMemBlocks() - mem_base);
19971 	    test_ret++;
19972             printf(" %d", n_f);
19973             printf(" %d", n_cur);
19974             printf("\n");
19975         }
19976     }
19977     }
19978     function_tests++;
19979 #endif
19980 
19981     return(test_ret);
19982 }
19983 
19984 
19985 static int
test_xmlDocDumpFormatMemory(void)19986 test_xmlDocDumpFormatMemory(void) {
19987     int test_ret = 0;
19988 
19989 #if defined(LIBXML_OUTPUT_ENABLED)
19990     int mem_base;
19991     xmlDocPtr cur; /* the document */
19992     int n_cur;
19993     xmlChar ** mem; /* OUT: the memory pointer */
19994     int n_mem;
19995     int * size; /* OUT: the memory length */
19996     int n_size;
19997     int format; /* should formatting spaces been added */
19998     int n_format;
19999 
20000     for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
20001     for (n_mem = 0;n_mem < gen_nb_xmlChar_ptr_ptr;n_mem++) {
20002     for (n_size = 0;n_size < gen_nb_int_ptr;n_size++) {
20003     for (n_format = 0;n_format < gen_nb_int;n_format++) {
20004         mem_base = xmlMemBlocks();
20005         cur = gen_xmlDocPtr(n_cur, 0);
20006         mem = gen_xmlChar_ptr_ptr(n_mem, 1);
20007         size = gen_int_ptr(n_size, 2);
20008         format = gen_int(n_format, 3);
20009 
20010         xmlDocDumpFormatMemory(cur, mem, size, format);
20011         call_tests++;
20012         des_xmlDocPtr(n_cur, cur, 0);
20013         des_xmlChar_ptr_ptr(n_mem, mem, 1);
20014         des_int_ptr(n_size, size, 2);
20015         des_int(n_format, format, 3);
20016         xmlResetLastError();
20017         if (mem_base != xmlMemBlocks()) {
20018             printf("Leak of %d blocks found in xmlDocDumpFormatMemory",
20019 	           xmlMemBlocks() - mem_base);
20020 	    test_ret++;
20021             printf(" %d", n_cur);
20022             printf(" %d", n_mem);
20023             printf(" %d", n_size);
20024             printf(" %d", n_format);
20025             printf("\n");
20026         }
20027     }
20028     }
20029     }
20030     }
20031     function_tests++;
20032 #endif
20033 
20034     return(test_ret);
20035 }
20036 
20037 
20038 static int
test_xmlDocDumpFormatMemoryEnc(void)20039 test_xmlDocDumpFormatMemoryEnc(void) {
20040     int test_ret = 0;
20041 
20042 #if defined(LIBXML_OUTPUT_ENABLED)
20043     int mem_base;
20044     xmlDocPtr out_doc; /* Document to generate XML text from */
20045     int n_out_doc;
20046     xmlChar ** doc_txt_ptr; /* Memory pointer for allocated XML text */
20047     int n_doc_txt_ptr;
20048     int * doc_txt_len; /* Length of the generated XML text */
20049     int n_doc_txt_len;
20050     const char * txt_encoding; /* Character encoding to use when generating XML text */
20051     int n_txt_encoding;
20052     int format; /* should formatting spaces been added */
20053     int n_format;
20054 
20055     for (n_out_doc = 0;n_out_doc < gen_nb_xmlDocPtr;n_out_doc++) {
20056     for (n_doc_txt_ptr = 0;n_doc_txt_ptr < gen_nb_xmlChar_ptr_ptr;n_doc_txt_ptr++) {
20057     for (n_doc_txt_len = 0;n_doc_txt_len < gen_nb_int_ptr;n_doc_txt_len++) {
20058     for (n_txt_encoding = 0;n_txt_encoding < gen_nb_const_char_ptr;n_txt_encoding++) {
20059     for (n_format = 0;n_format < gen_nb_int;n_format++) {
20060         mem_base = xmlMemBlocks();
20061         out_doc = gen_xmlDocPtr(n_out_doc, 0);
20062         doc_txt_ptr = gen_xmlChar_ptr_ptr(n_doc_txt_ptr, 1);
20063         doc_txt_len = gen_int_ptr(n_doc_txt_len, 2);
20064         txt_encoding = gen_const_char_ptr(n_txt_encoding, 3);
20065         format = gen_int(n_format, 4);
20066 
20067         xmlDocDumpFormatMemoryEnc(out_doc, doc_txt_ptr, doc_txt_len, txt_encoding, format);
20068         call_tests++;
20069         des_xmlDocPtr(n_out_doc, out_doc, 0);
20070         des_xmlChar_ptr_ptr(n_doc_txt_ptr, doc_txt_ptr, 1);
20071         des_int_ptr(n_doc_txt_len, doc_txt_len, 2);
20072         des_const_char_ptr(n_txt_encoding, txt_encoding, 3);
20073         des_int(n_format, format, 4);
20074         xmlResetLastError();
20075         if (mem_base != xmlMemBlocks()) {
20076             printf("Leak of %d blocks found in xmlDocDumpFormatMemoryEnc",
20077 	           xmlMemBlocks() - mem_base);
20078 	    test_ret++;
20079             printf(" %d", n_out_doc);
20080             printf(" %d", n_doc_txt_ptr);
20081             printf(" %d", n_doc_txt_len);
20082             printf(" %d", n_txt_encoding);
20083             printf(" %d", n_format);
20084             printf("\n");
20085         }
20086     }
20087     }
20088     }
20089     }
20090     }
20091     function_tests++;
20092 #endif
20093 
20094     return(test_ret);
20095 }
20096 
20097 
20098 static int
test_xmlDocDumpMemory(void)20099 test_xmlDocDumpMemory(void) {
20100     int test_ret = 0;
20101 
20102 #if defined(LIBXML_OUTPUT_ENABLED)
20103     int mem_base;
20104     xmlDocPtr cur; /* the document */
20105     int n_cur;
20106     xmlChar ** mem; /* OUT: the memory pointer */
20107     int n_mem;
20108     int * size; /* OUT: the memory length */
20109     int n_size;
20110 
20111     for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
20112     for (n_mem = 0;n_mem < gen_nb_xmlChar_ptr_ptr;n_mem++) {
20113     for (n_size = 0;n_size < gen_nb_int_ptr;n_size++) {
20114         mem_base = xmlMemBlocks();
20115         cur = gen_xmlDocPtr(n_cur, 0);
20116         mem = gen_xmlChar_ptr_ptr(n_mem, 1);
20117         size = gen_int_ptr(n_size, 2);
20118 
20119         xmlDocDumpMemory(cur, mem, size);
20120         call_tests++;
20121         des_xmlDocPtr(n_cur, cur, 0);
20122         des_xmlChar_ptr_ptr(n_mem, mem, 1);
20123         des_int_ptr(n_size, size, 2);
20124         xmlResetLastError();
20125         if (mem_base != xmlMemBlocks()) {
20126             printf("Leak of %d blocks found in xmlDocDumpMemory",
20127 	           xmlMemBlocks() - mem_base);
20128 	    test_ret++;
20129             printf(" %d", n_cur);
20130             printf(" %d", n_mem);
20131             printf(" %d", n_size);
20132             printf("\n");
20133         }
20134     }
20135     }
20136     }
20137     function_tests++;
20138 #endif
20139 
20140     return(test_ret);
20141 }
20142 
20143 
20144 static int
test_xmlDocDumpMemoryEnc(void)20145 test_xmlDocDumpMemoryEnc(void) {
20146     int test_ret = 0;
20147 
20148 #if defined(LIBXML_OUTPUT_ENABLED)
20149     int mem_base;
20150     xmlDocPtr out_doc; /* Document to generate XML text from */
20151     int n_out_doc;
20152     xmlChar ** doc_txt_ptr; /* Memory pointer for allocated XML text */
20153     int n_doc_txt_ptr;
20154     int * doc_txt_len; /* Length of the generated XML text */
20155     int n_doc_txt_len;
20156     const char * txt_encoding; /* Character encoding to use when generating XML text */
20157     int n_txt_encoding;
20158 
20159     for (n_out_doc = 0;n_out_doc < gen_nb_xmlDocPtr;n_out_doc++) {
20160     for (n_doc_txt_ptr = 0;n_doc_txt_ptr < gen_nb_xmlChar_ptr_ptr;n_doc_txt_ptr++) {
20161     for (n_doc_txt_len = 0;n_doc_txt_len < gen_nb_int_ptr;n_doc_txt_len++) {
20162     for (n_txt_encoding = 0;n_txt_encoding < gen_nb_const_char_ptr;n_txt_encoding++) {
20163         mem_base = xmlMemBlocks();
20164         out_doc = gen_xmlDocPtr(n_out_doc, 0);
20165         doc_txt_ptr = gen_xmlChar_ptr_ptr(n_doc_txt_ptr, 1);
20166         doc_txt_len = gen_int_ptr(n_doc_txt_len, 2);
20167         txt_encoding = gen_const_char_ptr(n_txt_encoding, 3);
20168 
20169         xmlDocDumpMemoryEnc(out_doc, doc_txt_ptr, doc_txt_len, txt_encoding);
20170         call_tests++;
20171         des_xmlDocPtr(n_out_doc, out_doc, 0);
20172         des_xmlChar_ptr_ptr(n_doc_txt_ptr, doc_txt_ptr, 1);
20173         des_int_ptr(n_doc_txt_len, doc_txt_len, 2);
20174         des_const_char_ptr(n_txt_encoding, txt_encoding, 3);
20175         xmlResetLastError();
20176         if (mem_base != xmlMemBlocks()) {
20177             printf("Leak of %d blocks found in xmlDocDumpMemoryEnc",
20178 	           xmlMemBlocks() - mem_base);
20179 	    test_ret++;
20180             printf(" %d", n_out_doc);
20181             printf(" %d", n_doc_txt_ptr);
20182             printf(" %d", n_doc_txt_len);
20183             printf(" %d", n_txt_encoding);
20184             printf("\n");
20185         }
20186     }
20187     }
20188     }
20189     }
20190     function_tests++;
20191 #endif
20192 
20193     return(test_ret);
20194 }
20195 
20196 
20197 static int
test_xmlDocFormatDump(void)20198 test_xmlDocFormatDump(void) {
20199     int test_ret = 0;
20200 
20201 #if defined(LIBXML_OUTPUT_ENABLED)
20202     int mem_base;
20203     int ret_val;
20204     FILE * f; /* the FILE* */
20205     int n_f;
20206     xmlDocPtr cur; /* the document */
20207     int n_cur;
20208     int format; /* should formatting spaces been added */
20209     int n_format;
20210 
20211     for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) {
20212     for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
20213     for (n_format = 0;n_format < gen_nb_int;n_format++) {
20214         mem_base = xmlMemBlocks();
20215         f = gen_FILE_ptr(n_f, 0);
20216         cur = gen_xmlDocPtr(n_cur, 1);
20217         format = gen_int(n_format, 2);
20218 
20219         ret_val = xmlDocFormatDump(f, cur, format);
20220         desret_int(ret_val);
20221         call_tests++;
20222         des_FILE_ptr(n_f, f, 0);
20223         des_xmlDocPtr(n_cur, cur, 1);
20224         des_int(n_format, format, 2);
20225         xmlResetLastError();
20226         if (mem_base != xmlMemBlocks()) {
20227             printf("Leak of %d blocks found in xmlDocFormatDump",
20228 	           xmlMemBlocks() - mem_base);
20229 	    test_ret++;
20230             printf(" %d", n_f);
20231             printf(" %d", n_cur);
20232             printf(" %d", n_format);
20233             printf("\n");
20234         }
20235     }
20236     }
20237     }
20238     function_tests++;
20239 #endif
20240 
20241     return(test_ret);
20242 }
20243 
20244 
20245 static int
test_xmlDocGetRootElement(void)20246 test_xmlDocGetRootElement(void) {
20247     int test_ret = 0;
20248 
20249     int mem_base;
20250     xmlNodePtr ret_val;
20251     const xmlDoc * doc; /* the document */
20252     int n_doc;
20253 
20254     for (n_doc = 0;n_doc < gen_nb_const_xmlDoc_ptr;n_doc++) {
20255         mem_base = xmlMemBlocks();
20256         doc = gen_const_xmlDoc_ptr(n_doc, 0);
20257 
20258         ret_val = xmlDocGetRootElement(doc);
20259         desret_xmlNodePtr(ret_val);
20260         call_tests++;
20261         des_const_xmlDoc_ptr(n_doc, doc, 0);
20262         xmlResetLastError();
20263         if (mem_base != xmlMemBlocks()) {
20264             printf("Leak of %d blocks found in xmlDocGetRootElement",
20265 	           xmlMemBlocks() - mem_base);
20266 	    test_ret++;
20267             printf(" %d", n_doc);
20268             printf("\n");
20269         }
20270     }
20271     function_tests++;
20272 
20273     return(test_ret);
20274 }
20275 
20276 
20277 static int
test_xmlDocSetRootElement(void)20278 test_xmlDocSetRootElement(void) {
20279     int test_ret = 0;
20280 
20281     int mem_base;
20282     xmlNodePtr ret_val;
20283     xmlDocPtr doc; /* the document */
20284     int n_doc;
20285     xmlNodePtr root; /* the new document root element, if root is NULL no action is taken, to remove a node from a document use xmlUnlinkNode(root) instead. */
20286     int n_root;
20287 
20288     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20289     for (n_root = 0;n_root < gen_nb_xmlNodePtr_in;n_root++) {
20290         mem_base = xmlMemBlocks();
20291         doc = gen_xmlDocPtr(n_doc, 0);
20292         root = gen_xmlNodePtr_in(n_root, 1);
20293 
20294         ret_val = xmlDocSetRootElement(doc, root);
20295         if (doc == NULL) { xmlFreeNode(root) ; root = NULL ; }
20296         desret_xmlNodePtr(ret_val);
20297         call_tests++;
20298         des_xmlDocPtr(n_doc, doc, 0);
20299         des_xmlNodePtr_in(n_root, root, 1);
20300         xmlResetLastError();
20301         if (mem_base != xmlMemBlocks()) {
20302             printf("Leak of %d blocks found in xmlDocSetRootElement",
20303 	           xmlMemBlocks() - mem_base);
20304 	    test_ret++;
20305             printf(" %d", n_doc);
20306             printf(" %d", n_root);
20307             printf("\n");
20308         }
20309     }
20310     }
20311     function_tests++;
20312 
20313     return(test_ret);
20314 }
20315 
20316 
20317 static int
test_xmlElemDump(void)20318 test_xmlElemDump(void) {
20319     int test_ret = 0;
20320 
20321 #if defined(LIBXML_OUTPUT_ENABLED)
20322     int mem_base;
20323     FILE * f; /* the FILE * for the output */
20324     int n_f;
20325     xmlDocPtr doc; /* the document */
20326     int n_doc;
20327     xmlNodePtr cur; /* the current node */
20328     int n_cur;
20329 
20330     for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) {
20331     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20332     for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
20333         mem_base = xmlMemBlocks();
20334         f = gen_FILE_ptr(n_f, 0);
20335         doc = gen_xmlDocPtr(n_doc, 1);
20336         cur = gen_xmlNodePtr(n_cur, 2);
20337 
20338         xmlElemDump(f, doc, cur);
20339         call_tests++;
20340         des_FILE_ptr(n_f, f, 0);
20341         des_xmlDocPtr(n_doc, doc, 1);
20342         des_xmlNodePtr(n_cur, cur, 2);
20343         xmlResetLastError();
20344         if (mem_base != xmlMemBlocks()) {
20345             printf("Leak of %d blocks found in xmlElemDump",
20346 	           xmlMemBlocks() - mem_base);
20347 	    test_ret++;
20348             printf(" %d", n_f);
20349             printf(" %d", n_doc);
20350             printf(" %d", n_cur);
20351             printf("\n");
20352         }
20353     }
20354     }
20355     }
20356     function_tests++;
20357 #endif
20358 
20359     return(test_ret);
20360 }
20361 
20362 
20363 static int
test_xmlFirstElementChild(void)20364 test_xmlFirstElementChild(void) {
20365     int test_ret = 0;
20366 
20367     int mem_base;
20368     xmlNodePtr ret_val;
20369     xmlNodePtr parent; /* the parent node */
20370     int n_parent;
20371 
20372     for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
20373         mem_base = xmlMemBlocks();
20374         parent = gen_xmlNodePtr(n_parent, 0);
20375 
20376         ret_val = xmlFirstElementChild(parent);
20377         desret_xmlNodePtr(ret_val);
20378         call_tests++;
20379         des_xmlNodePtr(n_parent, parent, 0);
20380         xmlResetLastError();
20381         if (mem_base != xmlMemBlocks()) {
20382             printf("Leak of %d blocks found in xmlFirstElementChild",
20383 	           xmlMemBlocks() - mem_base);
20384 	    test_ret++;
20385             printf(" %d", n_parent);
20386             printf("\n");
20387         }
20388     }
20389     function_tests++;
20390 
20391     return(test_ret);
20392 }
20393 
20394 
20395 static int
test_xmlGetBufferAllocationScheme(void)20396 test_xmlGetBufferAllocationScheme(void) {
20397     int test_ret = 0;
20398 
20399     int mem_base;
20400     xmlBufferAllocationScheme ret_val;
20401 
20402         mem_base = xmlMemBlocks();
20403 
20404         ret_val = xmlGetBufferAllocationScheme();
20405         desret_xmlBufferAllocationScheme(ret_val);
20406         call_tests++;
20407         xmlResetLastError();
20408         if (mem_base != xmlMemBlocks()) {
20409             printf("Leak of %d blocks found in xmlGetBufferAllocationScheme",
20410 	           xmlMemBlocks() - mem_base);
20411 	    test_ret++;
20412             printf("\n");
20413         }
20414     function_tests++;
20415 
20416     return(test_ret);
20417 }
20418 
20419 
20420 static int
test_xmlGetCompressMode(void)20421 test_xmlGetCompressMode(void) {
20422     int test_ret = 0;
20423 
20424     int mem_base;
20425     int ret_val;
20426 
20427         mem_base = xmlMemBlocks();
20428 
20429         ret_val = xmlGetCompressMode();
20430         desret_int(ret_val);
20431         call_tests++;
20432         xmlResetLastError();
20433         if (mem_base != xmlMemBlocks()) {
20434             printf("Leak of %d blocks found in xmlGetCompressMode",
20435 	           xmlMemBlocks() - mem_base);
20436 	    test_ret++;
20437             printf("\n");
20438         }
20439     function_tests++;
20440 
20441     return(test_ret);
20442 }
20443 
20444 
20445 static int
test_xmlGetDocCompressMode(void)20446 test_xmlGetDocCompressMode(void) {
20447     int test_ret = 0;
20448 
20449     int mem_base;
20450     int ret_val;
20451     const xmlDoc * doc; /* the document */
20452     int n_doc;
20453 
20454     for (n_doc = 0;n_doc < gen_nb_const_xmlDoc_ptr;n_doc++) {
20455         mem_base = xmlMemBlocks();
20456         doc = gen_const_xmlDoc_ptr(n_doc, 0);
20457 
20458         ret_val = xmlGetDocCompressMode(doc);
20459         desret_int(ret_val);
20460         call_tests++;
20461         des_const_xmlDoc_ptr(n_doc, doc, 0);
20462         xmlResetLastError();
20463         if (mem_base != xmlMemBlocks()) {
20464             printf("Leak of %d blocks found in xmlGetDocCompressMode",
20465 	           xmlMemBlocks() - mem_base);
20466 	    test_ret++;
20467             printf(" %d", n_doc);
20468             printf("\n");
20469         }
20470     }
20471     function_tests++;
20472 
20473     return(test_ret);
20474 }
20475 
20476 
20477 static int
test_xmlGetIntSubset(void)20478 test_xmlGetIntSubset(void) {
20479     int test_ret = 0;
20480 
20481     int mem_base;
20482     xmlDtdPtr ret_val;
20483     const xmlDoc * doc; /* the document pointer */
20484     int n_doc;
20485 
20486     for (n_doc = 0;n_doc < gen_nb_const_xmlDoc_ptr;n_doc++) {
20487         mem_base = xmlMemBlocks();
20488         doc = gen_const_xmlDoc_ptr(n_doc, 0);
20489 
20490         ret_val = xmlGetIntSubset(doc);
20491         desret_xmlDtdPtr(ret_val);
20492         call_tests++;
20493         des_const_xmlDoc_ptr(n_doc, doc, 0);
20494         xmlResetLastError();
20495         if (mem_base != xmlMemBlocks()) {
20496             printf("Leak of %d blocks found in xmlGetIntSubset",
20497 	           xmlMemBlocks() - mem_base);
20498 	    test_ret++;
20499             printf(" %d", n_doc);
20500             printf("\n");
20501         }
20502     }
20503     function_tests++;
20504 
20505     return(test_ret);
20506 }
20507 
20508 
20509 static int
test_xmlGetLastChild(void)20510 test_xmlGetLastChild(void) {
20511     int test_ret = 0;
20512 
20513     int mem_base;
20514     xmlNodePtr ret_val;
20515     const xmlNode * parent; /* the parent node */
20516     int n_parent;
20517 
20518     for (n_parent = 0;n_parent < gen_nb_const_xmlNode_ptr;n_parent++) {
20519         mem_base = xmlMemBlocks();
20520         parent = gen_const_xmlNode_ptr(n_parent, 0);
20521 
20522         ret_val = xmlGetLastChild(parent);
20523         desret_xmlNodePtr(ret_val);
20524         call_tests++;
20525         des_const_xmlNode_ptr(n_parent, parent, 0);
20526         xmlResetLastError();
20527         if (mem_base != xmlMemBlocks()) {
20528             printf("Leak of %d blocks found in xmlGetLastChild",
20529 	           xmlMemBlocks() - mem_base);
20530 	    test_ret++;
20531             printf(" %d", n_parent);
20532             printf("\n");
20533         }
20534     }
20535     function_tests++;
20536 
20537     return(test_ret);
20538 }
20539 
20540 
20541 static int
test_xmlGetLineNo(void)20542 test_xmlGetLineNo(void) {
20543     int test_ret = 0;
20544 
20545     int mem_base;
20546     long ret_val;
20547     const xmlNode * node; /* valid node */
20548     int n_node;
20549 
20550     for (n_node = 0;n_node < gen_nb_const_xmlNode_ptr;n_node++) {
20551         mem_base = xmlMemBlocks();
20552         node = gen_const_xmlNode_ptr(n_node, 0);
20553 
20554         ret_val = xmlGetLineNo(node);
20555         desret_long(ret_val);
20556         call_tests++;
20557         des_const_xmlNode_ptr(n_node, node, 0);
20558         xmlResetLastError();
20559         if (mem_base != xmlMemBlocks()) {
20560             printf("Leak of %d blocks found in xmlGetLineNo",
20561 	           xmlMemBlocks() - mem_base);
20562 	    test_ret++;
20563             printf(" %d", n_node);
20564             printf("\n");
20565         }
20566     }
20567     function_tests++;
20568 
20569     return(test_ret);
20570 }
20571 
20572 
20573 static int
test_xmlGetNoNsProp(void)20574 test_xmlGetNoNsProp(void) {
20575     int test_ret = 0;
20576 
20577     int mem_base;
20578     xmlChar * ret_val;
20579     const xmlNode * node; /* the node */
20580     int n_node;
20581     const xmlChar * name; /* the attribute name */
20582     int n_name;
20583 
20584     for (n_node = 0;n_node < gen_nb_const_xmlNode_ptr;n_node++) {
20585     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20586         mem_base = xmlMemBlocks();
20587         node = gen_const_xmlNode_ptr(n_node, 0);
20588         name = gen_const_xmlChar_ptr(n_name, 1);
20589 
20590         ret_val = xmlGetNoNsProp(node, name);
20591         desret_xmlChar_ptr(ret_val);
20592         call_tests++;
20593         des_const_xmlNode_ptr(n_node, node, 0);
20594         des_const_xmlChar_ptr(n_name, name, 1);
20595         xmlResetLastError();
20596         if (mem_base != xmlMemBlocks()) {
20597             printf("Leak of %d blocks found in xmlGetNoNsProp",
20598 	           xmlMemBlocks() - mem_base);
20599 	    test_ret++;
20600             printf(" %d", n_node);
20601             printf(" %d", n_name);
20602             printf("\n");
20603         }
20604     }
20605     }
20606     function_tests++;
20607 
20608     return(test_ret);
20609 }
20610 
20611 
20612 static int
test_xmlGetNodePath(void)20613 test_xmlGetNodePath(void) {
20614     int test_ret = 0;
20615 
20616     int mem_base;
20617     xmlChar * ret_val;
20618     const xmlNode * node; /* a node */
20619     int n_node;
20620 
20621     for (n_node = 0;n_node < gen_nb_const_xmlNode_ptr;n_node++) {
20622         mem_base = xmlMemBlocks();
20623         node = gen_const_xmlNode_ptr(n_node, 0);
20624 
20625         ret_val = xmlGetNodePath(node);
20626         desret_xmlChar_ptr(ret_val);
20627         call_tests++;
20628         des_const_xmlNode_ptr(n_node, node, 0);
20629         xmlResetLastError();
20630         if (mem_base != xmlMemBlocks()) {
20631             printf("Leak of %d blocks found in xmlGetNodePath",
20632 	           xmlMemBlocks() - mem_base);
20633 	    test_ret++;
20634             printf(" %d", n_node);
20635             printf("\n");
20636         }
20637     }
20638     function_tests++;
20639 
20640     return(test_ret);
20641 }
20642 
20643 
20644 static int
test_xmlGetNsList(void)20645 test_xmlGetNsList(void) {
20646     int test_ret = 0;
20647 
20648 
20649     /* missing type support */
20650     return(test_ret);
20651 }
20652 
20653 
20654 static int
test_xmlGetNsListSafe(void)20655 test_xmlGetNsListSafe(void) {
20656     int test_ret = 0;
20657 
20658 
20659     /* missing type support */
20660     return(test_ret);
20661 }
20662 
20663 
20664 static int
test_xmlGetNsProp(void)20665 test_xmlGetNsProp(void) {
20666     int test_ret = 0;
20667 
20668     int mem_base;
20669     xmlChar * ret_val;
20670     const xmlNode * node; /* the node */
20671     int n_node;
20672     const xmlChar * name; /* the attribute name */
20673     int n_name;
20674     const xmlChar * nameSpace; /* the URI of the namespace */
20675     int n_nameSpace;
20676 
20677     for (n_node = 0;n_node < gen_nb_const_xmlNode_ptr;n_node++) {
20678     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20679     for (n_nameSpace = 0;n_nameSpace < gen_nb_const_xmlChar_ptr;n_nameSpace++) {
20680         mem_base = xmlMemBlocks();
20681         node = gen_const_xmlNode_ptr(n_node, 0);
20682         name = gen_const_xmlChar_ptr(n_name, 1);
20683         nameSpace = gen_const_xmlChar_ptr(n_nameSpace, 2);
20684 
20685         ret_val = xmlGetNsProp(node, name, nameSpace);
20686         desret_xmlChar_ptr(ret_val);
20687         call_tests++;
20688         des_const_xmlNode_ptr(n_node, node, 0);
20689         des_const_xmlChar_ptr(n_name, name, 1);
20690         des_const_xmlChar_ptr(n_nameSpace, nameSpace, 2);
20691         xmlResetLastError();
20692         if (mem_base != xmlMemBlocks()) {
20693             printf("Leak of %d blocks found in xmlGetNsProp",
20694 	           xmlMemBlocks() - mem_base);
20695 	    test_ret++;
20696             printf(" %d", n_node);
20697             printf(" %d", n_name);
20698             printf(" %d", n_nameSpace);
20699             printf("\n");
20700         }
20701     }
20702     }
20703     }
20704     function_tests++;
20705 
20706     return(test_ret);
20707 }
20708 
20709 
20710 static int
test_xmlGetProp(void)20711 test_xmlGetProp(void) {
20712     int test_ret = 0;
20713 
20714     int mem_base;
20715     xmlChar * ret_val;
20716     const xmlNode * node; /* the node */
20717     int n_node;
20718     const xmlChar * name; /* the attribute name */
20719     int n_name;
20720 
20721     for (n_node = 0;n_node < gen_nb_const_xmlNode_ptr;n_node++) {
20722     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20723         mem_base = xmlMemBlocks();
20724         node = gen_const_xmlNode_ptr(n_node, 0);
20725         name = gen_const_xmlChar_ptr(n_name, 1);
20726 
20727         ret_val = xmlGetProp(node, name);
20728         desret_xmlChar_ptr(ret_val);
20729         call_tests++;
20730         des_const_xmlNode_ptr(n_node, node, 0);
20731         des_const_xmlChar_ptr(n_name, name, 1);
20732         xmlResetLastError();
20733         if (mem_base != xmlMemBlocks()) {
20734             printf("Leak of %d blocks found in xmlGetProp",
20735 	           xmlMemBlocks() - mem_base);
20736 	    test_ret++;
20737             printf(" %d", n_node);
20738             printf(" %d", n_name);
20739             printf("\n");
20740         }
20741     }
20742     }
20743     function_tests++;
20744 
20745     return(test_ret);
20746 }
20747 
20748 
20749 static int
test_xmlHasNsProp(void)20750 test_xmlHasNsProp(void) {
20751     int test_ret = 0;
20752 
20753     int mem_base;
20754     xmlAttrPtr ret_val;
20755     const xmlNode * node; /* the node */
20756     int n_node;
20757     const xmlChar * name; /* the attribute name */
20758     int n_name;
20759     const xmlChar * nameSpace; /* the URI of the namespace */
20760     int n_nameSpace;
20761 
20762     for (n_node = 0;n_node < gen_nb_const_xmlNode_ptr;n_node++) {
20763     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20764     for (n_nameSpace = 0;n_nameSpace < gen_nb_const_xmlChar_ptr;n_nameSpace++) {
20765         mem_base = xmlMemBlocks();
20766         node = gen_const_xmlNode_ptr(n_node, 0);
20767         name = gen_const_xmlChar_ptr(n_name, 1);
20768         nameSpace = gen_const_xmlChar_ptr(n_nameSpace, 2);
20769 
20770         ret_val = xmlHasNsProp(node, name, nameSpace);
20771         desret_xmlAttrPtr(ret_val);
20772         call_tests++;
20773         des_const_xmlNode_ptr(n_node, node, 0);
20774         des_const_xmlChar_ptr(n_name, name, 1);
20775         des_const_xmlChar_ptr(n_nameSpace, nameSpace, 2);
20776         xmlResetLastError();
20777         if (mem_base != xmlMemBlocks()) {
20778             printf("Leak of %d blocks found in xmlHasNsProp",
20779 	           xmlMemBlocks() - mem_base);
20780 	    test_ret++;
20781             printf(" %d", n_node);
20782             printf(" %d", n_name);
20783             printf(" %d", n_nameSpace);
20784             printf("\n");
20785         }
20786     }
20787     }
20788     }
20789     function_tests++;
20790 
20791     return(test_ret);
20792 }
20793 
20794 
20795 static int
test_xmlHasProp(void)20796 test_xmlHasProp(void) {
20797     int test_ret = 0;
20798 
20799     int mem_base;
20800     xmlAttrPtr ret_val;
20801     const xmlNode * node; /* the node */
20802     int n_node;
20803     const xmlChar * name; /* the attribute name */
20804     int n_name;
20805 
20806     for (n_node = 0;n_node < gen_nb_const_xmlNode_ptr;n_node++) {
20807     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20808         mem_base = xmlMemBlocks();
20809         node = gen_const_xmlNode_ptr(n_node, 0);
20810         name = gen_const_xmlChar_ptr(n_name, 1);
20811 
20812         ret_val = xmlHasProp(node, name);
20813         desret_xmlAttrPtr(ret_val);
20814         call_tests++;
20815         des_const_xmlNode_ptr(n_node, node, 0);
20816         des_const_xmlChar_ptr(n_name, name, 1);
20817         xmlResetLastError();
20818         if (mem_base != xmlMemBlocks()) {
20819             printf("Leak of %d blocks found in xmlHasProp",
20820 	           xmlMemBlocks() - mem_base);
20821 	    test_ret++;
20822             printf(" %d", n_node);
20823             printf(" %d", n_name);
20824             printf("\n");
20825         }
20826     }
20827     }
20828     function_tests++;
20829 
20830     return(test_ret);
20831 }
20832 
20833 
20834 static int
test_xmlIsBlankNode(void)20835 test_xmlIsBlankNode(void) {
20836     int test_ret = 0;
20837 
20838     int mem_base;
20839     int ret_val;
20840     const xmlNode * node; /* the node */
20841     int n_node;
20842 
20843     for (n_node = 0;n_node < gen_nb_const_xmlNode_ptr;n_node++) {
20844         mem_base = xmlMemBlocks();
20845         node = gen_const_xmlNode_ptr(n_node, 0);
20846 
20847         ret_val = xmlIsBlankNode(node);
20848         desret_int(ret_val);
20849         call_tests++;
20850         des_const_xmlNode_ptr(n_node, node, 0);
20851         xmlResetLastError();
20852         if (mem_base != xmlMemBlocks()) {
20853             printf("Leak of %d blocks found in xmlIsBlankNode",
20854 	           xmlMemBlocks() - mem_base);
20855 	    test_ret++;
20856             printf(" %d", n_node);
20857             printf("\n");
20858         }
20859     }
20860     function_tests++;
20861 
20862     return(test_ret);
20863 }
20864 
20865 
20866 static int
test_xmlIsXHTML(void)20867 test_xmlIsXHTML(void) {
20868     int test_ret = 0;
20869 
20870     int mem_base;
20871     int ret_val;
20872     const xmlChar * systemID; /* the system identifier */
20873     int n_systemID;
20874     const xmlChar * publicID; /* the public identifier */
20875     int n_publicID;
20876 
20877     for (n_systemID = 0;n_systemID < gen_nb_const_xmlChar_ptr;n_systemID++) {
20878     for (n_publicID = 0;n_publicID < gen_nb_const_xmlChar_ptr;n_publicID++) {
20879         mem_base = xmlMemBlocks();
20880         systemID = gen_const_xmlChar_ptr(n_systemID, 0);
20881         publicID = gen_const_xmlChar_ptr(n_publicID, 1);
20882 
20883         ret_val = xmlIsXHTML(systemID, publicID);
20884         desret_int(ret_val);
20885         call_tests++;
20886         des_const_xmlChar_ptr(n_systemID, systemID, 0);
20887         des_const_xmlChar_ptr(n_publicID, publicID, 1);
20888         xmlResetLastError();
20889         if (mem_base != xmlMemBlocks()) {
20890             printf("Leak of %d blocks found in xmlIsXHTML",
20891 	           xmlMemBlocks() - mem_base);
20892 	    test_ret++;
20893             printf(" %d", n_systemID);
20894             printf(" %d", n_publicID);
20895             printf("\n");
20896         }
20897     }
20898     }
20899     function_tests++;
20900 
20901     return(test_ret);
20902 }
20903 
20904 
20905 static int
test_xmlLastElementChild(void)20906 test_xmlLastElementChild(void) {
20907     int test_ret = 0;
20908 
20909     int mem_base;
20910     xmlNodePtr ret_val;
20911     xmlNodePtr parent; /* the parent node */
20912     int n_parent;
20913 
20914     for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
20915         mem_base = xmlMemBlocks();
20916         parent = gen_xmlNodePtr(n_parent, 0);
20917 
20918         ret_val = xmlLastElementChild(parent);
20919         desret_xmlNodePtr(ret_val);
20920         call_tests++;
20921         des_xmlNodePtr(n_parent, parent, 0);
20922         xmlResetLastError();
20923         if (mem_base != xmlMemBlocks()) {
20924             printf("Leak of %d blocks found in xmlLastElementChild",
20925 	           xmlMemBlocks() - mem_base);
20926 	    test_ret++;
20927             printf(" %d", n_parent);
20928             printf("\n");
20929         }
20930     }
20931     function_tests++;
20932 
20933     return(test_ret);
20934 }
20935 
20936 
20937 static int
test_xmlNewCDataBlock(void)20938 test_xmlNewCDataBlock(void) {
20939     int test_ret = 0;
20940 
20941     int mem_base;
20942     xmlNodePtr ret_val;
20943     xmlDocPtr doc; /* the target document (optional) */
20944     int n_doc;
20945     const xmlChar * content; /* raw text content (optional) */
20946     int n_content;
20947     int len; /* size of text content */
20948     int n_len;
20949 
20950     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20951     for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20952     for (n_len = 0;n_len < gen_nb_int;n_len++) {
20953         mem_base = xmlMemBlocks();
20954         doc = gen_xmlDocPtr(n_doc, 0);
20955         content = gen_const_xmlChar_ptr(n_content, 1);
20956         len = gen_int(n_len, 2);
20957         if ((content != NULL) &&
20958             (len > xmlStrlen(BAD_CAST content)))
20959             len = 0;
20960 
20961         ret_val = xmlNewCDataBlock(doc, content, len);
20962         desret_xmlNodePtr(ret_val);
20963         call_tests++;
20964         des_xmlDocPtr(n_doc, doc, 0);
20965         des_const_xmlChar_ptr(n_content, content, 1);
20966         des_int(n_len, len, 2);
20967         xmlResetLastError();
20968         if (mem_base != xmlMemBlocks()) {
20969             printf("Leak of %d blocks found in xmlNewCDataBlock",
20970 	           xmlMemBlocks() - mem_base);
20971 	    test_ret++;
20972             printf(" %d", n_doc);
20973             printf(" %d", n_content);
20974             printf(" %d", n_len);
20975             printf("\n");
20976         }
20977     }
20978     }
20979     }
20980     function_tests++;
20981 
20982     return(test_ret);
20983 }
20984 
20985 
20986 static int
test_xmlNewCharRef(void)20987 test_xmlNewCharRef(void) {
20988     int test_ret = 0;
20989 
20990     int mem_base;
20991     xmlNodePtr ret_val;
20992     xmlDocPtr doc; /* the target document (optional) */
20993     int n_doc;
20994     const xmlChar * name; /* the entity name */
20995     int n_name;
20996 
20997     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20998     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20999         mem_base = xmlMemBlocks();
21000         doc = gen_xmlDocPtr(n_doc, 0);
21001         name = gen_const_xmlChar_ptr(n_name, 1);
21002 
21003         ret_val = xmlNewCharRef(doc, name);
21004         desret_xmlNodePtr(ret_val);
21005         call_tests++;
21006         des_xmlDocPtr(n_doc, doc, 0);
21007         des_const_xmlChar_ptr(n_name, name, 1);
21008         xmlResetLastError();
21009         if (mem_base != xmlMemBlocks()) {
21010             printf("Leak of %d blocks found in xmlNewCharRef",
21011 	           xmlMemBlocks() - mem_base);
21012 	    test_ret++;
21013             printf(" %d", n_doc);
21014             printf(" %d", n_name);
21015             printf("\n");
21016         }
21017     }
21018     }
21019     function_tests++;
21020 
21021     return(test_ret);
21022 }
21023 
21024 
21025 static int
test_xmlNewChild(void)21026 test_xmlNewChild(void) {
21027     int test_ret = 0;
21028 
21029     int mem_base;
21030     xmlNodePtr ret_val;
21031     xmlNodePtr parent; /* the parent node */
21032     int n_parent;
21033     xmlNsPtr ns; /* a namespace (optional) */
21034     int n_ns;
21035     const xmlChar * name; /* the name of the child */
21036     int n_name;
21037     const xmlChar * content; /* text content with XML references (optional) */
21038     int n_content;
21039 
21040     for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
21041     for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
21042     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
21043     for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
21044         mem_base = xmlMemBlocks();
21045         parent = gen_xmlNodePtr(n_parent, 0);
21046         ns = gen_xmlNsPtr(n_ns, 1);
21047         name = gen_const_xmlChar_ptr(n_name, 2);
21048         content = gen_const_xmlChar_ptr(n_content, 3);
21049 
21050         ret_val = xmlNewChild(parent, ns, name, content);
21051         desret_xmlNodePtr(ret_val);
21052         call_tests++;
21053         des_xmlNodePtr(n_parent, parent, 0);
21054         des_xmlNsPtr(n_ns, ns, 1);
21055         des_const_xmlChar_ptr(n_name, name, 2);
21056         des_const_xmlChar_ptr(n_content, content, 3);
21057         xmlResetLastError();
21058         if (mem_base != xmlMemBlocks()) {
21059             printf("Leak of %d blocks found in xmlNewChild",
21060 	           xmlMemBlocks() - mem_base);
21061 	    test_ret++;
21062             printf(" %d", n_parent);
21063             printf(" %d", n_ns);
21064             printf(" %d", n_name);
21065             printf(" %d", n_content);
21066             printf("\n");
21067         }
21068     }
21069     }
21070     }
21071     }
21072     function_tests++;
21073 
21074     return(test_ret);
21075 }
21076 
21077 
21078 static int
test_xmlNewComment(void)21079 test_xmlNewComment(void) {
21080     int test_ret = 0;
21081 
21082     int mem_base;
21083     xmlNodePtr ret_val;
21084     const xmlChar * content; /* the comment content (optional) */
21085     int n_content;
21086 
21087     for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
21088         mem_base = xmlMemBlocks();
21089         content = gen_const_xmlChar_ptr(n_content, 0);
21090 
21091         ret_val = xmlNewComment(content);
21092         desret_xmlNodePtr(ret_val);
21093         call_tests++;
21094         des_const_xmlChar_ptr(n_content, content, 0);
21095         xmlResetLastError();
21096         if (mem_base != xmlMemBlocks()) {
21097             printf("Leak of %d blocks found in xmlNewComment",
21098 	           xmlMemBlocks() - mem_base);
21099 	    test_ret++;
21100             printf(" %d", n_content);
21101             printf("\n");
21102         }
21103     }
21104     function_tests++;
21105 
21106     return(test_ret);
21107 }
21108 
21109 
21110 static int
test_xmlNewDoc(void)21111 test_xmlNewDoc(void) {
21112     int test_ret = 0;
21113 
21114     int mem_base;
21115     xmlDocPtr ret_val;
21116     const xmlChar * version; /* XML version string like "1.0" (optional) */
21117     int n_version;
21118 
21119     for (n_version = 0;n_version < gen_nb_const_xmlChar_ptr;n_version++) {
21120         mem_base = xmlMemBlocks();
21121         version = gen_const_xmlChar_ptr(n_version, 0);
21122 
21123         ret_val = xmlNewDoc(version);
21124         desret_xmlDocPtr(ret_val);
21125         call_tests++;
21126         des_const_xmlChar_ptr(n_version, version, 0);
21127         xmlResetLastError();
21128         if (mem_base != xmlMemBlocks()) {
21129             printf("Leak of %d blocks found in xmlNewDoc",
21130 	           xmlMemBlocks() - mem_base);
21131 	    test_ret++;
21132             printf(" %d", n_version);
21133             printf("\n");
21134         }
21135     }
21136     function_tests++;
21137 
21138     return(test_ret);
21139 }
21140 
21141 
21142 static int
test_xmlNewDocComment(void)21143 test_xmlNewDocComment(void) {
21144     int test_ret = 0;
21145 
21146     int mem_base;
21147     xmlNodePtr ret_val;
21148     xmlDocPtr doc; /* the document */
21149     int n_doc;
21150     const xmlChar * content; /* the comment content */
21151     int n_content;
21152 
21153     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21154     for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
21155         mem_base = xmlMemBlocks();
21156         doc = gen_xmlDocPtr(n_doc, 0);
21157         content = gen_const_xmlChar_ptr(n_content, 1);
21158 
21159         ret_val = xmlNewDocComment(doc, content);
21160         desret_xmlNodePtr(ret_val);
21161         call_tests++;
21162         des_xmlDocPtr(n_doc, doc, 0);
21163         des_const_xmlChar_ptr(n_content, content, 1);
21164         xmlResetLastError();
21165         if (mem_base != xmlMemBlocks()) {
21166             printf("Leak of %d blocks found in xmlNewDocComment",
21167 	           xmlMemBlocks() - mem_base);
21168 	    test_ret++;
21169             printf(" %d", n_doc);
21170             printf(" %d", n_content);
21171             printf("\n");
21172         }
21173     }
21174     }
21175     function_tests++;
21176 
21177     return(test_ret);
21178 }
21179 
21180 
21181 static int
test_xmlNewDocFragment(void)21182 test_xmlNewDocFragment(void) {
21183     int test_ret = 0;
21184 
21185     int mem_base;
21186     xmlNodePtr ret_val;
21187     xmlDocPtr doc; /* the target document (optional) */
21188     int n_doc;
21189 
21190     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21191         mem_base = xmlMemBlocks();
21192         doc = gen_xmlDocPtr(n_doc, 0);
21193 
21194         ret_val = xmlNewDocFragment(doc);
21195         desret_xmlNodePtr(ret_val);
21196         call_tests++;
21197         des_xmlDocPtr(n_doc, doc, 0);
21198         xmlResetLastError();
21199         if (mem_base != xmlMemBlocks()) {
21200             printf("Leak of %d blocks found in xmlNewDocFragment",
21201 	           xmlMemBlocks() - mem_base);
21202 	    test_ret++;
21203             printf(" %d", n_doc);
21204             printf("\n");
21205         }
21206     }
21207     function_tests++;
21208 
21209     return(test_ret);
21210 }
21211 
21212 
21213 static int
test_xmlNewDocNode(void)21214 test_xmlNewDocNode(void) {
21215     int test_ret = 0;
21216 
21217     int mem_base;
21218     xmlNodePtr ret_val;
21219     xmlDocPtr doc; /* the target document */
21220     int n_doc;
21221     xmlNsPtr ns; /* namespace (optional) */
21222     int n_ns;
21223     const xmlChar * name; /* the node name */
21224     int n_name;
21225     const xmlChar * content; /* text content with XML references (optional) */
21226     int n_content;
21227 
21228     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21229     for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
21230     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
21231     for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
21232         mem_base = xmlMemBlocks();
21233         doc = gen_xmlDocPtr(n_doc, 0);
21234         ns = gen_xmlNsPtr(n_ns, 1);
21235         name = gen_const_xmlChar_ptr(n_name, 2);
21236         content = gen_const_xmlChar_ptr(n_content, 3);
21237 
21238         ret_val = xmlNewDocNode(doc, ns, name, content);
21239         desret_xmlNodePtr(ret_val);
21240         call_tests++;
21241         des_xmlDocPtr(n_doc, doc, 0);
21242         des_xmlNsPtr(n_ns, ns, 1);
21243         des_const_xmlChar_ptr(n_name, name, 2);
21244         des_const_xmlChar_ptr(n_content, content, 3);
21245         xmlResetLastError();
21246         if (mem_base != xmlMemBlocks()) {
21247             printf("Leak of %d blocks found in xmlNewDocNode",
21248 	           xmlMemBlocks() - mem_base);
21249 	    test_ret++;
21250             printf(" %d", n_doc);
21251             printf(" %d", n_ns);
21252             printf(" %d", n_name);
21253             printf(" %d", n_content);
21254             printf("\n");
21255         }
21256     }
21257     }
21258     }
21259     }
21260     function_tests++;
21261 
21262     return(test_ret);
21263 }
21264 
21265 
21266 static int
test_xmlNewDocNodeEatName(void)21267 test_xmlNewDocNodeEatName(void) {
21268     int test_ret = 0;
21269 
21270     int mem_base;
21271     xmlNodePtr ret_val;
21272     xmlDocPtr doc; /* the target document */
21273     int n_doc;
21274     xmlNsPtr ns; /* namespace (optional) */
21275     int n_ns;
21276     xmlChar * name; /* the node name */
21277     int n_name;
21278     const xmlChar * content; /* text content with XML references (optional) */
21279     int n_content;
21280 
21281     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21282     for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
21283     for (n_name = 0;n_name < gen_nb_eaten_name;n_name++) {
21284     for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
21285         mem_base = xmlMemBlocks();
21286         doc = gen_xmlDocPtr(n_doc, 0);
21287         ns = gen_xmlNsPtr(n_ns, 1);
21288         name = gen_eaten_name(n_name, 2);
21289         content = gen_const_xmlChar_ptr(n_content, 3);
21290 
21291         ret_val = xmlNewDocNodeEatName(doc, ns, name, content);
21292         desret_xmlNodePtr(ret_val);
21293         call_tests++;
21294         des_xmlDocPtr(n_doc, doc, 0);
21295         des_xmlNsPtr(n_ns, ns, 1);
21296         des_eaten_name(n_name, name, 2);
21297         des_const_xmlChar_ptr(n_content, content, 3);
21298         xmlResetLastError();
21299         if (mem_base != xmlMemBlocks()) {
21300             printf("Leak of %d blocks found in xmlNewDocNodeEatName",
21301 	           xmlMemBlocks() - mem_base);
21302 	    test_ret++;
21303             printf(" %d", n_doc);
21304             printf(" %d", n_ns);
21305             printf(" %d", n_name);
21306             printf(" %d", n_content);
21307             printf("\n");
21308         }
21309     }
21310     }
21311     }
21312     }
21313     function_tests++;
21314 
21315     return(test_ret);
21316 }
21317 
21318 
21319 static int
test_xmlNewDocPI(void)21320 test_xmlNewDocPI(void) {
21321     int test_ret = 0;
21322 
21323     int mem_base;
21324     xmlNodePtr ret_val;
21325     xmlDocPtr doc; /* the target document (optional) */
21326     int n_doc;
21327     const xmlChar * name; /* the processing instruction target */
21328     int n_name;
21329     const xmlChar * content; /* the PI content (optional) */
21330     int n_content;
21331 
21332     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21333     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
21334     for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
21335         mem_base = xmlMemBlocks();
21336         doc = gen_xmlDocPtr(n_doc, 0);
21337         name = gen_const_xmlChar_ptr(n_name, 1);
21338         content = gen_const_xmlChar_ptr(n_content, 2);
21339 
21340         ret_val = xmlNewDocPI(doc, name, content);
21341         desret_xmlNodePtr(ret_val);
21342         call_tests++;
21343         des_xmlDocPtr(n_doc, doc, 0);
21344         des_const_xmlChar_ptr(n_name, name, 1);
21345         des_const_xmlChar_ptr(n_content, content, 2);
21346         xmlResetLastError();
21347         if (mem_base != xmlMemBlocks()) {
21348             printf("Leak of %d blocks found in xmlNewDocPI",
21349 	           xmlMemBlocks() - mem_base);
21350 	    test_ret++;
21351             printf(" %d", n_doc);
21352             printf(" %d", n_name);
21353             printf(" %d", n_content);
21354             printf("\n");
21355         }
21356     }
21357     }
21358     }
21359     function_tests++;
21360 
21361     return(test_ret);
21362 }
21363 
21364 
21365 static int
test_xmlNewDocProp(void)21366 test_xmlNewDocProp(void) {
21367     int test_ret = 0;
21368 
21369     int mem_base;
21370     xmlAttrPtr ret_val;
21371     xmlDocPtr doc; /* the target document (optional) */
21372     int n_doc;
21373     const xmlChar * name; /* the name of the attribute */
21374     int n_name;
21375     const xmlChar * value; /* attribute value with XML references (optional) */
21376     int n_value;
21377 
21378     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21379     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
21380     for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
21381         mem_base = xmlMemBlocks();
21382         doc = gen_xmlDocPtr(n_doc, 0);
21383         name = gen_const_xmlChar_ptr(n_name, 1);
21384         value = gen_const_xmlChar_ptr(n_value, 2);
21385 
21386         ret_val = xmlNewDocProp(doc, name, value);
21387         desret_xmlAttrPtr(ret_val);
21388         call_tests++;
21389         des_xmlDocPtr(n_doc, doc, 0);
21390         des_const_xmlChar_ptr(n_name, name, 1);
21391         des_const_xmlChar_ptr(n_value, value, 2);
21392         xmlResetLastError();
21393         if (mem_base != xmlMemBlocks()) {
21394             printf("Leak of %d blocks found in xmlNewDocProp",
21395 	           xmlMemBlocks() - mem_base);
21396 	    test_ret++;
21397             printf(" %d", n_doc);
21398             printf(" %d", n_name);
21399             printf(" %d", n_value);
21400             printf("\n");
21401         }
21402     }
21403     }
21404     }
21405     function_tests++;
21406 
21407     return(test_ret);
21408 }
21409 
21410 
21411 static int
test_xmlNewDocRawNode(void)21412 test_xmlNewDocRawNode(void) {
21413     int test_ret = 0;
21414 
21415     int mem_base;
21416     xmlNodePtr ret_val;
21417     xmlDocPtr doc; /* the target document */
21418     int n_doc;
21419     xmlNsPtr ns; /* namespace (optional) */
21420     int n_ns;
21421     const xmlChar * name; /* the node name */
21422     int n_name;
21423     const xmlChar * content; /* raw text content (optional) */
21424     int n_content;
21425 
21426     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21427     for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
21428     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
21429     for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
21430         mem_base = xmlMemBlocks();
21431         doc = gen_xmlDocPtr(n_doc, 0);
21432         ns = gen_xmlNsPtr(n_ns, 1);
21433         name = gen_const_xmlChar_ptr(n_name, 2);
21434         content = gen_const_xmlChar_ptr(n_content, 3);
21435 
21436         ret_val = xmlNewDocRawNode(doc, ns, name, content);
21437         desret_xmlNodePtr(ret_val);
21438         call_tests++;
21439         des_xmlDocPtr(n_doc, doc, 0);
21440         des_xmlNsPtr(n_ns, ns, 1);
21441         des_const_xmlChar_ptr(n_name, name, 2);
21442         des_const_xmlChar_ptr(n_content, content, 3);
21443         xmlResetLastError();
21444         if (mem_base != xmlMemBlocks()) {
21445             printf("Leak of %d blocks found in xmlNewDocRawNode",
21446 	           xmlMemBlocks() - mem_base);
21447 	    test_ret++;
21448             printf(" %d", n_doc);
21449             printf(" %d", n_ns);
21450             printf(" %d", n_name);
21451             printf(" %d", n_content);
21452             printf("\n");
21453         }
21454     }
21455     }
21456     }
21457     }
21458     function_tests++;
21459 
21460     return(test_ret);
21461 }
21462 
21463 
21464 static int
test_xmlNewDocText(void)21465 test_xmlNewDocText(void) {
21466     int test_ret = 0;
21467 
21468     int mem_base;
21469     xmlNodePtr ret_val;
21470     const xmlDoc * doc; /* the target document */
21471     int n_doc;
21472     const xmlChar * content; /* raw text content (optional) */
21473     int n_content;
21474 
21475     for (n_doc = 0;n_doc < gen_nb_const_xmlDoc_ptr;n_doc++) {
21476     for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
21477         mem_base = xmlMemBlocks();
21478         doc = gen_const_xmlDoc_ptr(n_doc, 0);
21479         content = gen_const_xmlChar_ptr(n_content, 1);
21480 
21481         ret_val = xmlNewDocText(doc, content);
21482         desret_xmlNodePtr(ret_val);
21483         call_tests++;
21484         des_const_xmlDoc_ptr(n_doc, doc, 0);
21485         des_const_xmlChar_ptr(n_content, content, 1);
21486         xmlResetLastError();
21487         if (mem_base != xmlMemBlocks()) {
21488             printf("Leak of %d blocks found in xmlNewDocText",
21489 	           xmlMemBlocks() - mem_base);
21490 	    test_ret++;
21491             printf(" %d", n_doc);
21492             printf(" %d", n_content);
21493             printf("\n");
21494         }
21495     }
21496     }
21497     function_tests++;
21498 
21499     return(test_ret);
21500 }
21501 
21502 
21503 static int
test_xmlNewDocTextLen(void)21504 test_xmlNewDocTextLen(void) {
21505     int test_ret = 0;
21506 
21507     int mem_base;
21508     xmlNodePtr ret_val;
21509     xmlDocPtr doc; /* the target document */
21510     int n_doc;
21511     const xmlChar * content; /* raw text content (optional) */
21512     int n_content;
21513     int len; /* size of text content */
21514     int n_len;
21515 
21516     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21517     for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
21518     for (n_len = 0;n_len < gen_nb_int;n_len++) {
21519         mem_base = xmlMemBlocks();
21520         doc = gen_xmlDocPtr(n_doc, 0);
21521         content = gen_const_xmlChar_ptr(n_content, 1);
21522         len = gen_int(n_len, 2);
21523         if ((content != NULL) &&
21524             (len > xmlStrlen(BAD_CAST content)))
21525             len = 0;
21526 
21527         ret_val = xmlNewDocTextLen(doc, content, len);
21528         desret_xmlNodePtr(ret_val);
21529         call_tests++;
21530         des_xmlDocPtr(n_doc, doc, 0);
21531         des_const_xmlChar_ptr(n_content, content, 1);
21532         des_int(n_len, len, 2);
21533         xmlResetLastError();
21534         if (mem_base != xmlMemBlocks()) {
21535             printf("Leak of %d blocks found in xmlNewDocTextLen",
21536 	           xmlMemBlocks() - mem_base);
21537 	    test_ret++;
21538             printf(" %d", n_doc);
21539             printf(" %d", n_content);
21540             printf(" %d", n_len);
21541             printf("\n");
21542         }
21543     }
21544     }
21545     }
21546     function_tests++;
21547 
21548     return(test_ret);
21549 }
21550 
21551 
21552 static int
test_xmlNewDtd(void)21553 test_xmlNewDtd(void) {
21554     int test_ret = 0;
21555 
21556     int mem_base;
21557     xmlDtdPtr ret_val;
21558     xmlDocPtr doc; /* the document pointer (optional) */
21559     int n_doc;
21560     const xmlChar * name; /* the DTD name (optional) */
21561     int n_name;
21562     const xmlChar * ExternalID; /* the external ID (optional) */
21563     int n_ExternalID;
21564     const xmlChar * SystemID; /* the system ID (optional) */
21565     int n_SystemID;
21566 
21567     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21568     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
21569     for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
21570     for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
21571         mem_base = xmlMemBlocks();
21572         doc = gen_xmlDocPtr(n_doc, 0);
21573         name = gen_const_xmlChar_ptr(n_name, 1);
21574         ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2);
21575         SystemID = gen_const_xmlChar_ptr(n_SystemID, 3);
21576 
21577         ret_val = xmlNewDtd(doc, name, ExternalID, SystemID);
21578         desret_xmlDtdPtr(ret_val);
21579         call_tests++;
21580         des_xmlDocPtr(n_doc, doc, 0);
21581         des_const_xmlChar_ptr(n_name, name, 1);
21582         des_const_xmlChar_ptr(n_ExternalID, ExternalID, 2);
21583         des_const_xmlChar_ptr(n_SystemID, SystemID, 3);
21584         xmlResetLastError();
21585         if (mem_base != xmlMemBlocks()) {
21586             printf("Leak of %d blocks found in xmlNewDtd",
21587 	           xmlMemBlocks() - mem_base);
21588 	    test_ret++;
21589             printf(" %d", n_doc);
21590             printf(" %d", n_name);
21591             printf(" %d", n_ExternalID);
21592             printf(" %d", n_SystemID);
21593             printf("\n");
21594         }
21595     }
21596     }
21597     }
21598     }
21599     function_tests++;
21600 
21601     return(test_ret);
21602 }
21603 
21604 
21605 static int
test_xmlNewNode(void)21606 test_xmlNewNode(void) {
21607     int test_ret = 0;
21608 
21609     int mem_base;
21610     xmlNodePtr ret_val;
21611     xmlNsPtr ns; /* namespace (optional) */
21612     int n_ns;
21613     const xmlChar * name; /* the node name */
21614     int n_name;
21615 
21616     for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
21617     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
21618         mem_base = xmlMemBlocks();
21619         ns = gen_xmlNsPtr(n_ns, 0);
21620         name = gen_const_xmlChar_ptr(n_name, 1);
21621 
21622         ret_val = xmlNewNode(ns, name);
21623         desret_xmlNodePtr(ret_val);
21624         call_tests++;
21625         des_xmlNsPtr(n_ns, ns, 0);
21626         des_const_xmlChar_ptr(n_name, name, 1);
21627         xmlResetLastError();
21628         if (mem_base != xmlMemBlocks()) {
21629             printf("Leak of %d blocks found in xmlNewNode",
21630 	           xmlMemBlocks() - mem_base);
21631 	    test_ret++;
21632             printf(" %d", n_ns);
21633             printf(" %d", n_name);
21634             printf("\n");
21635         }
21636     }
21637     }
21638     function_tests++;
21639 
21640     return(test_ret);
21641 }
21642 
21643 
21644 static int
test_xmlNewNodeEatName(void)21645 test_xmlNewNodeEatName(void) {
21646     int test_ret = 0;
21647 
21648     int mem_base;
21649     xmlNodePtr ret_val;
21650     xmlNsPtr ns; /* namespace (optional) */
21651     int n_ns;
21652     xmlChar * name; /* the node name */
21653     int n_name;
21654 
21655     for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
21656     for (n_name = 0;n_name < gen_nb_eaten_name;n_name++) {
21657         mem_base = xmlMemBlocks();
21658         ns = gen_xmlNsPtr(n_ns, 0);
21659         name = gen_eaten_name(n_name, 1);
21660 
21661         ret_val = xmlNewNodeEatName(ns, name);
21662         desret_xmlNodePtr(ret_val);
21663         call_tests++;
21664         des_xmlNsPtr(n_ns, ns, 0);
21665         des_eaten_name(n_name, name, 1);
21666         xmlResetLastError();
21667         if (mem_base != xmlMemBlocks()) {
21668             printf("Leak of %d blocks found in xmlNewNodeEatName",
21669 	           xmlMemBlocks() - mem_base);
21670 	    test_ret++;
21671             printf(" %d", n_ns);
21672             printf(" %d", n_name);
21673             printf("\n");
21674         }
21675     }
21676     }
21677     function_tests++;
21678 
21679     return(test_ret);
21680 }
21681 
21682 
21683 static int
test_xmlNewNs(void)21684 test_xmlNewNs(void) {
21685     int test_ret = 0;
21686 
21687     int mem_base;
21688     xmlNsPtr ret_val;
21689     xmlNodePtr node; /* the element carrying the namespace (optional) */
21690     int n_node;
21691     const xmlChar * href; /* the URI associated */
21692     int n_href;
21693     const xmlChar * prefix; /* the prefix for the namespace (optional) */
21694     int n_prefix;
21695 
21696     for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
21697     for (n_href = 0;n_href < gen_nb_const_xmlChar_ptr;n_href++) {
21698     for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
21699         mem_base = xmlMemBlocks();
21700         node = gen_xmlNodePtr(n_node, 0);
21701         href = gen_const_xmlChar_ptr(n_href, 1);
21702         prefix = gen_const_xmlChar_ptr(n_prefix, 2);
21703 
21704         ret_val = xmlNewNs(node, href, prefix);
21705         if ((node == NULL) && (ret_val != NULL)) xmlFreeNs(ret_val);
21706         desret_xmlNsPtr(ret_val);
21707         call_tests++;
21708         des_xmlNodePtr(n_node, node, 0);
21709         des_const_xmlChar_ptr(n_href, href, 1);
21710         des_const_xmlChar_ptr(n_prefix, prefix, 2);
21711         xmlResetLastError();
21712         if (mem_base != xmlMemBlocks()) {
21713             printf("Leak of %d blocks found in xmlNewNs",
21714 	           xmlMemBlocks() - mem_base);
21715 	    test_ret++;
21716             printf(" %d", n_node);
21717             printf(" %d", n_href);
21718             printf(" %d", n_prefix);
21719             printf("\n");
21720         }
21721     }
21722     }
21723     }
21724     function_tests++;
21725 
21726     return(test_ret);
21727 }
21728 
21729 
21730 static int
test_xmlNewNsProp(void)21731 test_xmlNewNsProp(void) {
21732     int test_ret = 0;
21733 
21734     int mem_base;
21735     xmlAttrPtr ret_val;
21736     xmlNodePtr node; /* the parent node (optional) */
21737     int n_node;
21738     xmlNsPtr ns; /* the namespace (optional) */
21739     int n_ns;
21740     const xmlChar * name; /* the local name of the attribute */
21741     int n_name;
21742     const xmlChar * value; /* the value of the attribute (optional) */
21743     int n_value;
21744 
21745     for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
21746     for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
21747     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
21748     for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
21749         mem_base = xmlMemBlocks();
21750         node = gen_xmlNodePtr(n_node, 0);
21751         ns = gen_xmlNsPtr(n_ns, 1);
21752         name = gen_const_xmlChar_ptr(n_name, 2);
21753         value = gen_const_xmlChar_ptr(n_value, 3);
21754 
21755         ret_val = xmlNewNsProp(node, ns, name, value);
21756         desret_xmlAttrPtr(ret_val);
21757         call_tests++;
21758         des_xmlNodePtr(n_node, node, 0);
21759         des_xmlNsPtr(n_ns, ns, 1);
21760         des_const_xmlChar_ptr(n_name, name, 2);
21761         des_const_xmlChar_ptr(n_value, value, 3);
21762         xmlResetLastError();
21763         if (mem_base != xmlMemBlocks()) {
21764             printf("Leak of %d blocks found in xmlNewNsProp",
21765 	           xmlMemBlocks() - mem_base);
21766 	    test_ret++;
21767             printf(" %d", n_node);
21768             printf(" %d", n_ns);
21769             printf(" %d", n_name);
21770             printf(" %d", n_value);
21771             printf("\n");
21772         }
21773     }
21774     }
21775     }
21776     }
21777     function_tests++;
21778 
21779     return(test_ret);
21780 }
21781 
21782 
21783 static int
test_xmlNewNsPropEatName(void)21784 test_xmlNewNsPropEatName(void) {
21785     int test_ret = 0;
21786 
21787     int mem_base;
21788     xmlAttrPtr ret_val;
21789     xmlNodePtr node; /* the parent node (optional) */
21790     int n_node;
21791     xmlNsPtr ns; /* the namespace (optional) */
21792     int n_ns;
21793     xmlChar * name; /* the local name of the attribute */
21794     int n_name;
21795     const xmlChar * value; /* the value of the attribute (optional) */
21796     int n_value;
21797 
21798     for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
21799     for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
21800     for (n_name = 0;n_name < gen_nb_eaten_name;n_name++) {
21801     for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
21802         mem_base = xmlMemBlocks();
21803         node = gen_xmlNodePtr(n_node, 0);
21804         ns = gen_xmlNsPtr(n_ns, 1);
21805         name = gen_eaten_name(n_name, 2);
21806         value = gen_const_xmlChar_ptr(n_value, 3);
21807 
21808         ret_val = xmlNewNsPropEatName(node, ns, name, value);
21809         desret_xmlAttrPtr(ret_val);
21810         call_tests++;
21811         des_xmlNodePtr(n_node, node, 0);
21812         des_xmlNsPtr(n_ns, ns, 1);
21813         des_eaten_name(n_name, name, 2);
21814         des_const_xmlChar_ptr(n_value, value, 3);
21815         xmlResetLastError();
21816         if (mem_base != xmlMemBlocks()) {
21817             printf("Leak of %d blocks found in xmlNewNsPropEatName",
21818 	           xmlMemBlocks() - mem_base);
21819 	    test_ret++;
21820             printf(" %d", n_node);
21821             printf(" %d", n_ns);
21822             printf(" %d", n_name);
21823             printf(" %d", n_value);
21824             printf("\n");
21825         }
21826     }
21827     }
21828     }
21829     }
21830     function_tests++;
21831 
21832     return(test_ret);
21833 }
21834 
21835 
21836 static int
test_xmlNewPI(void)21837 test_xmlNewPI(void) {
21838     int test_ret = 0;
21839 
21840     int mem_base;
21841     xmlNodePtr ret_val;
21842     const xmlChar * name; /* the processing instruction target */
21843     int n_name;
21844     const xmlChar * content; /* the PI content (optional) */
21845     int n_content;
21846 
21847     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
21848     for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
21849         mem_base = xmlMemBlocks();
21850         name = gen_const_xmlChar_ptr(n_name, 0);
21851         content = gen_const_xmlChar_ptr(n_content, 1);
21852 
21853         ret_val = xmlNewPI(name, content);
21854         desret_xmlNodePtr(ret_val);
21855         call_tests++;
21856         des_const_xmlChar_ptr(n_name, name, 0);
21857         des_const_xmlChar_ptr(n_content, content, 1);
21858         xmlResetLastError();
21859         if (mem_base != xmlMemBlocks()) {
21860             printf("Leak of %d blocks found in xmlNewPI",
21861 	           xmlMemBlocks() - mem_base);
21862 	    test_ret++;
21863             printf(" %d", n_name);
21864             printf(" %d", n_content);
21865             printf("\n");
21866         }
21867     }
21868     }
21869     function_tests++;
21870 
21871     return(test_ret);
21872 }
21873 
21874 
21875 static int
test_xmlNewProp(void)21876 test_xmlNewProp(void) {
21877     int test_ret = 0;
21878 
21879     int mem_base;
21880     xmlAttrPtr ret_val;
21881     xmlNodePtr node; /* the parent node (optional) */
21882     int n_node;
21883     const xmlChar * name; /* the name of the attribute */
21884     int n_name;
21885     const xmlChar * value; /* the value of the attribute (optional) */
21886     int n_value;
21887 
21888     for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
21889     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
21890     for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
21891         mem_base = xmlMemBlocks();
21892         node = gen_xmlNodePtr(n_node, 0);
21893         name = gen_const_xmlChar_ptr(n_name, 1);
21894         value = gen_const_xmlChar_ptr(n_value, 2);
21895 
21896         ret_val = xmlNewProp(node, name, value);
21897         desret_xmlAttrPtr(ret_val);
21898         call_tests++;
21899         des_xmlNodePtr(n_node, node, 0);
21900         des_const_xmlChar_ptr(n_name, name, 1);
21901         des_const_xmlChar_ptr(n_value, value, 2);
21902         xmlResetLastError();
21903         if (mem_base != xmlMemBlocks()) {
21904             printf("Leak of %d blocks found in xmlNewProp",
21905 	           xmlMemBlocks() - mem_base);
21906 	    test_ret++;
21907             printf(" %d", n_node);
21908             printf(" %d", n_name);
21909             printf(" %d", n_value);
21910             printf("\n");
21911         }
21912     }
21913     }
21914     }
21915     function_tests++;
21916 
21917     return(test_ret);
21918 }
21919 
21920 
21921 static int
test_xmlNewReference(void)21922 test_xmlNewReference(void) {
21923     int test_ret = 0;
21924 
21925     int mem_base;
21926     xmlNodePtr ret_val;
21927     const xmlDoc * doc; /* the target document (optional) */
21928     int n_doc;
21929     const xmlChar * name; /* the entity name */
21930     int n_name;
21931 
21932     for (n_doc = 0;n_doc < gen_nb_const_xmlDoc_ptr;n_doc++) {
21933     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
21934         mem_base = xmlMemBlocks();
21935         doc = gen_const_xmlDoc_ptr(n_doc, 0);
21936         name = gen_const_xmlChar_ptr(n_name, 1);
21937 
21938         ret_val = xmlNewReference(doc, name);
21939         desret_xmlNodePtr(ret_val);
21940         call_tests++;
21941         des_const_xmlDoc_ptr(n_doc, doc, 0);
21942         des_const_xmlChar_ptr(n_name, name, 1);
21943         xmlResetLastError();
21944         if (mem_base != xmlMemBlocks()) {
21945             printf("Leak of %d blocks found in xmlNewReference",
21946 	           xmlMemBlocks() - mem_base);
21947 	    test_ret++;
21948             printf(" %d", n_doc);
21949             printf(" %d", n_name);
21950             printf("\n");
21951         }
21952     }
21953     }
21954     function_tests++;
21955 
21956     return(test_ret);
21957 }
21958 
21959 
21960 static int
test_xmlNewText(void)21961 test_xmlNewText(void) {
21962     int test_ret = 0;
21963 
21964     int mem_base;
21965     xmlNodePtr ret_val;
21966     const xmlChar * content; /* raw text content (optional) */
21967     int n_content;
21968 
21969     for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
21970         mem_base = xmlMemBlocks();
21971         content = gen_const_xmlChar_ptr(n_content, 0);
21972 
21973         ret_val = xmlNewText(content);
21974         desret_xmlNodePtr(ret_val);
21975         call_tests++;
21976         des_const_xmlChar_ptr(n_content, content, 0);
21977         xmlResetLastError();
21978         if (mem_base != xmlMemBlocks()) {
21979             printf("Leak of %d blocks found in xmlNewText",
21980 	           xmlMemBlocks() - mem_base);
21981 	    test_ret++;
21982             printf(" %d", n_content);
21983             printf("\n");
21984         }
21985     }
21986     function_tests++;
21987 
21988     return(test_ret);
21989 }
21990 
21991 
21992 static int
test_xmlNewTextChild(void)21993 test_xmlNewTextChild(void) {
21994     int test_ret = 0;
21995 
21996     int mem_base;
21997     xmlNodePtr ret_val;
21998     xmlNodePtr parent; /* the parent node */
21999     int n_parent;
22000     xmlNsPtr ns; /* a namespace (optional) */
22001     int n_ns;
22002     const xmlChar * name; /* the name of the child */
22003     int n_name;
22004     const xmlChar * content; /* raw text content of the child (optional) */
22005     int n_content;
22006 
22007     for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
22008     for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
22009     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22010     for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
22011         mem_base = xmlMemBlocks();
22012         parent = gen_xmlNodePtr(n_parent, 0);
22013         ns = gen_xmlNsPtr(n_ns, 1);
22014         name = gen_const_xmlChar_ptr(n_name, 2);
22015         content = gen_const_xmlChar_ptr(n_content, 3);
22016 
22017         ret_val = xmlNewTextChild(parent, ns, name, content);
22018         desret_xmlNodePtr(ret_val);
22019         call_tests++;
22020         des_xmlNodePtr(n_parent, parent, 0);
22021         des_xmlNsPtr(n_ns, ns, 1);
22022         des_const_xmlChar_ptr(n_name, name, 2);
22023         des_const_xmlChar_ptr(n_content, content, 3);
22024         xmlResetLastError();
22025         if (mem_base != xmlMemBlocks()) {
22026             printf("Leak of %d blocks found in xmlNewTextChild",
22027 	           xmlMemBlocks() - mem_base);
22028 	    test_ret++;
22029             printf(" %d", n_parent);
22030             printf(" %d", n_ns);
22031             printf(" %d", n_name);
22032             printf(" %d", n_content);
22033             printf("\n");
22034         }
22035     }
22036     }
22037     }
22038     }
22039     function_tests++;
22040 
22041     return(test_ret);
22042 }
22043 
22044 
22045 static int
test_xmlNewTextLen(void)22046 test_xmlNewTextLen(void) {
22047     int test_ret = 0;
22048 
22049     int mem_base;
22050     xmlNodePtr ret_val;
22051     const xmlChar * content; /* raw text content (optional) */
22052     int n_content;
22053     int len; /* size of text content */
22054     int n_len;
22055 
22056     for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
22057     for (n_len = 0;n_len < gen_nb_int;n_len++) {
22058         mem_base = xmlMemBlocks();
22059         content = gen_const_xmlChar_ptr(n_content, 0);
22060         len = gen_int(n_len, 1);
22061         if ((content != NULL) &&
22062             (len > xmlStrlen(BAD_CAST content)))
22063             len = 0;
22064 
22065         ret_val = xmlNewTextLen(content, len);
22066         desret_xmlNodePtr(ret_val);
22067         call_tests++;
22068         des_const_xmlChar_ptr(n_content, content, 0);
22069         des_int(n_len, len, 1);
22070         xmlResetLastError();
22071         if (mem_base != xmlMemBlocks()) {
22072             printf("Leak of %d blocks found in xmlNewTextLen",
22073 	           xmlMemBlocks() - mem_base);
22074 	    test_ret++;
22075             printf(" %d", n_content);
22076             printf(" %d", n_len);
22077             printf("\n");
22078         }
22079     }
22080     }
22081     function_tests++;
22082 
22083     return(test_ret);
22084 }
22085 
22086 
22087 static int
test_xmlNextElementSibling(void)22088 test_xmlNextElementSibling(void) {
22089     int test_ret = 0;
22090 
22091     int mem_base;
22092     xmlNodePtr ret_val;
22093     xmlNodePtr node; /* the current node */
22094     int n_node;
22095 
22096     for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22097         mem_base = xmlMemBlocks();
22098         node = gen_xmlNodePtr(n_node, 0);
22099 
22100         ret_val = xmlNextElementSibling(node);
22101         desret_xmlNodePtr(ret_val);
22102         call_tests++;
22103         des_xmlNodePtr(n_node, node, 0);
22104         xmlResetLastError();
22105         if (mem_base != xmlMemBlocks()) {
22106             printf("Leak of %d blocks found in xmlNextElementSibling",
22107 	           xmlMemBlocks() - mem_base);
22108 	    test_ret++;
22109             printf(" %d", n_node);
22110             printf("\n");
22111         }
22112     }
22113     function_tests++;
22114 
22115     return(test_ret);
22116 }
22117 
22118 
22119 static int
test_xmlNodeAddContent(void)22120 test_xmlNodeAddContent(void) {
22121     int test_ret = 0;
22122 
22123     int mem_base;
22124     int ret_val;
22125     xmlNodePtr cur; /* the node being modified */
22126     int n_cur;
22127     const xmlChar * content; /* extra content */
22128     int n_content;
22129 
22130     for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
22131     for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
22132         mem_base = xmlMemBlocks();
22133         cur = gen_xmlNodePtr(n_cur, 0);
22134         content = gen_const_xmlChar_ptr(n_content, 1);
22135 
22136         ret_val = xmlNodeAddContent(cur, content);
22137         desret_int(ret_val);
22138         call_tests++;
22139         des_xmlNodePtr(n_cur, cur, 0);
22140         des_const_xmlChar_ptr(n_content, content, 1);
22141         xmlResetLastError();
22142         if (mem_base != xmlMemBlocks()) {
22143             printf("Leak of %d blocks found in xmlNodeAddContent",
22144 	           xmlMemBlocks() - mem_base);
22145 	    test_ret++;
22146             printf(" %d", n_cur);
22147             printf(" %d", n_content);
22148             printf("\n");
22149         }
22150     }
22151     }
22152     function_tests++;
22153 
22154     return(test_ret);
22155 }
22156 
22157 
22158 static int
test_xmlNodeAddContentLen(void)22159 test_xmlNodeAddContentLen(void) {
22160     int test_ret = 0;
22161 
22162     int mem_base;
22163     int ret_val;
22164     xmlNodePtr cur; /* the node being modified */
22165     int n_cur;
22166     const xmlChar * content; /* extra content */
22167     int n_content;
22168     int len; /* the size of @content */
22169     int n_len;
22170 
22171     for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
22172     for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
22173     for (n_len = 0;n_len < gen_nb_int;n_len++) {
22174         mem_base = xmlMemBlocks();
22175         cur = gen_xmlNodePtr(n_cur, 0);
22176         content = gen_const_xmlChar_ptr(n_content, 1);
22177         len = gen_int(n_len, 2);
22178         if ((content != NULL) &&
22179             (len > xmlStrlen(BAD_CAST content)))
22180             len = 0;
22181 
22182         ret_val = xmlNodeAddContentLen(cur, content, len);
22183         desret_int(ret_val);
22184         call_tests++;
22185         des_xmlNodePtr(n_cur, cur, 0);
22186         des_const_xmlChar_ptr(n_content, content, 1);
22187         des_int(n_len, len, 2);
22188         xmlResetLastError();
22189         if (mem_base != xmlMemBlocks()) {
22190             printf("Leak of %d blocks found in xmlNodeAddContentLen",
22191 	           xmlMemBlocks() - mem_base);
22192 	    test_ret++;
22193             printf(" %d", n_cur);
22194             printf(" %d", n_content);
22195             printf(" %d", n_len);
22196             printf("\n");
22197         }
22198     }
22199     }
22200     }
22201     function_tests++;
22202 
22203     return(test_ret);
22204 }
22205 
22206 
22207 static int
test_xmlNodeBufGetContent(void)22208 test_xmlNodeBufGetContent(void) {
22209     int test_ret = 0;
22210 
22211     int mem_base;
22212     int ret_val;
22213     xmlBufferPtr buffer; /* a buffer */
22214     int n_buffer;
22215     const xmlNode * cur; /* the node being read */
22216     int n_cur;
22217 
22218     for (n_buffer = 0;n_buffer < gen_nb_xmlBufferPtr;n_buffer++) {
22219     for (n_cur = 0;n_cur < gen_nb_const_xmlNode_ptr;n_cur++) {
22220         mem_base = xmlMemBlocks();
22221         buffer = gen_xmlBufferPtr(n_buffer, 0);
22222         cur = gen_const_xmlNode_ptr(n_cur, 1);
22223 
22224         ret_val = xmlNodeBufGetContent(buffer, cur);
22225         desret_int(ret_val);
22226         call_tests++;
22227         des_xmlBufferPtr(n_buffer, buffer, 0);
22228         des_const_xmlNode_ptr(n_cur, cur, 1);
22229         xmlResetLastError();
22230         if (mem_base != xmlMemBlocks()) {
22231             printf("Leak of %d blocks found in xmlNodeBufGetContent",
22232 	           xmlMemBlocks() - mem_base);
22233 	    test_ret++;
22234             printf(" %d", n_buffer);
22235             printf(" %d", n_cur);
22236             printf("\n");
22237         }
22238     }
22239     }
22240     function_tests++;
22241 
22242     return(test_ret);
22243 }
22244 
22245 
22246 static int
test_xmlNodeDump(void)22247 test_xmlNodeDump(void) {
22248     int test_ret = 0;
22249 
22250 #if defined(LIBXML_OUTPUT_ENABLED)
22251     int mem_base;
22252     int ret_val;
22253     xmlBufferPtr buf; /* the XML buffer output */
22254     int n_buf;
22255     xmlDocPtr doc; /* the document */
22256     int n_doc;
22257     xmlNodePtr cur; /* the current node */
22258     int n_cur;
22259     int level; /* the imbrication level for indenting */
22260     int n_level;
22261     int format; /* is formatting allowed */
22262     int n_format;
22263 
22264     for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
22265     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22266     for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
22267     for (n_level = 0;n_level < gen_nb_int;n_level++) {
22268     for (n_format = 0;n_format < gen_nb_int;n_format++) {
22269         mem_base = xmlMemBlocks();
22270         buf = gen_xmlBufferPtr(n_buf, 0);
22271         doc = gen_xmlDocPtr(n_doc, 1);
22272         cur = gen_xmlNodePtr(n_cur, 2);
22273         level = gen_int(n_level, 3);
22274         format = gen_int(n_format, 4);
22275 
22276         ret_val = xmlNodeDump(buf, doc, cur, level, format);
22277         desret_int(ret_val);
22278         call_tests++;
22279         des_xmlBufferPtr(n_buf, buf, 0);
22280         des_xmlDocPtr(n_doc, doc, 1);
22281         des_xmlNodePtr(n_cur, cur, 2);
22282         des_int(n_level, level, 3);
22283         des_int(n_format, format, 4);
22284         xmlResetLastError();
22285         if (mem_base != xmlMemBlocks()) {
22286             printf("Leak of %d blocks found in xmlNodeDump",
22287 	           xmlMemBlocks() - mem_base);
22288 	    test_ret++;
22289             printf(" %d", n_buf);
22290             printf(" %d", n_doc);
22291             printf(" %d", n_cur);
22292             printf(" %d", n_level);
22293             printf(" %d", n_format);
22294             printf("\n");
22295         }
22296     }
22297     }
22298     }
22299     }
22300     }
22301     function_tests++;
22302 #endif
22303 
22304     return(test_ret);
22305 }
22306 
22307 
22308 static int
test_xmlNodeDumpOutput(void)22309 test_xmlNodeDumpOutput(void) {
22310     int test_ret = 0;
22311 
22312 #if defined(LIBXML_OUTPUT_ENABLED)
22313     int mem_base;
22314     xmlOutputBufferPtr buf; /* the XML buffer output */
22315     int n_buf;
22316     xmlDocPtr doc; /* the document */
22317     int n_doc;
22318     xmlNodePtr cur; /* the current node */
22319     int n_cur;
22320     int level; /* the imbrication level for indenting */
22321     int n_level;
22322     int format; /* is formatting allowed */
22323     int n_format;
22324     const char * encoding; /* an optional encoding string */
22325     int n_encoding;
22326 
22327     for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
22328     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22329     for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
22330     for (n_level = 0;n_level < gen_nb_int;n_level++) {
22331     for (n_format = 0;n_format < gen_nb_int;n_format++) {
22332     for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
22333         mem_base = xmlMemBlocks();
22334         buf = gen_xmlOutputBufferPtr(n_buf, 0);
22335         doc = gen_xmlDocPtr(n_doc, 1);
22336         cur = gen_xmlNodePtr(n_cur, 2);
22337         level = gen_int(n_level, 3);
22338         format = gen_int(n_format, 4);
22339         encoding = gen_const_char_ptr(n_encoding, 5);
22340 
22341         xmlNodeDumpOutput(buf, doc, cur, level, format, encoding);
22342         call_tests++;
22343         des_xmlOutputBufferPtr(n_buf, buf, 0);
22344         des_xmlDocPtr(n_doc, doc, 1);
22345         des_xmlNodePtr(n_cur, cur, 2);
22346         des_int(n_level, level, 3);
22347         des_int(n_format, format, 4);
22348         des_const_char_ptr(n_encoding, encoding, 5);
22349         xmlResetLastError();
22350         if (mem_base != xmlMemBlocks()) {
22351             printf("Leak of %d blocks found in xmlNodeDumpOutput",
22352 	           xmlMemBlocks() - mem_base);
22353 	    test_ret++;
22354             printf(" %d", n_buf);
22355             printf(" %d", n_doc);
22356             printf(" %d", n_cur);
22357             printf(" %d", n_level);
22358             printf(" %d", n_format);
22359             printf(" %d", n_encoding);
22360             printf("\n");
22361         }
22362     }
22363     }
22364     }
22365     }
22366     }
22367     }
22368     function_tests++;
22369 #endif
22370 
22371     return(test_ret);
22372 }
22373 
22374 
22375 static int
test_xmlNodeGetAttrValue(void)22376 test_xmlNodeGetAttrValue(void) {
22377     int test_ret = 0;
22378 
22379     int mem_base;
22380     int ret_val;
22381     const xmlNode * node; /* the node */
22382     int n_node;
22383     const xmlChar * name; /* the attribute name */
22384     int n_name;
22385     const xmlChar * nsUri; /* the URI of the namespace */
22386     int n_nsUri;
22387     xmlChar ** out; /* the returned string */
22388     int n_out;
22389 
22390     for (n_node = 0;n_node < gen_nb_const_xmlNode_ptr;n_node++) {
22391     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22392     for (n_nsUri = 0;n_nsUri < gen_nb_const_xmlChar_ptr;n_nsUri++) {
22393     for (n_out = 0;n_out < gen_nb_xmlChar_ptr_ptr;n_out++) {
22394         mem_base = xmlMemBlocks();
22395         node = gen_const_xmlNode_ptr(n_node, 0);
22396         name = gen_const_xmlChar_ptr(n_name, 1);
22397         nsUri = gen_const_xmlChar_ptr(n_nsUri, 2);
22398         out = gen_xmlChar_ptr_ptr(n_out, 3);
22399 
22400         ret_val = xmlNodeGetAttrValue(node, name, nsUri, out);
22401         desret_int(ret_val);
22402         call_tests++;
22403         des_const_xmlNode_ptr(n_node, node, 0);
22404         des_const_xmlChar_ptr(n_name, name, 1);
22405         des_const_xmlChar_ptr(n_nsUri, nsUri, 2);
22406         des_xmlChar_ptr_ptr(n_out, out, 3);
22407         xmlResetLastError();
22408         if (mem_base != xmlMemBlocks()) {
22409             printf("Leak of %d blocks found in xmlNodeGetAttrValue",
22410 	           xmlMemBlocks() - mem_base);
22411 	    test_ret++;
22412             printf(" %d", n_node);
22413             printf(" %d", n_name);
22414             printf(" %d", n_nsUri);
22415             printf(" %d", n_out);
22416             printf("\n");
22417         }
22418     }
22419     }
22420     }
22421     }
22422     function_tests++;
22423 
22424     return(test_ret);
22425 }
22426 
22427 
22428 static int
test_xmlNodeGetBase(void)22429 test_xmlNodeGetBase(void) {
22430     int test_ret = 0;
22431 
22432     int mem_base;
22433     xmlChar * ret_val;
22434     const xmlDoc * doc; /* the document the node pertains to */
22435     int n_doc;
22436     const xmlNode * cur; /* the node being checked */
22437     int n_cur;
22438 
22439     for (n_doc = 0;n_doc < gen_nb_const_xmlDoc_ptr;n_doc++) {
22440     for (n_cur = 0;n_cur < gen_nb_const_xmlNode_ptr;n_cur++) {
22441         mem_base = xmlMemBlocks();
22442         doc = gen_const_xmlDoc_ptr(n_doc, 0);
22443         cur = gen_const_xmlNode_ptr(n_cur, 1);
22444 
22445         ret_val = xmlNodeGetBase(doc, cur);
22446         desret_xmlChar_ptr(ret_val);
22447         call_tests++;
22448         des_const_xmlDoc_ptr(n_doc, doc, 0);
22449         des_const_xmlNode_ptr(n_cur, cur, 1);
22450         xmlResetLastError();
22451         if (mem_base != xmlMemBlocks()) {
22452             printf("Leak of %d blocks found in xmlNodeGetBase",
22453 	           xmlMemBlocks() - mem_base);
22454 	    test_ret++;
22455             printf(" %d", n_doc);
22456             printf(" %d", n_cur);
22457             printf("\n");
22458         }
22459     }
22460     }
22461     function_tests++;
22462 
22463     return(test_ret);
22464 }
22465 
22466 
22467 static int
test_xmlNodeGetBaseSafe(void)22468 test_xmlNodeGetBaseSafe(void) {
22469     int test_ret = 0;
22470 
22471     int mem_base;
22472     int ret_val;
22473     const xmlDoc * doc; /* the document the node pertains to */
22474     int n_doc;
22475     const xmlNode * cur; /* the node being checked */
22476     int n_cur;
22477     xmlChar ** baseOut; /* pointer to base */
22478     int n_baseOut;
22479 
22480     for (n_doc = 0;n_doc < gen_nb_const_xmlDoc_ptr;n_doc++) {
22481     for (n_cur = 0;n_cur < gen_nb_const_xmlNode_ptr;n_cur++) {
22482     for (n_baseOut = 0;n_baseOut < gen_nb_xmlChar_ptr_ptr;n_baseOut++) {
22483         mem_base = xmlMemBlocks();
22484         doc = gen_const_xmlDoc_ptr(n_doc, 0);
22485         cur = gen_const_xmlNode_ptr(n_cur, 1);
22486         baseOut = gen_xmlChar_ptr_ptr(n_baseOut, 2);
22487 
22488         ret_val = xmlNodeGetBaseSafe(doc, cur, baseOut);
22489         desret_int(ret_val);
22490         call_tests++;
22491         des_const_xmlDoc_ptr(n_doc, doc, 0);
22492         des_const_xmlNode_ptr(n_cur, cur, 1);
22493         des_xmlChar_ptr_ptr(n_baseOut, baseOut, 2);
22494         xmlResetLastError();
22495         if (mem_base != xmlMemBlocks()) {
22496             printf("Leak of %d blocks found in xmlNodeGetBaseSafe",
22497 	           xmlMemBlocks() - mem_base);
22498 	    test_ret++;
22499             printf(" %d", n_doc);
22500             printf(" %d", n_cur);
22501             printf(" %d", n_baseOut);
22502             printf("\n");
22503         }
22504     }
22505     }
22506     }
22507     function_tests++;
22508 
22509     return(test_ret);
22510 }
22511 
22512 
22513 static int
test_xmlNodeGetContent(void)22514 test_xmlNodeGetContent(void) {
22515     int test_ret = 0;
22516 
22517     int mem_base;
22518     xmlChar * ret_val;
22519     const xmlNode * cur; /* the node being read */
22520     int n_cur;
22521 
22522     for (n_cur = 0;n_cur < gen_nb_const_xmlNode_ptr;n_cur++) {
22523         mem_base = xmlMemBlocks();
22524         cur = gen_const_xmlNode_ptr(n_cur, 0);
22525 
22526         ret_val = xmlNodeGetContent(cur);
22527         desret_xmlChar_ptr(ret_val);
22528         call_tests++;
22529         des_const_xmlNode_ptr(n_cur, cur, 0);
22530         xmlResetLastError();
22531         if (mem_base != xmlMemBlocks()) {
22532             printf("Leak of %d blocks found in xmlNodeGetContent",
22533 	           xmlMemBlocks() - mem_base);
22534 	    test_ret++;
22535             printf(" %d", n_cur);
22536             printf("\n");
22537         }
22538     }
22539     function_tests++;
22540 
22541     return(test_ret);
22542 }
22543 
22544 
22545 static int
test_xmlNodeGetLang(void)22546 test_xmlNodeGetLang(void) {
22547     int test_ret = 0;
22548 
22549     int mem_base;
22550     xmlChar * ret_val;
22551     const xmlNode * cur; /* the node being checked */
22552     int n_cur;
22553 
22554     for (n_cur = 0;n_cur < gen_nb_const_xmlNode_ptr;n_cur++) {
22555         mem_base = xmlMemBlocks();
22556         cur = gen_const_xmlNode_ptr(n_cur, 0);
22557 
22558         ret_val = xmlNodeGetLang(cur);
22559         desret_xmlChar_ptr(ret_val);
22560         call_tests++;
22561         des_const_xmlNode_ptr(n_cur, cur, 0);
22562         xmlResetLastError();
22563         if (mem_base != xmlMemBlocks()) {
22564             printf("Leak of %d blocks found in xmlNodeGetLang",
22565 	           xmlMemBlocks() - mem_base);
22566 	    test_ret++;
22567             printf(" %d", n_cur);
22568             printf("\n");
22569         }
22570     }
22571     function_tests++;
22572 
22573     return(test_ret);
22574 }
22575 
22576 
22577 static int
test_xmlNodeGetSpacePreserve(void)22578 test_xmlNodeGetSpacePreserve(void) {
22579     int test_ret = 0;
22580 
22581     int mem_base;
22582     int ret_val;
22583     const xmlNode * cur; /* the node being checked */
22584     int n_cur;
22585 
22586     for (n_cur = 0;n_cur < gen_nb_const_xmlNode_ptr;n_cur++) {
22587         mem_base = xmlMemBlocks();
22588         cur = gen_const_xmlNode_ptr(n_cur, 0);
22589 
22590         ret_val = xmlNodeGetSpacePreserve(cur);
22591         desret_int(ret_val);
22592         call_tests++;
22593         des_const_xmlNode_ptr(n_cur, cur, 0);
22594         xmlResetLastError();
22595         if (mem_base != xmlMemBlocks()) {
22596             printf("Leak of %d blocks found in xmlNodeGetSpacePreserve",
22597 	           xmlMemBlocks() - mem_base);
22598 	    test_ret++;
22599             printf(" %d", n_cur);
22600             printf("\n");
22601         }
22602     }
22603     function_tests++;
22604 
22605     return(test_ret);
22606 }
22607 
22608 
22609 static int
test_xmlNodeIsText(void)22610 test_xmlNodeIsText(void) {
22611     int test_ret = 0;
22612 
22613     int mem_base;
22614     int ret_val;
22615     const xmlNode * node; /* the node */
22616     int n_node;
22617 
22618     for (n_node = 0;n_node < gen_nb_const_xmlNode_ptr;n_node++) {
22619         mem_base = xmlMemBlocks();
22620         node = gen_const_xmlNode_ptr(n_node, 0);
22621 
22622         ret_val = xmlNodeIsText(node);
22623         desret_int(ret_val);
22624         call_tests++;
22625         des_const_xmlNode_ptr(n_node, node, 0);
22626         xmlResetLastError();
22627         if (mem_base != xmlMemBlocks()) {
22628             printf("Leak of %d blocks found in xmlNodeIsText",
22629 	           xmlMemBlocks() - mem_base);
22630 	    test_ret++;
22631             printf(" %d", n_node);
22632             printf("\n");
22633         }
22634     }
22635     function_tests++;
22636 
22637     return(test_ret);
22638 }
22639 
22640 
22641 static int
test_xmlNodeListGetRawString(void)22642 test_xmlNodeListGetRawString(void) {
22643     int test_ret = 0;
22644 
22645     int mem_base;
22646     xmlChar * ret_val;
22647     const xmlDoc * doc; /* a document (optional) */
22648     int n_doc;
22649     const xmlNode * list; /* a node list of attribute children (optional) */
22650     int n_list;
22651     int inLine; /* whether entity references are substituted */
22652     int n_inLine;
22653 
22654     for (n_doc = 0;n_doc < gen_nb_const_xmlDoc_ptr;n_doc++) {
22655     for (n_list = 0;n_list < gen_nb_const_xmlNode_ptr;n_list++) {
22656     for (n_inLine = 0;n_inLine < gen_nb_int;n_inLine++) {
22657         mem_base = xmlMemBlocks();
22658         doc = gen_const_xmlDoc_ptr(n_doc, 0);
22659         list = gen_const_xmlNode_ptr(n_list, 1);
22660         inLine = gen_int(n_inLine, 2);
22661 
22662         ret_val = xmlNodeListGetRawString(doc, list, inLine);
22663         desret_xmlChar_ptr(ret_val);
22664         call_tests++;
22665         des_const_xmlDoc_ptr(n_doc, doc, 0);
22666         des_const_xmlNode_ptr(n_list, list, 1);
22667         des_int(n_inLine, inLine, 2);
22668         xmlResetLastError();
22669         if (mem_base != xmlMemBlocks()) {
22670             printf("Leak of %d blocks found in xmlNodeListGetRawString",
22671 	           xmlMemBlocks() - mem_base);
22672 	    test_ret++;
22673             printf(" %d", n_doc);
22674             printf(" %d", n_list);
22675             printf(" %d", n_inLine);
22676             printf("\n");
22677         }
22678     }
22679     }
22680     }
22681     function_tests++;
22682 
22683     return(test_ret);
22684 }
22685 
22686 
22687 static int
test_xmlNodeListGetString(void)22688 test_xmlNodeListGetString(void) {
22689     int test_ret = 0;
22690 
22691     int mem_base;
22692     xmlChar * ret_val;
22693     xmlDocPtr doc; /* a document (optional) */
22694     int n_doc;
22695     const xmlNode * list; /* a node list of attribute children (optional) */
22696     int n_list;
22697     int inLine; /* whether entity references are substituted */
22698     int n_inLine;
22699 
22700     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22701     for (n_list = 0;n_list < gen_nb_const_xmlNode_ptr;n_list++) {
22702     for (n_inLine = 0;n_inLine < gen_nb_int;n_inLine++) {
22703         mem_base = xmlMemBlocks();
22704         doc = gen_xmlDocPtr(n_doc, 0);
22705         list = gen_const_xmlNode_ptr(n_list, 1);
22706         inLine = gen_int(n_inLine, 2);
22707 
22708         ret_val = xmlNodeListGetString(doc, list, inLine);
22709         desret_xmlChar_ptr(ret_val);
22710         call_tests++;
22711         des_xmlDocPtr(n_doc, doc, 0);
22712         des_const_xmlNode_ptr(n_list, list, 1);
22713         des_int(n_inLine, inLine, 2);
22714         xmlResetLastError();
22715         if (mem_base != xmlMemBlocks()) {
22716             printf("Leak of %d blocks found in xmlNodeListGetString",
22717 	           xmlMemBlocks() - mem_base);
22718 	    test_ret++;
22719             printf(" %d", n_doc);
22720             printf(" %d", n_list);
22721             printf(" %d", n_inLine);
22722             printf("\n");
22723         }
22724     }
22725     }
22726     }
22727     function_tests++;
22728 
22729     return(test_ret);
22730 }
22731 
22732 
22733 static int
test_xmlNodeSetBase(void)22734 test_xmlNodeSetBase(void) {
22735     int test_ret = 0;
22736 
22737     int mem_base;
22738     int ret_val;
22739     xmlNodePtr cur; /* the node being changed */
22740     int n_cur;
22741     const xmlChar * uri; /* the new base URI */
22742     int n_uri;
22743 
22744     for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
22745     for (n_uri = 0;n_uri < gen_nb_const_xmlChar_ptr;n_uri++) {
22746         mem_base = xmlMemBlocks();
22747         cur = gen_xmlNodePtr(n_cur, 0);
22748         uri = gen_const_xmlChar_ptr(n_uri, 1);
22749 
22750         ret_val = xmlNodeSetBase(cur, uri);
22751         desret_int(ret_val);
22752         call_tests++;
22753         des_xmlNodePtr(n_cur, cur, 0);
22754         des_const_xmlChar_ptr(n_uri, uri, 1);
22755         xmlResetLastError();
22756         if (mem_base != xmlMemBlocks()) {
22757             printf("Leak of %d blocks found in xmlNodeSetBase",
22758 	           xmlMemBlocks() - mem_base);
22759 	    test_ret++;
22760             printf(" %d", n_cur);
22761             printf(" %d", n_uri);
22762             printf("\n");
22763         }
22764     }
22765     }
22766     function_tests++;
22767 
22768     return(test_ret);
22769 }
22770 
22771 
22772 static int
test_xmlNodeSetContent(void)22773 test_xmlNodeSetContent(void) {
22774     int test_ret = 0;
22775 
22776     int mem_base;
22777     int ret_val;
22778     xmlNodePtr cur; /* the node being modified */
22779     int n_cur;
22780     const xmlChar * content; /* the new value of the content */
22781     int n_content;
22782 
22783     for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
22784     for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
22785         mem_base = xmlMemBlocks();
22786         cur = gen_xmlNodePtr(n_cur, 0);
22787         content = gen_const_xmlChar_ptr(n_content, 1);
22788 
22789         ret_val = xmlNodeSetContent(cur, content);
22790         desret_int(ret_val);
22791         call_tests++;
22792         des_xmlNodePtr(n_cur, cur, 0);
22793         des_const_xmlChar_ptr(n_content, content, 1);
22794         xmlResetLastError();
22795         if (mem_base != xmlMemBlocks()) {
22796             printf("Leak of %d blocks found in xmlNodeSetContent",
22797 	           xmlMemBlocks() - mem_base);
22798 	    test_ret++;
22799             printf(" %d", n_cur);
22800             printf(" %d", n_content);
22801             printf("\n");
22802         }
22803     }
22804     }
22805     function_tests++;
22806 
22807     return(test_ret);
22808 }
22809 
22810 
22811 static int
test_xmlNodeSetContentLen(void)22812 test_xmlNodeSetContentLen(void) {
22813     int test_ret = 0;
22814 
22815     int mem_base;
22816     int ret_val;
22817     xmlNodePtr cur; /* the node being modified */
22818     int n_cur;
22819     const xmlChar * content; /* the new value of the content */
22820     int n_content;
22821     int len; /* the size of @content */
22822     int n_len;
22823 
22824     for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
22825     for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
22826     for (n_len = 0;n_len < gen_nb_int;n_len++) {
22827         mem_base = xmlMemBlocks();
22828         cur = gen_xmlNodePtr(n_cur, 0);
22829         content = gen_const_xmlChar_ptr(n_content, 1);
22830         len = gen_int(n_len, 2);
22831         if ((content != NULL) &&
22832             (len > xmlStrlen(BAD_CAST content)))
22833             len = 0;
22834 
22835         ret_val = xmlNodeSetContentLen(cur, content, len);
22836         desret_int(ret_val);
22837         call_tests++;
22838         des_xmlNodePtr(n_cur, cur, 0);
22839         des_const_xmlChar_ptr(n_content, content, 1);
22840         des_int(n_len, len, 2);
22841         xmlResetLastError();
22842         if (mem_base != xmlMemBlocks()) {
22843             printf("Leak of %d blocks found in xmlNodeSetContentLen",
22844 	           xmlMemBlocks() - mem_base);
22845 	    test_ret++;
22846             printf(" %d", n_cur);
22847             printf(" %d", n_content);
22848             printf(" %d", n_len);
22849             printf("\n");
22850         }
22851     }
22852     }
22853     }
22854     function_tests++;
22855 
22856     return(test_ret);
22857 }
22858 
22859 
22860 static int
test_xmlNodeSetLang(void)22861 test_xmlNodeSetLang(void) {
22862     int test_ret = 0;
22863 
22864     int mem_base;
22865     int ret_val;
22866     xmlNodePtr cur; /* the node being changed */
22867     int n_cur;
22868     const xmlChar * lang; /* the language description */
22869     int n_lang;
22870 
22871     for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
22872     for (n_lang = 0;n_lang < gen_nb_const_xmlChar_ptr;n_lang++) {
22873         mem_base = xmlMemBlocks();
22874         cur = gen_xmlNodePtr(n_cur, 0);
22875         lang = gen_const_xmlChar_ptr(n_lang, 1);
22876 
22877         ret_val = xmlNodeSetLang(cur, lang);
22878         desret_int(ret_val);
22879         call_tests++;
22880         des_xmlNodePtr(n_cur, cur, 0);
22881         des_const_xmlChar_ptr(n_lang, lang, 1);
22882         xmlResetLastError();
22883         if (mem_base != xmlMemBlocks()) {
22884             printf("Leak of %d blocks found in xmlNodeSetLang",
22885 	           xmlMemBlocks() - mem_base);
22886 	    test_ret++;
22887             printf(" %d", n_cur);
22888             printf(" %d", n_lang);
22889             printf("\n");
22890         }
22891     }
22892     }
22893     function_tests++;
22894 
22895     return(test_ret);
22896 }
22897 
22898 
22899 static int
test_xmlNodeSetName(void)22900 test_xmlNodeSetName(void) {
22901     int test_ret = 0;
22902 
22903     int mem_base;
22904     xmlNodePtr cur; /* the node being changed */
22905     int n_cur;
22906     const xmlChar * name; /* the new tag name */
22907     int n_name;
22908 
22909     for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
22910     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22911         mem_base = xmlMemBlocks();
22912         cur = gen_xmlNodePtr(n_cur, 0);
22913         name = gen_const_xmlChar_ptr(n_name, 1);
22914 
22915         xmlNodeSetName(cur, name);
22916         call_tests++;
22917         des_xmlNodePtr(n_cur, cur, 0);
22918         des_const_xmlChar_ptr(n_name, name, 1);
22919         xmlResetLastError();
22920         if (mem_base != xmlMemBlocks()) {
22921             printf("Leak of %d blocks found in xmlNodeSetName",
22922 	           xmlMemBlocks() - mem_base);
22923 	    test_ret++;
22924             printf(" %d", n_cur);
22925             printf(" %d", n_name);
22926             printf("\n");
22927         }
22928     }
22929     }
22930     function_tests++;
22931 
22932     return(test_ret);
22933 }
22934 
22935 
22936 static int
test_xmlNodeSetSpacePreserve(void)22937 test_xmlNodeSetSpacePreserve(void) {
22938     int test_ret = 0;
22939 
22940     int mem_base;
22941     int ret_val;
22942     xmlNodePtr cur; /* the node being changed */
22943     int n_cur;
22944     int val; /* the xml:space value ("0": default, 1: "preserve") */
22945     int n_val;
22946 
22947     for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
22948     for (n_val = 0;n_val < gen_nb_int;n_val++) {
22949         mem_base = xmlMemBlocks();
22950         cur = gen_xmlNodePtr(n_cur, 0);
22951         val = gen_int(n_val, 1);
22952 
22953         ret_val = xmlNodeSetSpacePreserve(cur, val);
22954         desret_int(ret_val);
22955         call_tests++;
22956         des_xmlNodePtr(n_cur, cur, 0);
22957         des_int(n_val, val, 1);
22958         xmlResetLastError();
22959         if (mem_base != xmlMemBlocks()) {
22960             printf("Leak of %d blocks found in xmlNodeSetSpacePreserve",
22961 	           xmlMemBlocks() - mem_base);
22962 	    test_ret++;
22963             printf(" %d", n_cur);
22964             printf(" %d", n_val);
22965             printf("\n");
22966         }
22967     }
22968     }
22969     function_tests++;
22970 
22971     return(test_ret);
22972 }
22973 
22974 
22975 static int
test_xmlPreviousElementSibling(void)22976 test_xmlPreviousElementSibling(void) {
22977     int test_ret = 0;
22978 
22979     int mem_base;
22980     xmlNodePtr ret_val;
22981     xmlNodePtr node; /* the current node */
22982     int n_node;
22983 
22984     for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22985         mem_base = xmlMemBlocks();
22986         node = gen_xmlNodePtr(n_node, 0);
22987 
22988         ret_val = xmlPreviousElementSibling(node);
22989         desret_xmlNodePtr(ret_val);
22990         call_tests++;
22991         des_xmlNodePtr(n_node, node, 0);
22992         xmlResetLastError();
22993         if (mem_base != xmlMemBlocks()) {
22994             printf("Leak of %d blocks found in xmlPreviousElementSibling",
22995 	           xmlMemBlocks() - mem_base);
22996 	    test_ret++;
22997             printf(" %d", n_node);
22998             printf("\n");
22999         }
23000     }
23001     function_tests++;
23002 
23003     return(test_ret);
23004 }
23005 
23006 
23007 static int
test_xmlReconciliateNs(void)23008 test_xmlReconciliateNs(void) {
23009     int test_ret = 0;
23010 
23011     int mem_base;
23012     int ret_val;
23013     xmlDocPtr doc; /* the document */
23014     int n_doc;
23015     xmlNodePtr tree; /* a node defining the subtree to reconciliate */
23016     int n_tree;
23017 
23018     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
23019     for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) {
23020         mem_base = xmlMemBlocks();
23021         doc = gen_xmlDocPtr(n_doc, 0);
23022         tree = gen_xmlNodePtr(n_tree, 1);
23023 
23024         ret_val = xmlReconciliateNs(doc, tree);
23025         desret_int(ret_val);
23026         call_tests++;
23027         des_xmlDocPtr(n_doc, doc, 0);
23028         des_xmlNodePtr(n_tree, tree, 1);
23029         xmlResetLastError();
23030         if (mem_base != xmlMemBlocks()) {
23031             printf("Leak of %d blocks found in xmlReconciliateNs",
23032 	           xmlMemBlocks() - mem_base);
23033 	    test_ret++;
23034             printf(" %d", n_doc);
23035             printf(" %d", n_tree);
23036             printf("\n");
23037         }
23038     }
23039     }
23040     function_tests++;
23041 
23042     return(test_ret);
23043 }
23044 
23045 
23046 static int
test_xmlRegisterNodeDefault(void)23047 test_xmlRegisterNodeDefault(void) {
23048     int test_ret = 0;
23049 
23050 
23051     /* missing type support */
23052     return(test_ret);
23053 }
23054 
23055 
23056 static int
test_xmlRemoveProp(void)23057 test_xmlRemoveProp(void) {
23058     int test_ret = 0;
23059 
23060     int mem_base;
23061     int ret_val;
23062     xmlAttrPtr cur; /* an attribute */
23063     int n_cur;
23064 
23065     for (n_cur = 0;n_cur < gen_nb_xmlAttrPtr;n_cur++) {
23066         mem_base = xmlMemBlocks();
23067         cur = gen_xmlAttrPtr(n_cur, 0);
23068 
23069         ret_val = xmlRemoveProp(cur);
23070         cur = NULL;
23071         desret_int(ret_val);
23072         call_tests++;
23073         des_xmlAttrPtr(n_cur, cur, 0);
23074         xmlResetLastError();
23075         if (mem_base != xmlMemBlocks()) {
23076             printf("Leak of %d blocks found in xmlRemoveProp",
23077 	           xmlMemBlocks() - mem_base);
23078 	    test_ret++;
23079             printf(" %d", n_cur);
23080             printf("\n");
23081         }
23082     }
23083     function_tests++;
23084 
23085     return(test_ret);
23086 }
23087 
23088 
23089 static int
test_xmlReplaceNode(void)23090 test_xmlReplaceNode(void) {
23091     int test_ret = 0;
23092 
23093     int mem_base;
23094     xmlNodePtr ret_val;
23095     xmlNodePtr old; /* the old node */
23096     int n_old;
23097     xmlNodePtr cur; /* the node (optional) */
23098     int n_cur;
23099 
23100     for (n_old = 0;n_old < gen_nb_xmlNodePtr;n_old++) {
23101     for (n_cur = 0;n_cur < gen_nb_xmlNodePtr_in;n_cur++) {
23102         mem_base = xmlMemBlocks();
23103         old = gen_xmlNodePtr(n_old, 0);
23104         cur = gen_xmlNodePtr_in(n_cur, 1);
23105 
23106         ret_val = xmlReplaceNode(old, cur);
23107         if (cur != NULL) {
23108               xmlUnlinkNode(cur);
23109               xmlFreeNode(cur) ; cur = NULL ; }
23110           if (old != NULL) {
23111               xmlUnlinkNode(old);
23112               xmlFreeNode(old) ; old = NULL ; }
23113 	  ret_val = NULL;
23114         desret_xmlNodePtr(ret_val);
23115         call_tests++;
23116         des_xmlNodePtr(n_old, old, 0);
23117         des_xmlNodePtr_in(n_cur, cur, 1);
23118         xmlResetLastError();
23119         if (mem_base != xmlMemBlocks()) {
23120             printf("Leak of %d blocks found in xmlReplaceNode",
23121 	           xmlMemBlocks() - mem_base);
23122 	    test_ret++;
23123             printf(" %d", n_old);
23124             printf(" %d", n_cur);
23125             printf("\n");
23126         }
23127     }
23128     }
23129     function_tests++;
23130 
23131     return(test_ret);
23132 }
23133 
23134 
23135 static int
test_xmlSaveFile(void)23136 test_xmlSaveFile(void) {
23137     int test_ret = 0;
23138 
23139 #if defined(LIBXML_OUTPUT_ENABLED)
23140     int mem_base;
23141     int ret_val;
23142     const char * filename; /* the filename (or URL) */
23143     int n_filename;
23144     xmlDocPtr cur; /* the document */
23145     int n_cur;
23146 
23147     for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
23148     for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
23149         mem_base = xmlMemBlocks();
23150         filename = gen_fileoutput(n_filename, 0);
23151         cur = gen_xmlDocPtr(n_cur, 1);
23152 
23153         ret_val = xmlSaveFile(filename, cur);
23154         desret_int(ret_val);
23155         call_tests++;
23156         des_fileoutput(n_filename, filename, 0);
23157         des_xmlDocPtr(n_cur, cur, 1);
23158         xmlResetLastError();
23159         if (mem_base != xmlMemBlocks()) {
23160             printf("Leak of %d blocks found in xmlSaveFile",
23161 	           xmlMemBlocks() - mem_base);
23162 	    test_ret++;
23163             printf(" %d", n_filename);
23164             printf(" %d", n_cur);
23165             printf("\n");
23166         }
23167     }
23168     }
23169     function_tests++;
23170 #endif
23171 
23172     return(test_ret);
23173 }
23174 
23175 
23176 static int
test_xmlSaveFileEnc(void)23177 test_xmlSaveFileEnc(void) {
23178     int test_ret = 0;
23179 
23180 #if defined(LIBXML_OUTPUT_ENABLED)
23181     int mem_base;
23182     int ret_val;
23183     const char * filename; /* the filename (or URL) */
23184     int n_filename;
23185     xmlDocPtr cur; /* the document */
23186     int n_cur;
23187     const char * encoding; /* the name of an encoding (or NULL) */
23188     int n_encoding;
23189 
23190     for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
23191     for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
23192     for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
23193         mem_base = xmlMemBlocks();
23194         filename = gen_fileoutput(n_filename, 0);
23195         cur = gen_xmlDocPtr(n_cur, 1);
23196         encoding = gen_const_char_ptr(n_encoding, 2);
23197 
23198         ret_val = xmlSaveFileEnc(filename, cur, encoding);
23199         desret_int(ret_val);
23200         call_tests++;
23201         des_fileoutput(n_filename, filename, 0);
23202         des_xmlDocPtr(n_cur, cur, 1);
23203         des_const_char_ptr(n_encoding, encoding, 2);
23204         xmlResetLastError();
23205         if (mem_base != xmlMemBlocks()) {
23206             printf("Leak of %d blocks found in xmlSaveFileEnc",
23207 	           xmlMemBlocks() - mem_base);
23208 	    test_ret++;
23209             printf(" %d", n_filename);
23210             printf(" %d", n_cur);
23211             printf(" %d", n_encoding);
23212             printf("\n");
23213         }
23214     }
23215     }
23216     }
23217     function_tests++;
23218 #endif
23219 
23220     return(test_ret);
23221 }
23222 
23223 
23224 static int
test_xmlSaveFileTo(void)23225 test_xmlSaveFileTo(void) {
23226     int test_ret = 0;
23227 
23228 #if defined(LIBXML_OUTPUT_ENABLED)
23229     int mem_base;
23230     int ret_val;
23231     xmlOutputBufferPtr buf; /* an output I/O buffer */
23232     int n_buf;
23233     xmlDocPtr cur; /* the document */
23234     int n_cur;
23235     const char * encoding; /* the encoding if any assuming the I/O layer handles the transcoding */
23236     int n_encoding;
23237 
23238     for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
23239     for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
23240     for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
23241         mem_base = xmlMemBlocks();
23242         buf = gen_xmlOutputBufferPtr(n_buf, 0);
23243         cur = gen_xmlDocPtr(n_cur, 1);
23244         encoding = gen_const_char_ptr(n_encoding, 2);
23245 
23246         ret_val = xmlSaveFileTo(buf, cur, encoding);
23247         buf = NULL;
23248         desret_int(ret_val);
23249         call_tests++;
23250         des_xmlOutputBufferPtr(n_buf, buf, 0);
23251         des_xmlDocPtr(n_cur, cur, 1);
23252         des_const_char_ptr(n_encoding, encoding, 2);
23253         xmlResetLastError();
23254         if (mem_base != xmlMemBlocks()) {
23255             printf("Leak of %d blocks found in xmlSaveFileTo",
23256 	           xmlMemBlocks() - mem_base);
23257 	    test_ret++;
23258             printf(" %d", n_buf);
23259             printf(" %d", n_cur);
23260             printf(" %d", n_encoding);
23261             printf("\n");
23262         }
23263     }
23264     }
23265     }
23266     function_tests++;
23267 #endif
23268 
23269     return(test_ret);
23270 }
23271 
23272 
23273 static int
test_xmlSaveFormatFile(void)23274 test_xmlSaveFormatFile(void) {
23275     int test_ret = 0;
23276 
23277 #if defined(LIBXML_OUTPUT_ENABLED)
23278     int mem_base;
23279     int ret_val;
23280     const char * filename; /* the filename (or URL) */
23281     int n_filename;
23282     xmlDocPtr cur; /* the document */
23283     int n_cur;
23284     int format; /* should formatting spaces been added */
23285     int n_format;
23286 
23287     for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
23288     for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
23289     for (n_format = 0;n_format < gen_nb_int;n_format++) {
23290         mem_base = xmlMemBlocks();
23291         filename = gen_fileoutput(n_filename, 0);
23292         cur = gen_xmlDocPtr(n_cur, 1);
23293         format = gen_int(n_format, 2);
23294 
23295         ret_val = xmlSaveFormatFile(filename, cur, format);
23296         desret_int(ret_val);
23297         call_tests++;
23298         des_fileoutput(n_filename, filename, 0);
23299         des_xmlDocPtr(n_cur, cur, 1);
23300         des_int(n_format, format, 2);
23301         xmlResetLastError();
23302         if (mem_base != xmlMemBlocks()) {
23303             printf("Leak of %d blocks found in xmlSaveFormatFile",
23304 	           xmlMemBlocks() - mem_base);
23305 	    test_ret++;
23306             printf(" %d", n_filename);
23307             printf(" %d", n_cur);
23308             printf(" %d", n_format);
23309             printf("\n");
23310         }
23311     }
23312     }
23313     }
23314     function_tests++;
23315 #endif
23316 
23317     return(test_ret);
23318 }
23319 
23320 
23321 static int
test_xmlSaveFormatFileEnc(void)23322 test_xmlSaveFormatFileEnc(void) {
23323     int test_ret = 0;
23324 
23325 #if defined(LIBXML_OUTPUT_ENABLED)
23326     int mem_base;
23327     int ret_val;
23328     const char * filename; /* the filename or URL to output */
23329     int n_filename;
23330     xmlDocPtr cur; /* the document being saved */
23331     int n_cur;
23332     const char * encoding; /* the name of the encoding to use or NULL. */
23333     int n_encoding;
23334     int format; /* should formatting spaces be added. */
23335     int n_format;
23336 
23337     for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
23338     for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
23339     for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
23340     for (n_format = 0;n_format < gen_nb_int;n_format++) {
23341         mem_base = xmlMemBlocks();
23342         filename = gen_fileoutput(n_filename, 0);
23343         cur = gen_xmlDocPtr(n_cur, 1);
23344         encoding = gen_const_char_ptr(n_encoding, 2);
23345         format = gen_int(n_format, 3);
23346 
23347         ret_val = xmlSaveFormatFileEnc(filename, cur, encoding, format);
23348         desret_int(ret_val);
23349         call_tests++;
23350         des_fileoutput(n_filename, filename, 0);
23351         des_xmlDocPtr(n_cur, cur, 1);
23352         des_const_char_ptr(n_encoding, encoding, 2);
23353         des_int(n_format, format, 3);
23354         xmlResetLastError();
23355         if (mem_base != xmlMemBlocks()) {
23356             printf("Leak of %d blocks found in xmlSaveFormatFileEnc",
23357 	           xmlMemBlocks() - mem_base);
23358 	    test_ret++;
23359             printf(" %d", n_filename);
23360             printf(" %d", n_cur);
23361             printf(" %d", n_encoding);
23362             printf(" %d", n_format);
23363             printf("\n");
23364         }
23365     }
23366     }
23367     }
23368     }
23369     function_tests++;
23370 #endif
23371 
23372     return(test_ret);
23373 }
23374 
23375 
23376 static int
test_xmlSaveFormatFileTo(void)23377 test_xmlSaveFormatFileTo(void) {
23378     int test_ret = 0;
23379 
23380 #if defined(LIBXML_OUTPUT_ENABLED)
23381     int mem_base;
23382     int ret_val;
23383     xmlOutputBufferPtr buf; /* an output I/O buffer */
23384     int n_buf;
23385     xmlDocPtr cur; /* the document */
23386     int n_cur;
23387     const char * encoding; /* the encoding if any assuming the I/O layer handles the transcoding */
23388     int n_encoding;
23389     int format; /* should formatting spaces been added */
23390     int n_format;
23391 
23392     for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
23393     for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
23394     for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
23395     for (n_format = 0;n_format < gen_nb_int;n_format++) {
23396         mem_base = xmlMemBlocks();
23397         buf = gen_xmlOutputBufferPtr(n_buf, 0);
23398         cur = gen_xmlDocPtr(n_cur, 1);
23399         encoding = gen_const_char_ptr(n_encoding, 2);
23400         format = gen_int(n_format, 3);
23401 
23402         ret_val = xmlSaveFormatFileTo(buf, cur, encoding, format);
23403         buf = NULL;
23404         desret_int(ret_val);
23405         call_tests++;
23406         des_xmlOutputBufferPtr(n_buf, buf, 0);
23407         des_xmlDocPtr(n_cur, cur, 1);
23408         des_const_char_ptr(n_encoding, encoding, 2);
23409         des_int(n_format, format, 3);
23410         xmlResetLastError();
23411         if (mem_base != xmlMemBlocks()) {
23412             printf("Leak of %d blocks found in xmlSaveFormatFileTo",
23413 	           xmlMemBlocks() - mem_base);
23414 	    test_ret++;
23415             printf(" %d", n_buf);
23416             printf(" %d", n_cur);
23417             printf(" %d", n_encoding);
23418             printf(" %d", n_format);
23419             printf("\n");
23420         }
23421     }
23422     }
23423     }
23424     }
23425     function_tests++;
23426 #endif
23427 
23428     return(test_ret);
23429 }
23430 
23431 
23432 static int
test_xmlSearchNs(void)23433 test_xmlSearchNs(void) {
23434     int test_ret = 0;
23435 
23436     int mem_base;
23437     xmlNsPtr ret_val;
23438     xmlDocPtr doc; /* the document */
23439     int n_doc;
23440     xmlNodePtr node; /* the current node */
23441     int n_node;
23442     const xmlChar * nameSpace; /* the namespace prefix */
23443     int n_nameSpace;
23444 
23445     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
23446     for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
23447     for (n_nameSpace = 0;n_nameSpace < gen_nb_const_xmlChar_ptr;n_nameSpace++) {
23448         mem_base = xmlMemBlocks();
23449         doc = gen_xmlDocPtr(n_doc, 0);
23450         node = gen_xmlNodePtr(n_node, 1);
23451         nameSpace = gen_const_xmlChar_ptr(n_nameSpace, 2);
23452 
23453         ret_val = xmlSearchNs(doc, node, nameSpace);
23454         desret_xmlNsPtr(ret_val);
23455         call_tests++;
23456         des_xmlDocPtr(n_doc, doc, 0);
23457         des_xmlNodePtr(n_node, node, 1);
23458         des_const_xmlChar_ptr(n_nameSpace, nameSpace, 2);
23459         xmlResetLastError();
23460         if (mem_base != xmlMemBlocks()) {
23461             printf("Leak of %d blocks found in xmlSearchNs",
23462 	           xmlMemBlocks() - mem_base);
23463 	    test_ret++;
23464             printf(" %d", n_doc);
23465             printf(" %d", n_node);
23466             printf(" %d", n_nameSpace);
23467             printf("\n");
23468         }
23469     }
23470     }
23471     }
23472     function_tests++;
23473 
23474     return(test_ret);
23475 }
23476 
23477 
23478 static int
test_xmlSearchNsByHref(void)23479 test_xmlSearchNsByHref(void) {
23480     int test_ret = 0;
23481 
23482     int mem_base;
23483     xmlNsPtr ret_val;
23484     xmlDocPtr doc; /* the document */
23485     int n_doc;
23486     xmlNodePtr node; /* the current node */
23487     int n_node;
23488     const xmlChar * href; /* the namespace value */
23489     int n_href;
23490 
23491     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
23492     for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
23493     for (n_href = 0;n_href < gen_nb_const_xmlChar_ptr;n_href++) {
23494         mem_base = xmlMemBlocks();
23495         doc = gen_xmlDocPtr(n_doc, 0);
23496         node = gen_xmlNodePtr(n_node, 1);
23497         href = gen_const_xmlChar_ptr(n_href, 2);
23498 
23499         ret_val = xmlSearchNsByHref(doc, node, href);
23500         desret_xmlNsPtr(ret_val);
23501         call_tests++;
23502         des_xmlDocPtr(n_doc, doc, 0);
23503         des_xmlNodePtr(n_node, node, 1);
23504         des_const_xmlChar_ptr(n_href, href, 2);
23505         xmlResetLastError();
23506         if (mem_base != xmlMemBlocks()) {
23507             printf("Leak of %d blocks found in xmlSearchNsByHref",
23508 	           xmlMemBlocks() - mem_base);
23509 	    test_ret++;
23510             printf(" %d", n_doc);
23511             printf(" %d", n_node);
23512             printf(" %d", n_href);
23513             printf("\n");
23514         }
23515     }
23516     }
23517     }
23518     function_tests++;
23519 
23520     return(test_ret);
23521 }
23522 
23523 
23524 static int
test_xmlSetBufferAllocationScheme(void)23525 test_xmlSetBufferAllocationScheme(void) {
23526     int test_ret = 0;
23527 
23528     int mem_base;
23529     xmlBufferAllocationScheme scheme; /* allocation method to use */
23530     int n_scheme;
23531 
23532     for (n_scheme = 0;n_scheme < gen_nb_xmlBufferAllocationScheme;n_scheme++) {
23533         mem_base = xmlMemBlocks();
23534         scheme = gen_xmlBufferAllocationScheme(n_scheme, 0);
23535 
23536         xmlSetBufferAllocationScheme(scheme);
23537         call_tests++;
23538         des_xmlBufferAllocationScheme(n_scheme, scheme, 0);
23539         xmlResetLastError();
23540         if (mem_base != xmlMemBlocks()) {
23541             printf("Leak of %d blocks found in xmlSetBufferAllocationScheme",
23542 	           xmlMemBlocks() - mem_base);
23543 	    test_ret++;
23544             printf(" %d", n_scheme);
23545             printf("\n");
23546         }
23547     }
23548     function_tests++;
23549 
23550     return(test_ret);
23551 }
23552 
23553 
23554 static int
test_xmlSetCompressMode(void)23555 test_xmlSetCompressMode(void) {
23556     int test_ret = 0;
23557 
23558     int mem_base;
23559     int mode; /* the compression ratio */
23560     int n_mode;
23561 
23562     for (n_mode = 0;n_mode < gen_nb_int;n_mode++) {
23563         mem_base = xmlMemBlocks();
23564         mode = gen_int(n_mode, 0);
23565 
23566         xmlSetCompressMode(mode);
23567         call_tests++;
23568         des_int(n_mode, mode, 0);
23569         xmlResetLastError();
23570         if (mem_base != xmlMemBlocks()) {
23571             printf("Leak of %d blocks found in xmlSetCompressMode",
23572 	           xmlMemBlocks() - mem_base);
23573 	    test_ret++;
23574             printf(" %d", n_mode);
23575             printf("\n");
23576         }
23577     }
23578     function_tests++;
23579 
23580     return(test_ret);
23581 }
23582 
23583 
23584 static int
test_xmlSetDocCompressMode(void)23585 test_xmlSetDocCompressMode(void) {
23586     int test_ret = 0;
23587 
23588     int mem_base;
23589     xmlDocPtr doc; /* the document */
23590     int n_doc;
23591     int mode; /* the compression ratio */
23592     int n_mode;
23593 
23594     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
23595     for (n_mode = 0;n_mode < gen_nb_int;n_mode++) {
23596         mem_base = xmlMemBlocks();
23597         doc = gen_xmlDocPtr(n_doc, 0);
23598         mode = gen_int(n_mode, 1);
23599 
23600         xmlSetDocCompressMode(doc, mode);
23601         call_tests++;
23602         des_xmlDocPtr(n_doc, doc, 0);
23603         des_int(n_mode, mode, 1);
23604         xmlResetLastError();
23605         if (mem_base != xmlMemBlocks()) {
23606             printf("Leak of %d blocks found in xmlSetDocCompressMode",
23607 	           xmlMemBlocks() - mem_base);
23608 	    test_ret++;
23609             printf(" %d", n_doc);
23610             printf(" %d", n_mode);
23611             printf("\n");
23612         }
23613     }
23614     }
23615     function_tests++;
23616 
23617     return(test_ret);
23618 }
23619 
23620 
23621 static int
test_xmlSetNs(void)23622 test_xmlSetNs(void) {
23623     int test_ret = 0;
23624 
23625     int mem_base;
23626     xmlNodePtr node; /* a node in the document */
23627     int n_node;
23628     xmlNsPtr ns; /* a namespace pointer (optional) */
23629     int n_ns;
23630 
23631     for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
23632     for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
23633         mem_base = xmlMemBlocks();
23634         node = gen_xmlNodePtr(n_node, 0);
23635         ns = gen_xmlNsPtr(n_ns, 1);
23636 
23637         xmlSetNs(node, ns);
23638         call_tests++;
23639         des_xmlNodePtr(n_node, node, 0);
23640         des_xmlNsPtr(n_ns, ns, 1);
23641         xmlResetLastError();
23642         if (mem_base != xmlMemBlocks()) {
23643             printf("Leak of %d blocks found in xmlSetNs",
23644 	           xmlMemBlocks() - mem_base);
23645 	    test_ret++;
23646             printf(" %d", n_node);
23647             printf(" %d", n_ns);
23648             printf("\n");
23649         }
23650     }
23651     }
23652     function_tests++;
23653 
23654     return(test_ret);
23655 }
23656 
23657 
23658 static int
test_xmlSetNsProp(void)23659 test_xmlSetNsProp(void) {
23660     int test_ret = 0;
23661 
23662     int mem_base;
23663     xmlAttrPtr ret_val;
23664     xmlNodePtr node; /* the node */
23665     int n_node;
23666     xmlNsPtr ns; /* the namespace definition */
23667     int n_ns;
23668     const xmlChar * name; /* the attribute name */
23669     int n_name;
23670     const xmlChar * value; /* the attribute value */
23671     int n_value;
23672 
23673     for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
23674     for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
23675     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
23676     for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
23677         mem_base = xmlMemBlocks();
23678         node = gen_xmlNodePtr(n_node, 0);
23679         ns = gen_xmlNsPtr(n_ns, 1);
23680         name = gen_const_xmlChar_ptr(n_name, 2);
23681         value = gen_const_xmlChar_ptr(n_value, 3);
23682 
23683         ret_val = xmlSetNsProp(node, ns, name, value);
23684         desret_xmlAttrPtr(ret_val);
23685         call_tests++;
23686         des_xmlNodePtr(n_node, node, 0);
23687         des_xmlNsPtr(n_ns, ns, 1);
23688         des_const_xmlChar_ptr(n_name, name, 2);
23689         des_const_xmlChar_ptr(n_value, value, 3);
23690         xmlResetLastError();
23691         if (mem_base != xmlMemBlocks()) {
23692             printf("Leak of %d blocks found in xmlSetNsProp",
23693 	           xmlMemBlocks() - mem_base);
23694 	    test_ret++;
23695             printf(" %d", n_node);
23696             printf(" %d", n_ns);
23697             printf(" %d", n_name);
23698             printf(" %d", n_value);
23699             printf("\n");
23700         }
23701     }
23702     }
23703     }
23704     }
23705     function_tests++;
23706 
23707     return(test_ret);
23708 }
23709 
23710 
23711 static int
test_xmlSetProp(void)23712 test_xmlSetProp(void) {
23713     int test_ret = 0;
23714 
23715     int mem_base;
23716     xmlAttrPtr ret_val;
23717     xmlNodePtr node; /* the node */
23718     int n_node;
23719     const xmlChar * name; /* the attribute name (a QName) */
23720     int n_name;
23721     const xmlChar * value; /* the attribute value */
23722     int n_value;
23723 
23724     for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
23725     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
23726     for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
23727         mem_base = xmlMemBlocks();
23728         node = gen_xmlNodePtr(n_node, 0);
23729         name = gen_const_xmlChar_ptr(n_name, 1);
23730         value = gen_const_xmlChar_ptr(n_value, 2);
23731 
23732         ret_val = xmlSetProp(node, name, value);
23733         desret_xmlAttrPtr(ret_val);
23734         call_tests++;
23735         des_xmlNodePtr(n_node, node, 0);
23736         des_const_xmlChar_ptr(n_name, name, 1);
23737         des_const_xmlChar_ptr(n_value, value, 2);
23738         xmlResetLastError();
23739         if (mem_base != xmlMemBlocks()) {
23740             printf("Leak of %d blocks found in xmlSetProp",
23741 	           xmlMemBlocks() - mem_base);
23742 	    test_ret++;
23743             printf(" %d", n_node);
23744             printf(" %d", n_name);
23745             printf(" %d", n_value);
23746             printf("\n");
23747         }
23748     }
23749     }
23750     }
23751     function_tests++;
23752 
23753     return(test_ret);
23754 }
23755 
23756 
23757 static int
test_xmlSplitQName2(void)23758 test_xmlSplitQName2(void) {
23759     int test_ret = 0;
23760 
23761     int mem_base;
23762     xmlChar * ret_val;
23763     const xmlChar * name; /* the full QName */
23764     int n_name;
23765     xmlChar ** prefix; /* a xmlChar ** */
23766     int n_prefix;
23767 
23768     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
23769     for (n_prefix = 0;n_prefix < gen_nb_xmlChar_ptr_ptr;n_prefix++) {
23770         mem_base = xmlMemBlocks();
23771         name = gen_const_xmlChar_ptr(n_name, 0);
23772         prefix = gen_xmlChar_ptr_ptr(n_prefix, 1);
23773 
23774         ret_val = xmlSplitQName2(name, prefix);
23775         desret_xmlChar_ptr(ret_val);
23776         call_tests++;
23777         des_const_xmlChar_ptr(n_name, name, 0);
23778         des_xmlChar_ptr_ptr(n_prefix, prefix, 1);
23779         xmlResetLastError();
23780         if (mem_base != xmlMemBlocks()) {
23781             printf("Leak of %d blocks found in xmlSplitQName2",
23782 	           xmlMemBlocks() - mem_base);
23783 	    test_ret++;
23784             printf(" %d", n_name);
23785             printf(" %d", n_prefix);
23786             printf("\n");
23787         }
23788     }
23789     }
23790     function_tests++;
23791 
23792     return(test_ret);
23793 }
23794 
23795 
23796 static int
test_xmlSplitQName3(void)23797 test_xmlSplitQName3(void) {
23798     int test_ret = 0;
23799 
23800     int mem_base;
23801     const xmlChar * ret_val;
23802     const xmlChar * name; /* the full QName */
23803     int n_name;
23804     int * len; /* an int * */
23805     int n_len;
23806 
23807     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
23808     for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
23809         mem_base = xmlMemBlocks();
23810         name = gen_const_xmlChar_ptr(n_name, 0);
23811         len = gen_int_ptr(n_len, 1);
23812 
23813         ret_val = xmlSplitQName3(name, len);
23814         desret_const_xmlChar_ptr(ret_val);
23815         call_tests++;
23816         des_const_xmlChar_ptr(n_name, name, 0);
23817         des_int_ptr(n_len, len, 1);
23818         xmlResetLastError();
23819         if (mem_base != xmlMemBlocks()) {
23820             printf("Leak of %d blocks found in xmlSplitQName3",
23821 	           xmlMemBlocks() - mem_base);
23822 	    test_ret++;
23823             printf(" %d", n_name);
23824             printf(" %d", n_len);
23825             printf("\n");
23826         }
23827     }
23828     }
23829     function_tests++;
23830 
23831     return(test_ret);
23832 }
23833 
23834 
23835 static int
test_xmlStringGetNodeList(void)23836 test_xmlStringGetNodeList(void) {
23837     int test_ret = 0;
23838 
23839     int mem_base;
23840     xmlNodePtr ret_val;
23841     const xmlDoc * doc; /* a document (optional) */
23842     int n_doc;
23843     const xmlChar * value; /* an attribute value */
23844     int n_value;
23845 
23846     for (n_doc = 0;n_doc < gen_nb_const_xmlDoc_ptr;n_doc++) {
23847     for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
23848         mem_base = xmlMemBlocks();
23849         doc = gen_const_xmlDoc_ptr(n_doc, 0);
23850         value = gen_const_xmlChar_ptr(n_value, 1);
23851 
23852         ret_val = xmlStringGetNodeList(doc, value);
23853         desret_xmlNodePtr(ret_val);
23854         call_tests++;
23855         des_const_xmlDoc_ptr(n_doc, doc, 0);
23856         des_const_xmlChar_ptr(n_value, value, 1);
23857         xmlResetLastError();
23858         if (mem_base != xmlMemBlocks()) {
23859             printf("Leak of %d blocks found in xmlStringGetNodeList",
23860 	           xmlMemBlocks() - mem_base);
23861 	    test_ret++;
23862             printf(" %d", n_doc);
23863             printf(" %d", n_value);
23864             printf("\n");
23865         }
23866     }
23867     }
23868     function_tests++;
23869 
23870     return(test_ret);
23871 }
23872 
23873 
23874 static int
test_xmlStringLenGetNodeList(void)23875 test_xmlStringLenGetNodeList(void) {
23876     int test_ret = 0;
23877 
23878     int mem_base;
23879     xmlNodePtr ret_val;
23880     const xmlDoc * doc; /* a document (optional) */
23881     int n_doc;
23882     const xmlChar * value; /* an attribute value */
23883     int n_value;
23884     int len; /* maximum length of the attribute value */
23885     int n_len;
23886 
23887     for (n_doc = 0;n_doc < gen_nb_const_xmlDoc_ptr;n_doc++) {
23888     for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
23889     for (n_len = 0;n_len < gen_nb_int;n_len++) {
23890         mem_base = xmlMemBlocks();
23891         doc = gen_const_xmlDoc_ptr(n_doc, 0);
23892         value = gen_const_xmlChar_ptr(n_value, 1);
23893         len = gen_int(n_len, 2);
23894         if ((value != NULL) &&
23895             (len > xmlStrlen(BAD_CAST value)))
23896             len = 0;
23897 
23898         ret_val = xmlStringLenGetNodeList(doc, value, len);
23899         desret_xmlNodePtr(ret_val);
23900         call_tests++;
23901         des_const_xmlDoc_ptr(n_doc, doc, 0);
23902         des_const_xmlChar_ptr(n_value, value, 1);
23903         des_int(n_len, len, 2);
23904         xmlResetLastError();
23905         if (mem_base != xmlMemBlocks()) {
23906             printf("Leak of %d blocks found in xmlStringLenGetNodeList",
23907 	           xmlMemBlocks() - mem_base);
23908 	    test_ret++;
23909             printf(" %d", n_doc);
23910             printf(" %d", n_value);
23911             printf(" %d", n_len);
23912             printf("\n");
23913         }
23914     }
23915     }
23916     }
23917     function_tests++;
23918 
23919     return(test_ret);
23920 }
23921 
23922 
23923 static int
test_xmlTextConcat(void)23924 test_xmlTextConcat(void) {
23925     int test_ret = 0;
23926 
23927     int mem_base;
23928     int ret_val;
23929     xmlNodePtr node; /* the node */
23930     int n_node;
23931     const xmlChar * content; /* the content */
23932     int n_content;
23933     int len; /* @content length */
23934     int n_len;
23935 
23936     for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
23937     for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
23938     for (n_len = 0;n_len < gen_nb_int;n_len++) {
23939         mem_base = xmlMemBlocks();
23940         node = gen_xmlNodePtr(n_node, 0);
23941         content = gen_const_xmlChar_ptr(n_content, 1);
23942         len = gen_int(n_len, 2);
23943         if ((content != NULL) &&
23944             (len > xmlStrlen(BAD_CAST content)))
23945             len = 0;
23946 
23947         ret_val = xmlTextConcat(node, content, len);
23948         desret_int(ret_val);
23949         call_tests++;
23950         des_xmlNodePtr(n_node, node, 0);
23951         des_const_xmlChar_ptr(n_content, content, 1);
23952         des_int(n_len, len, 2);
23953         xmlResetLastError();
23954         if (mem_base != xmlMemBlocks()) {
23955             printf("Leak of %d blocks found in xmlTextConcat",
23956 	           xmlMemBlocks() - mem_base);
23957 	    test_ret++;
23958             printf(" %d", n_node);
23959             printf(" %d", n_content);
23960             printf(" %d", n_len);
23961             printf("\n");
23962         }
23963     }
23964     }
23965     }
23966     function_tests++;
23967 
23968     return(test_ret);
23969 }
23970 
23971 
23972 static int
test_xmlTextMerge(void)23973 test_xmlTextMerge(void) {
23974     int test_ret = 0;
23975 
23976     int mem_base;
23977     xmlNodePtr ret_val;
23978     xmlNodePtr first; /* the first text node */
23979     int n_first;
23980     xmlNodePtr second; /* the second text node being merged */
23981     int n_second;
23982 
23983     for (n_first = 0;n_first < gen_nb_xmlNodePtr_in;n_first++) {
23984     for (n_second = 0;n_second < gen_nb_xmlNodePtr_in;n_second++) {
23985         mem_base = xmlMemBlocks();
23986         first = gen_xmlNodePtr_in(n_first, 0);
23987         second = gen_xmlNodePtr_in(n_second, 1);
23988 
23989         ret_val = xmlTextMerge(first, second);
23990         if (ret_val == NULL) {
23991               xmlUnlinkNode(second);
23992               xmlFreeNode(second) ; second = NULL ;
23993               ret_val = first; }
23994         desret_xmlNodePtr(ret_val);
23995         call_tests++;
23996         des_xmlNodePtr_in(n_first, first, 0);
23997         des_xmlNodePtr_in(n_second, second, 1);
23998         xmlResetLastError();
23999         if (mem_base != xmlMemBlocks()) {
24000             printf("Leak of %d blocks found in xmlTextMerge",
24001 	           xmlMemBlocks() - mem_base);
24002 	    test_ret++;
24003             printf(" %d", n_first);
24004             printf(" %d", n_second);
24005             printf("\n");
24006         }
24007     }
24008     }
24009     function_tests++;
24010 
24011     return(test_ret);
24012 }
24013 
24014 
24015 static int
test_xmlThrDefBufferAllocScheme(void)24016 test_xmlThrDefBufferAllocScheme(void) {
24017     int test_ret = 0;
24018 
24019     int mem_base;
24020     xmlBufferAllocationScheme ret_val;
24021     xmlBufferAllocationScheme v; /*  */
24022     int n_v;
24023 
24024     for (n_v = 0;n_v < gen_nb_xmlBufferAllocationScheme;n_v++) {
24025         mem_base = xmlMemBlocks();
24026         v = gen_xmlBufferAllocationScheme(n_v, 0);
24027 
24028         ret_val = xmlThrDefBufferAllocScheme(v);
24029         desret_xmlBufferAllocationScheme(ret_val);
24030         call_tests++;
24031         des_xmlBufferAllocationScheme(n_v, v, 0);
24032         xmlResetLastError();
24033         if (mem_base != xmlMemBlocks()) {
24034             printf("Leak of %d blocks found in xmlThrDefBufferAllocScheme",
24035 	           xmlMemBlocks() - mem_base);
24036 	    test_ret++;
24037             printf(" %d", n_v);
24038             printf("\n");
24039         }
24040     }
24041     function_tests++;
24042 
24043     return(test_ret);
24044 }
24045 
24046 
24047 static int
test_xmlThrDefDefaultBufferSize(void)24048 test_xmlThrDefDefaultBufferSize(void) {
24049     int test_ret = 0;
24050 
24051     int mem_base;
24052     int ret_val;
24053     int v; /*  */
24054     int n_v;
24055 
24056     for (n_v = 0;n_v < gen_nb_int;n_v++) {
24057         mem_base = xmlMemBlocks();
24058         v = gen_int(n_v, 0);
24059 
24060         ret_val = xmlThrDefDefaultBufferSize(v);
24061         desret_int(ret_val);
24062         call_tests++;
24063         des_int(n_v, v, 0);
24064         xmlResetLastError();
24065         if (mem_base != xmlMemBlocks()) {
24066             printf("Leak of %d blocks found in xmlThrDefDefaultBufferSize",
24067 	           xmlMemBlocks() - mem_base);
24068 	    test_ret++;
24069             printf(" %d", n_v);
24070             printf("\n");
24071         }
24072     }
24073     function_tests++;
24074 
24075     return(test_ret);
24076 }
24077 
24078 
24079 static int
test_xmlThrDefDeregisterNodeDefault(void)24080 test_xmlThrDefDeregisterNodeDefault(void) {
24081     int test_ret = 0;
24082 
24083 
24084     /* missing type support */
24085     return(test_ret);
24086 }
24087 
24088 
24089 static int
test_xmlThrDefRegisterNodeDefault(void)24090 test_xmlThrDefRegisterNodeDefault(void) {
24091     int test_ret = 0;
24092 
24093 
24094     /* missing type support */
24095     return(test_ret);
24096 }
24097 
24098 
24099 static int
test_xmlUnsetNsProp(void)24100 test_xmlUnsetNsProp(void) {
24101     int test_ret = 0;
24102 
24103     int mem_base;
24104     int ret_val;
24105     xmlNodePtr node; /* the node */
24106     int n_node;
24107     xmlNsPtr ns; /* the namespace definition */
24108     int n_ns;
24109     const xmlChar * name; /* the attribute name */
24110     int n_name;
24111 
24112     for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
24113     for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
24114     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24115         mem_base = xmlMemBlocks();
24116         node = gen_xmlNodePtr(n_node, 0);
24117         ns = gen_xmlNsPtr(n_ns, 1);
24118         name = gen_const_xmlChar_ptr(n_name, 2);
24119 
24120         ret_val = xmlUnsetNsProp(node, ns, name);
24121         desret_int(ret_val);
24122         call_tests++;
24123         des_xmlNodePtr(n_node, node, 0);
24124         des_xmlNsPtr(n_ns, ns, 1);
24125         des_const_xmlChar_ptr(n_name, name, 2);
24126         xmlResetLastError();
24127         if (mem_base != xmlMemBlocks()) {
24128             printf("Leak of %d blocks found in xmlUnsetNsProp",
24129 	           xmlMemBlocks() - mem_base);
24130 	    test_ret++;
24131             printf(" %d", n_node);
24132             printf(" %d", n_ns);
24133             printf(" %d", n_name);
24134             printf("\n");
24135         }
24136     }
24137     }
24138     }
24139     function_tests++;
24140 
24141     return(test_ret);
24142 }
24143 
24144 
24145 static int
test_xmlUnsetProp(void)24146 test_xmlUnsetProp(void) {
24147     int test_ret = 0;
24148 
24149     int mem_base;
24150     int ret_val;
24151     xmlNodePtr node; /* the node */
24152     int n_node;
24153     const xmlChar * name; /* the attribute name */
24154     int n_name;
24155 
24156     for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
24157     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24158         mem_base = xmlMemBlocks();
24159         node = gen_xmlNodePtr(n_node, 0);
24160         name = gen_const_xmlChar_ptr(n_name, 1);
24161 
24162         ret_val = xmlUnsetProp(node, name);
24163         desret_int(ret_val);
24164         call_tests++;
24165         des_xmlNodePtr(n_node, node, 0);
24166         des_const_xmlChar_ptr(n_name, name, 1);
24167         xmlResetLastError();
24168         if (mem_base != xmlMemBlocks()) {
24169             printf("Leak of %d blocks found in xmlUnsetProp",
24170 	           xmlMemBlocks() - mem_base);
24171 	    test_ret++;
24172             printf(" %d", n_node);
24173             printf(" %d", n_name);
24174             printf("\n");
24175         }
24176     }
24177     }
24178     function_tests++;
24179 
24180     return(test_ret);
24181 }
24182 
24183 
24184 static int
test_xmlValidateNCName(void)24185 test_xmlValidateNCName(void) {
24186     int test_ret = 0;
24187 
24188     int mem_base;
24189     int ret_val;
24190     const xmlChar * value; /* the value to check */
24191     int n_value;
24192     int space; /* allow spaces in front and end of the string */
24193     int n_space;
24194 
24195     for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
24196     for (n_space = 0;n_space < gen_nb_int;n_space++) {
24197         mem_base = xmlMemBlocks();
24198         value = gen_const_xmlChar_ptr(n_value, 0);
24199         space = gen_int(n_space, 1);
24200 
24201         ret_val = xmlValidateNCName(value, space);
24202         desret_int(ret_val);
24203         call_tests++;
24204         des_const_xmlChar_ptr(n_value, value, 0);
24205         des_int(n_space, space, 1);
24206         xmlResetLastError();
24207         if (mem_base != xmlMemBlocks()) {
24208             printf("Leak of %d blocks found in xmlValidateNCName",
24209 	           xmlMemBlocks() - mem_base);
24210 	    test_ret++;
24211             printf(" %d", n_value);
24212             printf(" %d", n_space);
24213             printf("\n");
24214         }
24215     }
24216     }
24217     function_tests++;
24218 
24219     return(test_ret);
24220 }
24221 
24222 
24223 static int
test_xmlValidateNMToken(void)24224 test_xmlValidateNMToken(void) {
24225     int test_ret = 0;
24226 
24227     int mem_base;
24228     int ret_val;
24229     const xmlChar * value; /* the value to check */
24230     int n_value;
24231     int space; /* allow spaces in front and end of the string */
24232     int n_space;
24233 
24234     for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
24235     for (n_space = 0;n_space < gen_nb_int;n_space++) {
24236         mem_base = xmlMemBlocks();
24237         value = gen_const_xmlChar_ptr(n_value, 0);
24238         space = gen_int(n_space, 1);
24239 
24240         ret_val = xmlValidateNMToken(value, space);
24241         desret_int(ret_val);
24242         call_tests++;
24243         des_const_xmlChar_ptr(n_value, value, 0);
24244         des_int(n_space, space, 1);
24245         xmlResetLastError();
24246         if (mem_base != xmlMemBlocks()) {
24247             printf("Leak of %d blocks found in xmlValidateNMToken",
24248 	           xmlMemBlocks() - mem_base);
24249 	    test_ret++;
24250             printf(" %d", n_value);
24251             printf(" %d", n_space);
24252             printf("\n");
24253         }
24254     }
24255     }
24256     function_tests++;
24257 
24258     return(test_ret);
24259 }
24260 
24261 
24262 static int
test_xmlValidateName(void)24263 test_xmlValidateName(void) {
24264     int test_ret = 0;
24265 
24266     int mem_base;
24267     int ret_val;
24268     const xmlChar * value; /* the value to check */
24269     int n_value;
24270     int space; /* allow spaces in front and end of the string */
24271     int n_space;
24272 
24273     for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
24274     for (n_space = 0;n_space < gen_nb_int;n_space++) {
24275         mem_base = xmlMemBlocks();
24276         value = gen_const_xmlChar_ptr(n_value, 0);
24277         space = gen_int(n_space, 1);
24278 
24279         ret_val = xmlValidateName(value, space);
24280         desret_int(ret_val);
24281         call_tests++;
24282         des_const_xmlChar_ptr(n_value, value, 0);
24283         des_int(n_space, space, 1);
24284         xmlResetLastError();
24285         if (mem_base != xmlMemBlocks()) {
24286             printf("Leak of %d blocks found in xmlValidateName",
24287 	           xmlMemBlocks() - mem_base);
24288 	    test_ret++;
24289             printf(" %d", n_value);
24290             printf(" %d", n_space);
24291             printf("\n");
24292         }
24293     }
24294     }
24295     function_tests++;
24296 
24297     return(test_ret);
24298 }
24299 
24300 
24301 static int
test_xmlValidateQName(void)24302 test_xmlValidateQName(void) {
24303     int test_ret = 0;
24304 
24305     int mem_base;
24306     int ret_val;
24307     const xmlChar * value; /* the value to check */
24308     int n_value;
24309     int space; /* allow spaces in front and end of the string */
24310     int n_space;
24311 
24312     for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
24313     for (n_space = 0;n_space < gen_nb_int;n_space++) {
24314         mem_base = xmlMemBlocks();
24315         value = gen_const_xmlChar_ptr(n_value, 0);
24316         space = gen_int(n_space, 1);
24317 
24318         ret_val = xmlValidateQName(value, space);
24319         desret_int(ret_val);
24320         call_tests++;
24321         des_const_xmlChar_ptr(n_value, value, 0);
24322         des_int(n_space, space, 1);
24323         xmlResetLastError();
24324         if (mem_base != xmlMemBlocks()) {
24325             printf("Leak of %d blocks found in xmlValidateQName",
24326 	           xmlMemBlocks() - mem_base);
24327 	    test_ret++;
24328             printf(" %d", n_value);
24329             printf(" %d", n_space);
24330             printf("\n");
24331         }
24332     }
24333     }
24334     function_tests++;
24335 
24336     return(test_ret);
24337 }
24338 
24339 static int
test_tree(void)24340 test_tree(void) {
24341     int test_ret = 0;
24342 
24343     if (quiet == 0) printf("Testing tree : 146 of 172 functions ...\n");
24344     test_ret += test_xmlAddChild();
24345     test_ret += test_xmlAddChildList();
24346     test_ret += test_xmlAddNextSibling();
24347     test_ret += test_xmlAddPrevSibling();
24348     test_ret += test_xmlAddSibling();
24349     test_ret += test_xmlAttrSerializeTxtContent();
24350     test_ret += test_xmlBufContent();
24351     test_ret += test_xmlBufEnd();
24352     test_ret += test_xmlBufGetNodeContent();
24353     test_ret += test_xmlBufNodeDump();
24354     test_ret += test_xmlBufShrink();
24355     test_ret += test_xmlBufUse();
24356     test_ret += test_xmlBufferAdd();
24357     test_ret += test_xmlBufferAddHead();
24358     test_ret += test_xmlBufferCCat();
24359     test_ret += test_xmlBufferCat();
24360     test_ret += test_xmlBufferContent();
24361     test_ret += test_xmlBufferCreate();
24362     test_ret += test_xmlBufferCreateSize();
24363     test_ret += test_xmlBufferCreateStatic();
24364     test_ret += test_xmlBufferDetach();
24365     test_ret += test_xmlBufferEmpty();
24366     test_ret += test_xmlBufferGrow();
24367     test_ret += test_xmlBufferLength();
24368     test_ret += test_xmlBufferResize();
24369     test_ret += test_xmlBufferSetAllocationScheme();
24370     test_ret += test_xmlBufferShrink();
24371     test_ret += test_xmlBufferWriteCHAR();
24372     test_ret += test_xmlBufferWriteChar();
24373     test_ret += test_xmlBufferWriteQuotedString();
24374     test_ret += test_xmlBuildQName();
24375     test_ret += test_xmlChildElementCount();
24376     test_ret += test_xmlCopyDoc();
24377     test_ret += test_xmlCopyDtd();
24378     test_ret += test_xmlCopyNamespace();
24379     test_ret += test_xmlCopyNamespaceList();
24380     test_ret += test_xmlCopyNode();
24381     test_ret += test_xmlCopyNodeList();
24382     test_ret += test_xmlCopyProp();
24383     test_ret += test_xmlCopyPropList();
24384     test_ret += test_xmlCreateIntSubset();
24385     test_ret += test_xmlDOMWrapAdoptNode();
24386     test_ret += test_xmlDOMWrapCloneNode();
24387     test_ret += test_xmlDOMWrapNewCtxt();
24388     test_ret += test_xmlDOMWrapReconcileNamespaces();
24389     test_ret += test_xmlDOMWrapRemoveNode();
24390     test_ret += test_xmlDeregisterNodeDefault();
24391     test_ret += test_xmlDocCopyNode();
24392     test_ret += test_xmlDocCopyNodeList();
24393     test_ret += test_xmlDocDump();
24394     test_ret += test_xmlDocDumpFormatMemory();
24395     test_ret += test_xmlDocDumpFormatMemoryEnc();
24396     test_ret += test_xmlDocDumpMemory();
24397     test_ret += test_xmlDocDumpMemoryEnc();
24398     test_ret += test_xmlDocFormatDump();
24399     test_ret += test_xmlDocGetRootElement();
24400     test_ret += test_xmlDocSetRootElement();
24401     test_ret += test_xmlElemDump();
24402     test_ret += test_xmlFirstElementChild();
24403     test_ret += test_xmlGetBufferAllocationScheme();
24404     test_ret += test_xmlGetCompressMode();
24405     test_ret += test_xmlGetDocCompressMode();
24406     test_ret += test_xmlGetIntSubset();
24407     test_ret += test_xmlGetLastChild();
24408     test_ret += test_xmlGetLineNo();
24409     test_ret += test_xmlGetNoNsProp();
24410     test_ret += test_xmlGetNodePath();
24411     test_ret += test_xmlGetNsList();
24412     test_ret += test_xmlGetNsListSafe();
24413     test_ret += test_xmlGetNsProp();
24414     test_ret += test_xmlGetProp();
24415     test_ret += test_xmlHasNsProp();
24416     test_ret += test_xmlHasProp();
24417     test_ret += test_xmlIsBlankNode();
24418     test_ret += test_xmlIsXHTML();
24419     test_ret += test_xmlLastElementChild();
24420     test_ret += test_xmlNewCDataBlock();
24421     test_ret += test_xmlNewCharRef();
24422     test_ret += test_xmlNewChild();
24423     test_ret += test_xmlNewComment();
24424     test_ret += test_xmlNewDoc();
24425     test_ret += test_xmlNewDocComment();
24426     test_ret += test_xmlNewDocFragment();
24427     test_ret += test_xmlNewDocNode();
24428     test_ret += test_xmlNewDocNodeEatName();
24429     test_ret += test_xmlNewDocPI();
24430     test_ret += test_xmlNewDocProp();
24431     test_ret += test_xmlNewDocRawNode();
24432     test_ret += test_xmlNewDocText();
24433     test_ret += test_xmlNewDocTextLen();
24434     test_ret += test_xmlNewDtd();
24435     test_ret += test_xmlNewNode();
24436     test_ret += test_xmlNewNodeEatName();
24437     test_ret += test_xmlNewNs();
24438     test_ret += test_xmlNewNsProp();
24439     test_ret += test_xmlNewNsPropEatName();
24440     test_ret += test_xmlNewPI();
24441     test_ret += test_xmlNewProp();
24442     test_ret += test_xmlNewReference();
24443     test_ret += test_xmlNewText();
24444     test_ret += test_xmlNewTextChild();
24445     test_ret += test_xmlNewTextLen();
24446     test_ret += test_xmlNextElementSibling();
24447     test_ret += test_xmlNodeAddContent();
24448     test_ret += test_xmlNodeAddContentLen();
24449     test_ret += test_xmlNodeBufGetContent();
24450     test_ret += test_xmlNodeDump();
24451     test_ret += test_xmlNodeDumpOutput();
24452     test_ret += test_xmlNodeGetAttrValue();
24453     test_ret += test_xmlNodeGetBase();
24454     test_ret += test_xmlNodeGetBaseSafe();
24455     test_ret += test_xmlNodeGetContent();
24456     test_ret += test_xmlNodeGetLang();
24457     test_ret += test_xmlNodeGetSpacePreserve();
24458     test_ret += test_xmlNodeIsText();
24459     test_ret += test_xmlNodeListGetRawString();
24460     test_ret += test_xmlNodeListGetString();
24461     test_ret += test_xmlNodeSetBase();
24462     test_ret += test_xmlNodeSetContent();
24463     test_ret += test_xmlNodeSetContentLen();
24464     test_ret += test_xmlNodeSetLang();
24465     test_ret += test_xmlNodeSetName();
24466     test_ret += test_xmlNodeSetSpacePreserve();
24467     test_ret += test_xmlPreviousElementSibling();
24468     test_ret += test_xmlReconciliateNs();
24469     test_ret += test_xmlRegisterNodeDefault();
24470     test_ret += test_xmlRemoveProp();
24471     test_ret += test_xmlReplaceNode();
24472     test_ret += test_xmlSaveFile();
24473     test_ret += test_xmlSaveFileEnc();
24474     test_ret += test_xmlSaveFileTo();
24475     test_ret += test_xmlSaveFormatFile();
24476     test_ret += test_xmlSaveFormatFileEnc();
24477     test_ret += test_xmlSaveFormatFileTo();
24478     test_ret += test_xmlSearchNs();
24479     test_ret += test_xmlSearchNsByHref();
24480     test_ret += test_xmlSetBufferAllocationScheme();
24481     test_ret += test_xmlSetCompressMode();
24482     test_ret += test_xmlSetDocCompressMode();
24483     test_ret += test_xmlSetNs();
24484     test_ret += test_xmlSetNsProp();
24485     test_ret += test_xmlSetProp();
24486     test_ret += test_xmlSplitQName2();
24487     test_ret += test_xmlSplitQName3();
24488     test_ret += test_xmlStringGetNodeList();
24489     test_ret += test_xmlStringLenGetNodeList();
24490     test_ret += test_xmlTextConcat();
24491     test_ret += test_xmlTextMerge();
24492     test_ret += test_xmlThrDefBufferAllocScheme();
24493     test_ret += test_xmlThrDefDefaultBufferSize();
24494     test_ret += test_xmlThrDefDeregisterNodeDefault();
24495     test_ret += test_xmlThrDefRegisterNodeDefault();
24496     test_ret += test_xmlUnsetNsProp();
24497     test_ret += test_xmlUnsetProp();
24498     test_ret += test_xmlValidateNCName();
24499     test_ret += test_xmlValidateNMToken();
24500     test_ret += test_xmlValidateName();
24501     test_ret += test_xmlValidateQName();
24502 
24503     if (test_ret != 0)
24504 	printf("Module tree: %d errors\n", test_ret);
24505     return(test_ret);
24506 }
24507 
24508 static int
test_xmlBuildRelativeURI(void)24509 test_xmlBuildRelativeURI(void) {
24510     int test_ret = 0;
24511 
24512     int mem_base;
24513     xmlChar * ret_val;
24514     const xmlChar * URI; /* the URI reference under consideration */
24515     int n_URI;
24516     const xmlChar * base; /* the base value */
24517     int n_base;
24518 
24519     for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
24520     for (n_base = 0;n_base < gen_nb_const_xmlChar_ptr;n_base++) {
24521         mem_base = xmlMemBlocks();
24522         URI = gen_const_xmlChar_ptr(n_URI, 0);
24523         base = gen_const_xmlChar_ptr(n_base, 1);
24524 
24525         ret_val = xmlBuildRelativeURI(URI, base);
24526         desret_xmlChar_ptr(ret_val);
24527         call_tests++;
24528         des_const_xmlChar_ptr(n_URI, URI, 0);
24529         des_const_xmlChar_ptr(n_base, base, 1);
24530         xmlResetLastError();
24531         if (mem_base != xmlMemBlocks()) {
24532             printf("Leak of %d blocks found in xmlBuildRelativeURI",
24533 	           xmlMemBlocks() - mem_base);
24534 	    test_ret++;
24535             printf(" %d", n_URI);
24536             printf(" %d", n_base);
24537             printf("\n");
24538         }
24539     }
24540     }
24541     function_tests++;
24542 
24543     return(test_ret);
24544 }
24545 
24546 
24547 static int
test_xmlBuildRelativeURISafe(void)24548 test_xmlBuildRelativeURISafe(void) {
24549     int test_ret = 0;
24550 
24551     int mem_base;
24552     int ret_val;
24553     const xmlChar * URI; /* the URI reference under consideration */
24554     int n_URI;
24555     const xmlChar * base; /* the base value */
24556     int n_base;
24557     xmlChar ** valPtr; /* pointer to result URI */
24558     int n_valPtr;
24559 
24560     for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
24561     for (n_base = 0;n_base < gen_nb_const_xmlChar_ptr;n_base++) {
24562     for (n_valPtr = 0;n_valPtr < gen_nb_xmlChar_ptr_ptr;n_valPtr++) {
24563         mem_base = xmlMemBlocks();
24564         URI = gen_const_xmlChar_ptr(n_URI, 0);
24565         base = gen_const_xmlChar_ptr(n_base, 1);
24566         valPtr = gen_xmlChar_ptr_ptr(n_valPtr, 2);
24567 
24568         ret_val = xmlBuildRelativeURISafe(URI, base, valPtr);
24569         desret_int(ret_val);
24570         call_tests++;
24571         des_const_xmlChar_ptr(n_URI, URI, 0);
24572         des_const_xmlChar_ptr(n_base, base, 1);
24573         des_xmlChar_ptr_ptr(n_valPtr, valPtr, 2);
24574         xmlResetLastError();
24575         if (mem_base != xmlMemBlocks()) {
24576             printf("Leak of %d blocks found in xmlBuildRelativeURISafe",
24577 	           xmlMemBlocks() - mem_base);
24578 	    test_ret++;
24579             printf(" %d", n_URI);
24580             printf(" %d", n_base);
24581             printf(" %d", n_valPtr);
24582             printf("\n");
24583         }
24584     }
24585     }
24586     }
24587     function_tests++;
24588 
24589     return(test_ret);
24590 }
24591 
24592 
24593 static int
test_xmlBuildURI(void)24594 test_xmlBuildURI(void) {
24595     int test_ret = 0;
24596 
24597     int mem_base;
24598     xmlChar * ret_val;
24599     const xmlChar * URI; /* the URI instance found in the document */
24600     int n_URI;
24601     const xmlChar * base; /* the base value */
24602     int n_base;
24603 
24604     for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
24605     for (n_base = 0;n_base < gen_nb_const_xmlChar_ptr;n_base++) {
24606         mem_base = xmlMemBlocks();
24607         URI = gen_const_xmlChar_ptr(n_URI, 0);
24608         base = gen_const_xmlChar_ptr(n_base, 1);
24609 
24610         ret_val = xmlBuildURI(URI, base);
24611         desret_xmlChar_ptr(ret_val);
24612         call_tests++;
24613         des_const_xmlChar_ptr(n_URI, URI, 0);
24614         des_const_xmlChar_ptr(n_base, base, 1);
24615         xmlResetLastError();
24616         if (mem_base != xmlMemBlocks()) {
24617             printf("Leak of %d blocks found in xmlBuildURI",
24618 	           xmlMemBlocks() - mem_base);
24619 	    test_ret++;
24620             printf(" %d", n_URI);
24621             printf(" %d", n_base);
24622             printf("\n");
24623         }
24624     }
24625     }
24626     function_tests++;
24627 
24628     return(test_ret);
24629 }
24630 
24631 
24632 static int
test_xmlBuildURISafe(void)24633 test_xmlBuildURISafe(void) {
24634     int test_ret = 0;
24635 
24636     int mem_base;
24637     int ret_val;
24638     const xmlChar * URI; /* the URI instance found in the document */
24639     int n_URI;
24640     const xmlChar * base; /* the base value */
24641     int n_base;
24642     xmlChar ** valPtr; /* pointer to result URI */
24643     int n_valPtr;
24644 
24645     for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
24646     for (n_base = 0;n_base < gen_nb_const_xmlChar_ptr;n_base++) {
24647     for (n_valPtr = 0;n_valPtr < gen_nb_xmlChar_ptr_ptr;n_valPtr++) {
24648         mem_base = xmlMemBlocks();
24649         URI = gen_const_xmlChar_ptr(n_URI, 0);
24650         base = gen_const_xmlChar_ptr(n_base, 1);
24651         valPtr = gen_xmlChar_ptr_ptr(n_valPtr, 2);
24652 
24653         ret_val = xmlBuildURISafe(URI, base, valPtr);
24654         desret_int(ret_val);
24655         call_tests++;
24656         des_const_xmlChar_ptr(n_URI, URI, 0);
24657         des_const_xmlChar_ptr(n_base, base, 1);
24658         des_xmlChar_ptr_ptr(n_valPtr, valPtr, 2);
24659         xmlResetLastError();
24660         if (mem_base != xmlMemBlocks()) {
24661             printf("Leak of %d blocks found in xmlBuildURISafe",
24662 	           xmlMemBlocks() - mem_base);
24663 	    test_ret++;
24664             printf(" %d", n_URI);
24665             printf(" %d", n_base);
24666             printf(" %d", n_valPtr);
24667             printf("\n");
24668         }
24669     }
24670     }
24671     }
24672     function_tests++;
24673 
24674     return(test_ret);
24675 }
24676 
24677 
24678 static int
test_xmlCanonicPath(void)24679 test_xmlCanonicPath(void) {
24680     int test_ret = 0;
24681 
24682     int mem_base;
24683     xmlChar * ret_val;
24684     const xmlChar * path; /* the resource locator in a filesystem notation */
24685     int n_path;
24686 
24687     for (n_path = 0;n_path < gen_nb_const_xmlChar_ptr;n_path++) {
24688         mem_base = xmlMemBlocks();
24689         path = gen_const_xmlChar_ptr(n_path, 0);
24690 
24691         ret_val = xmlCanonicPath(path);
24692         desret_xmlChar_ptr(ret_val);
24693         call_tests++;
24694         des_const_xmlChar_ptr(n_path, path, 0);
24695         xmlResetLastError();
24696         if (mem_base != xmlMemBlocks()) {
24697             printf("Leak of %d blocks found in xmlCanonicPath",
24698 	           xmlMemBlocks() - mem_base);
24699 	    test_ret++;
24700             printf(" %d", n_path);
24701             printf("\n");
24702         }
24703     }
24704     function_tests++;
24705 
24706     return(test_ret);
24707 }
24708 
24709 
24710 static int
test_xmlCreateURI(void)24711 test_xmlCreateURI(void) {
24712     int test_ret = 0;
24713 
24714 
24715     /* missing type support */
24716     return(test_ret);
24717 }
24718 
24719 
24720 #define gen_nb_char_ptr 1
24721 #define gen_char_ptr(no, nr) NULL
24722 #define des_char_ptr(no, val, nr)
24723 
24724 static int
test_xmlNormalizeURIPath(void)24725 test_xmlNormalizeURIPath(void) {
24726     int test_ret = 0;
24727 
24728     int mem_base;
24729     int ret_val;
24730     char * path; /* pointer to the path string */
24731     int n_path;
24732 
24733     for (n_path = 0;n_path < gen_nb_char_ptr;n_path++) {
24734         mem_base = xmlMemBlocks();
24735         path = gen_char_ptr(n_path, 0);
24736 
24737         ret_val = xmlNormalizeURIPath(path);
24738         desret_int(ret_val);
24739         call_tests++;
24740         des_char_ptr(n_path, path, 0);
24741         xmlResetLastError();
24742         if (mem_base != xmlMemBlocks()) {
24743             printf("Leak of %d blocks found in xmlNormalizeURIPath",
24744 	           xmlMemBlocks() - mem_base);
24745 	    test_ret++;
24746             printf(" %d", n_path);
24747             printf("\n");
24748         }
24749     }
24750     function_tests++;
24751 
24752     return(test_ret);
24753 }
24754 
24755 
24756 static int
test_xmlParseURI(void)24757 test_xmlParseURI(void) {
24758     int test_ret = 0;
24759 
24760 
24761     /* missing type support */
24762     return(test_ret);
24763 }
24764 
24765 
24766 static int
test_xmlParseURIRaw(void)24767 test_xmlParseURIRaw(void) {
24768     int test_ret = 0;
24769 
24770 
24771     /* missing type support */
24772     return(test_ret);
24773 }
24774 
24775 
24776 #define gen_nb_xmlURIPtr 1
24777 #define gen_xmlURIPtr(no, nr) NULL
24778 #define des_xmlURIPtr(no, val, nr)
24779 
24780 static int
test_xmlParseURIReference(void)24781 test_xmlParseURIReference(void) {
24782     int test_ret = 0;
24783 
24784     int mem_base;
24785     int ret_val;
24786     xmlURIPtr uri; /* pointer to an URI structure */
24787     int n_uri;
24788     const char * str; /* the string to analyze */
24789     int n_str;
24790 
24791     for (n_uri = 0;n_uri < gen_nb_xmlURIPtr;n_uri++) {
24792     for (n_str = 0;n_str < gen_nb_const_char_ptr;n_str++) {
24793         mem_base = xmlMemBlocks();
24794         uri = gen_xmlURIPtr(n_uri, 0);
24795         str = gen_const_char_ptr(n_str, 1);
24796 
24797         ret_val = xmlParseURIReference(uri, str);
24798         desret_int(ret_val);
24799         call_tests++;
24800         des_xmlURIPtr(n_uri, uri, 0);
24801         des_const_char_ptr(n_str, str, 1);
24802         xmlResetLastError();
24803         if (mem_base != xmlMemBlocks()) {
24804             printf("Leak of %d blocks found in xmlParseURIReference",
24805 	           xmlMemBlocks() - mem_base);
24806 	    test_ret++;
24807             printf(" %d", n_uri);
24808             printf(" %d", n_str);
24809             printf("\n");
24810         }
24811     }
24812     }
24813     function_tests++;
24814 
24815     return(test_ret);
24816 }
24817 
24818 
24819 #define gen_nb_xmlURIPtr_ptr 1
24820 #define gen_xmlURIPtr_ptr(no, nr) NULL
24821 #define des_xmlURIPtr_ptr(no, val, nr)
24822 
24823 static int
test_xmlParseURISafe(void)24824 test_xmlParseURISafe(void) {
24825     int test_ret = 0;
24826 
24827     int mem_base;
24828     int ret_val;
24829     const char * str; /* the URI string to analyze */
24830     int n_str;
24831     xmlURIPtr * uriOut; /* optional pointer to parsed URI */
24832     int n_uriOut;
24833 
24834     for (n_str = 0;n_str < gen_nb_filepath;n_str++) {
24835     for (n_uriOut = 0;n_uriOut < gen_nb_xmlURIPtr_ptr;n_uriOut++) {
24836         mem_base = xmlMemBlocks();
24837         str = gen_filepath(n_str, 0);
24838         uriOut = gen_xmlURIPtr_ptr(n_uriOut, 1);
24839 
24840         ret_val = xmlParseURISafe(str, uriOut);
24841         desret_int(ret_val);
24842         call_tests++;
24843         des_filepath(n_str, str, 0);
24844         des_xmlURIPtr_ptr(n_uriOut, uriOut, 1);
24845         xmlResetLastError();
24846         if (mem_base != xmlMemBlocks()) {
24847             printf("Leak of %d blocks found in xmlParseURISafe",
24848 	           xmlMemBlocks() - mem_base);
24849 	    test_ret++;
24850             printf(" %d", n_str);
24851             printf(" %d", n_uriOut);
24852             printf("\n");
24853         }
24854     }
24855     }
24856     function_tests++;
24857 
24858     return(test_ret);
24859 }
24860 
24861 
24862 static int
test_xmlPathToURI(void)24863 test_xmlPathToURI(void) {
24864     int test_ret = 0;
24865 
24866     int mem_base;
24867     xmlChar * ret_val;
24868     const xmlChar * path; /* the resource locator in a filesystem notation */
24869     int n_path;
24870 
24871     for (n_path = 0;n_path < gen_nb_const_xmlChar_ptr;n_path++) {
24872         mem_base = xmlMemBlocks();
24873         path = gen_const_xmlChar_ptr(n_path, 0);
24874 
24875         ret_val = xmlPathToURI(path);
24876         desret_xmlChar_ptr(ret_val);
24877         call_tests++;
24878         des_const_xmlChar_ptr(n_path, path, 0);
24879         xmlResetLastError();
24880         if (mem_base != xmlMemBlocks()) {
24881             printf("Leak of %d blocks found in xmlPathToURI",
24882 	           xmlMemBlocks() - mem_base);
24883 	    test_ret++;
24884             printf(" %d", n_path);
24885             printf("\n");
24886         }
24887     }
24888     function_tests++;
24889 
24890     return(test_ret);
24891 }
24892 
24893 
24894 static int
test_xmlPrintURI(void)24895 test_xmlPrintURI(void) {
24896     int test_ret = 0;
24897 
24898     int mem_base;
24899     FILE * stream; /* a FILE* for the output */
24900     int n_stream;
24901     xmlURIPtr uri; /* pointer to an xmlURI */
24902     int n_uri;
24903 
24904     for (n_stream = 0;n_stream < gen_nb_FILE_ptr;n_stream++) {
24905     for (n_uri = 0;n_uri < gen_nb_xmlURIPtr;n_uri++) {
24906         mem_base = xmlMemBlocks();
24907         stream = gen_FILE_ptr(n_stream, 0);
24908         uri = gen_xmlURIPtr(n_uri, 1);
24909 
24910         xmlPrintURI(stream, uri);
24911         call_tests++;
24912         des_FILE_ptr(n_stream, stream, 0);
24913         des_xmlURIPtr(n_uri, uri, 1);
24914         xmlResetLastError();
24915         if (mem_base != xmlMemBlocks()) {
24916             printf("Leak of %d blocks found in xmlPrintURI",
24917 	           xmlMemBlocks() - mem_base);
24918 	    test_ret++;
24919             printf(" %d", n_stream);
24920             printf(" %d", n_uri);
24921             printf("\n");
24922         }
24923     }
24924     }
24925     function_tests++;
24926 
24927     return(test_ret);
24928 }
24929 
24930 
24931 static int
test_xmlSaveUri(void)24932 test_xmlSaveUri(void) {
24933     int test_ret = 0;
24934 
24935     int mem_base;
24936     xmlChar * ret_val;
24937     xmlURIPtr uri; /* pointer to an xmlURI */
24938     int n_uri;
24939 
24940     for (n_uri = 0;n_uri < gen_nb_xmlURIPtr;n_uri++) {
24941         mem_base = xmlMemBlocks();
24942         uri = gen_xmlURIPtr(n_uri, 0);
24943 
24944         ret_val = xmlSaveUri(uri);
24945         desret_xmlChar_ptr(ret_val);
24946         call_tests++;
24947         des_xmlURIPtr(n_uri, uri, 0);
24948         xmlResetLastError();
24949         if (mem_base != xmlMemBlocks()) {
24950             printf("Leak of %d blocks found in xmlSaveUri",
24951 	           xmlMemBlocks() - mem_base);
24952 	    test_ret++;
24953             printf(" %d", n_uri);
24954             printf("\n");
24955         }
24956     }
24957     function_tests++;
24958 
24959     return(test_ret);
24960 }
24961 
24962 
24963 static int
test_xmlURIEscape(void)24964 test_xmlURIEscape(void) {
24965     int test_ret = 0;
24966 
24967     int mem_base;
24968     xmlChar * ret_val;
24969     const xmlChar * str; /* the string of the URI to escape */
24970     int n_str;
24971 
24972     for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
24973         mem_base = xmlMemBlocks();
24974         str = gen_const_xmlChar_ptr(n_str, 0);
24975 
24976         ret_val = xmlURIEscape(str);
24977         desret_xmlChar_ptr(ret_val);
24978         call_tests++;
24979         des_const_xmlChar_ptr(n_str, str, 0);
24980         xmlResetLastError();
24981         if (mem_base != xmlMemBlocks()) {
24982             printf("Leak of %d blocks found in xmlURIEscape",
24983 	           xmlMemBlocks() - mem_base);
24984 	    test_ret++;
24985             printf(" %d", n_str);
24986             printf("\n");
24987         }
24988     }
24989     function_tests++;
24990 
24991     return(test_ret);
24992 }
24993 
24994 
24995 static int
test_xmlURIEscapeStr(void)24996 test_xmlURIEscapeStr(void) {
24997     int test_ret = 0;
24998 
24999     int mem_base;
25000     xmlChar * ret_val;
25001     const xmlChar * str; /* string to escape */
25002     int n_str;
25003     const xmlChar * list; /* exception list string of chars not to escape */
25004     int n_list;
25005 
25006     for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
25007     for (n_list = 0;n_list < gen_nb_const_xmlChar_ptr;n_list++) {
25008         mem_base = xmlMemBlocks();
25009         str = gen_const_xmlChar_ptr(n_str, 0);
25010         list = gen_const_xmlChar_ptr(n_list, 1);
25011 
25012         ret_val = xmlURIEscapeStr(str, list);
25013         desret_xmlChar_ptr(ret_val);
25014         call_tests++;
25015         des_const_xmlChar_ptr(n_str, str, 0);
25016         des_const_xmlChar_ptr(n_list, list, 1);
25017         xmlResetLastError();
25018         if (mem_base != xmlMemBlocks()) {
25019             printf("Leak of %d blocks found in xmlURIEscapeStr",
25020 	           xmlMemBlocks() - mem_base);
25021 	    test_ret++;
25022             printf(" %d", n_str);
25023             printf(" %d", n_list);
25024             printf("\n");
25025         }
25026     }
25027     }
25028     function_tests++;
25029 
25030     return(test_ret);
25031 }
25032 
25033 
25034 static int
test_xmlURIUnescapeString(void)25035 test_xmlURIUnescapeString(void) {
25036     int test_ret = 0;
25037 
25038 
25039     /* missing type support */
25040     return(test_ret);
25041 }
25042 
25043 static int
test_uri(void)25044 test_uri(void) {
25045     int test_ret = 0;
25046 
25047     if (quiet == 0) printf("Testing uri : 13 of 18 functions ...\n");
25048     test_ret += test_xmlBuildRelativeURI();
25049     test_ret += test_xmlBuildRelativeURISafe();
25050     test_ret += test_xmlBuildURI();
25051     test_ret += test_xmlBuildURISafe();
25052     test_ret += test_xmlCanonicPath();
25053     test_ret += test_xmlCreateURI();
25054     test_ret += test_xmlNormalizeURIPath();
25055     test_ret += test_xmlParseURI();
25056     test_ret += test_xmlParseURIRaw();
25057     test_ret += test_xmlParseURIReference();
25058     test_ret += test_xmlParseURISafe();
25059     test_ret += test_xmlPathToURI();
25060     test_ret += test_xmlPrintURI();
25061     test_ret += test_xmlSaveUri();
25062     test_ret += test_xmlURIEscape();
25063     test_ret += test_xmlURIEscapeStr();
25064     test_ret += test_xmlURIUnescapeString();
25065 
25066     if (test_ret != 0)
25067 	printf("Module uri: %d errors\n", test_ret);
25068     return(test_ret);
25069 }
25070 
25071 static int
test_xmlAddAttributeDecl(void)25072 test_xmlAddAttributeDecl(void) {
25073     int test_ret = 0;
25074 
25075     int mem_base;
25076     xmlAttributePtr ret_val;
25077     xmlValidCtxtPtr ctxt; /* the validation context */
25078     int n_ctxt;
25079     xmlDtdPtr dtd; /* pointer to the DTD */
25080     int n_dtd;
25081     const xmlChar * elem; /* the element name */
25082     int n_elem;
25083     const xmlChar * name; /* the attribute name */
25084     int n_name;
25085     const xmlChar * ns; /* the attribute namespace prefix */
25086     int n_ns;
25087     xmlAttributeType type; /* the attribute type */
25088     int n_type;
25089     xmlAttributeDefault def; /* the attribute default type */
25090     int n_def;
25091     const xmlChar * defaultValue; /* the attribute default value */
25092     int n_defaultValue;
25093     xmlEnumerationPtr tree; /* if it's an enumeration, the associated list */
25094     int n_tree;
25095 
25096     for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25097     for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
25098     for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) {
25099     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
25100     for (n_ns = 0;n_ns < gen_nb_const_xmlChar_ptr;n_ns++) {
25101     for (n_type = 0;n_type < gen_nb_xmlAttributeType;n_type++) {
25102     for (n_def = 0;n_def < gen_nb_xmlAttributeDefault;n_def++) {
25103     for (n_defaultValue = 0;n_defaultValue < gen_nb_const_xmlChar_ptr;n_defaultValue++) {
25104     for (n_tree = 0;n_tree < gen_nb_xmlEnumerationPtr;n_tree++) {
25105         mem_base = xmlMemBlocks();
25106         ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25107         dtd = gen_xmlDtdPtr(n_dtd, 1);
25108         elem = gen_const_xmlChar_ptr(n_elem, 2);
25109         name = gen_const_xmlChar_ptr(n_name, 3);
25110         ns = gen_const_xmlChar_ptr(n_ns, 4);
25111         type = gen_xmlAttributeType(n_type, 5);
25112         def = gen_xmlAttributeDefault(n_def, 6);
25113         defaultValue = gen_const_xmlChar_ptr(n_defaultValue, 7);
25114         tree = gen_xmlEnumerationPtr(n_tree, 8);
25115 
25116         ret_val = xmlAddAttributeDecl(ctxt, dtd, elem, name, ns, type, def, defaultValue, tree);
25117         desret_xmlAttributePtr(ret_val);
25118         call_tests++;
25119         des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25120         des_xmlDtdPtr(n_dtd, dtd, 1);
25121         des_const_xmlChar_ptr(n_elem, elem, 2);
25122         des_const_xmlChar_ptr(n_name, name, 3);
25123         des_const_xmlChar_ptr(n_ns, ns, 4);
25124         des_xmlAttributeType(n_type, type, 5);
25125         des_xmlAttributeDefault(n_def, def, 6);
25126         des_const_xmlChar_ptr(n_defaultValue, defaultValue, 7);
25127         des_xmlEnumerationPtr(n_tree, tree, 8);
25128         xmlResetLastError();
25129         if (mem_base != xmlMemBlocks()) {
25130             printf("Leak of %d blocks found in xmlAddAttributeDecl",
25131 	           xmlMemBlocks() - mem_base);
25132 	    test_ret++;
25133             printf(" %d", n_ctxt);
25134             printf(" %d", n_dtd);
25135             printf(" %d", n_elem);
25136             printf(" %d", n_name);
25137             printf(" %d", n_ns);
25138             printf(" %d", n_type);
25139             printf(" %d", n_def);
25140             printf(" %d", n_defaultValue);
25141             printf(" %d", n_tree);
25142             printf("\n");
25143         }
25144     }
25145     }
25146     }
25147     }
25148     }
25149     }
25150     }
25151     }
25152     }
25153     function_tests++;
25154 
25155     return(test_ret);
25156 }
25157 
25158 
25159 static int
test_xmlAddElementDecl(void)25160 test_xmlAddElementDecl(void) {
25161     int test_ret = 0;
25162 
25163     int mem_base;
25164     xmlElementPtr ret_val;
25165     xmlValidCtxtPtr ctxt; /* the validation context */
25166     int n_ctxt;
25167     xmlDtdPtr dtd; /* pointer to the DTD */
25168     int n_dtd;
25169     const xmlChar * name; /* the entity name */
25170     int n_name;
25171     xmlElementTypeVal type; /* the element type */
25172     int n_type;
25173     xmlElementContentPtr content; /* the element content tree or NULL */
25174     int n_content;
25175 
25176     for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25177     for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
25178     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
25179     for (n_type = 0;n_type < gen_nb_xmlElementTypeVal;n_type++) {
25180     for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) {
25181         mem_base = xmlMemBlocks();
25182         ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25183         dtd = gen_xmlDtdPtr(n_dtd, 1);
25184         name = gen_const_xmlChar_ptr(n_name, 2);
25185         type = gen_xmlElementTypeVal(n_type, 3);
25186         content = gen_xmlElementContentPtr(n_content, 4);
25187 
25188         ret_val = xmlAddElementDecl(ctxt, dtd, name, type, content);
25189         desret_xmlElementPtr(ret_val);
25190         call_tests++;
25191         des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25192         des_xmlDtdPtr(n_dtd, dtd, 1);
25193         des_const_xmlChar_ptr(n_name, name, 2);
25194         des_xmlElementTypeVal(n_type, type, 3);
25195         des_xmlElementContentPtr(n_content, content, 4);
25196         xmlResetLastError();
25197         if (mem_base != xmlMemBlocks()) {
25198             printf("Leak of %d blocks found in xmlAddElementDecl",
25199 	           xmlMemBlocks() - mem_base);
25200 	    test_ret++;
25201             printf(" %d", n_ctxt);
25202             printf(" %d", n_dtd);
25203             printf(" %d", n_name);
25204             printf(" %d", n_type);
25205             printf(" %d", n_content);
25206             printf("\n");
25207         }
25208     }
25209     }
25210     }
25211     }
25212     }
25213     function_tests++;
25214 
25215     return(test_ret);
25216 }
25217 
25218 
25219 static int
test_xmlAddID(void)25220 test_xmlAddID(void) {
25221     int test_ret = 0;
25222 
25223 
25224     /* missing type support */
25225     return(test_ret);
25226 }
25227 
25228 
25229 static int
test_xmlAddIDSafe(void)25230 test_xmlAddIDSafe(void) {
25231     int test_ret = 0;
25232 
25233     int mem_base;
25234     int ret_val;
25235     xmlAttrPtr attr; /* the attribute holding the ID */
25236     int n_attr;
25237     const xmlChar * value; /* the attribute (ID) value */
25238     int n_value;
25239 
25240     for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
25241     for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25242         mem_base = xmlMemBlocks();
25243         attr = gen_xmlAttrPtr(n_attr, 0);
25244         value = gen_const_xmlChar_ptr(n_value, 1);
25245 
25246         ret_val = xmlAddIDSafe(attr, value);
25247         desret_int(ret_val);
25248         call_tests++;
25249         des_xmlAttrPtr(n_attr, attr, 0);
25250         des_const_xmlChar_ptr(n_value, value, 1);
25251         xmlResetLastError();
25252         if (mem_base != xmlMemBlocks()) {
25253             printf("Leak of %d blocks found in xmlAddIDSafe",
25254 	           xmlMemBlocks() - mem_base);
25255 	    test_ret++;
25256             printf(" %d", n_attr);
25257             printf(" %d", n_value);
25258             printf("\n");
25259         }
25260     }
25261     }
25262     function_tests++;
25263 
25264     return(test_ret);
25265 }
25266 
25267 
25268 static int
test_xmlAddNotationDecl(void)25269 test_xmlAddNotationDecl(void) {
25270     int test_ret = 0;
25271 
25272 
25273     /* missing type support */
25274     return(test_ret);
25275 }
25276 
25277 
25278 static int
test_xmlAddRef(void)25279 test_xmlAddRef(void) {
25280     int test_ret = 0;
25281 
25282 
25283     /* missing type support */
25284     return(test_ret);
25285 }
25286 
25287 
25288 static int
test_xmlCopyAttributeTable(void)25289 test_xmlCopyAttributeTable(void) {
25290     int test_ret = 0;
25291 
25292 
25293     /* missing type support */
25294     return(test_ret);
25295 }
25296 
25297 
25298 static int
test_xmlCopyDocElementContent(void)25299 test_xmlCopyDocElementContent(void) {
25300     int test_ret = 0;
25301 
25302     int mem_base;
25303     xmlElementContentPtr ret_val;
25304     xmlDocPtr doc; /* the document owning the element declaration */
25305     int n_doc;
25306     xmlElementContentPtr cur; /* An element content pointer. */
25307     int n_cur;
25308 
25309     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25310     for (n_cur = 0;n_cur < gen_nb_xmlElementContentPtr;n_cur++) {
25311         mem_base = xmlMemBlocks();
25312         doc = gen_xmlDocPtr(n_doc, 0);
25313         cur = gen_xmlElementContentPtr(n_cur, 1);
25314 
25315         ret_val = xmlCopyDocElementContent(doc, cur);
25316         desret_xmlElementContentPtr(ret_val);
25317         call_tests++;
25318         des_xmlDocPtr(n_doc, doc, 0);
25319         des_xmlElementContentPtr(n_cur, cur, 1);
25320         xmlResetLastError();
25321         if (mem_base != xmlMemBlocks()) {
25322             printf("Leak of %d blocks found in xmlCopyDocElementContent",
25323 	           xmlMemBlocks() - mem_base);
25324 	    test_ret++;
25325             printf(" %d", n_doc);
25326             printf(" %d", n_cur);
25327             printf("\n");
25328         }
25329     }
25330     }
25331     function_tests++;
25332 
25333     return(test_ret);
25334 }
25335 
25336 
25337 static int
test_xmlCopyElementContent(void)25338 test_xmlCopyElementContent(void) {
25339     int test_ret = 0;
25340 
25341     int mem_base;
25342     xmlElementContentPtr ret_val;
25343     xmlElementContentPtr cur; /* An element content pointer. */
25344     int n_cur;
25345 
25346     for (n_cur = 0;n_cur < gen_nb_xmlElementContentPtr;n_cur++) {
25347         mem_base = xmlMemBlocks();
25348         cur = gen_xmlElementContentPtr(n_cur, 0);
25349 
25350         ret_val = xmlCopyElementContent(cur);
25351         desret_xmlElementContentPtr(ret_val);
25352         call_tests++;
25353         des_xmlElementContentPtr(n_cur, cur, 0);
25354         xmlResetLastError();
25355         if (mem_base != xmlMemBlocks()) {
25356             printf("Leak of %d blocks found in xmlCopyElementContent",
25357 	           xmlMemBlocks() - mem_base);
25358 	    test_ret++;
25359             printf(" %d", n_cur);
25360             printf("\n");
25361         }
25362     }
25363     function_tests++;
25364 
25365     return(test_ret);
25366 }
25367 
25368 
25369 static int
test_xmlCopyElementTable(void)25370 test_xmlCopyElementTable(void) {
25371     int test_ret = 0;
25372 
25373 
25374     /* missing type support */
25375     return(test_ret);
25376 }
25377 
25378 
25379 static int
test_xmlCopyEnumeration(void)25380 test_xmlCopyEnumeration(void) {
25381     int test_ret = 0;
25382 
25383 
25384     /* missing type support */
25385     return(test_ret);
25386 }
25387 
25388 
25389 static int
test_xmlCopyNotationTable(void)25390 test_xmlCopyNotationTable(void) {
25391     int test_ret = 0;
25392 
25393 
25394     /* missing type support */
25395     return(test_ret);
25396 }
25397 
25398 
25399 static int
test_xmlCreateEnumeration(void)25400 test_xmlCreateEnumeration(void) {
25401     int test_ret = 0;
25402 
25403 
25404     /* missing type support */
25405     return(test_ret);
25406 }
25407 
25408 
25409 #define gen_nb_xmlAttributePtr 1
25410 #define gen_xmlAttributePtr(no, nr) NULL
25411 #define des_xmlAttributePtr(no, val, nr)
25412 
25413 static int
test_xmlDumpAttributeDecl(void)25414 test_xmlDumpAttributeDecl(void) {
25415     int test_ret = 0;
25416 
25417 #if defined(LIBXML_OUTPUT_ENABLED)
25418     int mem_base;
25419     xmlBufferPtr buf; /* the XML buffer output */
25420     int n_buf;
25421     xmlAttributePtr attr; /* An attribute declaration */
25422     int n_attr;
25423 
25424     for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
25425     for (n_attr = 0;n_attr < gen_nb_xmlAttributePtr;n_attr++) {
25426         mem_base = xmlMemBlocks();
25427         buf = gen_xmlBufferPtr(n_buf, 0);
25428         attr = gen_xmlAttributePtr(n_attr, 1);
25429 
25430         xmlDumpAttributeDecl(buf, attr);
25431         call_tests++;
25432         des_xmlBufferPtr(n_buf, buf, 0);
25433         des_xmlAttributePtr(n_attr, attr, 1);
25434         xmlResetLastError();
25435         if (mem_base != xmlMemBlocks()) {
25436             printf("Leak of %d blocks found in xmlDumpAttributeDecl",
25437 	           xmlMemBlocks() - mem_base);
25438 	    test_ret++;
25439             printf(" %d", n_buf);
25440             printf(" %d", n_attr);
25441             printf("\n");
25442         }
25443     }
25444     }
25445     function_tests++;
25446 #endif
25447 
25448     return(test_ret);
25449 }
25450 
25451 
25452 #define gen_nb_xmlAttributeTablePtr 1
25453 #define gen_xmlAttributeTablePtr(no, nr) NULL
25454 #define des_xmlAttributeTablePtr(no, val, nr)
25455 
25456 static int
test_xmlDumpAttributeTable(void)25457 test_xmlDumpAttributeTable(void) {
25458     int test_ret = 0;
25459 
25460 #if defined(LIBXML_OUTPUT_ENABLED)
25461     int mem_base;
25462     xmlBufferPtr buf; /* the XML buffer output */
25463     int n_buf;
25464     xmlAttributeTablePtr table; /* An attribute table */
25465     int n_table;
25466 
25467     for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
25468     for (n_table = 0;n_table < gen_nb_xmlAttributeTablePtr;n_table++) {
25469         mem_base = xmlMemBlocks();
25470         buf = gen_xmlBufferPtr(n_buf, 0);
25471         table = gen_xmlAttributeTablePtr(n_table, 1);
25472 
25473         xmlDumpAttributeTable(buf, table);
25474         call_tests++;
25475         des_xmlBufferPtr(n_buf, buf, 0);
25476         des_xmlAttributeTablePtr(n_table, table, 1);
25477         xmlResetLastError();
25478         if (mem_base != xmlMemBlocks()) {
25479             printf("Leak of %d blocks found in xmlDumpAttributeTable",
25480 	           xmlMemBlocks() - mem_base);
25481 	    test_ret++;
25482             printf(" %d", n_buf);
25483             printf(" %d", n_table);
25484             printf("\n");
25485         }
25486     }
25487     }
25488     function_tests++;
25489 #endif
25490 
25491     return(test_ret);
25492 }
25493 
25494 
25495 #define gen_nb_xmlElementPtr 1
25496 #define gen_xmlElementPtr(no, nr) NULL
25497 #define des_xmlElementPtr(no, val, nr)
25498 
25499 static int
test_xmlDumpElementDecl(void)25500 test_xmlDumpElementDecl(void) {
25501     int test_ret = 0;
25502 
25503 #if defined(LIBXML_OUTPUT_ENABLED)
25504     int mem_base;
25505     xmlBufferPtr buf; /* the XML buffer output */
25506     int n_buf;
25507     xmlElementPtr elem; /* An element table */
25508     int n_elem;
25509 
25510     for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
25511     for (n_elem = 0;n_elem < gen_nb_xmlElementPtr;n_elem++) {
25512         mem_base = xmlMemBlocks();
25513         buf = gen_xmlBufferPtr(n_buf, 0);
25514         elem = gen_xmlElementPtr(n_elem, 1);
25515 
25516         xmlDumpElementDecl(buf, elem);
25517         call_tests++;
25518         des_xmlBufferPtr(n_buf, buf, 0);
25519         des_xmlElementPtr(n_elem, elem, 1);
25520         xmlResetLastError();
25521         if (mem_base != xmlMemBlocks()) {
25522             printf("Leak of %d blocks found in xmlDumpElementDecl",
25523 	           xmlMemBlocks() - mem_base);
25524 	    test_ret++;
25525             printf(" %d", n_buf);
25526             printf(" %d", n_elem);
25527             printf("\n");
25528         }
25529     }
25530     }
25531     function_tests++;
25532 #endif
25533 
25534     return(test_ret);
25535 }
25536 
25537 
25538 #define gen_nb_xmlElementTablePtr 1
25539 #define gen_xmlElementTablePtr(no, nr) NULL
25540 #define des_xmlElementTablePtr(no, val, nr)
25541 
25542 static int
test_xmlDumpElementTable(void)25543 test_xmlDumpElementTable(void) {
25544     int test_ret = 0;
25545 
25546 #if defined(LIBXML_OUTPUT_ENABLED)
25547     int mem_base;
25548     xmlBufferPtr buf; /* the XML buffer output */
25549     int n_buf;
25550     xmlElementTablePtr table; /* An element table */
25551     int n_table;
25552 
25553     for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
25554     for (n_table = 0;n_table < gen_nb_xmlElementTablePtr;n_table++) {
25555         mem_base = xmlMemBlocks();
25556         buf = gen_xmlBufferPtr(n_buf, 0);
25557         table = gen_xmlElementTablePtr(n_table, 1);
25558 
25559         xmlDumpElementTable(buf, table);
25560         call_tests++;
25561         des_xmlBufferPtr(n_buf, buf, 0);
25562         des_xmlElementTablePtr(n_table, table, 1);
25563         xmlResetLastError();
25564         if (mem_base != xmlMemBlocks()) {
25565             printf("Leak of %d blocks found in xmlDumpElementTable",
25566 	           xmlMemBlocks() - mem_base);
25567 	    test_ret++;
25568             printf(" %d", n_buf);
25569             printf(" %d", n_table);
25570             printf("\n");
25571         }
25572     }
25573     }
25574     function_tests++;
25575 #endif
25576 
25577     return(test_ret);
25578 }
25579 
25580 
25581 #define gen_nb_xmlNotationPtr 1
25582 #define gen_xmlNotationPtr(no, nr) NULL
25583 #define des_xmlNotationPtr(no, val, nr)
25584 
25585 static int
test_xmlDumpNotationDecl(void)25586 test_xmlDumpNotationDecl(void) {
25587     int test_ret = 0;
25588 
25589 #if defined(LIBXML_OUTPUT_ENABLED)
25590     int mem_base;
25591     xmlBufferPtr buf; /* the XML buffer output */
25592     int n_buf;
25593     xmlNotationPtr nota; /* A notation declaration */
25594     int n_nota;
25595 
25596     for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
25597     for (n_nota = 0;n_nota < gen_nb_xmlNotationPtr;n_nota++) {
25598         mem_base = xmlMemBlocks();
25599         buf = gen_xmlBufferPtr(n_buf, 0);
25600         nota = gen_xmlNotationPtr(n_nota, 1);
25601 
25602         xmlDumpNotationDecl(buf, nota);
25603         call_tests++;
25604         des_xmlBufferPtr(n_buf, buf, 0);
25605         des_xmlNotationPtr(n_nota, nota, 1);
25606         xmlResetLastError();
25607         if (mem_base != xmlMemBlocks()) {
25608             printf("Leak of %d blocks found in xmlDumpNotationDecl",
25609 	           xmlMemBlocks() - mem_base);
25610 	    test_ret++;
25611             printf(" %d", n_buf);
25612             printf(" %d", n_nota);
25613             printf("\n");
25614         }
25615     }
25616     }
25617     function_tests++;
25618 #endif
25619 
25620     return(test_ret);
25621 }
25622 
25623 
25624 #define gen_nb_xmlNotationTablePtr 1
25625 #define gen_xmlNotationTablePtr(no, nr) NULL
25626 #define des_xmlNotationTablePtr(no, val, nr)
25627 
25628 static int
test_xmlDumpNotationTable(void)25629 test_xmlDumpNotationTable(void) {
25630     int test_ret = 0;
25631 
25632 #if defined(LIBXML_OUTPUT_ENABLED)
25633     int mem_base;
25634     xmlBufferPtr buf; /* the XML buffer output */
25635     int n_buf;
25636     xmlNotationTablePtr table; /* A notation table */
25637     int n_table;
25638 
25639     for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
25640     for (n_table = 0;n_table < gen_nb_xmlNotationTablePtr;n_table++) {
25641         mem_base = xmlMemBlocks();
25642         buf = gen_xmlBufferPtr(n_buf, 0);
25643         table = gen_xmlNotationTablePtr(n_table, 1);
25644 
25645         xmlDumpNotationTable(buf, table);
25646         call_tests++;
25647         des_xmlBufferPtr(n_buf, buf, 0);
25648         des_xmlNotationTablePtr(n_table, table, 1);
25649         xmlResetLastError();
25650         if (mem_base != xmlMemBlocks()) {
25651             printf("Leak of %d blocks found in xmlDumpNotationTable",
25652 	           xmlMemBlocks() - mem_base);
25653 	    test_ret++;
25654             printf(" %d", n_buf);
25655             printf(" %d", n_table);
25656             printf("\n");
25657         }
25658     }
25659     }
25660     function_tests++;
25661 #endif
25662 
25663     return(test_ret);
25664 }
25665 
25666 
25667 static int
test_xmlGetDtdAttrDesc(void)25668 test_xmlGetDtdAttrDesc(void) {
25669     int test_ret = 0;
25670 
25671     int mem_base;
25672     xmlAttributePtr ret_val;
25673     xmlDtdPtr dtd; /* a pointer to the DtD to search */
25674     int n_dtd;
25675     const xmlChar * elem; /* the element name */
25676     int n_elem;
25677     const xmlChar * name; /* the attribute name */
25678     int n_name;
25679 
25680     for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
25681     for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) {
25682     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
25683         mem_base = xmlMemBlocks();
25684         dtd = gen_xmlDtdPtr(n_dtd, 0);
25685         elem = gen_const_xmlChar_ptr(n_elem, 1);
25686         name = gen_const_xmlChar_ptr(n_name, 2);
25687 
25688         ret_val = xmlGetDtdAttrDesc(dtd, elem, name);
25689         desret_xmlAttributePtr(ret_val);
25690         call_tests++;
25691         des_xmlDtdPtr(n_dtd, dtd, 0);
25692         des_const_xmlChar_ptr(n_elem, elem, 1);
25693         des_const_xmlChar_ptr(n_name, name, 2);
25694         xmlResetLastError();
25695         if (mem_base != xmlMemBlocks()) {
25696             printf("Leak of %d blocks found in xmlGetDtdAttrDesc",
25697 	           xmlMemBlocks() - mem_base);
25698 	    test_ret++;
25699             printf(" %d", n_dtd);
25700             printf(" %d", n_elem);
25701             printf(" %d", n_name);
25702             printf("\n");
25703         }
25704     }
25705     }
25706     }
25707     function_tests++;
25708 
25709     return(test_ret);
25710 }
25711 
25712 
25713 static int
test_xmlGetDtdElementDesc(void)25714 test_xmlGetDtdElementDesc(void) {
25715     int test_ret = 0;
25716 
25717     int mem_base;
25718     xmlElementPtr ret_val;
25719     xmlDtdPtr dtd; /* a pointer to the DtD to search */
25720     int n_dtd;
25721     const xmlChar * name; /* the element name */
25722     int n_name;
25723 
25724     for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
25725     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
25726         mem_base = xmlMemBlocks();
25727         dtd = gen_xmlDtdPtr(n_dtd, 0);
25728         name = gen_const_xmlChar_ptr(n_name, 1);
25729 
25730         ret_val = xmlGetDtdElementDesc(dtd, name);
25731         desret_xmlElementPtr(ret_val);
25732         call_tests++;
25733         des_xmlDtdPtr(n_dtd, dtd, 0);
25734         des_const_xmlChar_ptr(n_name, name, 1);
25735         xmlResetLastError();
25736         if (mem_base != xmlMemBlocks()) {
25737             printf("Leak of %d blocks found in xmlGetDtdElementDesc",
25738 	           xmlMemBlocks() - mem_base);
25739 	    test_ret++;
25740             printf(" %d", n_dtd);
25741             printf(" %d", n_name);
25742             printf("\n");
25743         }
25744     }
25745     }
25746     function_tests++;
25747 
25748     return(test_ret);
25749 }
25750 
25751 
25752 static int
test_xmlGetDtdNotationDesc(void)25753 test_xmlGetDtdNotationDesc(void) {
25754     int test_ret = 0;
25755 
25756 
25757     /* missing type support */
25758     return(test_ret);
25759 }
25760 
25761 
25762 static int
test_xmlGetDtdQAttrDesc(void)25763 test_xmlGetDtdQAttrDesc(void) {
25764     int test_ret = 0;
25765 
25766     int mem_base;
25767     xmlAttributePtr ret_val;
25768     xmlDtdPtr dtd; /* a pointer to the DtD to search */
25769     int n_dtd;
25770     const xmlChar * elem; /* the element name */
25771     int n_elem;
25772     const xmlChar * name; /* the attribute name */
25773     int n_name;
25774     const xmlChar * prefix; /* the attribute namespace prefix */
25775     int n_prefix;
25776 
25777     for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
25778     for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) {
25779     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
25780     for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
25781         mem_base = xmlMemBlocks();
25782         dtd = gen_xmlDtdPtr(n_dtd, 0);
25783         elem = gen_const_xmlChar_ptr(n_elem, 1);
25784         name = gen_const_xmlChar_ptr(n_name, 2);
25785         prefix = gen_const_xmlChar_ptr(n_prefix, 3);
25786 
25787         ret_val = xmlGetDtdQAttrDesc(dtd, elem, name, prefix);
25788         desret_xmlAttributePtr(ret_val);
25789         call_tests++;
25790         des_xmlDtdPtr(n_dtd, dtd, 0);
25791         des_const_xmlChar_ptr(n_elem, elem, 1);
25792         des_const_xmlChar_ptr(n_name, name, 2);
25793         des_const_xmlChar_ptr(n_prefix, prefix, 3);
25794         xmlResetLastError();
25795         if (mem_base != xmlMemBlocks()) {
25796             printf("Leak of %d blocks found in xmlGetDtdQAttrDesc",
25797 	           xmlMemBlocks() - mem_base);
25798 	    test_ret++;
25799             printf(" %d", n_dtd);
25800             printf(" %d", n_elem);
25801             printf(" %d", n_name);
25802             printf(" %d", n_prefix);
25803             printf("\n");
25804         }
25805     }
25806     }
25807     }
25808     }
25809     function_tests++;
25810 
25811     return(test_ret);
25812 }
25813 
25814 
25815 static int
test_xmlGetDtdQElementDesc(void)25816 test_xmlGetDtdQElementDesc(void) {
25817     int test_ret = 0;
25818 
25819     int mem_base;
25820     xmlElementPtr ret_val;
25821     xmlDtdPtr dtd; /* a pointer to the DtD to search */
25822     int n_dtd;
25823     const xmlChar * name; /* the element name */
25824     int n_name;
25825     const xmlChar * prefix; /* the element namespace prefix */
25826     int n_prefix;
25827 
25828     for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
25829     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
25830     for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
25831         mem_base = xmlMemBlocks();
25832         dtd = gen_xmlDtdPtr(n_dtd, 0);
25833         name = gen_const_xmlChar_ptr(n_name, 1);
25834         prefix = gen_const_xmlChar_ptr(n_prefix, 2);
25835 
25836         ret_val = xmlGetDtdQElementDesc(dtd, name, prefix);
25837         desret_xmlElementPtr(ret_val);
25838         call_tests++;
25839         des_xmlDtdPtr(n_dtd, dtd, 0);
25840         des_const_xmlChar_ptr(n_name, name, 1);
25841         des_const_xmlChar_ptr(n_prefix, prefix, 2);
25842         xmlResetLastError();
25843         if (mem_base != xmlMemBlocks()) {
25844             printf("Leak of %d blocks found in xmlGetDtdQElementDesc",
25845 	           xmlMemBlocks() - mem_base);
25846 	    test_ret++;
25847             printf(" %d", n_dtd);
25848             printf(" %d", n_name);
25849             printf(" %d", n_prefix);
25850             printf("\n");
25851         }
25852     }
25853     }
25854     }
25855     function_tests++;
25856 
25857     return(test_ret);
25858 }
25859 
25860 
25861 static int
test_xmlGetID(void)25862 test_xmlGetID(void) {
25863     int test_ret = 0;
25864 
25865     int mem_base;
25866     xmlAttrPtr ret_val;
25867     xmlDocPtr doc; /* pointer to the document */
25868     int n_doc;
25869     const xmlChar * ID; /* the ID value */
25870     int n_ID;
25871 
25872     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25873     for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) {
25874         mem_base = xmlMemBlocks();
25875         doc = gen_xmlDocPtr(n_doc, 0);
25876         ID = gen_const_xmlChar_ptr(n_ID, 1);
25877 
25878         ret_val = xmlGetID(doc, ID);
25879         desret_xmlAttrPtr(ret_val);
25880         call_tests++;
25881         des_xmlDocPtr(n_doc, doc, 0);
25882         des_const_xmlChar_ptr(n_ID, ID, 1);
25883         xmlResetLastError();
25884         if (mem_base != xmlMemBlocks()) {
25885             printf("Leak of %d blocks found in xmlGetID",
25886 	           xmlMemBlocks() - mem_base);
25887 	    test_ret++;
25888             printf(" %d", n_doc);
25889             printf(" %d", n_ID);
25890             printf("\n");
25891         }
25892     }
25893     }
25894     function_tests++;
25895 
25896     return(test_ret);
25897 }
25898 
25899 
25900 static int
test_xmlGetRefs(void)25901 test_xmlGetRefs(void) {
25902     int test_ret = 0;
25903 
25904 
25905     /* missing type support */
25906     return(test_ret);
25907 }
25908 
25909 
25910 static int
test_xmlIsID(void)25911 test_xmlIsID(void) {
25912     int test_ret = 0;
25913 
25914     int mem_base;
25915     int ret_val;
25916     xmlDocPtr doc; /* the document */
25917     int n_doc;
25918     xmlNodePtr elem; /* the element carrying the attribute */
25919     int n_elem;
25920     xmlAttrPtr attr; /* the attribute */
25921     int n_attr;
25922 
25923     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25924     for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25925     for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
25926         mem_base = xmlMemBlocks();
25927         doc = gen_xmlDocPtr(n_doc, 0);
25928         elem = gen_xmlNodePtr(n_elem, 1);
25929         attr = gen_xmlAttrPtr(n_attr, 2);
25930 
25931         ret_val = xmlIsID(doc, elem, attr);
25932         desret_int(ret_val);
25933         call_tests++;
25934         des_xmlDocPtr(n_doc, doc, 0);
25935         des_xmlNodePtr(n_elem, elem, 1);
25936         des_xmlAttrPtr(n_attr, attr, 2);
25937         xmlResetLastError();
25938         if (mem_base != xmlMemBlocks()) {
25939             printf("Leak of %d blocks found in xmlIsID",
25940 	           xmlMemBlocks() - mem_base);
25941 	    test_ret++;
25942             printf(" %d", n_doc);
25943             printf(" %d", n_elem);
25944             printf(" %d", n_attr);
25945             printf("\n");
25946         }
25947     }
25948     }
25949     }
25950     function_tests++;
25951 
25952     return(test_ret);
25953 }
25954 
25955 
25956 static int
test_xmlIsMixedElement(void)25957 test_xmlIsMixedElement(void) {
25958     int test_ret = 0;
25959 
25960     int mem_base;
25961     int ret_val;
25962     xmlDocPtr doc; /* the document */
25963     int n_doc;
25964     const xmlChar * name; /* the element name */
25965     int n_name;
25966 
25967     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25968     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
25969         mem_base = xmlMemBlocks();
25970         doc = gen_xmlDocPtr(n_doc, 0);
25971         name = gen_const_xmlChar_ptr(n_name, 1);
25972 
25973         ret_val = xmlIsMixedElement(doc, name);
25974         desret_int(ret_val);
25975         call_tests++;
25976         des_xmlDocPtr(n_doc, doc, 0);
25977         des_const_xmlChar_ptr(n_name, name, 1);
25978         xmlResetLastError();
25979         if (mem_base != xmlMemBlocks()) {
25980             printf("Leak of %d blocks found in xmlIsMixedElement",
25981 	           xmlMemBlocks() - mem_base);
25982 	    test_ret++;
25983             printf(" %d", n_doc);
25984             printf(" %d", n_name);
25985             printf("\n");
25986         }
25987     }
25988     }
25989     function_tests++;
25990 
25991     return(test_ret);
25992 }
25993 
25994 
25995 static int
test_xmlIsRef(void)25996 test_xmlIsRef(void) {
25997     int test_ret = 0;
25998 
25999     int mem_base;
26000     int ret_val;
26001     xmlDocPtr doc; /* the document */
26002     int n_doc;
26003     xmlNodePtr elem; /* the element carrying the attribute */
26004     int n_elem;
26005     xmlAttrPtr attr; /* the attribute */
26006     int n_attr;
26007 
26008     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
26009     for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
26010     for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
26011         mem_base = xmlMemBlocks();
26012         doc = gen_xmlDocPtr(n_doc, 0);
26013         elem = gen_xmlNodePtr(n_elem, 1);
26014         attr = gen_xmlAttrPtr(n_attr, 2);
26015 
26016         ret_val = xmlIsRef(doc, elem, attr);
26017         desret_int(ret_val);
26018         call_tests++;
26019         des_xmlDocPtr(n_doc, doc, 0);
26020         des_xmlNodePtr(n_elem, elem, 1);
26021         des_xmlAttrPtr(n_attr, attr, 2);
26022         xmlResetLastError();
26023         if (mem_base != xmlMemBlocks()) {
26024             printf("Leak of %d blocks found in xmlIsRef",
26025 	           xmlMemBlocks() - mem_base);
26026 	    test_ret++;
26027             printf(" %d", n_doc);
26028             printf(" %d", n_elem);
26029             printf(" %d", n_attr);
26030             printf("\n");
26031         }
26032     }
26033     }
26034     }
26035     function_tests++;
26036 
26037     return(test_ret);
26038 }
26039 
26040 
26041 static int
test_xmlNewDocElementContent(void)26042 test_xmlNewDocElementContent(void) {
26043     int test_ret = 0;
26044 
26045     int mem_base;
26046     xmlElementContentPtr ret_val;
26047     xmlDocPtr doc; /* the document */
26048     int n_doc;
26049     const xmlChar * name; /* the subelement name or NULL */
26050     int n_name;
26051     xmlElementContentType type; /* the type of element content decl */
26052     int n_type;
26053 
26054     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
26055     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
26056     for (n_type = 0;n_type < gen_nb_xmlElementContentType;n_type++) {
26057         mem_base = xmlMemBlocks();
26058         doc = gen_xmlDocPtr(n_doc, 0);
26059         name = gen_const_xmlChar_ptr(n_name, 1);
26060         type = gen_xmlElementContentType(n_type, 2);
26061 
26062         ret_val = xmlNewDocElementContent(doc, name, type);
26063         xmlFreeDocElementContent(doc, ret_val); ret_val = NULL;
26064         desret_xmlElementContentPtr(ret_val);
26065         call_tests++;
26066         des_xmlDocPtr(n_doc, doc, 0);
26067         des_const_xmlChar_ptr(n_name, name, 1);
26068         des_xmlElementContentType(n_type, type, 2);
26069         xmlResetLastError();
26070         if (mem_base != xmlMemBlocks()) {
26071             printf("Leak of %d blocks found in xmlNewDocElementContent",
26072 	           xmlMemBlocks() - mem_base);
26073 	    test_ret++;
26074             printf(" %d", n_doc);
26075             printf(" %d", n_name);
26076             printf(" %d", n_type);
26077             printf("\n");
26078         }
26079     }
26080     }
26081     }
26082     function_tests++;
26083 
26084     return(test_ret);
26085 }
26086 
26087 
26088 static int
test_xmlNewElementContent(void)26089 test_xmlNewElementContent(void) {
26090     int test_ret = 0;
26091 
26092     int mem_base;
26093     xmlElementContentPtr ret_val;
26094     const xmlChar * name; /* the subelement name or NULL */
26095     int n_name;
26096     xmlElementContentType type; /* the type of element content decl */
26097     int n_type;
26098 
26099     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
26100     for (n_type = 0;n_type < gen_nb_xmlElementContentType;n_type++) {
26101         mem_base = xmlMemBlocks();
26102         name = gen_const_xmlChar_ptr(n_name, 0);
26103         type = gen_xmlElementContentType(n_type, 1);
26104 
26105         ret_val = xmlNewElementContent(name, type);
26106         desret_xmlElementContentPtr(ret_val);
26107         call_tests++;
26108         des_const_xmlChar_ptr(n_name, name, 0);
26109         des_xmlElementContentType(n_type, type, 1);
26110         xmlResetLastError();
26111         if (mem_base != xmlMemBlocks()) {
26112             printf("Leak of %d blocks found in xmlNewElementContent",
26113 	           xmlMemBlocks() - mem_base);
26114 	    test_ret++;
26115             printf(" %d", n_name);
26116             printf(" %d", n_type);
26117             printf("\n");
26118         }
26119     }
26120     }
26121     function_tests++;
26122 
26123     return(test_ret);
26124 }
26125 
26126 
26127 static int
test_xmlNewValidCtxt(void)26128 test_xmlNewValidCtxt(void) {
26129     int test_ret = 0;
26130 
26131 
26132     /* missing type support */
26133     return(test_ret);
26134 }
26135 
26136 
26137 static int
test_xmlRemoveID(void)26138 test_xmlRemoveID(void) {
26139     int test_ret = 0;
26140 
26141     int mem_base;
26142     int ret_val;
26143     xmlDocPtr doc; /* the document */
26144     int n_doc;
26145     xmlAttrPtr attr; /* the attribute */
26146     int n_attr;
26147 
26148     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
26149     for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
26150         mem_base = xmlMemBlocks();
26151         doc = gen_xmlDocPtr(n_doc, 0);
26152         attr = gen_xmlAttrPtr(n_attr, 1);
26153 
26154         ret_val = xmlRemoveID(doc, attr);
26155         desret_int(ret_val);
26156         call_tests++;
26157         des_xmlDocPtr(n_doc, doc, 0);
26158         des_xmlAttrPtr(n_attr, attr, 1);
26159         xmlResetLastError();
26160         if (mem_base != xmlMemBlocks()) {
26161             printf("Leak of %d blocks found in xmlRemoveID",
26162 	           xmlMemBlocks() - mem_base);
26163 	    test_ret++;
26164             printf(" %d", n_doc);
26165             printf(" %d", n_attr);
26166             printf("\n");
26167         }
26168     }
26169     }
26170     function_tests++;
26171 
26172     return(test_ret);
26173 }
26174 
26175 
26176 static int
test_xmlRemoveRef(void)26177 test_xmlRemoveRef(void) {
26178     int test_ret = 0;
26179 
26180     int mem_base;
26181     int ret_val;
26182     xmlDocPtr doc; /* the document */
26183     int n_doc;
26184     xmlAttrPtr attr; /* the attribute */
26185     int n_attr;
26186 
26187     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
26188     for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
26189         mem_base = xmlMemBlocks();
26190         doc = gen_xmlDocPtr(n_doc, 0);
26191         attr = gen_xmlAttrPtr(n_attr, 1);
26192 
26193         ret_val = xmlRemoveRef(doc, attr);
26194         desret_int(ret_val);
26195         call_tests++;
26196         des_xmlDocPtr(n_doc, doc, 0);
26197         des_xmlAttrPtr(n_attr, attr, 1);
26198         xmlResetLastError();
26199         if (mem_base != xmlMemBlocks()) {
26200             printf("Leak of %d blocks found in xmlRemoveRef",
26201 	           xmlMemBlocks() - mem_base);
26202 	    test_ret++;
26203             printf(" %d", n_doc);
26204             printf(" %d", n_attr);
26205             printf("\n");
26206         }
26207     }
26208     }
26209     function_tests++;
26210 
26211     return(test_ret);
26212 }
26213 
26214 
26215 static int
test_xmlSnprintfElementContent(void)26216 test_xmlSnprintfElementContent(void) {
26217     int test_ret = 0;
26218 
26219     int mem_base;
26220     char * buf; /* an output buffer */
26221     int n_buf;
26222     int size; /* the buffer size */
26223     int n_size;
26224     xmlElementContentPtr content; /* An element table */
26225     int n_content;
26226     int englob; /* 1 if one must print the englobing parenthesis, 0 otherwise */
26227     int n_englob;
26228 
26229     for (n_buf = 0;n_buf < gen_nb_char_ptr;n_buf++) {
26230     for (n_size = 0;n_size < gen_nb_int;n_size++) {
26231     for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) {
26232     for (n_englob = 0;n_englob < gen_nb_int;n_englob++) {
26233         mem_base = xmlMemBlocks();
26234         buf = gen_char_ptr(n_buf, 0);
26235         size = gen_int(n_size, 1);
26236         content = gen_xmlElementContentPtr(n_content, 2);
26237         englob = gen_int(n_englob, 3);
26238 
26239         xmlSnprintfElementContent(buf, size, content, englob);
26240         call_tests++;
26241         des_char_ptr(n_buf, buf, 0);
26242         des_int(n_size, size, 1);
26243         des_xmlElementContentPtr(n_content, content, 2);
26244         des_int(n_englob, englob, 3);
26245         xmlResetLastError();
26246         if (mem_base != xmlMemBlocks()) {
26247             printf("Leak of %d blocks found in xmlSnprintfElementContent",
26248 	           xmlMemBlocks() - mem_base);
26249 	    test_ret++;
26250             printf(" %d", n_buf);
26251             printf(" %d", n_size);
26252             printf(" %d", n_content);
26253             printf(" %d", n_englob);
26254             printf("\n");
26255         }
26256     }
26257     }
26258     }
26259     }
26260     function_tests++;
26261 
26262     return(test_ret);
26263 }
26264 
26265 
26266 static int
test_xmlSprintfElementContent(void)26267 test_xmlSprintfElementContent(void) {
26268     int test_ret = 0;
26269 
26270 #if defined(LIBXML_OUTPUT_ENABLED)
26271 #ifdef LIBXML_OUTPUT_ENABLED
26272     int mem_base;
26273     char * buf; /* an output buffer */
26274     int n_buf;
26275     xmlElementContentPtr content; /* An element table */
26276     int n_content;
26277     int englob; /* 1 if one must print the englobing parenthesis, 0 otherwise */
26278     int n_englob;
26279 
26280     for (n_buf = 0;n_buf < gen_nb_char_ptr;n_buf++) {
26281     for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) {
26282     for (n_englob = 0;n_englob < gen_nb_int;n_englob++) {
26283         mem_base = xmlMemBlocks();
26284         buf = gen_char_ptr(n_buf, 0);
26285         content = gen_xmlElementContentPtr(n_content, 1);
26286         englob = gen_int(n_englob, 2);
26287 
26288         xmlSprintfElementContent(buf, content, englob);
26289         call_tests++;
26290         des_char_ptr(n_buf, buf, 0);
26291         des_xmlElementContentPtr(n_content, content, 1);
26292         des_int(n_englob, englob, 2);
26293         xmlResetLastError();
26294         if (mem_base != xmlMemBlocks()) {
26295             printf("Leak of %d blocks found in xmlSprintfElementContent",
26296 	           xmlMemBlocks() - mem_base);
26297 	    test_ret++;
26298             printf(" %d", n_buf);
26299             printf(" %d", n_content);
26300             printf(" %d", n_englob);
26301             printf("\n");
26302         }
26303     }
26304     }
26305     }
26306     function_tests++;
26307 #endif
26308 #endif
26309 
26310     return(test_ret);
26311 }
26312 
26313 
26314 static int
test_xmlValidBuildContentModel(void)26315 test_xmlValidBuildContentModel(void) {
26316     int test_ret = 0;
26317 
26318 #if defined(LIBXML_VALID_ENABLED) && defined(LIBXML_REGEXP_ENABLED)
26319     int mem_base;
26320     int ret_val;
26321     xmlValidCtxtPtr ctxt; /* a validation context */
26322     int n_ctxt;
26323     xmlElementPtr elem; /* an element declaration node */
26324     int n_elem;
26325 
26326     for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
26327     for (n_elem = 0;n_elem < gen_nb_xmlElementPtr;n_elem++) {
26328         mem_base = xmlMemBlocks();
26329         ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
26330         elem = gen_xmlElementPtr(n_elem, 1);
26331 
26332         ret_val = xmlValidBuildContentModel(ctxt, elem);
26333         desret_int(ret_val);
26334         call_tests++;
26335         des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
26336         des_xmlElementPtr(n_elem, elem, 1);
26337         xmlResetLastError();
26338         if (mem_base != xmlMemBlocks()) {
26339             printf("Leak of %d blocks found in xmlValidBuildContentModel",
26340 	           xmlMemBlocks() - mem_base);
26341 	    test_ret++;
26342             printf(" %d", n_ctxt);
26343             printf(" %d", n_elem);
26344             printf("\n");
26345         }
26346     }
26347     }
26348     function_tests++;
26349 #endif
26350 
26351     return(test_ret);
26352 }
26353 
26354 
26355 static int
test_xmlValidCtxtNormalizeAttributeValue(void)26356 test_xmlValidCtxtNormalizeAttributeValue(void) {
26357     int test_ret = 0;
26358 
26359 #if defined(LIBXML_VALID_ENABLED)
26360     int mem_base;
26361     xmlChar * ret_val;
26362     xmlValidCtxtPtr ctxt; /* the validation context or NULL */
26363     int n_ctxt;
26364     xmlDocPtr doc; /* the document */
26365     int n_doc;
26366     xmlNodePtr elem; /* the parent */
26367     int n_elem;
26368     const xmlChar * name; /* the attribute name */
26369     int n_name;
26370     const xmlChar * value; /* the attribute value */
26371     int n_value;
26372 
26373     for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
26374     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
26375     for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
26376     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
26377     for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
26378         mem_base = xmlMemBlocks();
26379         ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
26380         doc = gen_xmlDocPtr(n_doc, 1);
26381         elem = gen_xmlNodePtr(n_elem, 2);
26382         name = gen_const_xmlChar_ptr(n_name, 3);
26383         value = gen_const_xmlChar_ptr(n_value, 4);
26384 
26385         ret_val = xmlValidCtxtNormalizeAttributeValue(ctxt, doc, elem, name, value);
26386         desret_xmlChar_ptr(ret_val);
26387         call_tests++;
26388         des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
26389         des_xmlDocPtr(n_doc, doc, 1);
26390         des_xmlNodePtr(n_elem, elem, 2);
26391         des_const_xmlChar_ptr(n_name, name, 3);
26392         des_const_xmlChar_ptr(n_value, value, 4);
26393         xmlResetLastError();
26394         if (mem_base != xmlMemBlocks()) {
26395             printf("Leak of %d blocks found in xmlValidCtxtNormalizeAttributeValue",
26396 	           xmlMemBlocks() - mem_base);
26397 	    test_ret++;
26398             printf(" %d", n_ctxt);
26399             printf(" %d", n_doc);
26400             printf(" %d", n_elem);
26401             printf(" %d", n_name);
26402             printf(" %d", n_value);
26403             printf("\n");
26404         }
26405     }
26406     }
26407     }
26408     }
26409     }
26410     function_tests++;
26411 #endif
26412 
26413     return(test_ret);
26414 }
26415 
26416 
26417 #define gen_nb_xmlElementContent_ptr 1
26418 #define gen_xmlElementContent_ptr(no, nr) NULL
26419 #define des_xmlElementContent_ptr(no, val, nr)
26420 
26421 static int
test_xmlValidGetPotentialChildren(void)26422 test_xmlValidGetPotentialChildren(void) {
26423     int test_ret = 0;
26424 
26425 #if defined(LIBXML_VALID_ENABLED)
26426 #ifdef LIBXML_VALID_ENABLED
26427     int mem_base;
26428     int ret_val;
26429     xmlElementContent * ctree; /* an element content tree */
26430     int n_ctree;
26431     const xmlChar ** names; /* an array to store the list of child names */
26432     int n_names;
26433     int * len; /* a pointer to the number of element in the list */
26434     int n_len;
26435     int max; /* the size of the array */
26436     int n_max;
26437 
26438     for (n_ctree = 0;n_ctree < gen_nb_xmlElementContent_ptr;n_ctree++) {
26439     for (n_names = 0;n_names < gen_nb_const_xmlChar_ptr_ptr;n_names++) {
26440     for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
26441     for (n_max = 0;n_max < gen_nb_int;n_max++) {
26442         mem_base = xmlMemBlocks();
26443         ctree = gen_xmlElementContent_ptr(n_ctree, 0);
26444         names = gen_const_xmlChar_ptr_ptr(n_names, 1);
26445         len = gen_int_ptr(n_len, 2);
26446         max = gen_int(n_max, 3);
26447 
26448         ret_val = xmlValidGetPotentialChildren(ctree, names, len, max);
26449         desret_int(ret_val);
26450         call_tests++;
26451         des_xmlElementContent_ptr(n_ctree, ctree, 0);
26452         des_const_xmlChar_ptr_ptr(n_names, names, 1);
26453         des_int_ptr(n_len, len, 2);
26454         des_int(n_max, max, 3);
26455         xmlResetLastError();
26456         if (mem_base != xmlMemBlocks()) {
26457             printf("Leak of %d blocks found in xmlValidGetPotentialChildren",
26458 	           xmlMemBlocks() - mem_base);
26459 	    test_ret++;
26460             printf(" %d", n_ctree);
26461             printf(" %d", n_names);
26462             printf(" %d", n_len);
26463             printf(" %d", n_max);
26464             printf("\n");
26465         }
26466     }
26467     }
26468     }
26469     }
26470     function_tests++;
26471 #endif
26472 #endif
26473 
26474     return(test_ret);
26475 }
26476 
26477 
26478 static int
test_xmlValidGetValidElements(void)26479 test_xmlValidGetValidElements(void) {
26480     int test_ret = 0;
26481 
26482 #if defined(LIBXML_VALID_ENABLED)
26483 #ifdef LIBXML_VALID_ENABLED
26484     int mem_base;
26485     int ret_val;
26486     xmlNode * prev; /* an element to insert after */
26487     int n_prev;
26488     xmlNode * next; /* an element to insert next */
26489     int n_next;
26490     const xmlChar ** names; /* an array to store the list of child names */
26491     int n_names;
26492     int max; /* the size of the array */
26493     int n_max;
26494 
26495     for (n_prev = 0;n_prev < gen_nb_xmlNodePtr;n_prev++) {
26496     for (n_next = 0;n_next < gen_nb_xmlNodePtr;n_next++) {
26497     for (n_names = 0;n_names < gen_nb_const_xmlChar_ptr_ptr;n_names++) {
26498     for (n_max = 0;n_max < gen_nb_int;n_max++) {
26499         mem_base = xmlMemBlocks();
26500         prev = gen_xmlNodePtr(n_prev, 0);
26501         next = gen_xmlNodePtr(n_next, 1);
26502         names = gen_const_xmlChar_ptr_ptr(n_names, 2);
26503         max = gen_int(n_max, 3);
26504 
26505         ret_val = xmlValidGetValidElements(prev, next, names, max);
26506         desret_int(ret_val);
26507         call_tests++;
26508         des_xmlNodePtr(n_prev, prev, 0);
26509         des_xmlNodePtr(n_next, next, 1);
26510         des_const_xmlChar_ptr_ptr(n_names, names, 2);
26511         des_int(n_max, max, 3);
26512         xmlResetLastError();
26513         if (mem_base != xmlMemBlocks()) {
26514             printf("Leak of %d blocks found in xmlValidGetValidElements",
26515 	           xmlMemBlocks() - mem_base);
26516 	    test_ret++;
26517             printf(" %d", n_prev);
26518             printf(" %d", n_next);
26519             printf(" %d", n_names);
26520             printf(" %d", n_max);
26521             printf("\n");
26522         }
26523     }
26524     }
26525     }
26526     }
26527     function_tests++;
26528 #endif
26529 #endif
26530 
26531     return(test_ret);
26532 }
26533 
26534 
26535 static int
test_xmlValidNormalizeAttributeValue(void)26536 test_xmlValidNormalizeAttributeValue(void) {
26537     int test_ret = 0;
26538 
26539 #if defined(LIBXML_VALID_ENABLED)
26540     int mem_base;
26541     xmlChar * ret_val;
26542     xmlDocPtr doc; /* the document */
26543     int n_doc;
26544     xmlNodePtr elem; /* the parent */
26545     int n_elem;
26546     const xmlChar * name; /* the attribute name */
26547     int n_name;
26548     const xmlChar * value; /* the attribute value */
26549     int n_value;
26550 
26551     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
26552     for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
26553     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
26554     for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
26555         mem_base = xmlMemBlocks();
26556         doc = gen_xmlDocPtr(n_doc, 0);
26557         elem = gen_xmlNodePtr(n_elem, 1);
26558         name = gen_const_xmlChar_ptr(n_name, 2);
26559         value = gen_const_xmlChar_ptr(n_value, 3);
26560 
26561         ret_val = xmlValidNormalizeAttributeValue(doc, elem, name, value);
26562         desret_xmlChar_ptr(ret_val);
26563         call_tests++;
26564         des_xmlDocPtr(n_doc, doc, 0);
26565         des_xmlNodePtr(n_elem, elem, 1);
26566         des_const_xmlChar_ptr(n_name, name, 2);
26567         des_const_xmlChar_ptr(n_value, value, 3);
26568         xmlResetLastError();
26569         if (mem_base != xmlMemBlocks()) {
26570             printf("Leak of %d blocks found in xmlValidNormalizeAttributeValue",
26571 	           xmlMemBlocks() - mem_base);
26572 	    test_ret++;
26573             printf(" %d", n_doc);
26574             printf(" %d", n_elem);
26575             printf(" %d", n_name);
26576             printf(" %d", n_value);
26577             printf("\n");
26578         }
26579     }
26580     }
26581     }
26582     }
26583     function_tests++;
26584 #endif
26585 
26586     return(test_ret);
26587 }
26588 
26589 
26590 static int
test_xmlValidateAttributeDecl(void)26591 test_xmlValidateAttributeDecl(void) {
26592     int test_ret = 0;
26593 
26594 #if defined(LIBXML_VALID_ENABLED)
26595     int mem_base;
26596     int ret_val;
26597     xmlValidCtxtPtr ctxt; /* the validation context */
26598     int n_ctxt;
26599     xmlDocPtr doc; /* a document instance */
26600     int n_doc;
26601     xmlAttributePtr attr; /* an attribute definition */
26602     int n_attr;
26603 
26604     for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
26605     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
26606     for (n_attr = 0;n_attr < gen_nb_xmlAttributePtr;n_attr++) {
26607         mem_base = xmlMemBlocks();
26608         ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
26609         doc = gen_xmlDocPtr(n_doc, 1);
26610         attr = gen_xmlAttributePtr(n_attr, 2);
26611 
26612         ret_val = xmlValidateAttributeDecl(ctxt, doc, attr);
26613         desret_int(ret_val);
26614         call_tests++;
26615         des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
26616         des_xmlDocPtr(n_doc, doc, 1);
26617         des_xmlAttributePtr(n_attr, attr, 2);
26618         xmlResetLastError();
26619         if (mem_base != xmlMemBlocks()) {
26620             printf("Leak of %d blocks found in xmlValidateAttributeDecl",
26621 	           xmlMemBlocks() - mem_base);
26622 	    test_ret++;
26623             printf(" %d", n_ctxt);
26624             printf(" %d", n_doc);
26625             printf(" %d", n_attr);
26626             printf("\n");
26627         }
26628     }
26629     }
26630     }
26631     function_tests++;
26632 #endif
26633 
26634     return(test_ret);
26635 }
26636 
26637 
26638 static int
test_xmlValidateAttributeValue(void)26639 test_xmlValidateAttributeValue(void) {
26640     int test_ret = 0;
26641 
26642 #if defined(LIBXML_VALID_ENABLED)
26643     int mem_base;
26644     int ret_val;
26645     xmlAttributeType type; /* an attribute type */
26646     int n_type;
26647     const xmlChar * value; /* an attribute value */
26648     int n_value;
26649 
26650     for (n_type = 0;n_type < gen_nb_xmlAttributeType;n_type++) {
26651     for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
26652         mem_base = xmlMemBlocks();
26653         type = gen_xmlAttributeType(n_type, 0);
26654         value = gen_const_xmlChar_ptr(n_value, 1);
26655 
26656         ret_val = xmlValidateAttributeValue(type, value);
26657         desret_int(ret_val);
26658         call_tests++;
26659         des_xmlAttributeType(n_type, type, 0);
26660         des_const_xmlChar_ptr(n_value, value, 1);
26661         xmlResetLastError();
26662         if (mem_base != xmlMemBlocks()) {
26663             printf("Leak of %d blocks found in xmlValidateAttributeValue",
26664 	           xmlMemBlocks() - mem_base);
26665 	    test_ret++;
26666             printf(" %d", n_type);
26667             printf(" %d", n_value);
26668             printf("\n");
26669         }
26670     }
26671     }
26672     function_tests++;
26673 #endif
26674 
26675     return(test_ret);
26676 }
26677 
26678 
26679 static int
test_xmlValidateDocument(void)26680 test_xmlValidateDocument(void) {
26681     int test_ret = 0;
26682 
26683 #if defined(LIBXML_VALID_ENABLED)
26684     int mem_base;
26685     int ret_val;
26686     xmlValidCtxtPtr ctxt; /* the validation context */
26687     int n_ctxt;
26688     xmlDocPtr doc; /* a document instance */
26689     int n_doc;
26690 
26691     for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
26692     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
26693         mem_base = xmlMemBlocks();
26694         ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
26695         doc = gen_xmlDocPtr(n_doc, 1);
26696 
26697         ret_val = xmlValidateDocument(ctxt, doc);
26698         desret_int(ret_val);
26699         call_tests++;
26700         des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
26701         des_xmlDocPtr(n_doc, doc, 1);
26702         xmlResetLastError();
26703         if (mem_base != xmlMemBlocks()) {
26704             printf("Leak of %d blocks found in xmlValidateDocument",
26705 	           xmlMemBlocks() - mem_base);
26706 	    test_ret++;
26707             printf(" %d", n_ctxt);
26708             printf(" %d", n_doc);
26709             printf("\n");
26710         }
26711     }
26712     }
26713     function_tests++;
26714 #endif
26715 
26716     return(test_ret);
26717 }
26718 
26719 
26720 static int
test_xmlValidateDocumentFinal(void)26721 test_xmlValidateDocumentFinal(void) {
26722     int test_ret = 0;
26723 
26724 #if defined(LIBXML_VALID_ENABLED)
26725     int mem_base;
26726     int ret_val;
26727     xmlValidCtxtPtr ctxt; /* the validation context */
26728     int n_ctxt;
26729     xmlDocPtr doc; /* a document instance */
26730     int n_doc;
26731 
26732     for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
26733     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
26734         mem_base = xmlMemBlocks();
26735         ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
26736         doc = gen_xmlDocPtr(n_doc, 1);
26737 
26738         ret_val = xmlValidateDocumentFinal(ctxt, doc);
26739         desret_int(ret_val);
26740         call_tests++;
26741         des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
26742         des_xmlDocPtr(n_doc, doc, 1);
26743         xmlResetLastError();
26744         if (mem_base != xmlMemBlocks()) {
26745             printf("Leak of %d blocks found in xmlValidateDocumentFinal",
26746 	           xmlMemBlocks() - mem_base);
26747 	    test_ret++;
26748             printf(" %d", n_ctxt);
26749             printf(" %d", n_doc);
26750             printf("\n");
26751         }
26752     }
26753     }
26754     function_tests++;
26755 #endif
26756 
26757     return(test_ret);
26758 }
26759 
26760 
26761 static int
test_xmlValidateDtd(void)26762 test_xmlValidateDtd(void) {
26763     int test_ret = 0;
26764 
26765 #if defined(LIBXML_VALID_ENABLED)
26766     int mem_base;
26767     int ret_val;
26768     xmlValidCtxtPtr ctxt; /* the validation context */
26769     int n_ctxt;
26770     xmlDocPtr doc; /* a document instance */
26771     int n_doc;
26772     xmlDtdPtr dtd; /* a dtd instance */
26773     int n_dtd;
26774 
26775     for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
26776     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
26777     for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
26778         mem_base = xmlMemBlocks();
26779         ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
26780         doc = gen_xmlDocPtr(n_doc, 1);
26781         dtd = gen_xmlDtdPtr(n_dtd, 2);
26782 
26783         ret_val = xmlValidateDtd(ctxt, doc, dtd);
26784         desret_int(ret_val);
26785         call_tests++;
26786         des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
26787         des_xmlDocPtr(n_doc, doc, 1);
26788         des_xmlDtdPtr(n_dtd, dtd, 2);
26789         xmlResetLastError();
26790         if (mem_base != xmlMemBlocks()) {
26791             printf("Leak of %d blocks found in xmlValidateDtd",
26792 	           xmlMemBlocks() - mem_base);
26793 	    test_ret++;
26794             printf(" %d", n_ctxt);
26795             printf(" %d", n_doc);
26796             printf(" %d", n_dtd);
26797             printf("\n");
26798         }
26799     }
26800     }
26801     }
26802     function_tests++;
26803 #endif
26804 
26805     return(test_ret);
26806 }
26807 
26808 
26809 static int
test_xmlValidateDtdFinal(void)26810 test_xmlValidateDtdFinal(void) {
26811     int test_ret = 0;
26812 
26813 #if defined(LIBXML_VALID_ENABLED)
26814     int mem_base;
26815     int ret_val;
26816     xmlValidCtxtPtr ctxt; /* the validation context */
26817     int n_ctxt;
26818     xmlDocPtr doc; /* a document instance */
26819     int n_doc;
26820 
26821     for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
26822     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
26823         mem_base = xmlMemBlocks();
26824         ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
26825         doc = gen_xmlDocPtr(n_doc, 1);
26826 
26827         ret_val = xmlValidateDtdFinal(ctxt, doc);
26828         desret_int(ret_val);
26829         call_tests++;
26830         des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
26831         des_xmlDocPtr(n_doc, doc, 1);
26832         xmlResetLastError();
26833         if (mem_base != xmlMemBlocks()) {
26834             printf("Leak of %d blocks found in xmlValidateDtdFinal",
26835 	           xmlMemBlocks() - mem_base);
26836 	    test_ret++;
26837             printf(" %d", n_ctxt);
26838             printf(" %d", n_doc);
26839             printf("\n");
26840         }
26841     }
26842     }
26843     function_tests++;
26844 #endif
26845 
26846     return(test_ret);
26847 }
26848 
26849 
26850 static int
test_xmlValidateElement(void)26851 test_xmlValidateElement(void) {
26852     int test_ret = 0;
26853 
26854 #if defined(LIBXML_VALID_ENABLED)
26855     int mem_base;
26856     int ret_val;
26857     xmlValidCtxtPtr ctxt; /* the validation context */
26858     int n_ctxt;
26859     xmlDocPtr doc; /* a document instance */
26860     int n_doc;
26861     xmlNodePtr root; /* an element instance */
26862     int n_root;
26863 
26864     for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
26865     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
26866     for (n_root = 0;n_root < gen_nb_xmlNodePtr;n_root++) {
26867         mem_base = xmlMemBlocks();
26868         ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
26869         doc = gen_xmlDocPtr(n_doc, 1);
26870         root = gen_xmlNodePtr(n_root, 2);
26871 
26872         ret_val = xmlValidateElement(ctxt, doc, root);
26873         desret_int(ret_val);
26874         call_tests++;
26875         des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
26876         des_xmlDocPtr(n_doc, doc, 1);
26877         des_xmlNodePtr(n_root, root, 2);
26878         xmlResetLastError();
26879         if (mem_base != xmlMemBlocks()) {
26880             printf("Leak of %d blocks found in xmlValidateElement",
26881 	           xmlMemBlocks() - mem_base);
26882 	    test_ret++;
26883             printf(" %d", n_ctxt);
26884             printf(" %d", n_doc);
26885             printf(" %d", n_root);
26886             printf("\n");
26887         }
26888     }
26889     }
26890     }
26891     function_tests++;
26892 #endif
26893 
26894     return(test_ret);
26895 }
26896 
26897 
26898 static int
test_xmlValidateElementDecl(void)26899 test_xmlValidateElementDecl(void) {
26900     int test_ret = 0;
26901 
26902 #if defined(LIBXML_VALID_ENABLED)
26903     int mem_base;
26904     int ret_val;
26905     xmlValidCtxtPtr ctxt; /* the validation context */
26906     int n_ctxt;
26907     xmlDocPtr doc; /* a document instance */
26908     int n_doc;
26909     xmlElementPtr elem; /* an element definition */
26910     int n_elem;
26911 
26912     for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
26913     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
26914     for (n_elem = 0;n_elem < gen_nb_xmlElementPtr;n_elem++) {
26915         mem_base = xmlMemBlocks();
26916         ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
26917         doc = gen_xmlDocPtr(n_doc, 1);
26918         elem = gen_xmlElementPtr(n_elem, 2);
26919 
26920         ret_val = xmlValidateElementDecl(ctxt, doc, elem);
26921         desret_int(ret_val);
26922         call_tests++;
26923         des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
26924         des_xmlDocPtr(n_doc, doc, 1);
26925         des_xmlElementPtr(n_elem, elem, 2);
26926         xmlResetLastError();
26927         if (mem_base != xmlMemBlocks()) {
26928             printf("Leak of %d blocks found in xmlValidateElementDecl",
26929 	           xmlMemBlocks() - mem_base);
26930 	    test_ret++;
26931             printf(" %d", n_ctxt);
26932             printf(" %d", n_doc);
26933             printf(" %d", n_elem);
26934             printf("\n");
26935         }
26936     }
26937     }
26938     }
26939     function_tests++;
26940 #endif
26941 
26942     return(test_ret);
26943 }
26944 
26945 
26946 static int
test_xmlValidateNameValue(void)26947 test_xmlValidateNameValue(void) {
26948     int test_ret = 0;
26949 
26950 #if defined(LIBXML_VALID_ENABLED)
26951     int mem_base;
26952     int ret_val;
26953     const xmlChar * value; /* an Name value */
26954     int n_value;
26955 
26956     for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
26957         mem_base = xmlMemBlocks();
26958         value = gen_const_xmlChar_ptr(n_value, 0);
26959 
26960         ret_val = xmlValidateNameValue(value);
26961         desret_int(ret_val);
26962         call_tests++;
26963         des_const_xmlChar_ptr(n_value, value, 0);
26964         xmlResetLastError();
26965         if (mem_base != xmlMemBlocks()) {
26966             printf("Leak of %d blocks found in xmlValidateNameValue",
26967 	           xmlMemBlocks() - mem_base);
26968 	    test_ret++;
26969             printf(" %d", n_value);
26970             printf("\n");
26971         }
26972     }
26973     function_tests++;
26974 #endif
26975 
26976     return(test_ret);
26977 }
26978 
26979 
26980 static int
test_xmlValidateNamesValue(void)26981 test_xmlValidateNamesValue(void) {
26982     int test_ret = 0;
26983 
26984 #if defined(LIBXML_VALID_ENABLED)
26985     int mem_base;
26986     int ret_val;
26987     const xmlChar * value; /* an Names value */
26988     int n_value;
26989 
26990     for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
26991         mem_base = xmlMemBlocks();
26992         value = gen_const_xmlChar_ptr(n_value, 0);
26993 
26994         ret_val = xmlValidateNamesValue(value);
26995         desret_int(ret_val);
26996         call_tests++;
26997         des_const_xmlChar_ptr(n_value, value, 0);
26998         xmlResetLastError();
26999         if (mem_base != xmlMemBlocks()) {
27000             printf("Leak of %d blocks found in xmlValidateNamesValue",
27001 	           xmlMemBlocks() - mem_base);
27002 	    test_ret++;
27003             printf(" %d", n_value);
27004             printf("\n");
27005         }
27006     }
27007     function_tests++;
27008 #endif
27009 
27010     return(test_ret);
27011 }
27012 
27013 
27014 static int
test_xmlValidateNmtokenValue(void)27015 test_xmlValidateNmtokenValue(void) {
27016     int test_ret = 0;
27017 
27018 #if defined(LIBXML_VALID_ENABLED)
27019     int mem_base;
27020     int ret_val;
27021     const xmlChar * value; /* an Nmtoken value */
27022     int n_value;
27023 
27024     for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
27025         mem_base = xmlMemBlocks();
27026         value = gen_const_xmlChar_ptr(n_value, 0);
27027 
27028         ret_val = xmlValidateNmtokenValue(value);
27029         desret_int(ret_val);
27030         call_tests++;
27031         des_const_xmlChar_ptr(n_value, value, 0);
27032         xmlResetLastError();
27033         if (mem_base != xmlMemBlocks()) {
27034             printf("Leak of %d blocks found in xmlValidateNmtokenValue",
27035 	           xmlMemBlocks() - mem_base);
27036 	    test_ret++;
27037             printf(" %d", n_value);
27038             printf("\n");
27039         }
27040     }
27041     function_tests++;
27042 #endif
27043 
27044     return(test_ret);
27045 }
27046 
27047 
27048 static int
test_xmlValidateNmtokensValue(void)27049 test_xmlValidateNmtokensValue(void) {
27050     int test_ret = 0;
27051 
27052 #if defined(LIBXML_VALID_ENABLED)
27053     int mem_base;
27054     int ret_val;
27055     const xmlChar * value; /* an Nmtokens value */
27056     int n_value;
27057 
27058     for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
27059         mem_base = xmlMemBlocks();
27060         value = gen_const_xmlChar_ptr(n_value, 0);
27061 
27062         ret_val = xmlValidateNmtokensValue(value);
27063         desret_int(ret_val);
27064         call_tests++;
27065         des_const_xmlChar_ptr(n_value, value, 0);
27066         xmlResetLastError();
27067         if (mem_base != xmlMemBlocks()) {
27068             printf("Leak of %d blocks found in xmlValidateNmtokensValue",
27069 	           xmlMemBlocks() - mem_base);
27070 	    test_ret++;
27071             printf(" %d", n_value);
27072             printf("\n");
27073         }
27074     }
27075     function_tests++;
27076 #endif
27077 
27078     return(test_ret);
27079 }
27080 
27081 
27082 static int
test_xmlValidateNotationDecl(void)27083 test_xmlValidateNotationDecl(void) {
27084     int test_ret = 0;
27085 
27086 #if defined(LIBXML_VALID_ENABLED)
27087     int mem_base;
27088     int ret_val;
27089     xmlValidCtxtPtr ctxt; /* the validation context */
27090     int n_ctxt;
27091     xmlDocPtr doc; /* a document instance */
27092     int n_doc;
27093     xmlNotationPtr nota; /* a notation definition */
27094     int n_nota;
27095 
27096     for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
27097     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
27098     for (n_nota = 0;n_nota < gen_nb_xmlNotationPtr;n_nota++) {
27099         mem_base = xmlMemBlocks();
27100         ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
27101         doc = gen_xmlDocPtr(n_doc, 1);
27102         nota = gen_xmlNotationPtr(n_nota, 2);
27103 
27104         ret_val = xmlValidateNotationDecl(ctxt, doc, nota);
27105         desret_int(ret_val);
27106         call_tests++;
27107         des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
27108         des_xmlDocPtr(n_doc, doc, 1);
27109         des_xmlNotationPtr(n_nota, nota, 2);
27110         xmlResetLastError();
27111         if (mem_base != xmlMemBlocks()) {
27112             printf("Leak of %d blocks found in xmlValidateNotationDecl",
27113 	           xmlMemBlocks() - mem_base);
27114 	    test_ret++;
27115             printf(" %d", n_ctxt);
27116             printf(" %d", n_doc);
27117             printf(" %d", n_nota);
27118             printf("\n");
27119         }
27120     }
27121     }
27122     }
27123     function_tests++;
27124 #endif
27125 
27126     return(test_ret);
27127 }
27128 
27129 
27130 static int
test_xmlValidateNotationUse(void)27131 test_xmlValidateNotationUse(void) {
27132     int test_ret = 0;
27133 
27134 #if defined(LIBXML_VALID_ENABLED)
27135     int mem_base;
27136     int ret_val;
27137     xmlValidCtxtPtr ctxt; /* the validation context */
27138     int n_ctxt;
27139     xmlDocPtr doc; /* the document */
27140     int n_doc;
27141     const xmlChar * notationName; /* the notation name to check */
27142     int n_notationName;
27143 
27144     for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
27145     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
27146     for (n_notationName = 0;n_notationName < gen_nb_const_xmlChar_ptr;n_notationName++) {
27147         mem_base = xmlMemBlocks();
27148         ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
27149         doc = gen_xmlDocPtr(n_doc, 1);
27150         notationName = gen_const_xmlChar_ptr(n_notationName, 2);
27151 
27152         ret_val = xmlValidateNotationUse(ctxt, doc, notationName);
27153         desret_int(ret_val);
27154         call_tests++;
27155         des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
27156         des_xmlDocPtr(n_doc, doc, 1);
27157         des_const_xmlChar_ptr(n_notationName, notationName, 2);
27158         xmlResetLastError();
27159         if (mem_base != xmlMemBlocks()) {
27160             printf("Leak of %d blocks found in xmlValidateNotationUse",
27161 	           xmlMemBlocks() - mem_base);
27162 	    test_ret++;
27163             printf(" %d", n_ctxt);
27164             printf(" %d", n_doc);
27165             printf(" %d", n_notationName);
27166             printf("\n");
27167         }
27168     }
27169     }
27170     }
27171     function_tests++;
27172 #endif
27173 
27174     return(test_ret);
27175 }
27176 
27177 
27178 static int
test_xmlValidateOneAttribute(void)27179 test_xmlValidateOneAttribute(void) {
27180     int test_ret = 0;
27181 
27182 #if defined(LIBXML_VALID_ENABLED)
27183     int mem_base;
27184     int ret_val;
27185     xmlValidCtxtPtr ctxt; /* the validation context */
27186     int n_ctxt;
27187     xmlDocPtr doc; /* a document instance */
27188     int n_doc;
27189     xmlNodePtr elem; /* an element instance */
27190     int n_elem;
27191     xmlAttrPtr attr; /* an attribute instance */
27192     int n_attr;
27193     const xmlChar * value; /* the attribute value (without entities processing) */
27194     int n_value;
27195 
27196     for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
27197     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
27198     for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
27199     for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
27200     for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
27201         mem_base = xmlMemBlocks();
27202         ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
27203         doc = gen_xmlDocPtr(n_doc, 1);
27204         elem = gen_xmlNodePtr(n_elem, 2);
27205         attr = gen_xmlAttrPtr(n_attr, 3);
27206         value = gen_const_xmlChar_ptr(n_value, 4);
27207 
27208         ret_val = xmlValidateOneAttribute(ctxt, doc, elem, attr, value);
27209         desret_int(ret_val);
27210         call_tests++;
27211         des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
27212         des_xmlDocPtr(n_doc, doc, 1);
27213         des_xmlNodePtr(n_elem, elem, 2);
27214         des_xmlAttrPtr(n_attr, attr, 3);
27215         des_const_xmlChar_ptr(n_value, value, 4);
27216         xmlResetLastError();
27217         if (mem_base != xmlMemBlocks()) {
27218             printf("Leak of %d blocks found in xmlValidateOneAttribute",
27219 	           xmlMemBlocks() - mem_base);
27220 	    test_ret++;
27221             printf(" %d", n_ctxt);
27222             printf(" %d", n_doc);
27223             printf(" %d", n_elem);
27224             printf(" %d", n_attr);
27225             printf(" %d", n_value);
27226             printf("\n");
27227         }
27228     }
27229     }
27230     }
27231     }
27232     }
27233     function_tests++;
27234 #endif
27235 
27236     return(test_ret);
27237 }
27238 
27239 
27240 static int
test_xmlValidateOneElement(void)27241 test_xmlValidateOneElement(void) {
27242     int test_ret = 0;
27243 
27244 #if defined(LIBXML_VALID_ENABLED)
27245     int mem_base;
27246     int ret_val;
27247     xmlValidCtxtPtr ctxt; /* the validation context */
27248     int n_ctxt;
27249     xmlDocPtr doc; /* a document instance */
27250     int n_doc;
27251     xmlNodePtr elem; /* an element instance */
27252     int n_elem;
27253 
27254     for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
27255     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
27256     for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
27257         mem_base = xmlMemBlocks();
27258         ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
27259         doc = gen_xmlDocPtr(n_doc, 1);
27260         elem = gen_xmlNodePtr(n_elem, 2);
27261 
27262         ret_val = xmlValidateOneElement(ctxt, doc, elem);
27263         desret_int(ret_val);
27264         call_tests++;
27265         des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
27266         des_xmlDocPtr(n_doc, doc, 1);
27267         des_xmlNodePtr(n_elem, elem, 2);
27268         xmlResetLastError();
27269         if (mem_base != xmlMemBlocks()) {
27270             printf("Leak of %d blocks found in xmlValidateOneElement",
27271 	           xmlMemBlocks() - mem_base);
27272 	    test_ret++;
27273             printf(" %d", n_ctxt);
27274             printf(" %d", n_doc);
27275             printf(" %d", n_elem);
27276             printf("\n");
27277         }
27278     }
27279     }
27280     }
27281     function_tests++;
27282 #endif
27283 
27284     return(test_ret);
27285 }
27286 
27287 
27288 static int
test_xmlValidateOneNamespace(void)27289 test_xmlValidateOneNamespace(void) {
27290     int test_ret = 0;
27291 
27292 #if defined(LIBXML_VALID_ENABLED)
27293     int mem_base;
27294     int ret_val;
27295     xmlValidCtxtPtr ctxt; /* the validation context */
27296     int n_ctxt;
27297     xmlDocPtr doc; /* a document instance */
27298     int n_doc;
27299     xmlNodePtr elem; /* an element instance */
27300     int n_elem;
27301     const xmlChar * prefix; /* the namespace prefix */
27302     int n_prefix;
27303     xmlNsPtr ns; /* an namespace declaration instance */
27304     int n_ns;
27305     const xmlChar * value; /* the attribute value (without entities processing) */
27306     int n_value;
27307 
27308     for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
27309     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
27310     for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
27311     for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
27312     for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
27313     for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
27314         mem_base = xmlMemBlocks();
27315         ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
27316         doc = gen_xmlDocPtr(n_doc, 1);
27317         elem = gen_xmlNodePtr(n_elem, 2);
27318         prefix = gen_const_xmlChar_ptr(n_prefix, 3);
27319         ns = gen_xmlNsPtr(n_ns, 4);
27320         value = gen_const_xmlChar_ptr(n_value, 5);
27321 
27322         ret_val = xmlValidateOneNamespace(ctxt, doc, elem, prefix, ns, value);
27323         desret_int(ret_val);
27324         call_tests++;
27325         des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
27326         des_xmlDocPtr(n_doc, doc, 1);
27327         des_xmlNodePtr(n_elem, elem, 2);
27328         des_const_xmlChar_ptr(n_prefix, prefix, 3);
27329         des_xmlNsPtr(n_ns, ns, 4);
27330         des_const_xmlChar_ptr(n_value, value, 5);
27331         xmlResetLastError();
27332         if (mem_base != xmlMemBlocks()) {
27333             printf("Leak of %d blocks found in xmlValidateOneNamespace",
27334 	           xmlMemBlocks() - mem_base);
27335 	    test_ret++;
27336             printf(" %d", n_ctxt);
27337             printf(" %d", n_doc);
27338             printf(" %d", n_elem);
27339             printf(" %d", n_prefix);
27340             printf(" %d", n_ns);
27341             printf(" %d", n_value);
27342             printf("\n");
27343         }
27344     }
27345     }
27346     }
27347     }
27348     }
27349     }
27350     function_tests++;
27351 #endif
27352 
27353     return(test_ret);
27354 }
27355 
27356 
27357 static int
test_xmlValidatePopElement(void)27358 test_xmlValidatePopElement(void) {
27359     int test_ret = 0;
27360 
27361 #if defined(LIBXML_VALID_ENABLED) && defined(LIBXML_REGEXP_ENABLED)
27362     int mem_base;
27363     int ret_val;
27364     xmlValidCtxtPtr ctxt; /* the validation context */
27365     int n_ctxt;
27366     xmlDocPtr doc; /* a document instance */
27367     int n_doc;
27368     xmlNodePtr elem; /* an element instance */
27369     int n_elem;
27370     const xmlChar * qname; /* the qualified name as appearing in the serialization */
27371     int n_qname;
27372 
27373     for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
27374     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
27375     for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
27376     for (n_qname = 0;n_qname < gen_nb_const_xmlChar_ptr;n_qname++) {
27377         mem_base = xmlMemBlocks();
27378         ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
27379         doc = gen_xmlDocPtr(n_doc, 1);
27380         elem = gen_xmlNodePtr(n_elem, 2);
27381         qname = gen_const_xmlChar_ptr(n_qname, 3);
27382 
27383         ret_val = xmlValidatePopElement(ctxt, doc, elem, qname);
27384         desret_int(ret_val);
27385         call_tests++;
27386         des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
27387         des_xmlDocPtr(n_doc, doc, 1);
27388         des_xmlNodePtr(n_elem, elem, 2);
27389         des_const_xmlChar_ptr(n_qname, qname, 3);
27390         xmlResetLastError();
27391         if (mem_base != xmlMemBlocks()) {
27392             printf("Leak of %d blocks found in xmlValidatePopElement",
27393 	           xmlMemBlocks() - mem_base);
27394 	    test_ret++;
27395             printf(" %d", n_ctxt);
27396             printf(" %d", n_doc);
27397             printf(" %d", n_elem);
27398             printf(" %d", n_qname);
27399             printf("\n");
27400         }
27401     }
27402     }
27403     }
27404     }
27405     function_tests++;
27406 #endif
27407 
27408     return(test_ret);
27409 }
27410 
27411 
27412 static int
test_xmlValidatePushCData(void)27413 test_xmlValidatePushCData(void) {
27414     int test_ret = 0;
27415 
27416 #if defined(LIBXML_VALID_ENABLED) && defined(LIBXML_REGEXP_ENABLED)
27417     int mem_base;
27418     int ret_val;
27419     xmlValidCtxtPtr ctxt; /* the validation context */
27420     int n_ctxt;
27421     const xmlChar * data; /* some character data read */
27422     int n_data;
27423     int len; /* the length of the data */
27424     int n_len;
27425 
27426     for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
27427     for (n_data = 0;n_data < gen_nb_const_xmlChar_ptr;n_data++) {
27428     for (n_len = 0;n_len < gen_nb_int;n_len++) {
27429         mem_base = xmlMemBlocks();
27430         ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
27431         data = gen_const_xmlChar_ptr(n_data, 1);
27432         len = gen_int(n_len, 2);
27433         if ((data != NULL) &&
27434             (len > xmlStrlen(BAD_CAST data)))
27435             len = 0;
27436 
27437         ret_val = xmlValidatePushCData(ctxt, data, len);
27438         desret_int(ret_val);
27439         call_tests++;
27440         des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
27441         des_const_xmlChar_ptr(n_data, data, 1);
27442         des_int(n_len, len, 2);
27443         xmlResetLastError();
27444         if (mem_base != xmlMemBlocks()) {
27445             printf("Leak of %d blocks found in xmlValidatePushCData",
27446 	           xmlMemBlocks() - mem_base);
27447 	    test_ret++;
27448             printf(" %d", n_ctxt);
27449             printf(" %d", n_data);
27450             printf(" %d", n_len);
27451             printf("\n");
27452         }
27453     }
27454     }
27455     }
27456     function_tests++;
27457 #endif
27458 
27459     return(test_ret);
27460 }
27461 
27462 
27463 static int
test_xmlValidatePushElement(void)27464 test_xmlValidatePushElement(void) {
27465     int test_ret = 0;
27466 
27467 #if defined(LIBXML_VALID_ENABLED) && defined(LIBXML_REGEXP_ENABLED)
27468     int mem_base;
27469     int ret_val;
27470     xmlValidCtxtPtr ctxt; /* the validation context */
27471     int n_ctxt;
27472     xmlDocPtr doc; /* a document instance */
27473     int n_doc;
27474     xmlNodePtr elem; /* an element instance */
27475     int n_elem;
27476     const xmlChar * qname; /* the qualified name as appearing in the serialization */
27477     int n_qname;
27478 
27479     for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
27480     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
27481     for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
27482     for (n_qname = 0;n_qname < gen_nb_const_xmlChar_ptr;n_qname++) {
27483         mem_base = xmlMemBlocks();
27484         ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
27485         doc = gen_xmlDocPtr(n_doc, 1);
27486         elem = gen_xmlNodePtr(n_elem, 2);
27487         qname = gen_const_xmlChar_ptr(n_qname, 3);
27488 
27489         ret_val = xmlValidatePushElement(ctxt, doc, elem, qname);
27490         desret_int(ret_val);
27491         call_tests++;
27492         des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
27493         des_xmlDocPtr(n_doc, doc, 1);
27494         des_xmlNodePtr(n_elem, elem, 2);
27495         des_const_xmlChar_ptr(n_qname, qname, 3);
27496         xmlResetLastError();
27497         if (mem_base != xmlMemBlocks()) {
27498             printf("Leak of %d blocks found in xmlValidatePushElement",
27499 	           xmlMemBlocks() - mem_base);
27500 	    test_ret++;
27501             printf(" %d", n_ctxt);
27502             printf(" %d", n_doc);
27503             printf(" %d", n_elem);
27504             printf(" %d", n_qname);
27505             printf("\n");
27506         }
27507     }
27508     }
27509     }
27510     }
27511     function_tests++;
27512 #endif
27513 
27514     return(test_ret);
27515 }
27516 
27517 
27518 static int
test_xmlValidateRoot(void)27519 test_xmlValidateRoot(void) {
27520     int test_ret = 0;
27521 
27522 #if defined(LIBXML_VALID_ENABLED)
27523     int mem_base;
27524     int ret_val;
27525     xmlValidCtxtPtr ctxt; /* the validation context */
27526     int n_ctxt;
27527     xmlDocPtr doc; /* a document instance */
27528     int n_doc;
27529 
27530     for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
27531     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
27532         mem_base = xmlMemBlocks();
27533         ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
27534         doc = gen_xmlDocPtr(n_doc, 1);
27535 
27536         ret_val = xmlValidateRoot(ctxt, doc);
27537         desret_int(ret_val);
27538         call_tests++;
27539         des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
27540         des_xmlDocPtr(n_doc, doc, 1);
27541         xmlResetLastError();
27542         if (mem_base != xmlMemBlocks()) {
27543             printf("Leak of %d blocks found in xmlValidateRoot",
27544 	           xmlMemBlocks() - mem_base);
27545 	    test_ret++;
27546             printf(" %d", n_ctxt);
27547             printf(" %d", n_doc);
27548             printf("\n");
27549         }
27550     }
27551     }
27552     function_tests++;
27553 #endif
27554 
27555     return(test_ret);
27556 }
27557 
27558 static int
test_valid(void)27559 test_valid(void) {
27560     int test_ret = 0;
27561 
27562     if (quiet == 0) printf("Testing valid : 51 of 71 functions ...\n");
27563     test_ret += test_xmlAddAttributeDecl();
27564     test_ret += test_xmlAddElementDecl();
27565     test_ret += test_xmlAddID();
27566     test_ret += test_xmlAddIDSafe();
27567     test_ret += test_xmlAddNotationDecl();
27568     test_ret += test_xmlAddRef();
27569     test_ret += test_xmlCopyAttributeTable();
27570     test_ret += test_xmlCopyDocElementContent();
27571     test_ret += test_xmlCopyElementContent();
27572     test_ret += test_xmlCopyElementTable();
27573     test_ret += test_xmlCopyEnumeration();
27574     test_ret += test_xmlCopyNotationTable();
27575     test_ret += test_xmlCreateEnumeration();
27576     test_ret += test_xmlDumpAttributeDecl();
27577     test_ret += test_xmlDumpAttributeTable();
27578     test_ret += test_xmlDumpElementDecl();
27579     test_ret += test_xmlDumpElementTable();
27580     test_ret += test_xmlDumpNotationDecl();
27581     test_ret += test_xmlDumpNotationTable();
27582     test_ret += test_xmlGetDtdAttrDesc();
27583     test_ret += test_xmlGetDtdElementDesc();
27584     test_ret += test_xmlGetDtdNotationDesc();
27585     test_ret += test_xmlGetDtdQAttrDesc();
27586     test_ret += test_xmlGetDtdQElementDesc();
27587     test_ret += test_xmlGetID();
27588     test_ret += test_xmlGetRefs();
27589     test_ret += test_xmlIsID();
27590     test_ret += test_xmlIsMixedElement();
27591     test_ret += test_xmlIsRef();
27592     test_ret += test_xmlNewDocElementContent();
27593     test_ret += test_xmlNewElementContent();
27594     test_ret += test_xmlNewValidCtxt();
27595     test_ret += test_xmlRemoveID();
27596     test_ret += test_xmlRemoveRef();
27597     test_ret += test_xmlSnprintfElementContent();
27598     test_ret += test_xmlSprintfElementContent();
27599     test_ret += test_xmlValidBuildContentModel();
27600     test_ret += test_xmlValidCtxtNormalizeAttributeValue();
27601     test_ret += test_xmlValidGetPotentialChildren();
27602     test_ret += test_xmlValidGetValidElements();
27603     test_ret += test_xmlValidNormalizeAttributeValue();
27604     test_ret += test_xmlValidateAttributeDecl();
27605     test_ret += test_xmlValidateAttributeValue();
27606     test_ret += test_xmlValidateDocument();
27607     test_ret += test_xmlValidateDocumentFinal();
27608     test_ret += test_xmlValidateDtd();
27609     test_ret += test_xmlValidateDtdFinal();
27610     test_ret += test_xmlValidateElement();
27611     test_ret += test_xmlValidateElementDecl();
27612     test_ret += test_xmlValidateNameValue();
27613     test_ret += test_xmlValidateNamesValue();
27614     test_ret += test_xmlValidateNmtokenValue();
27615     test_ret += test_xmlValidateNmtokensValue();
27616     test_ret += test_xmlValidateNotationDecl();
27617     test_ret += test_xmlValidateNotationUse();
27618     test_ret += test_xmlValidateOneAttribute();
27619     test_ret += test_xmlValidateOneElement();
27620     test_ret += test_xmlValidateOneNamespace();
27621     test_ret += test_xmlValidatePopElement();
27622     test_ret += test_xmlValidatePushCData();
27623     test_ret += test_xmlValidatePushElement();
27624     test_ret += test_xmlValidateRoot();
27625 
27626     if (test_ret != 0)
27627 	printf("Module valid: %d errors\n", test_ret);
27628     return(test_ret);
27629 }
27630 #ifdef LIBXML_XINCLUDE_ENABLED
27631 
27632 #define gen_nb_xmlXIncludeCtxtPtr 1
27633 #define gen_xmlXIncludeCtxtPtr(no, nr) NULL
27634 #define des_xmlXIncludeCtxtPtr(no, val, nr)
27635 #endif
27636 
27637 
27638 static int
test_xmlXIncludeGetLastError(void)27639 test_xmlXIncludeGetLastError(void) {
27640     int test_ret = 0;
27641 
27642 #if defined(LIBXML_XINCLUDE_ENABLED)
27643     int mem_base;
27644     int ret_val;
27645     xmlXIncludeCtxtPtr ctxt; /* an XInclude processing context */
27646     int n_ctxt;
27647 
27648     for (n_ctxt = 0;n_ctxt < gen_nb_xmlXIncludeCtxtPtr;n_ctxt++) {
27649         mem_base = xmlMemBlocks();
27650         ctxt = gen_xmlXIncludeCtxtPtr(n_ctxt, 0);
27651 
27652         ret_val = xmlXIncludeGetLastError(ctxt);
27653         desret_int(ret_val);
27654         call_tests++;
27655         des_xmlXIncludeCtxtPtr(n_ctxt, ctxt, 0);
27656         xmlResetLastError();
27657         if (mem_base != xmlMemBlocks()) {
27658             printf("Leak of %d blocks found in xmlXIncludeGetLastError",
27659 	           xmlMemBlocks() - mem_base);
27660 	    test_ret++;
27661             printf(" %d", n_ctxt);
27662             printf("\n");
27663         }
27664     }
27665     function_tests++;
27666 #endif
27667 
27668     return(test_ret);
27669 }
27670 
27671 
27672 static int
test_xmlXIncludeNewContext(void)27673 test_xmlXIncludeNewContext(void) {
27674     int test_ret = 0;
27675 
27676 
27677     /* missing type support */
27678     return(test_ret);
27679 }
27680 
27681 
27682 static int
test_xmlXIncludeProcess(void)27683 test_xmlXIncludeProcess(void) {
27684     int test_ret = 0;
27685 
27686 #if defined(LIBXML_XINCLUDE_ENABLED)
27687     int mem_base;
27688     int ret_val;
27689     xmlDocPtr doc; /* an XML document */
27690     int n_doc;
27691 
27692     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
27693         mem_base = xmlMemBlocks();
27694         doc = gen_xmlDocPtr(n_doc, 0);
27695 
27696         ret_val = xmlXIncludeProcess(doc);
27697         desret_int(ret_val);
27698         call_tests++;
27699         des_xmlDocPtr(n_doc, doc, 0);
27700         xmlResetLastError();
27701         if (mem_base != xmlMemBlocks()) {
27702             printf("Leak of %d blocks found in xmlXIncludeProcess",
27703 	           xmlMemBlocks() - mem_base);
27704 	    test_ret++;
27705             printf(" %d", n_doc);
27706             printf("\n");
27707         }
27708     }
27709     function_tests++;
27710 #endif
27711 
27712     return(test_ret);
27713 }
27714 
27715 
27716 static int
test_xmlXIncludeProcessFlags(void)27717 test_xmlXIncludeProcessFlags(void) {
27718     int test_ret = 0;
27719 
27720 #if defined(LIBXML_XINCLUDE_ENABLED)
27721     int mem_base;
27722     int ret_val;
27723     xmlDocPtr doc; /* an XML document */
27724     int n_doc;
27725     int flags; /* a set of xmlParserOption used for parsing XML includes */
27726     int n_flags;
27727 
27728     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
27729     for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
27730         mem_base = xmlMemBlocks();
27731         doc = gen_xmlDocPtr(n_doc, 0);
27732         flags = gen_int(n_flags, 1);
27733 
27734         ret_val = xmlXIncludeProcessFlags(doc, flags);
27735         desret_int(ret_val);
27736         call_tests++;
27737         des_xmlDocPtr(n_doc, doc, 0);
27738         des_int(n_flags, flags, 1);
27739         xmlResetLastError();
27740         if (mem_base != xmlMemBlocks()) {
27741             printf("Leak of %d blocks found in xmlXIncludeProcessFlags",
27742 	           xmlMemBlocks() - mem_base);
27743 	    test_ret++;
27744             printf(" %d", n_doc);
27745             printf(" %d", n_flags);
27746             printf("\n");
27747         }
27748     }
27749     }
27750     function_tests++;
27751 #endif
27752 
27753     return(test_ret);
27754 }
27755 
27756 
27757 static int
test_xmlXIncludeProcessFlagsData(void)27758 test_xmlXIncludeProcessFlagsData(void) {
27759     int test_ret = 0;
27760 
27761 #if defined(LIBXML_XINCLUDE_ENABLED)
27762     int mem_base;
27763     int ret_val;
27764     xmlDocPtr doc; /* an XML document */
27765     int n_doc;
27766     int flags; /* a set of xmlParserOption used for parsing XML includes */
27767     int n_flags;
27768     void * data; /* application data that will be passed to the parser context in the _private field of the parser context(s) */
27769     int n_data;
27770 
27771     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
27772     for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
27773     for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
27774         mem_base = xmlMemBlocks();
27775         doc = gen_xmlDocPtr(n_doc, 0);
27776         flags = gen_int(n_flags, 1);
27777         data = gen_userdata(n_data, 2);
27778 
27779         ret_val = xmlXIncludeProcessFlagsData(doc, flags, data);
27780         desret_int(ret_val);
27781         call_tests++;
27782         des_xmlDocPtr(n_doc, doc, 0);
27783         des_int(n_flags, flags, 1);
27784         des_userdata(n_data, data, 2);
27785         xmlResetLastError();
27786         if (mem_base != xmlMemBlocks()) {
27787             printf("Leak of %d blocks found in xmlXIncludeProcessFlagsData",
27788 	           xmlMemBlocks() - mem_base);
27789 	    test_ret++;
27790             printf(" %d", n_doc);
27791             printf(" %d", n_flags);
27792             printf(" %d", n_data);
27793             printf("\n");
27794         }
27795     }
27796     }
27797     }
27798     function_tests++;
27799 #endif
27800 
27801     return(test_ret);
27802 }
27803 
27804 
27805 static int
test_xmlXIncludeProcessNode(void)27806 test_xmlXIncludeProcessNode(void) {
27807     int test_ret = 0;
27808 
27809 #if defined(LIBXML_XINCLUDE_ENABLED)
27810     int mem_base;
27811     int ret_val;
27812     xmlXIncludeCtxtPtr ctxt; /* an existing XInclude context */
27813     int n_ctxt;
27814     xmlNodePtr node; /* a node in an XML document */
27815     int n_node;
27816 
27817     for (n_ctxt = 0;n_ctxt < gen_nb_xmlXIncludeCtxtPtr;n_ctxt++) {
27818     for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
27819         mem_base = xmlMemBlocks();
27820         ctxt = gen_xmlXIncludeCtxtPtr(n_ctxt, 0);
27821         node = gen_xmlNodePtr(n_node, 1);
27822 
27823         ret_val = xmlXIncludeProcessNode(ctxt, node);
27824         desret_int(ret_val);
27825         call_tests++;
27826         des_xmlXIncludeCtxtPtr(n_ctxt, ctxt, 0);
27827         des_xmlNodePtr(n_node, node, 1);
27828         xmlResetLastError();
27829         if (mem_base != xmlMemBlocks()) {
27830             printf("Leak of %d blocks found in xmlXIncludeProcessNode",
27831 	           xmlMemBlocks() - mem_base);
27832 	    test_ret++;
27833             printf(" %d", n_ctxt);
27834             printf(" %d", n_node);
27835             printf("\n");
27836         }
27837     }
27838     }
27839     function_tests++;
27840 #endif
27841 
27842     return(test_ret);
27843 }
27844 
27845 
27846 static int
test_xmlXIncludeProcessTree(void)27847 test_xmlXIncludeProcessTree(void) {
27848     int test_ret = 0;
27849 
27850 #if defined(LIBXML_XINCLUDE_ENABLED)
27851     int mem_base;
27852     int ret_val;
27853     xmlNodePtr tree; /* a node in an XML document */
27854     int n_tree;
27855 
27856     for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) {
27857         mem_base = xmlMemBlocks();
27858         tree = gen_xmlNodePtr(n_tree, 0);
27859 
27860         ret_val = xmlXIncludeProcessTree(tree);
27861         desret_int(ret_val);
27862         call_tests++;
27863         des_xmlNodePtr(n_tree, tree, 0);
27864         xmlResetLastError();
27865         if (mem_base != xmlMemBlocks()) {
27866             printf("Leak of %d blocks found in xmlXIncludeProcessTree",
27867 	           xmlMemBlocks() - mem_base);
27868 	    test_ret++;
27869             printf(" %d", n_tree);
27870             printf("\n");
27871         }
27872     }
27873     function_tests++;
27874 #endif
27875 
27876     return(test_ret);
27877 }
27878 
27879 
27880 static int
test_xmlXIncludeProcessTreeFlags(void)27881 test_xmlXIncludeProcessTreeFlags(void) {
27882     int test_ret = 0;
27883 
27884 #if defined(LIBXML_XINCLUDE_ENABLED)
27885     int mem_base;
27886     int ret_val;
27887     xmlNodePtr tree; /* a node in an XML document */
27888     int n_tree;
27889     int flags; /* a set of xmlParserOption used for parsing XML includes */
27890     int n_flags;
27891 
27892     for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) {
27893     for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
27894         mem_base = xmlMemBlocks();
27895         tree = gen_xmlNodePtr(n_tree, 0);
27896         flags = gen_int(n_flags, 1);
27897 
27898         ret_val = xmlXIncludeProcessTreeFlags(tree, flags);
27899         desret_int(ret_val);
27900         call_tests++;
27901         des_xmlNodePtr(n_tree, tree, 0);
27902         des_int(n_flags, flags, 1);
27903         xmlResetLastError();
27904         if (mem_base != xmlMemBlocks()) {
27905             printf("Leak of %d blocks found in xmlXIncludeProcessTreeFlags",
27906 	           xmlMemBlocks() - mem_base);
27907 	    test_ret++;
27908             printf(" %d", n_tree);
27909             printf(" %d", n_flags);
27910             printf("\n");
27911         }
27912     }
27913     }
27914     function_tests++;
27915 #endif
27916 
27917     return(test_ret);
27918 }
27919 
27920 
27921 static int
test_xmlXIncludeProcessTreeFlagsData(void)27922 test_xmlXIncludeProcessTreeFlagsData(void) {
27923     int test_ret = 0;
27924 
27925 #if defined(LIBXML_XINCLUDE_ENABLED)
27926     int mem_base;
27927     int ret_val;
27928     xmlNodePtr tree; /* an XML node */
27929     int n_tree;
27930     int flags; /* a set of xmlParserOption used for parsing XML includes */
27931     int n_flags;
27932     void * data; /* application data that will be passed to the parser context in the _private field of the parser context(s) */
27933     int n_data;
27934 
27935     for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) {
27936     for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
27937     for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
27938         mem_base = xmlMemBlocks();
27939         tree = gen_xmlNodePtr(n_tree, 0);
27940         flags = gen_int(n_flags, 1);
27941         data = gen_userdata(n_data, 2);
27942 
27943         ret_val = xmlXIncludeProcessTreeFlagsData(tree, flags, data);
27944         desret_int(ret_val);
27945         call_tests++;
27946         des_xmlNodePtr(n_tree, tree, 0);
27947         des_int(n_flags, flags, 1);
27948         des_userdata(n_data, data, 2);
27949         xmlResetLastError();
27950         if (mem_base != xmlMemBlocks()) {
27951             printf("Leak of %d blocks found in xmlXIncludeProcessTreeFlagsData",
27952 	           xmlMemBlocks() - mem_base);
27953 	    test_ret++;
27954             printf(" %d", n_tree);
27955             printf(" %d", n_flags);
27956             printf(" %d", n_data);
27957             printf("\n");
27958         }
27959     }
27960     }
27961     }
27962     function_tests++;
27963 #endif
27964 
27965     return(test_ret);
27966 }
27967 
27968 
27969 static int
test_xmlXIncludeSetErrorHandler(void)27970 test_xmlXIncludeSetErrorHandler(void) {
27971     int test_ret = 0;
27972 
27973 
27974     /* missing type support */
27975     return(test_ret);
27976 }
27977 
27978 
27979 static int
test_xmlXIncludeSetFlags(void)27980 test_xmlXIncludeSetFlags(void) {
27981     int test_ret = 0;
27982 
27983 #if defined(LIBXML_XINCLUDE_ENABLED)
27984     int mem_base;
27985     int ret_val;
27986     xmlXIncludeCtxtPtr ctxt; /* an XInclude processing context */
27987     int n_ctxt;
27988     int flags; /* a set of xmlParserOption used for parsing XML includes */
27989     int n_flags;
27990 
27991     for (n_ctxt = 0;n_ctxt < gen_nb_xmlXIncludeCtxtPtr;n_ctxt++) {
27992     for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
27993         mem_base = xmlMemBlocks();
27994         ctxt = gen_xmlXIncludeCtxtPtr(n_ctxt, 0);
27995         flags = gen_int(n_flags, 1);
27996 
27997         ret_val = xmlXIncludeSetFlags(ctxt, flags);
27998         desret_int(ret_val);
27999         call_tests++;
28000         des_xmlXIncludeCtxtPtr(n_ctxt, ctxt, 0);
28001         des_int(n_flags, flags, 1);
28002         xmlResetLastError();
28003         if (mem_base != xmlMemBlocks()) {
28004             printf("Leak of %d blocks found in xmlXIncludeSetFlags",
28005 	           xmlMemBlocks() - mem_base);
28006 	    test_ret++;
28007             printf(" %d", n_ctxt);
28008             printf(" %d", n_flags);
28009             printf("\n");
28010         }
28011     }
28012     }
28013     function_tests++;
28014 #endif
28015 
28016     return(test_ret);
28017 }
28018 
28019 
28020 static int
test_xmlXIncludeSetResourceLoader(void)28021 test_xmlXIncludeSetResourceLoader(void) {
28022     int test_ret = 0;
28023 
28024 
28025     /* missing type support */
28026     return(test_ret);
28027 }
28028 
28029 static int
test_xinclude(void)28030 test_xinclude(void) {
28031     int test_ret = 0;
28032 
28033     if (quiet == 0) printf("Testing xinclude : 9 of 13 functions ...\n");
28034     test_ret += test_xmlXIncludeGetLastError();
28035     test_ret += test_xmlXIncludeNewContext();
28036     test_ret += test_xmlXIncludeProcess();
28037     test_ret += test_xmlXIncludeProcessFlags();
28038     test_ret += test_xmlXIncludeProcessFlagsData();
28039     test_ret += test_xmlXIncludeProcessNode();
28040     test_ret += test_xmlXIncludeProcessTree();
28041     test_ret += test_xmlXIncludeProcessTreeFlags();
28042     test_ret += test_xmlXIncludeProcessTreeFlagsData();
28043     test_ret += test_xmlXIncludeSetErrorHandler();
28044     test_ret += test_xmlXIncludeSetFlags();
28045     test_ret += test_xmlXIncludeSetResourceLoader();
28046 
28047     if (test_ret != 0)
28048 	printf("Module xinclude: %d errors\n", test_ret);
28049     return(test_ret);
28050 }
28051 
28052 static int
test_xmlAllocOutputBuffer(void)28053 test_xmlAllocOutputBuffer(void) {
28054     int test_ret = 0;
28055 
28056 #if defined(LIBXML_OUTPUT_ENABLED)
28057     int mem_base;
28058     xmlOutputBufferPtr ret_val;
28059     xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */
28060     int n_encoder;
28061 
28062     for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) {
28063         mem_base = xmlMemBlocks();
28064         encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 0);
28065 
28066         ret_val = xmlAllocOutputBuffer(encoder);
28067         desret_xmlOutputBufferPtr(ret_val);
28068         call_tests++;
28069         des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 0);
28070         xmlResetLastError();
28071         if (mem_base != xmlMemBlocks()) {
28072             printf("Leak of %d blocks found in xmlAllocOutputBuffer",
28073 	           xmlMemBlocks() - mem_base);
28074 	    test_ret++;
28075             printf(" %d", n_encoder);
28076             printf("\n");
28077         }
28078     }
28079     function_tests++;
28080 #endif
28081 
28082     return(test_ret);
28083 }
28084 
28085 
28086 static int
test_xmlAllocParserInputBuffer(void)28087 test_xmlAllocParserInputBuffer(void) {
28088     int test_ret = 0;
28089 
28090     int mem_base;
28091     xmlParserInputBufferPtr ret_val;
28092     xmlCharEncoding enc; /* the charset encoding if known (deprecated) */
28093     int n_enc;
28094 
28095     for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
28096         mem_base = xmlMemBlocks();
28097         enc = gen_xmlCharEncoding(n_enc, 0);
28098 
28099         ret_val = xmlAllocParserInputBuffer(enc);
28100         desret_xmlParserInputBufferPtr(ret_val);
28101         call_tests++;
28102         des_xmlCharEncoding(n_enc, enc, 0);
28103         xmlResetLastError();
28104         if (mem_base != xmlMemBlocks()) {
28105             printf("Leak of %d blocks found in xmlAllocParserInputBuffer",
28106 	           xmlMemBlocks() - mem_base);
28107 	    test_ret++;
28108             printf(" %d", n_enc);
28109             printf("\n");
28110         }
28111     }
28112     function_tests++;
28113 
28114     return(test_ret);
28115 }
28116 
28117 
28118 static int
test_xmlCheckFilename(void)28119 test_xmlCheckFilename(void) {
28120     int test_ret = 0;
28121 
28122     int mem_base;
28123     int ret_val;
28124     const char * path; /* the path to check */
28125     int n_path;
28126 
28127     for (n_path = 0;n_path < gen_nb_const_char_ptr;n_path++) {
28128         mem_base = xmlMemBlocks();
28129         path = gen_const_char_ptr(n_path, 0);
28130 
28131         ret_val = xmlCheckFilename(path);
28132         desret_int(ret_val);
28133         call_tests++;
28134         des_const_char_ptr(n_path, path, 0);
28135         xmlResetLastError();
28136         if (mem_base != xmlMemBlocks()) {
28137             printf("Leak of %d blocks found in xmlCheckFilename",
28138 	           xmlMemBlocks() - mem_base);
28139 	    test_ret++;
28140             printf(" %d", n_path);
28141             printf("\n");
28142         }
28143     }
28144     function_tests++;
28145 
28146     return(test_ret);
28147 }
28148 
28149 
28150 static int
test_xmlCheckHTTPInput(void)28151 test_xmlCheckHTTPInput(void) {
28152     int test_ret = 0;
28153 
28154     int mem_base;
28155     xmlParserInputPtr ret_val;
28156     xmlParserCtxtPtr ctxt; /* an XML parser context */
28157     int n_ctxt;
28158     xmlParserInputPtr ret; /* an XML parser input */
28159     int n_ret;
28160 
28161     for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
28162     for (n_ret = 0;n_ret < gen_nb_xmlParserInputPtr;n_ret++) {
28163         mem_base = xmlMemBlocks();
28164         ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
28165         ret = gen_xmlParserInputPtr(n_ret, 1);
28166 
28167         ret_val = xmlCheckHTTPInput(ctxt, ret);
28168         desret_xmlParserInputPtr(ret_val);
28169         call_tests++;
28170         des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
28171         des_xmlParserInputPtr(n_ret, ret, 1);
28172         xmlResetLastError();
28173         if (mem_base != xmlMemBlocks()) {
28174             printf("Leak of %d blocks found in xmlCheckHTTPInput",
28175 	           xmlMemBlocks() - mem_base);
28176 	    test_ret++;
28177             printf(" %d", n_ctxt);
28178             printf(" %d", n_ret);
28179             printf("\n");
28180         }
28181     }
28182     }
28183     function_tests++;
28184 
28185     return(test_ret);
28186 }
28187 
28188 
28189 static int
test_xmlCleanupInputCallbacks(void)28190 test_xmlCleanupInputCallbacks(void) {
28191     int test_ret = 0;
28192 
28193     int mem_base;
28194 
28195         mem_base = xmlMemBlocks();
28196 
28197         xmlCleanupInputCallbacks();
28198         call_tests++;
28199         xmlResetLastError();
28200         if (mem_base != xmlMemBlocks()) {
28201             printf("Leak of %d blocks found in xmlCleanupInputCallbacks",
28202 	           xmlMemBlocks() - mem_base);
28203 	    test_ret++;
28204             printf("\n");
28205         }
28206     function_tests++;
28207 
28208     return(test_ret);
28209 }
28210 
28211 
28212 static int
test_xmlCleanupOutputCallbacks(void)28213 test_xmlCleanupOutputCallbacks(void) {
28214     int test_ret = 0;
28215 
28216 #if defined(LIBXML_OUTPUT_ENABLED)
28217     int mem_base;
28218 
28219         mem_base = xmlMemBlocks();
28220 
28221         xmlCleanupOutputCallbacks();
28222         call_tests++;
28223         xmlResetLastError();
28224         if (mem_base != xmlMemBlocks()) {
28225             printf("Leak of %d blocks found in xmlCleanupOutputCallbacks",
28226 	           xmlMemBlocks() - mem_base);
28227 	    test_ret++;
28228             printf("\n");
28229         }
28230     function_tests++;
28231 #endif
28232 
28233     return(test_ret);
28234 }
28235 
28236 
28237 static int
test_xmlFileClose(void)28238 test_xmlFileClose(void) {
28239     int test_ret = 0;
28240 
28241     int mem_base;
28242     int ret_val;
28243     void * context; /* the I/O context */
28244     int n_context;
28245 
28246     for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
28247         mem_base = xmlMemBlocks();
28248         context = gen_void_ptr(n_context, 0);
28249 
28250         ret_val = xmlFileClose(context);
28251         desret_int(ret_val);
28252         call_tests++;
28253         des_void_ptr(n_context, context, 0);
28254         xmlResetLastError();
28255         if (mem_base != xmlMemBlocks()) {
28256             printf("Leak of %d blocks found in xmlFileClose",
28257 	           xmlMemBlocks() - mem_base);
28258 	    test_ret++;
28259             printf(" %d", n_context);
28260             printf("\n");
28261         }
28262     }
28263     function_tests++;
28264 
28265     return(test_ret);
28266 }
28267 
28268 
28269 static int
test_xmlFileMatch(void)28270 test_xmlFileMatch(void) {
28271     int test_ret = 0;
28272 
28273     int mem_base;
28274     int ret_val;
28275     const char * filename; /* the URI for matching */
28276     int n_filename;
28277 
28278     for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
28279         mem_base = xmlMemBlocks();
28280         filename = gen_filepath(n_filename, 0);
28281 
28282         ret_val = xmlFileMatch(filename);
28283         desret_int(ret_val);
28284         call_tests++;
28285         des_filepath(n_filename, filename, 0);
28286         xmlResetLastError();
28287         if (mem_base != xmlMemBlocks()) {
28288             printf("Leak of %d blocks found in xmlFileMatch",
28289 	           xmlMemBlocks() - mem_base);
28290 	    test_ret++;
28291             printf(" %d", n_filename);
28292             printf("\n");
28293         }
28294     }
28295     function_tests++;
28296 
28297     return(test_ret);
28298 }
28299 
28300 
28301 static int
test_xmlFileOpen(void)28302 test_xmlFileOpen(void) {
28303     int test_ret = 0;
28304 
28305     int mem_base;
28306     void * ret_val;
28307     const char * filename; /* the URI for matching */
28308     int n_filename;
28309 
28310     for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
28311         mem_base = xmlMemBlocks();
28312         filename = gen_filepath(n_filename, 0);
28313 
28314         ret_val = xmlFileOpen(filename);
28315         desret_void_ptr(ret_val);
28316         call_tests++;
28317         des_filepath(n_filename, filename, 0);
28318         xmlResetLastError();
28319         if (mem_base != xmlMemBlocks()) {
28320             printf("Leak of %d blocks found in xmlFileOpen",
28321 	           xmlMemBlocks() - mem_base);
28322 	    test_ret++;
28323             printf(" %d", n_filename);
28324             printf("\n");
28325         }
28326     }
28327     function_tests++;
28328 
28329     return(test_ret);
28330 }
28331 
28332 
28333 static int
test_xmlFileRead(void)28334 test_xmlFileRead(void) {
28335     int test_ret = 0;
28336 
28337     int mem_base;
28338     int ret_val;
28339     void * context; /* the I/O context */
28340     int n_context;
28341     char * buffer; /* where to drop data */
28342     int n_buffer;
28343     int len; /* number of bytes to write */
28344     int n_len;
28345 
28346     for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
28347     for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) {
28348     for (n_len = 0;n_len < gen_nb_int;n_len++) {
28349         mem_base = xmlMemBlocks();
28350         context = gen_void_ptr(n_context, 0);
28351         buffer = gen_char_ptr(n_buffer, 1);
28352         len = gen_int(n_len, 2);
28353 
28354         ret_val = xmlFileRead(context, buffer, len);
28355         desret_int(ret_val);
28356         call_tests++;
28357         des_void_ptr(n_context, context, 0);
28358         des_char_ptr(n_buffer, buffer, 1);
28359         des_int(n_len, len, 2);
28360         xmlResetLastError();
28361         if (mem_base != xmlMemBlocks()) {
28362             printf("Leak of %d blocks found in xmlFileRead",
28363 	           xmlMemBlocks() - mem_base);
28364 	    test_ret++;
28365             printf(" %d", n_context);
28366             printf(" %d", n_buffer);
28367             printf(" %d", n_len);
28368             printf("\n");
28369         }
28370     }
28371     }
28372     }
28373     function_tests++;
28374 
28375     return(test_ret);
28376 }
28377 
28378 
28379 static int
test_xmlIOHTTPClose(void)28380 test_xmlIOHTTPClose(void) {
28381     int test_ret = 0;
28382 
28383 #if defined(LIBXML_HTTP_ENABLED)
28384     int mem_base;
28385     int ret_val;
28386     void * context; /* the I/O context */
28387     int n_context;
28388 
28389     for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
28390         mem_base = xmlMemBlocks();
28391         context = gen_void_ptr(n_context, 0);
28392 
28393         ret_val = xmlIOHTTPClose(context);
28394         desret_int(ret_val);
28395         call_tests++;
28396         des_void_ptr(n_context, context, 0);
28397         xmlResetLastError();
28398         if (mem_base != xmlMemBlocks()) {
28399             printf("Leak of %d blocks found in xmlIOHTTPClose",
28400 	           xmlMemBlocks() - mem_base);
28401 	    test_ret++;
28402             printf(" %d", n_context);
28403             printf("\n");
28404         }
28405     }
28406     function_tests++;
28407 #endif
28408 
28409     return(test_ret);
28410 }
28411 
28412 
28413 static int
test_xmlIOHTTPMatch(void)28414 test_xmlIOHTTPMatch(void) {
28415     int test_ret = 0;
28416 
28417 #if defined(LIBXML_HTTP_ENABLED)
28418     int mem_base;
28419     int ret_val;
28420     const char * filename; /* the URI for matching */
28421     int n_filename;
28422 
28423     for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
28424         mem_base = xmlMemBlocks();
28425         filename = gen_filepath(n_filename, 0);
28426 
28427         ret_val = xmlIOHTTPMatch(filename);
28428         desret_int(ret_val);
28429         call_tests++;
28430         des_filepath(n_filename, filename, 0);
28431         xmlResetLastError();
28432         if (mem_base != xmlMemBlocks()) {
28433             printf("Leak of %d blocks found in xmlIOHTTPMatch",
28434 	           xmlMemBlocks() - mem_base);
28435 	    test_ret++;
28436             printf(" %d", n_filename);
28437             printf("\n");
28438         }
28439     }
28440     function_tests++;
28441 #endif
28442 
28443     return(test_ret);
28444 }
28445 
28446 
28447 static int
test_xmlIOHTTPOpen(void)28448 test_xmlIOHTTPOpen(void) {
28449     int test_ret = 0;
28450 
28451 #if defined(LIBXML_HTTP_ENABLED)
28452     int mem_base;
28453     void * ret_val;
28454     const char * filename; /* the URI for matching */
28455     int n_filename;
28456 
28457     for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
28458         mem_base = xmlMemBlocks();
28459         filename = gen_filepath(n_filename, 0);
28460 
28461         ret_val = xmlIOHTTPOpen(filename);
28462         desret_xmlNanoHTTPCtxtPtr(ret_val);
28463         call_tests++;
28464         des_filepath(n_filename, filename, 0);
28465         xmlResetLastError();
28466         if (mem_base != xmlMemBlocks()) {
28467             printf("Leak of %d blocks found in xmlIOHTTPOpen",
28468 	           xmlMemBlocks() - mem_base);
28469 	    test_ret++;
28470             printf(" %d", n_filename);
28471             printf("\n");
28472         }
28473     }
28474     function_tests++;
28475 #endif
28476 
28477     return(test_ret);
28478 }
28479 
28480 
28481 static int
test_xmlIOHTTPRead(void)28482 test_xmlIOHTTPRead(void) {
28483     int test_ret = 0;
28484 
28485 #if defined(LIBXML_HTTP_ENABLED)
28486     int mem_base;
28487     int ret_val;
28488     void * context; /* the I/O context */
28489     int n_context;
28490     char * buffer; /* where to drop data */
28491     int n_buffer;
28492     int len; /* number of bytes to write */
28493     int n_len;
28494 
28495     for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
28496     for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) {
28497     for (n_len = 0;n_len < gen_nb_int;n_len++) {
28498         mem_base = xmlMemBlocks();
28499         context = gen_void_ptr(n_context, 0);
28500         buffer = gen_char_ptr(n_buffer, 1);
28501         len = gen_int(n_len, 2);
28502 
28503         ret_val = xmlIOHTTPRead(context, buffer, len);
28504         desret_int(ret_val);
28505         call_tests++;
28506         des_void_ptr(n_context, context, 0);
28507         des_char_ptr(n_buffer, buffer, 1);
28508         des_int(n_len, len, 2);
28509         xmlResetLastError();
28510         if (mem_base != xmlMemBlocks()) {
28511             printf("Leak of %d blocks found in xmlIOHTTPRead",
28512 	           xmlMemBlocks() - mem_base);
28513 	    test_ret++;
28514             printf(" %d", n_context);
28515             printf(" %d", n_buffer);
28516             printf(" %d", n_len);
28517             printf("\n");
28518         }
28519     }
28520     }
28521     }
28522     function_tests++;
28523 #endif
28524 
28525     return(test_ret);
28526 }
28527 
28528 
28529 static int
test_xmlNoNetExternalEntityLoader(void)28530 test_xmlNoNetExternalEntityLoader(void) {
28531     int test_ret = 0;
28532 
28533     int mem_base;
28534     xmlParserInputPtr ret_val;
28535     const char * URL; /* the URL for the entity to load */
28536     int n_URL;
28537     const char * ID; /* the System ID for the entity to load */
28538     int n_ID;
28539     xmlParserCtxtPtr ctxt; /* the context in which the entity is called or NULL */
28540     int n_ctxt;
28541 
28542     for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
28543     for (n_ID = 0;n_ID < gen_nb_const_char_ptr;n_ID++) {
28544     for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
28545         mem_base = xmlMemBlocks();
28546         URL = gen_filepath(n_URL, 0);
28547         ID = gen_const_char_ptr(n_ID, 1);
28548         ctxt = gen_xmlParserCtxtPtr(n_ctxt, 2);
28549 
28550         ret_val = xmlNoNetExternalEntityLoader(URL, ID, ctxt);
28551         desret_xmlParserInputPtr(ret_val);
28552         call_tests++;
28553         des_filepath(n_URL, URL, 0);
28554         des_const_char_ptr(n_ID, ID, 1);
28555         des_xmlParserCtxtPtr(n_ctxt, ctxt, 2);
28556         xmlResetLastError();
28557         if (mem_base != xmlMemBlocks()) {
28558             printf("Leak of %d blocks found in xmlNoNetExternalEntityLoader",
28559 	           xmlMemBlocks() - mem_base);
28560 	    test_ret++;
28561             printf(" %d", n_URL);
28562             printf(" %d", n_ID);
28563             printf(" %d", n_ctxt);
28564             printf("\n");
28565         }
28566     }
28567     }
28568     }
28569     function_tests++;
28570 
28571     return(test_ret);
28572 }
28573 
28574 
28575 static int
test_xmlNormalizeWindowsPath(void)28576 test_xmlNormalizeWindowsPath(void) {
28577     int test_ret = 0;
28578 
28579     int mem_base;
28580     xmlChar * ret_val;
28581     const xmlChar * path; /* the input file path */
28582     int n_path;
28583 
28584     for (n_path = 0;n_path < gen_nb_const_xmlChar_ptr;n_path++) {
28585         mem_base = xmlMemBlocks();
28586         path = gen_const_xmlChar_ptr(n_path, 0);
28587 
28588         ret_val = xmlNormalizeWindowsPath(path);
28589         desret_xmlChar_ptr(ret_val);
28590         call_tests++;
28591         des_const_xmlChar_ptr(n_path, path, 0);
28592         xmlResetLastError();
28593         if (mem_base != xmlMemBlocks()) {
28594             printf("Leak of %d blocks found in xmlNormalizeWindowsPath",
28595 	           xmlMemBlocks() - mem_base);
28596 	    test_ret++;
28597             printf(" %d", n_path);
28598             printf("\n");
28599         }
28600     }
28601     function_tests++;
28602 
28603     return(test_ret);
28604 }
28605 
28606 
28607 static int
test_xmlOutputBufferCreateBuffer(void)28608 test_xmlOutputBufferCreateBuffer(void) {
28609     int test_ret = 0;
28610 
28611 #if defined(LIBXML_OUTPUT_ENABLED)
28612     int mem_base;
28613     xmlOutputBufferPtr ret_val;
28614     xmlBufferPtr buffer; /* a xmlBufferPtr */
28615     int n_buffer;
28616     xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */
28617     int n_encoder;
28618 
28619     for (n_buffer = 0;n_buffer < gen_nb_xmlBufferPtr;n_buffer++) {
28620     for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) {
28621         mem_base = xmlMemBlocks();
28622         buffer = gen_xmlBufferPtr(n_buffer, 0);
28623         encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 1);
28624 
28625         ret_val = xmlOutputBufferCreateBuffer(buffer, encoder);
28626         desret_xmlOutputBufferPtr(ret_val);
28627         call_tests++;
28628         des_xmlBufferPtr(n_buffer, buffer, 0);
28629         des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 1);
28630         xmlResetLastError();
28631         if (mem_base != xmlMemBlocks()) {
28632             printf("Leak of %d blocks found in xmlOutputBufferCreateBuffer",
28633 	           xmlMemBlocks() - mem_base);
28634 	    test_ret++;
28635             printf(" %d", n_buffer);
28636             printf(" %d", n_encoder);
28637             printf("\n");
28638         }
28639     }
28640     }
28641     function_tests++;
28642 #endif
28643 
28644     return(test_ret);
28645 }
28646 
28647 
28648 static int
test_xmlOutputBufferCreateFd(void)28649 test_xmlOutputBufferCreateFd(void) {
28650     int test_ret = 0;
28651 
28652 #if defined(LIBXML_OUTPUT_ENABLED)
28653     int mem_base;
28654     xmlOutputBufferPtr ret_val;
28655     int fd; /* a file descriptor number */
28656     int n_fd;
28657     xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */
28658     int n_encoder;
28659 
28660     for (n_fd = 0;n_fd < gen_nb_int;n_fd++) {
28661     for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) {
28662         mem_base = xmlMemBlocks();
28663         fd = gen_int(n_fd, 0);
28664         encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 1);
28665 
28666         ret_val = xmlOutputBufferCreateFd(fd, encoder);
28667         desret_xmlOutputBufferPtr(ret_val);
28668         call_tests++;
28669         des_int(n_fd, fd, 0);
28670         des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 1);
28671         xmlResetLastError();
28672         if (mem_base != xmlMemBlocks()) {
28673             printf("Leak of %d blocks found in xmlOutputBufferCreateFd",
28674 	           xmlMemBlocks() - mem_base);
28675 	    test_ret++;
28676             printf(" %d", n_fd);
28677             printf(" %d", n_encoder);
28678             printf("\n");
28679         }
28680     }
28681     }
28682     function_tests++;
28683 #endif
28684 
28685     return(test_ret);
28686 }
28687 
28688 
28689 static int
test_xmlOutputBufferCreateFile(void)28690 test_xmlOutputBufferCreateFile(void) {
28691     int test_ret = 0;
28692 
28693 #if defined(LIBXML_OUTPUT_ENABLED)
28694     int mem_base;
28695     xmlOutputBufferPtr ret_val;
28696     FILE * file; /* a FILE* */
28697     int n_file;
28698     xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */
28699     int n_encoder;
28700 
28701     for (n_file = 0;n_file < gen_nb_FILE_ptr;n_file++) {
28702     for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) {
28703         mem_base = xmlMemBlocks();
28704         file = gen_FILE_ptr(n_file, 0);
28705         encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 1);
28706 
28707         ret_val = xmlOutputBufferCreateFile(file, encoder);
28708         desret_xmlOutputBufferPtr(ret_val);
28709         call_tests++;
28710         des_FILE_ptr(n_file, file, 0);
28711         des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 1);
28712         xmlResetLastError();
28713         if (mem_base != xmlMemBlocks()) {
28714             printf("Leak of %d blocks found in xmlOutputBufferCreateFile",
28715 	           xmlMemBlocks() - mem_base);
28716 	    test_ret++;
28717             printf(" %d", n_file);
28718             printf(" %d", n_encoder);
28719             printf("\n");
28720         }
28721     }
28722     }
28723     function_tests++;
28724 #endif
28725 
28726     return(test_ret);
28727 }
28728 
28729 
28730 static int
test_xmlOutputBufferCreateFilename(void)28731 test_xmlOutputBufferCreateFilename(void) {
28732     int test_ret = 0;
28733 
28734 #if defined(LIBXML_OUTPUT_ENABLED)
28735     int mem_base;
28736     xmlOutputBufferPtr ret_val;
28737     const char * URI; /* a C string containing the URI or filename */
28738     int n_URI;
28739     xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */
28740     int n_encoder;
28741     int compression; /* the compression ration (0 none, 9 max). */
28742     int n_compression;
28743 
28744     for (n_URI = 0;n_URI < gen_nb_fileoutput;n_URI++) {
28745     for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) {
28746     for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
28747         mem_base = xmlMemBlocks();
28748         URI = gen_fileoutput(n_URI, 0);
28749         encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 1);
28750         compression = gen_int(n_compression, 2);
28751 
28752         ret_val = xmlOutputBufferCreateFilename(URI, encoder, compression);
28753         desret_xmlOutputBufferPtr(ret_val);
28754         call_tests++;
28755         des_fileoutput(n_URI, URI, 0);
28756         des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 1);
28757         des_int(n_compression, compression, 2);
28758         xmlResetLastError();
28759         if (mem_base != xmlMemBlocks()) {
28760             printf("Leak of %d blocks found in xmlOutputBufferCreateFilename",
28761 	           xmlMemBlocks() - mem_base);
28762 	    test_ret++;
28763             printf(" %d", n_URI);
28764             printf(" %d", n_encoder);
28765             printf(" %d", n_compression);
28766             printf("\n");
28767         }
28768     }
28769     }
28770     }
28771     function_tests++;
28772 #endif
28773 
28774     return(test_ret);
28775 }
28776 
28777 
28778 static int
test_xmlOutputBufferCreateFilenameDefault(void)28779 test_xmlOutputBufferCreateFilenameDefault(void) {
28780     int test_ret = 0;
28781 
28782 
28783     /* missing type support */
28784     return(test_ret);
28785 }
28786 
28787 
28788 static int
test_xmlOutputBufferFlush(void)28789 test_xmlOutputBufferFlush(void) {
28790     int test_ret = 0;
28791 
28792 #if defined(LIBXML_OUTPUT_ENABLED)
28793     int mem_base;
28794     int ret_val;
28795     xmlOutputBufferPtr out; /* a buffered output */
28796     int n_out;
28797 
28798     for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) {
28799         mem_base = xmlMemBlocks();
28800         out = gen_xmlOutputBufferPtr(n_out, 0);
28801 
28802         ret_val = xmlOutputBufferFlush(out);
28803         desret_int(ret_val);
28804         call_tests++;
28805         des_xmlOutputBufferPtr(n_out, out, 0);
28806         xmlResetLastError();
28807         if (mem_base != xmlMemBlocks()) {
28808             printf("Leak of %d blocks found in xmlOutputBufferFlush",
28809 	           xmlMemBlocks() - mem_base);
28810 	    test_ret++;
28811             printf(" %d", n_out);
28812             printf("\n");
28813         }
28814     }
28815     function_tests++;
28816 #endif
28817 
28818     return(test_ret);
28819 }
28820 
28821 
28822 static int
test_xmlOutputBufferGetContent(void)28823 test_xmlOutputBufferGetContent(void) {
28824     int test_ret = 0;
28825 
28826 #if defined(LIBXML_OUTPUT_ENABLED)
28827     int mem_base;
28828     const xmlChar * ret_val;
28829     xmlOutputBufferPtr out; /* an xmlOutputBufferPtr */
28830     int n_out;
28831 
28832     for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) {
28833         mem_base = xmlMemBlocks();
28834         out = gen_xmlOutputBufferPtr(n_out, 0);
28835 
28836         ret_val = xmlOutputBufferGetContent(out);
28837         desret_const_xmlChar_ptr(ret_val);
28838         call_tests++;
28839         des_xmlOutputBufferPtr(n_out, out, 0);
28840         xmlResetLastError();
28841         if (mem_base != xmlMemBlocks()) {
28842             printf("Leak of %d blocks found in xmlOutputBufferGetContent",
28843 	           xmlMemBlocks() - mem_base);
28844 	    test_ret++;
28845             printf(" %d", n_out);
28846             printf("\n");
28847         }
28848     }
28849     function_tests++;
28850 #endif
28851 
28852     return(test_ret);
28853 }
28854 
28855 
28856 static int
test_xmlOutputBufferGetSize(void)28857 test_xmlOutputBufferGetSize(void) {
28858     int test_ret = 0;
28859 
28860 
28861     /* missing type support */
28862     return(test_ret);
28863 }
28864 
28865 
28866 static int
test_xmlOutputBufferWrite(void)28867 test_xmlOutputBufferWrite(void) {
28868     int test_ret = 0;
28869 
28870 #if defined(LIBXML_OUTPUT_ENABLED)
28871     int mem_base;
28872     int ret_val;
28873     xmlOutputBufferPtr out; /* a buffered parser output */
28874     int n_out;
28875     int len; /* the size in bytes of the array. */
28876     int n_len;
28877     const char * buf; /* an char array */
28878     int n_buf;
28879 
28880     for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) {
28881     for (n_len = 0;n_len < gen_nb_int;n_len++) {
28882     for (n_buf = 0;n_buf < gen_nb_const_char_ptr;n_buf++) {
28883         mem_base = xmlMemBlocks();
28884         out = gen_xmlOutputBufferPtr(n_out, 0);
28885         len = gen_int(n_len, 1);
28886         buf = gen_const_char_ptr(n_buf, 2);
28887         if ((buf != NULL) &&
28888             (len > xmlStrlen(BAD_CAST buf)))
28889             len = 0;
28890 
28891         ret_val = xmlOutputBufferWrite(out, len, buf);
28892         desret_int(ret_val);
28893         call_tests++;
28894         des_xmlOutputBufferPtr(n_out, out, 0);
28895         des_int(n_len, len, 1);
28896         des_const_char_ptr(n_buf, buf, 2);
28897         xmlResetLastError();
28898         if (mem_base != xmlMemBlocks()) {
28899             printf("Leak of %d blocks found in xmlOutputBufferWrite",
28900 	           xmlMemBlocks() - mem_base);
28901 	    test_ret++;
28902             printf(" %d", n_out);
28903             printf(" %d", n_len);
28904             printf(" %d", n_buf);
28905             printf("\n");
28906         }
28907     }
28908     }
28909     }
28910     function_tests++;
28911 #endif
28912 
28913     return(test_ret);
28914 }
28915 
28916 
28917 static int
test_xmlOutputBufferWriteEscape(void)28918 test_xmlOutputBufferWriteEscape(void) {
28919     int test_ret = 0;
28920 
28921 
28922     /* missing type support */
28923     return(test_ret);
28924 }
28925 
28926 
28927 static int
test_xmlOutputBufferWriteString(void)28928 test_xmlOutputBufferWriteString(void) {
28929     int test_ret = 0;
28930 
28931 #if defined(LIBXML_OUTPUT_ENABLED)
28932     int mem_base;
28933     int ret_val;
28934     xmlOutputBufferPtr out; /* a buffered parser output */
28935     int n_out;
28936     const char * str; /* a zero terminated C string */
28937     int n_str;
28938 
28939     for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) {
28940     for (n_str = 0;n_str < gen_nb_const_char_ptr;n_str++) {
28941         mem_base = xmlMemBlocks();
28942         out = gen_xmlOutputBufferPtr(n_out, 0);
28943         str = gen_const_char_ptr(n_str, 1);
28944 
28945         ret_val = xmlOutputBufferWriteString(out, str);
28946         desret_int(ret_val);
28947         call_tests++;
28948         des_xmlOutputBufferPtr(n_out, out, 0);
28949         des_const_char_ptr(n_str, str, 1);
28950         xmlResetLastError();
28951         if (mem_base != xmlMemBlocks()) {
28952             printf("Leak of %d blocks found in xmlOutputBufferWriteString",
28953 	           xmlMemBlocks() - mem_base);
28954 	    test_ret++;
28955             printf(" %d", n_out);
28956             printf(" %d", n_str);
28957             printf("\n");
28958         }
28959     }
28960     }
28961     function_tests++;
28962 #endif
28963 
28964     return(test_ret);
28965 }
28966 
28967 
28968 static int
test_xmlParserGetDirectory(void)28969 test_xmlParserGetDirectory(void) {
28970     int test_ret = 0;
28971 
28972 
28973     /* missing type support */
28974     return(test_ret);
28975 }
28976 
28977 
28978 static int
test_xmlParserInputBufferCreateFd(void)28979 test_xmlParserInputBufferCreateFd(void) {
28980     int test_ret = 0;
28981 
28982     int mem_base;
28983     xmlParserInputBufferPtr ret_val;
28984     int fd; /* a file descriptor number */
28985     int n_fd;
28986     xmlCharEncoding enc; /* the charset encoding if known (deprecated) */
28987     int n_enc;
28988 
28989     for (n_fd = 0;n_fd < gen_nb_int;n_fd++) {
28990     for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
28991         mem_base = xmlMemBlocks();
28992         fd = gen_int(n_fd, 0);
28993         enc = gen_xmlCharEncoding(n_enc, 1);
28994         if (fd >= 0) fd = -1;
28995 
28996         ret_val = xmlParserInputBufferCreateFd(fd, enc);
28997         desret_xmlParserInputBufferPtr(ret_val);
28998         call_tests++;
28999         des_int(n_fd, fd, 0);
29000         des_xmlCharEncoding(n_enc, enc, 1);
29001         xmlResetLastError();
29002         if (mem_base != xmlMemBlocks()) {
29003             printf("Leak of %d blocks found in xmlParserInputBufferCreateFd",
29004 	           xmlMemBlocks() - mem_base);
29005 	    test_ret++;
29006             printf(" %d", n_fd);
29007             printf(" %d", n_enc);
29008             printf("\n");
29009         }
29010     }
29011     }
29012     function_tests++;
29013 
29014     return(test_ret);
29015 }
29016 
29017 
29018 static int
test_xmlParserInputBufferCreateFile(void)29019 test_xmlParserInputBufferCreateFile(void) {
29020     int test_ret = 0;
29021 
29022     int mem_base;
29023     xmlParserInputBufferPtr ret_val;
29024     FILE * file; /* a FILE* */
29025     int n_file;
29026     xmlCharEncoding enc; /* the charset encoding if known (deprecated) */
29027     int n_enc;
29028 
29029     for (n_file = 0;n_file < gen_nb_FILE_ptr;n_file++) {
29030     for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
29031         mem_base = xmlMemBlocks();
29032         file = gen_FILE_ptr(n_file, 0);
29033         enc = gen_xmlCharEncoding(n_enc, 1);
29034 
29035         ret_val = xmlParserInputBufferCreateFile(file, enc);
29036         desret_xmlParserInputBufferPtr(ret_val);
29037         call_tests++;
29038         des_FILE_ptr(n_file, file, 0);
29039         des_xmlCharEncoding(n_enc, enc, 1);
29040         xmlResetLastError();
29041         if (mem_base != xmlMemBlocks()) {
29042             printf("Leak of %d blocks found in xmlParserInputBufferCreateFile",
29043 	           xmlMemBlocks() - mem_base);
29044 	    test_ret++;
29045             printf(" %d", n_file);
29046             printf(" %d", n_enc);
29047             printf("\n");
29048         }
29049     }
29050     }
29051     function_tests++;
29052 
29053     return(test_ret);
29054 }
29055 
29056 
29057 static int
test_xmlParserInputBufferCreateFilename(void)29058 test_xmlParserInputBufferCreateFilename(void) {
29059     int test_ret = 0;
29060 
29061     int mem_base;
29062     xmlParserInputBufferPtr ret_val;
29063     const char * URI; /* a C string containing the URI or filename */
29064     int n_URI;
29065     xmlCharEncoding enc; /* the charset encoding if known */
29066     int n_enc;
29067 
29068     for (n_URI = 0;n_URI < gen_nb_fileoutput;n_URI++) {
29069     for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
29070         mem_base = xmlMemBlocks();
29071         URI = gen_fileoutput(n_URI, 0);
29072         enc = gen_xmlCharEncoding(n_enc, 1);
29073 
29074         ret_val = xmlParserInputBufferCreateFilename(URI, enc);
29075         desret_xmlParserInputBufferPtr(ret_val);
29076         call_tests++;
29077         des_fileoutput(n_URI, URI, 0);
29078         des_xmlCharEncoding(n_enc, enc, 1);
29079         xmlResetLastError();
29080         if (mem_base != xmlMemBlocks()) {
29081             printf("Leak of %d blocks found in xmlParserInputBufferCreateFilename",
29082 	           xmlMemBlocks() - mem_base);
29083 	    test_ret++;
29084             printf(" %d", n_URI);
29085             printf(" %d", n_enc);
29086             printf("\n");
29087         }
29088     }
29089     }
29090     function_tests++;
29091 
29092     return(test_ret);
29093 }
29094 
29095 
29096 static int
test_xmlParserInputBufferCreateFilenameDefault(void)29097 test_xmlParserInputBufferCreateFilenameDefault(void) {
29098     int test_ret = 0;
29099 
29100 
29101     /* missing type support */
29102     return(test_ret);
29103 }
29104 
29105 
29106 static int
test_xmlParserInputBufferCreateMem(void)29107 test_xmlParserInputBufferCreateMem(void) {
29108     int test_ret = 0;
29109 
29110     int mem_base;
29111     xmlParserInputBufferPtr ret_val;
29112     const char * mem; /* the memory input */
29113     int n_mem;
29114     int size; /* the length of the memory block */
29115     int n_size;
29116     xmlCharEncoding enc; /* the charset encoding if known (deprecated) */
29117     int n_enc;
29118 
29119     for (n_mem = 0;n_mem < gen_nb_const_char_ptr;n_mem++) {
29120     for (n_size = 0;n_size < gen_nb_int;n_size++) {
29121     for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
29122         mem_base = xmlMemBlocks();
29123         mem = gen_const_char_ptr(n_mem, 0);
29124         size = gen_int(n_size, 1);
29125         enc = gen_xmlCharEncoding(n_enc, 2);
29126         if ((mem != NULL) &&
29127             (size > xmlStrlen(BAD_CAST mem)))
29128             size = 0;
29129 
29130         ret_val = xmlParserInputBufferCreateMem(mem, size, enc);
29131         desret_xmlParserInputBufferPtr(ret_val);
29132         call_tests++;
29133         des_const_char_ptr(n_mem, mem, 0);
29134         des_int(n_size, size, 1);
29135         des_xmlCharEncoding(n_enc, enc, 2);
29136         xmlResetLastError();
29137         if (mem_base != xmlMemBlocks()) {
29138             printf("Leak of %d blocks found in xmlParserInputBufferCreateMem",
29139 	           xmlMemBlocks() - mem_base);
29140 	    test_ret++;
29141             printf(" %d", n_mem);
29142             printf(" %d", n_size);
29143             printf(" %d", n_enc);
29144             printf("\n");
29145         }
29146     }
29147     }
29148     }
29149     function_tests++;
29150 
29151     return(test_ret);
29152 }
29153 
29154 
29155 static int
test_xmlParserInputBufferCreateStatic(void)29156 test_xmlParserInputBufferCreateStatic(void) {
29157     int test_ret = 0;
29158 
29159     int mem_base;
29160     xmlParserInputBufferPtr ret_val;
29161     const char * mem; /* the memory input */
29162     int n_mem;
29163     int size; /* the length of the memory block */
29164     int n_size;
29165     xmlCharEncoding enc; /* the charset encoding if known */
29166     int n_enc;
29167 
29168     for (n_mem = 0;n_mem < gen_nb_const_char_ptr;n_mem++) {
29169     for (n_size = 0;n_size < gen_nb_int;n_size++) {
29170     for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
29171         mem_base = xmlMemBlocks();
29172         mem = gen_const_char_ptr(n_mem, 0);
29173         size = gen_int(n_size, 1);
29174         enc = gen_xmlCharEncoding(n_enc, 2);
29175         if ((mem != NULL) &&
29176             (size > xmlStrlen(BAD_CAST mem)))
29177             size = 0;
29178 
29179         ret_val = xmlParserInputBufferCreateStatic(mem, size, enc);
29180         desret_xmlParserInputBufferPtr(ret_val);
29181         call_tests++;
29182         des_const_char_ptr(n_mem, mem, 0);
29183         des_int(n_size, size, 1);
29184         des_xmlCharEncoding(n_enc, enc, 2);
29185         xmlResetLastError();
29186         if (mem_base != xmlMemBlocks()) {
29187             printf("Leak of %d blocks found in xmlParserInputBufferCreateStatic",
29188 	           xmlMemBlocks() - mem_base);
29189 	    test_ret++;
29190             printf(" %d", n_mem);
29191             printf(" %d", n_size);
29192             printf(" %d", n_enc);
29193             printf("\n");
29194         }
29195     }
29196     }
29197     }
29198     function_tests++;
29199 
29200     return(test_ret);
29201 }
29202 
29203 
29204 static int
test_xmlParserInputBufferGrow(void)29205 test_xmlParserInputBufferGrow(void) {
29206     int test_ret = 0;
29207 
29208     int mem_base;
29209     int ret_val;
29210     xmlParserInputBufferPtr in; /* a buffered parser input */
29211     int n_in;
29212     int len; /* indicative value of the amount of chars to read */
29213     int n_len;
29214 
29215     for (n_in = 0;n_in < gen_nb_xmlParserInputBufferPtr;n_in++) {
29216     for (n_len = 0;n_len < gen_nb_int;n_len++) {
29217         mem_base = xmlMemBlocks();
29218         in = gen_xmlParserInputBufferPtr(n_in, 0);
29219         len = gen_int(n_len, 1);
29220 
29221         ret_val = xmlParserInputBufferGrow(in, len);
29222         desret_int(ret_val);
29223         call_tests++;
29224         des_xmlParserInputBufferPtr(n_in, in, 0);
29225         des_int(n_len, len, 1);
29226         xmlResetLastError();
29227         if (mem_base != xmlMemBlocks()) {
29228             printf("Leak of %d blocks found in xmlParserInputBufferGrow",
29229 	           xmlMemBlocks() - mem_base);
29230 	    test_ret++;
29231             printf(" %d", n_in);
29232             printf(" %d", n_len);
29233             printf("\n");
29234         }
29235     }
29236     }
29237     function_tests++;
29238 
29239     return(test_ret);
29240 }
29241 
29242 
29243 static int
test_xmlParserInputBufferPush(void)29244 test_xmlParserInputBufferPush(void) {
29245     int test_ret = 0;
29246 
29247     int mem_base;
29248     int ret_val;
29249     xmlParserInputBufferPtr in; /* a buffered parser input */
29250     int n_in;
29251     int len; /* the size in bytes of the array. */
29252     int n_len;
29253     const char * buf; /* an char array */
29254     int n_buf;
29255 
29256     for (n_in = 0;n_in < gen_nb_xmlParserInputBufferPtr;n_in++) {
29257     for (n_len = 0;n_len < gen_nb_int;n_len++) {
29258     for (n_buf = 0;n_buf < gen_nb_const_char_ptr;n_buf++) {
29259         mem_base = xmlMemBlocks();
29260         in = gen_xmlParserInputBufferPtr(n_in, 0);
29261         len = gen_int(n_len, 1);
29262         buf = gen_const_char_ptr(n_buf, 2);
29263         if ((buf != NULL) &&
29264             (len > xmlStrlen(BAD_CAST buf)))
29265             len = 0;
29266 
29267         ret_val = xmlParserInputBufferPush(in, len, buf);
29268         desret_int(ret_val);
29269         call_tests++;
29270         des_xmlParserInputBufferPtr(n_in, in, 0);
29271         des_int(n_len, len, 1);
29272         des_const_char_ptr(n_buf, buf, 2);
29273         xmlResetLastError();
29274         if (mem_base != xmlMemBlocks()) {
29275             printf("Leak of %d blocks found in xmlParserInputBufferPush",
29276 	           xmlMemBlocks() - mem_base);
29277 	    test_ret++;
29278             printf(" %d", n_in);
29279             printf(" %d", n_len);
29280             printf(" %d", n_buf);
29281             printf("\n");
29282         }
29283     }
29284     }
29285     }
29286     function_tests++;
29287 
29288     return(test_ret);
29289 }
29290 
29291 
29292 static int
test_xmlParserInputBufferRead(void)29293 test_xmlParserInputBufferRead(void) {
29294     int test_ret = 0;
29295 
29296     int mem_base;
29297     int ret_val;
29298     xmlParserInputBufferPtr in; /* a buffered parser input */
29299     int n_in;
29300     int len; /* indicative value of the amount of chars to read */
29301     int n_len;
29302 
29303     for (n_in = 0;n_in < gen_nb_xmlParserInputBufferPtr;n_in++) {
29304     for (n_len = 0;n_len < gen_nb_int;n_len++) {
29305         mem_base = xmlMemBlocks();
29306         in = gen_xmlParserInputBufferPtr(n_in, 0);
29307         len = gen_int(n_len, 1);
29308 
29309         ret_val = xmlParserInputBufferRead(in, len);
29310         desret_int(ret_val);
29311         call_tests++;
29312         des_xmlParserInputBufferPtr(n_in, in, 0);
29313         des_int(n_len, len, 1);
29314         xmlResetLastError();
29315         if (mem_base != xmlMemBlocks()) {
29316             printf("Leak of %d blocks found in xmlParserInputBufferRead",
29317 	           xmlMemBlocks() - mem_base);
29318 	    test_ret++;
29319             printf(" %d", n_in);
29320             printf(" %d", n_len);
29321             printf("\n");
29322         }
29323     }
29324     }
29325     function_tests++;
29326 
29327     return(test_ret);
29328 }
29329 
29330 
29331 static int
test_xmlPopInputCallbacks(void)29332 test_xmlPopInputCallbacks(void) {
29333     int test_ret = 0;
29334 
29335     int mem_base;
29336     int ret_val;
29337 
29338         mem_base = xmlMemBlocks();
29339 
29340         ret_val = xmlPopInputCallbacks();
29341         desret_int(ret_val);
29342         call_tests++;
29343         xmlResetLastError();
29344         if (mem_base != xmlMemBlocks()) {
29345             printf("Leak of %d blocks found in xmlPopInputCallbacks",
29346 	           xmlMemBlocks() - mem_base);
29347 	    test_ret++;
29348             printf("\n");
29349         }
29350     function_tests++;
29351 
29352     return(test_ret);
29353 }
29354 
29355 
29356 static int
test_xmlPopOutputCallbacks(void)29357 test_xmlPopOutputCallbacks(void) {
29358     int test_ret = 0;
29359 
29360 #if defined(LIBXML_OUTPUT_ENABLED)
29361     int mem_base;
29362     int ret_val;
29363 
29364         mem_base = xmlMemBlocks();
29365 
29366         ret_val = xmlPopOutputCallbacks();
29367         desret_int(ret_val);
29368         call_tests++;
29369         xmlResetLastError();
29370         if (mem_base != xmlMemBlocks()) {
29371             printf("Leak of %d blocks found in xmlPopOutputCallbacks",
29372 	           xmlMemBlocks() - mem_base);
29373 	    test_ret++;
29374             printf("\n");
29375         }
29376     function_tests++;
29377 #endif
29378 
29379     return(test_ret);
29380 }
29381 
29382 
29383 static int
test_xmlRegisterDefaultInputCallbacks(void)29384 test_xmlRegisterDefaultInputCallbacks(void) {
29385     int test_ret = 0;
29386 
29387     int mem_base;
29388 
29389         mem_base = xmlMemBlocks();
29390 
29391         xmlRegisterDefaultInputCallbacks();
29392         call_tests++;
29393         xmlResetLastError();
29394         if (mem_base != xmlMemBlocks()) {
29395             printf("Leak of %d blocks found in xmlRegisterDefaultInputCallbacks",
29396 	           xmlMemBlocks() - mem_base);
29397 	    test_ret++;
29398             printf("\n");
29399         }
29400     function_tests++;
29401 
29402     return(test_ret);
29403 }
29404 
29405 
29406 static int
test_xmlRegisterDefaultOutputCallbacks(void)29407 test_xmlRegisterDefaultOutputCallbacks(void) {
29408     int test_ret = 0;
29409 
29410 #if defined(LIBXML_OUTPUT_ENABLED)
29411     int mem_base;
29412 
29413         mem_base = xmlMemBlocks();
29414 
29415         xmlRegisterDefaultOutputCallbacks();
29416         call_tests++;
29417         xmlResetLastError();
29418         if (mem_base != xmlMemBlocks()) {
29419             printf("Leak of %d blocks found in xmlRegisterDefaultOutputCallbacks",
29420 	           xmlMemBlocks() - mem_base);
29421 	    test_ret++;
29422             printf("\n");
29423         }
29424     function_tests++;
29425 #endif
29426 
29427     return(test_ret);
29428 }
29429 
29430 
29431 static int
test_xmlRegisterHTTPPostCallbacks(void)29432 test_xmlRegisterHTTPPostCallbacks(void) {
29433     int test_ret = 0;
29434 
29435 #if defined(LIBXML_OUTPUT_ENABLED) && defined(LIBXML_HTTP_ENABLED)
29436     int mem_base;
29437 
29438         mem_base = xmlMemBlocks();
29439 
29440         xmlRegisterHTTPPostCallbacks();
29441         call_tests++;
29442         xmlResetLastError();
29443         if (mem_base != xmlMemBlocks()) {
29444             printf("Leak of %d blocks found in xmlRegisterHTTPPostCallbacks",
29445 	           xmlMemBlocks() - mem_base);
29446 	    test_ret++;
29447             printf("\n");
29448         }
29449     function_tests++;
29450 #endif
29451 
29452     return(test_ret);
29453 }
29454 
29455 
29456 static int
test_xmlThrDefOutputBufferCreateFilenameDefault(void)29457 test_xmlThrDefOutputBufferCreateFilenameDefault(void) {
29458     int test_ret = 0;
29459 
29460 
29461     /* missing type support */
29462     return(test_ret);
29463 }
29464 
29465 
29466 static int
test_xmlThrDefParserInputBufferCreateFilenameDefault(void)29467 test_xmlThrDefParserInputBufferCreateFilenameDefault(void) {
29468     int test_ret = 0;
29469 
29470 
29471     /* missing type support */
29472     return(test_ret);
29473 }
29474 
29475 static int
test_xmlIO(void)29476 test_xmlIO(void) {
29477     int test_ret = 0;
29478 
29479     if (quiet == 0) printf("Testing xmlIO : 37 of 51 functions ...\n");
29480     test_ret += test_xmlAllocOutputBuffer();
29481     test_ret += test_xmlAllocParserInputBuffer();
29482     test_ret += test_xmlCheckFilename();
29483     test_ret += test_xmlCheckHTTPInput();
29484     test_ret += test_xmlCleanupInputCallbacks();
29485     test_ret += test_xmlCleanupOutputCallbacks();
29486     test_ret += test_xmlFileClose();
29487     test_ret += test_xmlFileMatch();
29488     test_ret += test_xmlFileOpen();
29489     test_ret += test_xmlFileRead();
29490     test_ret += test_xmlIOHTTPClose();
29491     test_ret += test_xmlIOHTTPMatch();
29492     test_ret += test_xmlIOHTTPOpen();
29493     test_ret += test_xmlIOHTTPRead();
29494     test_ret += test_xmlNoNetExternalEntityLoader();
29495     test_ret += test_xmlNormalizeWindowsPath();
29496     test_ret += test_xmlOutputBufferCreateBuffer();
29497     test_ret += test_xmlOutputBufferCreateFd();
29498     test_ret += test_xmlOutputBufferCreateFile();
29499     test_ret += test_xmlOutputBufferCreateFilename();
29500     test_ret += test_xmlOutputBufferCreateFilenameDefault();
29501     test_ret += test_xmlOutputBufferFlush();
29502     test_ret += test_xmlOutputBufferGetContent();
29503     test_ret += test_xmlOutputBufferGetSize();
29504     test_ret += test_xmlOutputBufferWrite();
29505     test_ret += test_xmlOutputBufferWriteEscape();
29506     test_ret += test_xmlOutputBufferWriteString();
29507     test_ret += test_xmlParserGetDirectory();
29508     test_ret += test_xmlParserInputBufferCreateFd();
29509     test_ret += test_xmlParserInputBufferCreateFile();
29510     test_ret += test_xmlParserInputBufferCreateFilename();
29511     test_ret += test_xmlParserInputBufferCreateFilenameDefault();
29512     test_ret += test_xmlParserInputBufferCreateMem();
29513     test_ret += test_xmlParserInputBufferCreateStatic();
29514     test_ret += test_xmlParserInputBufferGrow();
29515     test_ret += test_xmlParserInputBufferPush();
29516     test_ret += test_xmlParserInputBufferRead();
29517     test_ret += test_xmlPopInputCallbacks();
29518     test_ret += test_xmlPopOutputCallbacks();
29519     test_ret += test_xmlRegisterDefaultInputCallbacks();
29520     test_ret += test_xmlRegisterDefaultOutputCallbacks();
29521     test_ret += test_xmlRegisterHTTPPostCallbacks();
29522     test_ret += test_xmlThrDefOutputBufferCreateFilenameDefault();
29523     test_ret += test_xmlThrDefParserInputBufferCreateFilenameDefault();
29524 
29525     if (test_ret != 0)
29526 	printf("Module xmlIO: %d errors\n", test_ret);
29527     return(test_ret);
29528 }
29529 
29530 static int
test_xmlAutomataCompile(void)29531 test_xmlAutomataCompile(void) {
29532     int test_ret = 0;
29533 
29534 
29535     /* missing type support */
29536     return(test_ret);
29537 }
29538 
29539 
29540 static int
test_xmlAutomataGetInitState(void)29541 test_xmlAutomataGetInitState(void) {
29542     int test_ret = 0;
29543 
29544 
29545     /* missing type support */
29546     return(test_ret);
29547 }
29548 
29549 #ifdef LIBXML_AUTOMATA_ENABLED
29550 
29551 #define gen_nb_xmlAutomataPtr 1
29552 #define gen_xmlAutomataPtr(no, nr) NULL
29553 #define des_xmlAutomataPtr(no, val, nr)
29554 #endif
29555 
29556 
29557 static int
test_xmlAutomataIsDeterminist(void)29558 test_xmlAutomataIsDeterminist(void) {
29559     int test_ret = 0;
29560 
29561 #if defined(LIBXML_REGEXP_ENABLED)
29562     int mem_base;
29563     int ret_val;
29564     xmlAutomataPtr am; /* an automata */
29565     int n_am;
29566 
29567     for (n_am = 0;n_am < gen_nb_xmlAutomataPtr;n_am++) {
29568         mem_base = xmlMemBlocks();
29569         am = gen_xmlAutomataPtr(n_am, 0);
29570 
29571         ret_val = xmlAutomataIsDeterminist(am);
29572         desret_int(ret_val);
29573         call_tests++;
29574         des_xmlAutomataPtr(n_am, am, 0);
29575         xmlResetLastError();
29576         if (mem_base != xmlMemBlocks()) {
29577             printf("Leak of %d blocks found in xmlAutomataIsDeterminist",
29578 	           xmlMemBlocks() - mem_base);
29579 	    test_ret++;
29580             printf(" %d", n_am);
29581             printf("\n");
29582         }
29583     }
29584     function_tests++;
29585 #endif
29586 
29587     return(test_ret);
29588 }
29589 
29590 
29591 static int
test_xmlAutomataNewAllTrans(void)29592 test_xmlAutomataNewAllTrans(void) {
29593     int test_ret = 0;
29594 
29595 
29596     /* missing type support */
29597     return(test_ret);
29598 }
29599 
29600 
29601 static int
test_xmlAutomataNewCountTrans(void)29602 test_xmlAutomataNewCountTrans(void) {
29603     int test_ret = 0;
29604 
29605 
29606     /* missing type support */
29607     return(test_ret);
29608 }
29609 
29610 
29611 static int
test_xmlAutomataNewCountTrans2(void)29612 test_xmlAutomataNewCountTrans2(void) {
29613     int test_ret = 0;
29614 
29615 
29616     /* missing type support */
29617     return(test_ret);
29618 }
29619 
29620 
29621 static int
test_xmlAutomataNewCountedTrans(void)29622 test_xmlAutomataNewCountedTrans(void) {
29623     int test_ret = 0;
29624 
29625 
29626     /* missing type support */
29627     return(test_ret);
29628 }
29629 
29630 
29631 static int
test_xmlAutomataNewCounter(void)29632 test_xmlAutomataNewCounter(void) {
29633     int test_ret = 0;
29634 
29635 #if defined(LIBXML_REGEXP_ENABLED)
29636     int mem_base;
29637     int ret_val;
29638     xmlAutomataPtr am; /* an automata */
29639     int n_am;
29640     int min; /* the minimal value on the counter */
29641     int n_min;
29642     int max; /* the maximal value on the counter */
29643     int n_max;
29644 
29645     for (n_am = 0;n_am < gen_nb_xmlAutomataPtr;n_am++) {
29646     for (n_min = 0;n_min < gen_nb_int;n_min++) {
29647     for (n_max = 0;n_max < gen_nb_int;n_max++) {
29648         mem_base = xmlMemBlocks();
29649         am = gen_xmlAutomataPtr(n_am, 0);
29650         min = gen_int(n_min, 1);
29651         max = gen_int(n_max, 2);
29652 
29653         ret_val = xmlAutomataNewCounter(am, min, max);
29654         desret_int(ret_val);
29655         call_tests++;
29656         des_xmlAutomataPtr(n_am, am, 0);
29657         des_int(n_min, min, 1);
29658         des_int(n_max, max, 2);
29659         xmlResetLastError();
29660         if (mem_base != xmlMemBlocks()) {
29661             printf("Leak of %d blocks found in xmlAutomataNewCounter",
29662 	           xmlMemBlocks() - mem_base);
29663 	    test_ret++;
29664             printf(" %d", n_am);
29665             printf(" %d", n_min);
29666             printf(" %d", n_max);
29667             printf("\n");
29668         }
29669     }
29670     }
29671     }
29672     function_tests++;
29673 #endif
29674 
29675     return(test_ret);
29676 }
29677 
29678 
29679 static int
test_xmlAutomataNewCounterTrans(void)29680 test_xmlAutomataNewCounterTrans(void) {
29681     int test_ret = 0;
29682 
29683 
29684     /* missing type support */
29685     return(test_ret);
29686 }
29687 
29688 
29689 static int
test_xmlAutomataNewEpsilon(void)29690 test_xmlAutomataNewEpsilon(void) {
29691     int test_ret = 0;
29692 
29693 
29694     /* missing type support */
29695     return(test_ret);
29696 }
29697 
29698 
29699 static int
test_xmlAutomataNewNegTrans(void)29700 test_xmlAutomataNewNegTrans(void) {
29701     int test_ret = 0;
29702 
29703 
29704     /* missing type support */
29705     return(test_ret);
29706 }
29707 
29708 
29709 static int
test_xmlAutomataNewOnceTrans(void)29710 test_xmlAutomataNewOnceTrans(void) {
29711     int test_ret = 0;
29712 
29713 
29714     /* missing type support */
29715     return(test_ret);
29716 }
29717 
29718 
29719 static int
test_xmlAutomataNewOnceTrans2(void)29720 test_xmlAutomataNewOnceTrans2(void) {
29721     int test_ret = 0;
29722 
29723 
29724     /* missing type support */
29725     return(test_ret);
29726 }
29727 
29728 
29729 static int
test_xmlAutomataNewState(void)29730 test_xmlAutomataNewState(void) {
29731     int test_ret = 0;
29732 
29733 
29734     /* missing type support */
29735     return(test_ret);
29736 }
29737 
29738 
29739 static int
test_xmlAutomataNewTransition(void)29740 test_xmlAutomataNewTransition(void) {
29741     int test_ret = 0;
29742 
29743 
29744     /* missing type support */
29745     return(test_ret);
29746 }
29747 
29748 
29749 static int
test_xmlAutomataNewTransition2(void)29750 test_xmlAutomataNewTransition2(void) {
29751     int test_ret = 0;
29752 
29753 
29754     /* missing type support */
29755     return(test_ret);
29756 }
29757 
29758 #ifdef LIBXML_AUTOMATA_ENABLED
29759 
29760 #define gen_nb_xmlAutomataStatePtr 1
29761 #define gen_xmlAutomataStatePtr(no, nr) NULL
29762 #define des_xmlAutomataStatePtr(no, val, nr)
29763 #endif
29764 
29765 
29766 static int
test_xmlAutomataSetFinalState(void)29767 test_xmlAutomataSetFinalState(void) {
29768     int test_ret = 0;
29769 
29770 #if defined(LIBXML_REGEXP_ENABLED)
29771     int mem_base;
29772     int ret_val;
29773     xmlAutomataPtr am; /* an automata */
29774     int n_am;
29775     xmlAutomataStatePtr state; /* a state in this automata */
29776     int n_state;
29777 
29778     for (n_am = 0;n_am < gen_nb_xmlAutomataPtr;n_am++) {
29779     for (n_state = 0;n_state < gen_nb_xmlAutomataStatePtr;n_state++) {
29780         mem_base = xmlMemBlocks();
29781         am = gen_xmlAutomataPtr(n_am, 0);
29782         state = gen_xmlAutomataStatePtr(n_state, 1);
29783 
29784         ret_val = xmlAutomataSetFinalState(am, state);
29785         desret_int(ret_val);
29786         call_tests++;
29787         des_xmlAutomataPtr(n_am, am, 0);
29788         des_xmlAutomataStatePtr(n_state, state, 1);
29789         xmlResetLastError();
29790         if (mem_base != xmlMemBlocks()) {
29791             printf("Leak of %d blocks found in xmlAutomataSetFinalState",
29792 	           xmlMemBlocks() - mem_base);
29793 	    test_ret++;
29794             printf(" %d", n_am);
29795             printf(" %d", n_state);
29796             printf("\n");
29797         }
29798     }
29799     }
29800     function_tests++;
29801 #endif
29802 
29803     return(test_ret);
29804 }
29805 
29806 
29807 static int
test_xmlNewAutomata(void)29808 test_xmlNewAutomata(void) {
29809     int test_ret = 0;
29810 
29811 
29812     /* missing type support */
29813     return(test_ret);
29814 }
29815 
29816 static int
test_xmlautomata(void)29817 test_xmlautomata(void) {
29818     int test_ret = 0;
29819 
29820     if (quiet == 0) printf("Testing xmlautomata : 3 of 19 functions ...\n");
29821     test_ret += test_xmlAutomataCompile();
29822     test_ret += test_xmlAutomataGetInitState();
29823     test_ret += test_xmlAutomataIsDeterminist();
29824     test_ret += test_xmlAutomataNewAllTrans();
29825     test_ret += test_xmlAutomataNewCountTrans();
29826     test_ret += test_xmlAutomataNewCountTrans2();
29827     test_ret += test_xmlAutomataNewCountedTrans();
29828     test_ret += test_xmlAutomataNewCounter();
29829     test_ret += test_xmlAutomataNewCounterTrans();
29830     test_ret += test_xmlAutomataNewEpsilon();
29831     test_ret += test_xmlAutomataNewNegTrans();
29832     test_ret += test_xmlAutomataNewOnceTrans();
29833     test_ret += test_xmlAutomataNewOnceTrans2();
29834     test_ret += test_xmlAutomataNewState();
29835     test_ret += test_xmlAutomataNewTransition();
29836     test_ret += test_xmlAutomataNewTransition2();
29837     test_ret += test_xmlAutomataSetFinalState();
29838     test_ret += test_xmlNewAutomata();
29839 
29840     if (test_ret != 0)
29841 	printf("Module xmlautomata: %d errors\n", test_ret);
29842     return(test_ret);
29843 }
29844 
29845 #define gen_nb_xmlGenericErrorFunc_ptr 1
29846 #define gen_xmlGenericErrorFunc_ptr(no, nr) NULL
29847 #define des_xmlGenericErrorFunc_ptr(no, val, nr)
29848 
29849 static int
test_initGenericErrorDefaultFunc(void)29850 test_initGenericErrorDefaultFunc(void) {
29851     int test_ret = 0;
29852 
29853     int mem_base;
29854     xmlGenericErrorFunc * handler; /* the handler */
29855     int n_handler;
29856 
29857     for (n_handler = 0;n_handler < gen_nb_xmlGenericErrorFunc_ptr;n_handler++) {
29858         mem_base = xmlMemBlocks();
29859         handler = gen_xmlGenericErrorFunc_ptr(n_handler, 0);
29860 
29861         initGenericErrorDefaultFunc(handler);
29862         call_tests++;
29863         des_xmlGenericErrorFunc_ptr(n_handler, handler, 0);
29864         xmlResetLastError();
29865         if (mem_base != xmlMemBlocks()) {
29866             printf("Leak of %d blocks found in initGenericErrorDefaultFunc",
29867 	           xmlMemBlocks() - mem_base);
29868 	    test_ret++;
29869             printf(" %d", n_handler);
29870             printf("\n");
29871         }
29872     }
29873     function_tests++;
29874 
29875     return(test_ret);
29876 }
29877 
29878 
29879 #define gen_nb_const_xmlError_ptr 1
29880 #define gen_const_xmlError_ptr(no, nr) NULL
29881 #define des_const_xmlError_ptr(no, val, nr)
29882 
29883 #define gen_nb_xmlErrorPtr 1
29884 #define gen_xmlErrorPtr(no, nr) NULL
29885 #define des_xmlErrorPtr(no, val, nr)
29886 
29887 static int
test_xmlCopyError(void)29888 test_xmlCopyError(void) {
29889     int test_ret = 0;
29890 
29891     int mem_base;
29892     int ret_val;
29893     const xmlError * from; /* a source error */
29894     int n_from;
29895     xmlErrorPtr to; /* a target error */
29896     int n_to;
29897 
29898     for (n_from = 0;n_from < gen_nb_const_xmlError_ptr;n_from++) {
29899     for (n_to = 0;n_to < gen_nb_xmlErrorPtr;n_to++) {
29900         mem_base = xmlMemBlocks();
29901         from = gen_const_xmlError_ptr(n_from, 0);
29902         to = gen_xmlErrorPtr(n_to, 1);
29903 
29904         ret_val = xmlCopyError(from, to);
29905         desret_int(ret_val);
29906         call_tests++;
29907         des_const_xmlError_ptr(n_from, from, 0);
29908         des_xmlErrorPtr(n_to, to, 1);
29909         xmlResetLastError();
29910         if (mem_base != xmlMemBlocks()) {
29911             printf("Leak of %d blocks found in xmlCopyError",
29912 	           xmlMemBlocks() - mem_base);
29913 	    test_ret++;
29914             printf(" %d", n_from);
29915             printf(" %d", n_to);
29916             printf("\n");
29917         }
29918     }
29919     }
29920     function_tests++;
29921 
29922     return(test_ret);
29923 }
29924 
29925 
29926 static int
test_xmlCtxtGetLastError(void)29927 test_xmlCtxtGetLastError(void) {
29928     int test_ret = 0;
29929 
29930 
29931     /* missing type support */
29932     return(test_ret);
29933 }
29934 
29935 
29936 static int
test_xmlCtxtResetLastError(void)29937 test_xmlCtxtResetLastError(void) {
29938     int test_ret = 0;
29939 
29940     int mem_base;
29941     void * ctx; /* an XML parser context */
29942     int n_ctx;
29943 
29944     for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
29945         mem_base = xmlMemBlocks();
29946         ctx = gen_void_ptr(n_ctx, 0);
29947 
29948         xmlCtxtResetLastError(ctx);
29949         call_tests++;
29950         des_void_ptr(n_ctx, ctx, 0);
29951         xmlResetLastError();
29952         if (mem_base != xmlMemBlocks()) {
29953             printf("Leak of %d blocks found in xmlCtxtResetLastError",
29954 	           xmlMemBlocks() - mem_base);
29955 	    test_ret++;
29956             printf(" %d", n_ctx);
29957             printf("\n");
29958         }
29959     }
29960     function_tests++;
29961 
29962     return(test_ret);
29963 }
29964 
29965 
29966 static int
test_xmlFormatError(void)29967 test_xmlFormatError(void) {
29968     int test_ret = 0;
29969 
29970 
29971     /* missing type support */
29972     return(test_ret);
29973 }
29974 
29975 
29976 static int
test_xmlGetLastError(void)29977 test_xmlGetLastError(void) {
29978     int test_ret = 0;
29979 
29980 
29981     /* missing type support */
29982     return(test_ret);
29983 }
29984 
29985 
29986 static int
test_xmlParserError(void)29987 test_xmlParserError(void) {
29988     int test_ret = 0;
29989 
29990 
29991     /* missing type support */
29992     return(test_ret);
29993 }
29994 
29995 
29996 static int
test_xmlParserPrintFileContext(void)29997 test_xmlParserPrintFileContext(void) {
29998     int test_ret = 0;
29999 
30000     int mem_base;
30001     xmlParserInputPtr input; /* an xmlParserInputPtr input */
30002     int n_input;
30003 
30004     for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) {
30005         mem_base = xmlMemBlocks();
30006         input = gen_xmlParserInputPtr(n_input, 0);
30007 
30008         xmlParserPrintFileContext(input);
30009         call_tests++;
30010         des_xmlParserInputPtr(n_input, input, 0);
30011         xmlResetLastError();
30012         if (mem_base != xmlMemBlocks()) {
30013             printf("Leak of %d blocks found in xmlParserPrintFileContext",
30014 	           xmlMemBlocks() - mem_base);
30015 	    test_ret++;
30016             printf(" %d", n_input);
30017             printf("\n");
30018         }
30019     }
30020     function_tests++;
30021 
30022     return(test_ret);
30023 }
30024 
30025 
30026 static int
test_xmlParserPrintFileInfo(void)30027 test_xmlParserPrintFileInfo(void) {
30028     int test_ret = 0;
30029 
30030     int mem_base;
30031     xmlParserInputPtr input; /* an xmlParserInputPtr input */
30032     int n_input;
30033 
30034     for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) {
30035         mem_base = xmlMemBlocks();
30036         input = gen_xmlParserInputPtr(n_input, 0);
30037 
30038         xmlParserPrintFileInfo(input);
30039         call_tests++;
30040         des_xmlParserInputPtr(n_input, input, 0);
30041         xmlResetLastError();
30042         if (mem_base != xmlMemBlocks()) {
30043             printf("Leak of %d blocks found in xmlParserPrintFileInfo",
30044 	           xmlMemBlocks() - mem_base);
30045 	    test_ret++;
30046             printf(" %d", n_input);
30047             printf("\n");
30048         }
30049     }
30050     function_tests++;
30051 
30052     return(test_ret);
30053 }
30054 
30055 
30056 static int
test_xmlParserValidityError(void)30057 test_xmlParserValidityError(void) {
30058     int test_ret = 0;
30059 
30060 
30061     /* missing type support */
30062     return(test_ret);
30063 }
30064 
30065 
30066 static int
test_xmlParserValidityWarning(void)30067 test_xmlParserValidityWarning(void) {
30068     int test_ret = 0;
30069 
30070 
30071     /* missing type support */
30072     return(test_ret);
30073 }
30074 
30075 
30076 static int
test_xmlParserWarning(void)30077 test_xmlParserWarning(void) {
30078     int test_ret = 0;
30079 
30080 
30081     /* missing type support */
30082     return(test_ret);
30083 }
30084 
30085 
30086 static int
test_xmlResetError(void)30087 test_xmlResetError(void) {
30088     int test_ret = 0;
30089 
30090     int mem_base;
30091     xmlErrorPtr err; /* pointer to the error. */
30092     int n_err;
30093 
30094     for (n_err = 0;n_err < gen_nb_xmlErrorPtr;n_err++) {
30095         mem_base = xmlMemBlocks();
30096         err = gen_xmlErrorPtr(n_err, 0);
30097 
30098         xmlResetError(err);
30099         call_tests++;
30100         des_xmlErrorPtr(n_err, err, 0);
30101         xmlResetLastError();
30102         if (mem_base != xmlMemBlocks()) {
30103             printf("Leak of %d blocks found in xmlResetError",
30104 	           xmlMemBlocks() - mem_base);
30105 	    test_ret++;
30106             printf(" %d", n_err);
30107             printf("\n");
30108         }
30109     }
30110     function_tests++;
30111 
30112     return(test_ret);
30113 }
30114 
30115 
30116 static int
test_xmlResetLastError(void)30117 test_xmlResetLastError(void) {
30118     int test_ret = 0;
30119 
30120 
30121 
30122         xmlResetLastError();
30123         call_tests++;
30124         xmlResetLastError();
30125     function_tests++;
30126 
30127     return(test_ret);
30128 }
30129 
30130 
30131 static int
test_xmlSetGenericErrorFunc(void)30132 test_xmlSetGenericErrorFunc(void) {
30133     int test_ret = 0;
30134 
30135 
30136     /* missing type support */
30137     return(test_ret);
30138 }
30139 
30140 
30141 static int
test_xmlSetStructuredErrorFunc(void)30142 test_xmlSetStructuredErrorFunc(void) {
30143     int test_ret = 0;
30144 
30145 
30146     /* missing type support */
30147     return(test_ret);
30148 }
30149 
30150 
30151 static int
test_xmlThrDefSetGenericErrorFunc(void)30152 test_xmlThrDefSetGenericErrorFunc(void) {
30153     int test_ret = 0;
30154 
30155 
30156     /* missing type support */
30157     return(test_ret);
30158 }
30159 
30160 
30161 static int
test_xmlThrDefSetStructuredErrorFunc(void)30162 test_xmlThrDefSetStructuredErrorFunc(void) {
30163     int test_ret = 0;
30164 
30165 
30166     /* missing type support */
30167     return(test_ret);
30168 }
30169 
30170 static int
test_xmlerror(void)30171 test_xmlerror(void) {
30172     int test_ret = 0;
30173 
30174     if (quiet == 0) printf("Testing xmlerror : 7 of 18 functions ...\n");
30175     test_ret += test_initGenericErrorDefaultFunc();
30176     test_ret += test_xmlCopyError();
30177     test_ret += test_xmlCtxtGetLastError();
30178     test_ret += test_xmlCtxtResetLastError();
30179     test_ret += test_xmlFormatError();
30180     test_ret += test_xmlGetLastError();
30181     test_ret += test_xmlParserError();
30182     test_ret += test_xmlParserPrintFileContext();
30183     test_ret += test_xmlParserPrintFileInfo();
30184     test_ret += test_xmlParserValidityError();
30185     test_ret += test_xmlParserValidityWarning();
30186     test_ret += test_xmlParserWarning();
30187     test_ret += test_xmlResetError();
30188     test_ret += test_xmlResetLastError();
30189     test_ret += test_xmlSetGenericErrorFunc();
30190     test_ret += test_xmlSetStructuredErrorFunc();
30191     test_ret += test_xmlThrDefSetGenericErrorFunc();
30192     test_ret += test_xmlThrDefSetStructuredErrorFunc();
30193 
30194     if (test_ret != 0)
30195 	printf("Module xmlerror: %d errors\n", test_ret);
30196     return(test_ret);
30197 }
30198 #ifdef LIBXML_MODULES_ENABLED
30199 
30200 #define gen_nb_xmlModulePtr 1
30201 #define gen_xmlModulePtr(no, nr) NULL
30202 #define des_xmlModulePtr(no, val, nr)
30203 #endif
30204 
30205 
30206 static int
test_xmlModuleClose(void)30207 test_xmlModuleClose(void) {
30208     int test_ret = 0;
30209 
30210 #if defined(LIBXML_MODULES_ENABLED)
30211     int mem_base;
30212     int ret_val;
30213     xmlModulePtr module; /* the module handle */
30214     int n_module;
30215 
30216     for (n_module = 0;n_module < gen_nb_xmlModulePtr;n_module++) {
30217         mem_base = xmlMemBlocks();
30218         module = gen_xmlModulePtr(n_module, 0);
30219 
30220         ret_val = xmlModuleClose(module);
30221         desret_int(ret_val);
30222         call_tests++;
30223         des_xmlModulePtr(n_module, module, 0);
30224         xmlResetLastError();
30225         if (mem_base != xmlMemBlocks()) {
30226             printf("Leak of %d blocks found in xmlModuleClose",
30227 	           xmlMemBlocks() - mem_base);
30228 	    test_ret++;
30229             printf(" %d", n_module);
30230             printf("\n");
30231         }
30232     }
30233     function_tests++;
30234 #endif
30235 
30236     return(test_ret);
30237 }
30238 
30239 
30240 static int
test_xmlModuleOpen(void)30241 test_xmlModuleOpen(void) {
30242     int test_ret = 0;
30243 
30244 
30245     /* missing type support */
30246     return(test_ret);
30247 }
30248 
30249 
30250 static int
test_xmlModuleSymbol(void)30251 test_xmlModuleSymbol(void) {
30252     int test_ret = 0;
30253 
30254 #if defined(LIBXML_MODULES_ENABLED)
30255     int mem_base;
30256     int ret_val;
30257     xmlModulePtr module; /* the module */
30258     int n_module;
30259     const char * name; /* the name of the symbol */
30260     int n_name;
30261     void ** symbol; /* the resulting symbol address */
30262     int n_symbol;
30263 
30264     for (n_module = 0;n_module < gen_nb_xmlModulePtr;n_module++) {
30265     for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
30266     for (n_symbol = 0;n_symbol < gen_nb_void_ptr_ptr;n_symbol++) {
30267         mem_base = xmlMemBlocks();
30268         module = gen_xmlModulePtr(n_module, 0);
30269         name = gen_const_char_ptr(n_name, 1);
30270         symbol = gen_void_ptr_ptr(n_symbol, 2);
30271 
30272         ret_val = xmlModuleSymbol(module, name, symbol);
30273         desret_int(ret_val);
30274         call_tests++;
30275         des_xmlModulePtr(n_module, module, 0);
30276         des_const_char_ptr(n_name, name, 1);
30277         des_void_ptr_ptr(n_symbol, symbol, 2);
30278         xmlResetLastError();
30279         if (mem_base != xmlMemBlocks()) {
30280             printf("Leak of %d blocks found in xmlModuleSymbol",
30281 	           xmlMemBlocks() - mem_base);
30282 	    test_ret++;
30283             printf(" %d", n_module);
30284             printf(" %d", n_name);
30285             printf(" %d", n_symbol);
30286             printf("\n");
30287         }
30288     }
30289     }
30290     }
30291     function_tests++;
30292 #endif
30293 
30294     return(test_ret);
30295 }
30296 
30297 static int
test_xmlmodule(void)30298 test_xmlmodule(void) {
30299     int test_ret = 0;
30300 
30301     if (quiet == 0) printf("Testing xmlmodule : 2 of 4 functions ...\n");
30302     test_ret += test_xmlModuleClose();
30303     test_ret += test_xmlModuleOpen();
30304     test_ret += test_xmlModuleSymbol();
30305 
30306     if (test_ret != 0)
30307 	printf("Module xmlmodule: %d errors\n", test_ret);
30308     return(test_ret);
30309 }
30310 
30311 static int
test_xmlNewTextReader(void)30312 test_xmlNewTextReader(void) {
30313     int test_ret = 0;
30314 
30315 #if defined(LIBXML_READER_ENABLED)
30316     int mem_base;
30317     xmlTextReaderPtr ret_val;
30318     xmlParserInputBufferPtr input; /* the xmlParserInputBufferPtr used to read data */
30319     int n_input;
30320     const char * URI; /* the URI information for the source if available */
30321     int n_URI;
30322 
30323     for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
30324     for (n_URI = 0;n_URI < gen_nb_filepath;n_URI++) {
30325         mem_base = xmlMemBlocks();
30326         input = gen_xmlParserInputBufferPtr(n_input, 0);
30327         URI = gen_filepath(n_URI, 1);
30328 
30329         ret_val = xmlNewTextReader(input, URI);
30330         desret_xmlTextReaderPtr(ret_val);
30331         call_tests++;
30332         des_xmlParserInputBufferPtr(n_input, input, 0);
30333         des_filepath(n_URI, URI, 1);
30334         xmlResetLastError();
30335         if (mem_base != xmlMemBlocks()) {
30336             printf("Leak of %d blocks found in xmlNewTextReader",
30337 	           xmlMemBlocks() - mem_base);
30338 	    test_ret++;
30339             printf(" %d", n_input);
30340             printf(" %d", n_URI);
30341             printf("\n");
30342         }
30343     }
30344     }
30345     function_tests++;
30346 #endif
30347 
30348     return(test_ret);
30349 }
30350 
30351 
30352 static int
test_xmlNewTextReaderFilename(void)30353 test_xmlNewTextReaderFilename(void) {
30354     int test_ret = 0;
30355 
30356 #if defined(LIBXML_READER_ENABLED)
30357     int mem_base;
30358     xmlTextReaderPtr ret_val;
30359     const char * URI; /* the URI of the resource to process */
30360     int n_URI;
30361 
30362     for (n_URI = 0;n_URI < gen_nb_filepath;n_URI++) {
30363         mem_base = xmlMemBlocks();
30364         URI = gen_filepath(n_URI, 0);
30365 
30366         ret_val = xmlNewTextReaderFilename(URI);
30367         desret_xmlTextReaderPtr(ret_val);
30368         call_tests++;
30369         des_filepath(n_URI, URI, 0);
30370         xmlResetLastError();
30371         if (mem_base != xmlMemBlocks()) {
30372             printf("Leak of %d blocks found in xmlNewTextReaderFilename",
30373 	           xmlMemBlocks() - mem_base);
30374 	    test_ret++;
30375             printf(" %d", n_URI);
30376             printf("\n");
30377         }
30378     }
30379     function_tests++;
30380 #endif
30381 
30382     return(test_ret);
30383 }
30384 
30385 
30386 static int
test_xmlReaderForDoc(void)30387 test_xmlReaderForDoc(void) {
30388     int test_ret = 0;
30389 
30390 #if defined(LIBXML_READER_ENABLED)
30391     int mem_base;
30392     xmlTextReaderPtr ret_val;
30393     const xmlChar * cur; /* a pointer to a zero terminated string */
30394     int n_cur;
30395     const char * URL; /* the base URL to use for the document */
30396     int n_URL;
30397     const char * encoding; /* the document encoding, or NULL */
30398     int n_encoding;
30399     int options; /* a combination of xmlParserOption */
30400     int n_options;
30401 
30402     for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
30403     for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
30404     for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
30405     for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
30406         mem_base = xmlMemBlocks();
30407         cur = gen_const_xmlChar_ptr(n_cur, 0);
30408         URL = gen_filepath(n_URL, 1);
30409         encoding = gen_const_char_ptr(n_encoding, 2);
30410         options = gen_parseroptions(n_options, 3);
30411 
30412         ret_val = xmlReaderForDoc(cur, URL, encoding, options);
30413         desret_xmlTextReaderPtr(ret_val);
30414         call_tests++;
30415         des_const_xmlChar_ptr(n_cur, cur, 0);
30416         des_filepath(n_URL, URL, 1);
30417         des_const_char_ptr(n_encoding, encoding, 2);
30418         des_parseroptions(n_options, options, 3);
30419         xmlResetLastError();
30420         if (mem_base != xmlMemBlocks()) {
30421             printf("Leak of %d blocks found in xmlReaderForDoc",
30422 	           xmlMemBlocks() - mem_base);
30423 	    test_ret++;
30424             printf(" %d", n_cur);
30425             printf(" %d", n_URL);
30426             printf(" %d", n_encoding);
30427             printf(" %d", n_options);
30428             printf("\n");
30429         }
30430     }
30431     }
30432     }
30433     }
30434     function_tests++;
30435 #endif
30436 
30437     return(test_ret);
30438 }
30439 
30440 
30441 static int
test_xmlReaderForFile(void)30442 test_xmlReaderForFile(void) {
30443     int test_ret = 0;
30444 
30445 #if defined(LIBXML_READER_ENABLED)
30446     int mem_base;
30447     xmlTextReaderPtr ret_val;
30448     const char * filename; /* a file or URL */
30449     int n_filename;
30450     const char * encoding; /* the document encoding, or NULL */
30451     int n_encoding;
30452     int options; /* a combination of xmlParserOption */
30453     int n_options;
30454 
30455     for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
30456     for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
30457     for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
30458         mem_base = xmlMemBlocks();
30459         filename = gen_filepath(n_filename, 0);
30460         encoding = gen_const_char_ptr(n_encoding, 1);
30461         options = gen_parseroptions(n_options, 2);
30462 
30463         ret_val = xmlReaderForFile(filename, encoding, options);
30464         desret_xmlTextReaderPtr(ret_val);
30465         call_tests++;
30466         des_filepath(n_filename, filename, 0);
30467         des_const_char_ptr(n_encoding, encoding, 1);
30468         des_parseroptions(n_options, options, 2);
30469         xmlResetLastError();
30470         if (mem_base != xmlMemBlocks()) {
30471             printf("Leak of %d blocks found in xmlReaderForFile",
30472 	           xmlMemBlocks() - mem_base);
30473 	    test_ret++;
30474             printf(" %d", n_filename);
30475             printf(" %d", n_encoding);
30476             printf(" %d", n_options);
30477             printf("\n");
30478         }
30479     }
30480     }
30481     }
30482     function_tests++;
30483 #endif
30484 
30485     return(test_ret);
30486 }
30487 
30488 
30489 static int
test_xmlReaderForMemory(void)30490 test_xmlReaderForMemory(void) {
30491     int test_ret = 0;
30492 
30493 #if defined(LIBXML_READER_ENABLED)
30494     int mem_base;
30495     xmlTextReaderPtr ret_val;
30496     const char * buffer; /* a pointer to a char array */
30497     int n_buffer;
30498     int size; /* the size of the array */
30499     int n_size;
30500     const char * URL; /* the base URL to use for the document */
30501     int n_URL;
30502     const char * encoding; /* the document encoding, or NULL */
30503     int n_encoding;
30504     int options; /* a combination of xmlParserOption */
30505     int n_options;
30506 
30507     for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
30508     for (n_size = 0;n_size < gen_nb_int;n_size++) {
30509     for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
30510     for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
30511     for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
30512         mem_base = xmlMemBlocks();
30513         buffer = gen_const_char_ptr(n_buffer, 0);
30514         size = gen_int(n_size, 1);
30515         URL = gen_filepath(n_URL, 2);
30516         encoding = gen_const_char_ptr(n_encoding, 3);
30517         options = gen_parseroptions(n_options, 4);
30518         if ((buffer != NULL) &&
30519             (size > xmlStrlen(BAD_CAST buffer)))
30520             size = 0;
30521 
30522         ret_val = xmlReaderForMemory(buffer, size, URL, encoding, options);
30523         desret_xmlTextReaderPtr(ret_val);
30524         call_tests++;
30525         des_const_char_ptr(n_buffer, buffer, 0);
30526         des_int(n_size, size, 1);
30527         des_filepath(n_URL, URL, 2);
30528         des_const_char_ptr(n_encoding, encoding, 3);
30529         des_parseroptions(n_options, options, 4);
30530         xmlResetLastError();
30531         if (mem_base != xmlMemBlocks()) {
30532             printf("Leak of %d blocks found in xmlReaderForMemory",
30533 	           xmlMemBlocks() - mem_base);
30534 	    test_ret++;
30535             printf(" %d", n_buffer);
30536             printf(" %d", n_size);
30537             printf(" %d", n_URL);
30538             printf(" %d", n_encoding);
30539             printf(" %d", n_options);
30540             printf("\n");
30541         }
30542     }
30543     }
30544     }
30545     }
30546     }
30547     function_tests++;
30548 #endif
30549 
30550     return(test_ret);
30551 }
30552 
30553 
30554 static int
test_xmlReaderNewDoc(void)30555 test_xmlReaderNewDoc(void) {
30556     int test_ret = 0;
30557 
30558 #if defined(LIBXML_READER_ENABLED)
30559     int mem_base;
30560     int ret_val;
30561     xmlTextReaderPtr reader; /* an XML reader */
30562     int n_reader;
30563     const xmlChar * cur; /* a pointer to a zero terminated string */
30564     int n_cur;
30565     const char * URL; /* the base URL to use for the document */
30566     int n_URL;
30567     const char * encoding; /* the document encoding, or NULL */
30568     int n_encoding;
30569     int options; /* a combination of xmlParserOption */
30570     int n_options;
30571 
30572     for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30573     for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
30574     for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
30575     for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
30576     for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
30577         mem_base = xmlMemBlocks();
30578         reader = gen_xmlTextReaderPtr(n_reader, 0);
30579         cur = gen_const_xmlChar_ptr(n_cur, 1);
30580         URL = gen_filepath(n_URL, 2);
30581         encoding = gen_const_char_ptr(n_encoding, 3);
30582         options = gen_parseroptions(n_options, 4);
30583 
30584         ret_val = xmlReaderNewDoc(reader, cur, URL, encoding, options);
30585         desret_int(ret_val);
30586         call_tests++;
30587         des_xmlTextReaderPtr(n_reader, reader, 0);
30588         des_const_xmlChar_ptr(n_cur, cur, 1);
30589         des_filepath(n_URL, URL, 2);
30590         des_const_char_ptr(n_encoding, encoding, 3);
30591         des_parseroptions(n_options, options, 4);
30592         xmlResetLastError();
30593         if (mem_base != xmlMemBlocks()) {
30594             printf("Leak of %d blocks found in xmlReaderNewDoc",
30595 	           xmlMemBlocks() - mem_base);
30596 	    test_ret++;
30597             printf(" %d", n_reader);
30598             printf(" %d", n_cur);
30599             printf(" %d", n_URL);
30600             printf(" %d", n_encoding);
30601             printf(" %d", n_options);
30602             printf("\n");
30603         }
30604     }
30605     }
30606     }
30607     }
30608     }
30609     function_tests++;
30610 #endif
30611 
30612     return(test_ret);
30613 }
30614 
30615 
30616 static int
test_xmlReaderNewFile(void)30617 test_xmlReaderNewFile(void) {
30618     int test_ret = 0;
30619 
30620 #if defined(LIBXML_READER_ENABLED)
30621     int mem_base;
30622     int ret_val;
30623     xmlTextReaderPtr reader; /* an XML reader */
30624     int n_reader;
30625     const char * filename; /* a file or URL */
30626     int n_filename;
30627     const char * encoding; /* the document encoding, or NULL */
30628     int n_encoding;
30629     int options; /* a combination of xmlParserOption */
30630     int n_options;
30631 
30632     for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30633     for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
30634     for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
30635     for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
30636         mem_base = xmlMemBlocks();
30637         reader = gen_xmlTextReaderPtr(n_reader, 0);
30638         filename = gen_filepath(n_filename, 1);
30639         encoding = gen_const_char_ptr(n_encoding, 2);
30640         options = gen_parseroptions(n_options, 3);
30641 
30642         ret_val = xmlReaderNewFile(reader, filename, encoding, options);
30643         desret_int(ret_val);
30644         call_tests++;
30645         des_xmlTextReaderPtr(n_reader, reader, 0);
30646         des_filepath(n_filename, filename, 1);
30647         des_const_char_ptr(n_encoding, encoding, 2);
30648         des_parseroptions(n_options, options, 3);
30649         xmlResetLastError();
30650         if (mem_base != xmlMemBlocks()) {
30651             printf("Leak of %d blocks found in xmlReaderNewFile",
30652 	           xmlMemBlocks() - mem_base);
30653 	    test_ret++;
30654             printf(" %d", n_reader);
30655             printf(" %d", n_filename);
30656             printf(" %d", n_encoding);
30657             printf(" %d", n_options);
30658             printf("\n");
30659         }
30660     }
30661     }
30662     }
30663     }
30664     function_tests++;
30665 #endif
30666 
30667     return(test_ret);
30668 }
30669 
30670 
30671 static int
test_xmlReaderNewMemory(void)30672 test_xmlReaderNewMemory(void) {
30673     int test_ret = 0;
30674 
30675 #if defined(LIBXML_READER_ENABLED)
30676     int mem_base;
30677     int ret_val;
30678     xmlTextReaderPtr reader; /* an XML reader */
30679     int n_reader;
30680     const char * buffer; /* a pointer to a char array */
30681     int n_buffer;
30682     int size; /* the size of the array */
30683     int n_size;
30684     const char * URL; /* the base URL to use for the document */
30685     int n_URL;
30686     const char * encoding; /* the document encoding, or NULL */
30687     int n_encoding;
30688     int options; /* a combination of xmlParserOption */
30689     int n_options;
30690 
30691     for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30692     for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
30693     for (n_size = 0;n_size < gen_nb_int;n_size++) {
30694     for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
30695     for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
30696     for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
30697         mem_base = xmlMemBlocks();
30698         reader = gen_xmlTextReaderPtr(n_reader, 0);
30699         buffer = gen_const_char_ptr(n_buffer, 1);
30700         size = gen_int(n_size, 2);
30701         URL = gen_filepath(n_URL, 3);
30702         encoding = gen_const_char_ptr(n_encoding, 4);
30703         options = gen_parseroptions(n_options, 5);
30704         if ((buffer != NULL) &&
30705             (size > xmlStrlen(BAD_CAST buffer)))
30706             size = 0;
30707 
30708         ret_val = xmlReaderNewMemory(reader, buffer, size, URL, encoding, options);
30709         desret_int(ret_val);
30710         call_tests++;
30711         des_xmlTextReaderPtr(n_reader, reader, 0);
30712         des_const_char_ptr(n_buffer, buffer, 1);
30713         des_int(n_size, size, 2);
30714         des_filepath(n_URL, URL, 3);
30715         des_const_char_ptr(n_encoding, encoding, 4);
30716         des_parseroptions(n_options, options, 5);
30717         xmlResetLastError();
30718         if (mem_base != xmlMemBlocks()) {
30719             printf("Leak of %d blocks found in xmlReaderNewMemory",
30720 	           xmlMemBlocks() - mem_base);
30721 	    test_ret++;
30722             printf(" %d", n_reader);
30723             printf(" %d", n_buffer);
30724             printf(" %d", n_size);
30725             printf(" %d", n_URL);
30726             printf(" %d", n_encoding);
30727             printf(" %d", n_options);
30728             printf("\n");
30729         }
30730     }
30731     }
30732     }
30733     }
30734     }
30735     }
30736     function_tests++;
30737 #endif
30738 
30739     return(test_ret);
30740 }
30741 
30742 
30743 static int
test_xmlReaderNewWalker(void)30744 test_xmlReaderNewWalker(void) {
30745     int test_ret = 0;
30746 
30747 #if defined(LIBXML_READER_ENABLED)
30748     int mem_base;
30749     int ret_val;
30750     xmlTextReaderPtr reader; /* an XML reader */
30751     int n_reader;
30752     xmlDocPtr doc; /* a preparsed document */
30753     int n_doc;
30754 
30755     for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30756     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
30757         mem_base = xmlMemBlocks();
30758         reader = gen_xmlTextReaderPtr(n_reader, 0);
30759         doc = gen_xmlDocPtr(n_doc, 1);
30760 
30761         ret_val = xmlReaderNewWalker(reader, doc);
30762         desret_int(ret_val);
30763         call_tests++;
30764         des_xmlTextReaderPtr(n_reader, reader, 0);
30765         des_xmlDocPtr(n_doc, doc, 1);
30766         xmlResetLastError();
30767         if (mem_base != xmlMemBlocks()) {
30768             printf("Leak of %d blocks found in xmlReaderNewWalker",
30769 	           xmlMemBlocks() - mem_base);
30770 	    test_ret++;
30771             printf(" %d", n_reader);
30772             printf(" %d", n_doc);
30773             printf("\n");
30774         }
30775     }
30776     }
30777     function_tests++;
30778 #endif
30779 
30780     return(test_ret);
30781 }
30782 
30783 
30784 static int
test_xmlReaderWalker(void)30785 test_xmlReaderWalker(void) {
30786     int test_ret = 0;
30787 
30788 #if defined(LIBXML_READER_ENABLED)
30789     int mem_base;
30790     xmlTextReaderPtr ret_val;
30791     xmlDocPtr doc; /* a preparsed document */
30792     int n_doc;
30793 
30794     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
30795         mem_base = xmlMemBlocks();
30796         doc = gen_xmlDocPtr(n_doc, 0);
30797 
30798         ret_val = xmlReaderWalker(doc);
30799         desret_xmlTextReaderPtr(ret_val);
30800         call_tests++;
30801         des_xmlDocPtr(n_doc, doc, 0);
30802         xmlResetLastError();
30803         if (mem_base != xmlMemBlocks()) {
30804             printf("Leak of %d blocks found in xmlReaderWalker",
30805 	           xmlMemBlocks() - mem_base);
30806 	    test_ret++;
30807             printf(" %d", n_doc);
30808             printf("\n");
30809         }
30810     }
30811     function_tests++;
30812 #endif
30813 
30814     return(test_ret);
30815 }
30816 
30817 
30818 static int
test_xmlTextReaderAttributeCount(void)30819 test_xmlTextReaderAttributeCount(void) {
30820     int test_ret = 0;
30821 
30822 #if defined(LIBXML_READER_ENABLED)
30823     int mem_base;
30824     int ret_val;
30825     xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30826     int n_reader;
30827 
30828     for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30829         mem_base = xmlMemBlocks();
30830         reader = gen_xmlTextReaderPtr(n_reader, 0);
30831 
30832         ret_val = xmlTextReaderAttributeCount(reader);
30833         desret_int(ret_val);
30834         call_tests++;
30835         des_xmlTextReaderPtr(n_reader, reader, 0);
30836         xmlResetLastError();
30837         if (mem_base != xmlMemBlocks()) {
30838             printf("Leak of %d blocks found in xmlTextReaderAttributeCount",
30839 	           xmlMemBlocks() - mem_base);
30840 	    test_ret++;
30841             printf(" %d", n_reader);
30842             printf("\n");
30843         }
30844     }
30845     function_tests++;
30846 #endif
30847 
30848     return(test_ret);
30849 }
30850 
30851 
30852 static int
test_xmlTextReaderBaseUri(void)30853 test_xmlTextReaderBaseUri(void) {
30854     int test_ret = 0;
30855 
30856 #if defined(LIBXML_READER_ENABLED)
30857     int mem_base;
30858     xmlChar * ret_val;
30859     xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30860     int n_reader;
30861 
30862     for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30863         mem_base = xmlMemBlocks();
30864         reader = gen_xmlTextReaderPtr(n_reader, 0);
30865 
30866         ret_val = xmlTextReaderBaseUri(reader);
30867         desret_xmlChar_ptr(ret_val);
30868         call_tests++;
30869         des_xmlTextReaderPtr(n_reader, reader, 0);
30870         xmlResetLastError();
30871         if (mem_base != xmlMemBlocks()) {
30872             printf("Leak of %d blocks found in xmlTextReaderBaseUri",
30873 	           xmlMemBlocks() - mem_base);
30874 	    test_ret++;
30875             printf(" %d", n_reader);
30876             printf("\n");
30877         }
30878     }
30879     function_tests++;
30880 #endif
30881 
30882     return(test_ret);
30883 }
30884 
30885 
30886 static int
test_xmlTextReaderByteConsumed(void)30887 test_xmlTextReaderByteConsumed(void) {
30888     int test_ret = 0;
30889 
30890 #if defined(LIBXML_READER_ENABLED)
30891     int mem_base;
30892     long ret_val;
30893     xmlTextReaderPtr reader; /* an XML reader */
30894     int n_reader;
30895 
30896     for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30897         mem_base = xmlMemBlocks();
30898         reader = gen_xmlTextReaderPtr(n_reader, 0);
30899 
30900         ret_val = xmlTextReaderByteConsumed(reader);
30901         desret_long(ret_val);
30902         call_tests++;
30903         des_xmlTextReaderPtr(n_reader, reader, 0);
30904         xmlResetLastError();
30905         if (mem_base != xmlMemBlocks()) {
30906             printf("Leak of %d blocks found in xmlTextReaderByteConsumed",
30907 	           xmlMemBlocks() - mem_base);
30908 	    test_ret++;
30909             printf(" %d", n_reader);
30910             printf("\n");
30911         }
30912     }
30913     function_tests++;
30914 #endif
30915 
30916     return(test_ret);
30917 }
30918 
30919 
30920 static int
test_xmlTextReaderClose(void)30921 test_xmlTextReaderClose(void) {
30922     int test_ret = 0;
30923 
30924 #if defined(LIBXML_READER_ENABLED)
30925     int mem_base;
30926     int ret_val;
30927     xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30928     int n_reader;
30929 
30930     for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30931         mem_base = xmlMemBlocks();
30932         reader = gen_xmlTextReaderPtr(n_reader, 0);
30933 
30934         ret_val = xmlTextReaderClose(reader);
30935         desret_int(ret_val);
30936         call_tests++;
30937         des_xmlTextReaderPtr(n_reader, reader, 0);
30938         xmlResetLastError();
30939         if (mem_base != xmlMemBlocks()) {
30940             printf("Leak of %d blocks found in xmlTextReaderClose",
30941 	           xmlMemBlocks() - mem_base);
30942 	    test_ret++;
30943             printf(" %d", n_reader);
30944             printf("\n");
30945         }
30946     }
30947     function_tests++;
30948 #endif
30949 
30950     return(test_ret);
30951 }
30952 
30953 
30954 static int
test_xmlTextReaderConstBaseUri(void)30955 test_xmlTextReaderConstBaseUri(void) {
30956     int test_ret = 0;
30957 
30958 #if defined(LIBXML_READER_ENABLED)
30959     int mem_base;
30960     const xmlChar * ret_val;
30961     xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30962     int n_reader;
30963 
30964     for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30965         mem_base = xmlMemBlocks();
30966         reader = gen_xmlTextReaderPtr(n_reader, 0);
30967 
30968         ret_val = xmlTextReaderConstBaseUri(reader);
30969         desret_const_xmlChar_ptr(ret_val);
30970         call_tests++;
30971         des_xmlTextReaderPtr(n_reader, reader, 0);
30972         xmlResetLastError();
30973         if (mem_base != xmlMemBlocks()) {
30974             printf("Leak of %d blocks found in xmlTextReaderConstBaseUri",
30975 	           xmlMemBlocks() - mem_base);
30976 	    test_ret++;
30977             printf(" %d", n_reader);
30978             printf("\n");
30979         }
30980     }
30981     function_tests++;
30982 #endif
30983 
30984     return(test_ret);
30985 }
30986 
30987 
30988 static int
test_xmlTextReaderConstEncoding(void)30989 test_xmlTextReaderConstEncoding(void) {
30990     int test_ret = 0;
30991 
30992 #if defined(LIBXML_READER_ENABLED)
30993     int mem_base;
30994     const xmlChar * ret_val;
30995     xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30996     int n_reader;
30997 
30998     for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30999         mem_base = xmlMemBlocks();
31000         reader = gen_xmlTextReaderPtr(n_reader, 0);
31001 
31002         ret_val = xmlTextReaderConstEncoding(reader);
31003         desret_const_xmlChar_ptr(ret_val);
31004         call_tests++;
31005         des_xmlTextReaderPtr(n_reader, reader, 0);
31006         xmlResetLastError();
31007         if (mem_base != xmlMemBlocks()) {
31008             printf("Leak of %d blocks found in xmlTextReaderConstEncoding",
31009 	           xmlMemBlocks() - mem_base);
31010 	    test_ret++;
31011             printf(" %d", n_reader);
31012             printf("\n");
31013         }
31014     }
31015     function_tests++;
31016 #endif
31017 
31018     return(test_ret);
31019 }
31020 
31021 
31022 static int
test_xmlTextReaderConstLocalName(void)31023 test_xmlTextReaderConstLocalName(void) {
31024     int test_ret = 0;
31025 
31026 #if defined(LIBXML_READER_ENABLED)
31027     int mem_base;
31028     const xmlChar * ret_val;
31029     xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31030     int n_reader;
31031 
31032     for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31033         mem_base = xmlMemBlocks();
31034         reader = gen_xmlTextReaderPtr(n_reader, 0);
31035 
31036         ret_val = xmlTextReaderConstLocalName(reader);
31037         desret_const_xmlChar_ptr(ret_val);
31038         call_tests++;
31039         des_xmlTextReaderPtr(n_reader, reader, 0);
31040         xmlResetLastError();
31041         if (mem_base != xmlMemBlocks()) {
31042             printf("Leak of %d blocks found in xmlTextReaderConstLocalName",
31043 	           xmlMemBlocks() - mem_base);
31044 	    test_ret++;
31045             printf(" %d", n_reader);
31046             printf("\n");
31047         }
31048     }
31049     function_tests++;
31050 #endif
31051 
31052     return(test_ret);
31053 }
31054 
31055 
31056 static int
test_xmlTextReaderConstName(void)31057 test_xmlTextReaderConstName(void) {
31058     int test_ret = 0;
31059 
31060 #if defined(LIBXML_READER_ENABLED)
31061     int mem_base;
31062     const xmlChar * ret_val;
31063     xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31064     int n_reader;
31065 
31066     for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31067         mem_base = xmlMemBlocks();
31068         reader = gen_xmlTextReaderPtr(n_reader, 0);
31069 
31070         ret_val = xmlTextReaderConstName(reader);
31071         desret_const_xmlChar_ptr(ret_val);
31072         call_tests++;
31073         des_xmlTextReaderPtr(n_reader, reader, 0);
31074         xmlResetLastError();
31075         if (mem_base != xmlMemBlocks()) {
31076             printf("Leak of %d blocks found in xmlTextReaderConstName",
31077 	           xmlMemBlocks() - mem_base);
31078 	    test_ret++;
31079             printf(" %d", n_reader);
31080             printf("\n");
31081         }
31082     }
31083     function_tests++;
31084 #endif
31085 
31086     return(test_ret);
31087 }
31088 
31089 
31090 static int
test_xmlTextReaderConstNamespaceUri(void)31091 test_xmlTextReaderConstNamespaceUri(void) {
31092     int test_ret = 0;
31093 
31094 #if defined(LIBXML_READER_ENABLED)
31095     int mem_base;
31096     const xmlChar * ret_val;
31097     xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31098     int n_reader;
31099 
31100     for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31101         mem_base = xmlMemBlocks();
31102         reader = gen_xmlTextReaderPtr(n_reader, 0);
31103 
31104         ret_val = xmlTextReaderConstNamespaceUri(reader);
31105         desret_const_xmlChar_ptr(ret_val);
31106         call_tests++;
31107         des_xmlTextReaderPtr(n_reader, reader, 0);
31108         xmlResetLastError();
31109         if (mem_base != xmlMemBlocks()) {
31110             printf("Leak of %d blocks found in xmlTextReaderConstNamespaceUri",
31111 	           xmlMemBlocks() - mem_base);
31112 	    test_ret++;
31113             printf(" %d", n_reader);
31114             printf("\n");
31115         }
31116     }
31117     function_tests++;
31118 #endif
31119 
31120     return(test_ret);
31121 }
31122 
31123 
31124 static int
test_xmlTextReaderConstPrefix(void)31125 test_xmlTextReaderConstPrefix(void) {
31126     int test_ret = 0;
31127 
31128 #if defined(LIBXML_READER_ENABLED)
31129     int mem_base;
31130     const xmlChar * ret_val;
31131     xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31132     int n_reader;
31133 
31134     for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31135         mem_base = xmlMemBlocks();
31136         reader = gen_xmlTextReaderPtr(n_reader, 0);
31137 
31138         ret_val = xmlTextReaderConstPrefix(reader);
31139         desret_const_xmlChar_ptr(ret_val);
31140         call_tests++;
31141         des_xmlTextReaderPtr(n_reader, reader, 0);
31142         xmlResetLastError();
31143         if (mem_base != xmlMemBlocks()) {
31144             printf("Leak of %d blocks found in xmlTextReaderConstPrefix",
31145 	           xmlMemBlocks() - mem_base);
31146 	    test_ret++;
31147             printf(" %d", n_reader);
31148             printf("\n");
31149         }
31150     }
31151     function_tests++;
31152 #endif
31153 
31154     return(test_ret);
31155 }
31156 
31157 
31158 static int
test_xmlTextReaderConstString(void)31159 test_xmlTextReaderConstString(void) {
31160     int test_ret = 0;
31161 
31162 #if defined(LIBXML_READER_ENABLED)
31163     int mem_base;
31164     const xmlChar * ret_val;
31165     xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31166     int n_reader;
31167     const xmlChar * str; /* the string to intern. */
31168     int n_str;
31169 
31170     for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31171     for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
31172         mem_base = xmlMemBlocks();
31173         reader = gen_xmlTextReaderPtr(n_reader, 0);
31174         str = gen_const_xmlChar_ptr(n_str, 1);
31175 
31176         ret_val = xmlTextReaderConstString(reader, str);
31177         desret_const_xmlChar_ptr(ret_val);
31178         call_tests++;
31179         des_xmlTextReaderPtr(n_reader, reader, 0);
31180         des_const_xmlChar_ptr(n_str, str, 1);
31181         xmlResetLastError();
31182         if (mem_base != xmlMemBlocks()) {
31183             printf("Leak of %d blocks found in xmlTextReaderConstString",
31184 	           xmlMemBlocks() - mem_base);
31185 	    test_ret++;
31186             printf(" %d", n_reader);
31187             printf(" %d", n_str);
31188             printf("\n");
31189         }
31190     }
31191     }
31192     function_tests++;
31193 #endif
31194 
31195     return(test_ret);
31196 }
31197 
31198 
31199 static int
test_xmlTextReaderConstValue(void)31200 test_xmlTextReaderConstValue(void) {
31201     int test_ret = 0;
31202 
31203 #if defined(LIBXML_READER_ENABLED)
31204     int mem_base;
31205     const xmlChar * ret_val;
31206     xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31207     int n_reader;
31208 
31209     for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31210         mem_base = xmlMemBlocks();
31211         reader = gen_xmlTextReaderPtr(n_reader, 0);
31212 
31213         ret_val = xmlTextReaderConstValue(reader);
31214         desret_const_xmlChar_ptr(ret_val);
31215         call_tests++;
31216         des_xmlTextReaderPtr(n_reader, reader, 0);
31217         xmlResetLastError();
31218         if (mem_base != xmlMemBlocks()) {
31219             printf("Leak of %d blocks found in xmlTextReaderConstValue",
31220 	           xmlMemBlocks() - mem_base);
31221 	    test_ret++;
31222             printf(" %d", n_reader);
31223             printf("\n");
31224         }
31225     }
31226     function_tests++;
31227 #endif
31228 
31229     return(test_ret);
31230 }
31231 
31232 
31233 static int
test_xmlTextReaderConstXmlLang(void)31234 test_xmlTextReaderConstXmlLang(void) {
31235     int test_ret = 0;
31236 
31237 #if defined(LIBXML_READER_ENABLED)
31238     int mem_base;
31239     const xmlChar * ret_val;
31240     xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31241     int n_reader;
31242 
31243     for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31244         mem_base = xmlMemBlocks();
31245         reader = gen_xmlTextReaderPtr(n_reader, 0);
31246 
31247         ret_val = xmlTextReaderConstXmlLang(reader);
31248         desret_const_xmlChar_ptr(ret_val);
31249         call_tests++;
31250         des_xmlTextReaderPtr(n_reader, reader, 0);
31251         xmlResetLastError();
31252         if (mem_base != xmlMemBlocks()) {
31253             printf("Leak of %d blocks found in xmlTextReaderConstXmlLang",
31254 	           xmlMemBlocks() - mem_base);
31255 	    test_ret++;
31256             printf(" %d", n_reader);
31257             printf("\n");
31258         }
31259     }
31260     function_tests++;
31261 #endif
31262 
31263     return(test_ret);
31264 }
31265 
31266 
31267 static int
test_xmlTextReaderConstXmlVersion(void)31268 test_xmlTextReaderConstXmlVersion(void) {
31269     int test_ret = 0;
31270 
31271 #if defined(LIBXML_READER_ENABLED)
31272     int mem_base;
31273     const xmlChar * ret_val;
31274     xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31275     int n_reader;
31276 
31277     for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31278         mem_base = xmlMemBlocks();
31279         reader = gen_xmlTextReaderPtr(n_reader, 0);
31280 
31281         ret_val = xmlTextReaderConstXmlVersion(reader);
31282         desret_const_xmlChar_ptr(ret_val);
31283         call_tests++;
31284         des_xmlTextReaderPtr(n_reader, reader, 0);
31285         xmlResetLastError();
31286         if (mem_base != xmlMemBlocks()) {
31287             printf("Leak of %d blocks found in xmlTextReaderConstXmlVersion",
31288 	           xmlMemBlocks() - mem_base);
31289 	    test_ret++;
31290             printf(" %d", n_reader);
31291             printf("\n");
31292         }
31293     }
31294     function_tests++;
31295 #endif
31296 
31297     return(test_ret);
31298 }
31299 
31300 
31301 static int
test_xmlTextReaderCurrentDoc(void)31302 test_xmlTextReaderCurrentDoc(void) {
31303     int test_ret = 0;
31304 
31305 #if defined(LIBXML_READER_ENABLED)
31306     int mem_base;
31307     xmlDocPtr ret_val;
31308     xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31309     int n_reader;
31310 
31311     for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31312         mem_base = xmlMemBlocks();
31313         reader = gen_xmlTextReaderPtr(n_reader, 0);
31314 
31315         ret_val = xmlTextReaderCurrentDoc(reader);
31316         desret_xmlDocPtr(ret_val);
31317         call_tests++;
31318         des_xmlTextReaderPtr(n_reader, reader, 0);
31319         xmlResetLastError();
31320         if (mem_base != xmlMemBlocks()) {
31321             printf("Leak of %d blocks found in xmlTextReaderCurrentDoc",
31322 	           xmlMemBlocks() - mem_base);
31323 	    test_ret++;
31324             printf(" %d", n_reader);
31325             printf("\n");
31326         }
31327     }
31328     function_tests++;
31329 #endif
31330 
31331     return(test_ret);
31332 }
31333 
31334 
31335 static int
test_xmlTextReaderCurrentNode(void)31336 test_xmlTextReaderCurrentNode(void) {
31337     int test_ret = 0;
31338 
31339 #if defined(LIBXML_READER_ENABLED)
31340     int mem_base;
31341     xmlNodePtr ret_val;
31342     xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31343     int n_reader;
31344 
31345     for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31346         mem_base = xmlMemBlocks();
31347         reader = gen_xmlTextReaderPtr(n_reader, 0);
31348 
31349         ret_val = xmlTextReaderCurrentNode(reader);
31350         desret_xmlNodePtr(ret_val);
31351         call_tests++;
31352         des_xmlTextReaderPtr(n_reader, reader, 0);
31353         xmlResetLastError();
31354         if (mem_base != xmlMemBlocks()) {
31355             printf("Leak of %d blocks found in xmlTextReaderCurrentNode",
31356 	           xmlMemBlocks() - mem_base);
31357 	    test_ret++;
31358             printf(" %d", n_reader);
31359             printf("\n");
31360         }
31361     }
31362     function_tests++;
31363 #endif
31364 
31365     return(test_ret);
31366 }
31367 
31368 
31369 static int
test_xmlTextReaderDepth(void)31370 test_xmlTextReaderDepth(void) {
31371     int test_ret = 0;
31372 
31373 #if defined(LIBXML_READER_ENABLED)
31374     int mem_base;
31375     int ret_val;
31376     xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31377     int n_reader;
31378 
31379     for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31380         mem_base = xmlMemBlocks();
31381         reader = gen_xmlTextReaderPtr(n_reader, 0);
31382 
31383         ret_val = xmlTextReaderDepth(reader);
31384         desret_int(ret_val);
31385         call_tests++;
31386         des_xmlTextReaderPtr(n_reader, reader, 0);
31387         xmlResetLastError();
31388         if (mem_base != xmlMemBlocks()) {
31389             printf("Leak of %d blocks found in xmlTextReaderDepth",
31390 	           xmlMemBlocks() - mem_base);
31391 	    test_ret++;
31392             printf(" %d", n_reader);
31393             printf("\n");
31394         }
31395     }
31396     function_tests++;
31397 #endif
31398 
31399     return(test_ret);
31400 }
31401 
31402 
31403 static int
test_xmlTextReaderExpand(void)31404 test_xmlTextReaderExpand(void) {
31405     int test_ret = 0;
31406 
31407 #if defined(LIBXML_READER_ENABLED)
31408     int mem_base;
31409     xmlNodePtr ret_val;
31410     xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31411     int n_reader;
31412 
31413     for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31414         mem_base = xmlMemBlocks();
31415         reader = gen_xmlTextReaderPtr(n_reader, 0);
31416 
31417         ret_val = xmlTextReaderExpand(reader);
31418         desret_xmlNodePtr(ret_val);
31419         call_tests++;
31420         des_xmlTextReaderPtr(n_reader, reader, 0);
31421         xmlResetLastError();
31422         if (mem_base != xmlMemBlocks()) {
31423             printf("Leak of %d blocks found in xmlTextReaderExpand",
31424 	           xmlMemBlocks() - mem_base);
31425 	    test_ret++;
31426             printf(" %d", n_reader);
31427             printf("\n");
31428         }
31429     }
31430     function_tests++;
31431 #endif
31432 
31433     return(test_ret);
31434 }
31435 
31436 
31437 static int
test_xmlTextReaderGetAttribute(void)31438 test_xmlTextReaderGetAttribute(void) {
31439     int test_ret = 0;
31440 
31441 #if defined(LIBXML_READER_ENABLED)
31442     int mem_base;
31443     xmlChar * ret_val;
31444     xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31445     int n_reader;
31446     const xmlChar * name; /* the qualified name of the attribute. */
31447     int n_name;
31448 
31449     for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31450     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
31451         mem_base = xmlMemBlocks();
31452         reader = gen_xmlTextReaderPtr(n_reader, 0);
31453         name = gen_const_xmlChar_ptr(n_name, 1);
31454 
31455         ret_val = xmlTextReaderGetAttribute(reader, name);
31456         desret_xmlChar_ptr(ret_val);
31457         call_tests++;
31458         des_xmlTextReaderPtr(n_reader, reader, 0);
31459         des_const_xmlChar_ptr(n_name, name, 1);
31460         xmlResetLastError();
31461         if (mem_base != xmlMemBlocks()) {
31462             printf("Leak of %d blocks found in xmlTextReaderGetAttribute",
31463 	           xmlMemBlocks() - mem_base);
31464 	    test_ret++;
31465             printf(" %d", n_reader);
31466             printf(" %d", n_name);
31467             printf("\n");
31468         }
31469     }
31470     }
31471     function_tests++;
31472 #endif
31473 
31474     return(test_ret);
31475 }
31476 
31477 
31478 static int
test_xmlTextReaderGetAttributeNo(void)31479 test_xmlTextReaderGetAttributeNo(void) {
31480     int test_ret = 0;
31481 
31482 #if defined(LIBXML_READER_ENABLED)
31483     int mem_base;
31484     xmlChar * ret_val;
31485     xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31486     int n_reader;
31487     int no; /* the zero-based index of the attribute relative to the containing element */
31488     int n_no;
31489 
31490     for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31491     for (n_no = 0;n_no < gen_nb_int;n_no++) {
31492         mem_base = xmlMemBlocks();
31493         reader = gen_xmlTextReaderPtr(n_reader, 0);
31494         no = gen_int(n_no, 1);
31495 
31496         ret_val = xmlTextReaderGetAttributeNo(reader, no);
31497         desret_xmlChar_ptr(ret_val);
31498         call_tests++;
31499         des_xmlTextReaderPtr(n_reader, reader, 0);
31500         des_int(n_no, no, 1);
31501         xmlResetLastError();
31502         if (mem_base != xmlMemBlocks()) {
31503             printf("Leak of %d blocks found in xmlTextReaderGetAttributeNo",
31504 	           xmlMemBlocks() - mem_base);
31505 	    test_ret++;
31506             printf(" %d", n_reader);
31507             printf(" %d", n_no);
31508             printf("\n");
31509         }
31510     }
31511     }
31512     function_tests++;
31513 #endif
31514 
31515     return(test_ret);
31516 }
31517 
31518 
31519 static int
test_xmlTextReaderGetAttributeNs(void)31520 test_xmlTextReaderGetAttributeNs(void) {
31521     int test_ret = 0;
31522 
31523 #if defined(LIBXML_READER_ENABLED)
31524     int mem_base;
31525     xmlChar * ret_val;
31526     xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31527     int n_reader;
31528     const xmlChar * localName; /* the local name of the attribute. */
31529     int n_localName;
31530     const xmlChar * namespaceURI; /* the namespace URI of the attribute. */
31531     int n_namespaceURI;
31532 
31533     for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31534     for (n_localName = 0;n_localName < gen_nb_const_xmlChar_ptr;n_localName++) {
31535     for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
31536         mem_base = xmlMemBlocks();
31537         reader = gen_xmlTextReaderPtr(n_reader, 0);
31538         localName = gen_const_xmlChar_ptr(n_localName, 1);
31539         namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 2);
31540 
31541         ret_val = xmlTextReaderGetAttributeNs(reader, localName, namespaceURI);
31542         desret_xmlChar_ptr(ret_val);
31543         call_tests++;
31544         des_xmlTextReaderPtr(n_reader, reader, 0);
31545         des_const_xmlChar_ptr(n_localName, localName, 1);
31546         des_const_xmlChar_ptr(n_namespaceURI, namespaceURI, 2);
31547         xmlResetLastError();
31548         if (mem_base != xmlMemBlocks()) {
31549             printf("Leak of %d blocks found in xmlTextReaderGetAttributeNs",
31550 	           xmlMemBlocks() - mem_base);
31551 	    test_ret++;
31552             printf(" %d", n_reader);
31553             printf(" %d", n_localName);
31554             printf(" %d", n_namespaceURI);
31555             printf("\n");
31556         }
31557     }
31558     }
31559     }
31560     function_tests++;
31561 #endif
31562 
31563     return(test_ret);
31564 }
31565 
31566 #ifdef LIBXML_READER_ENABLED
31567 
31568 #define gen_nb_xmlTextReaderErrorFunc_ptr 1
31569 #define gen_xmlTextReaderErrorFunc_ptr(no, nr) NULL
31570 #define des_xmlTextReaderErrorFunc_ptr(no, val, nr)
31571 #endif
31572 
31573 
31574 static int
test_xmlTextReaderGetErrorHandler(void)31575 test_xmlTextReaderGetErrorHandler(void) {
31576     int test_ret = 0;
31577 
31578 #if defined(LIBXML_READER_ENABLED)
31579     int mem_base;
31580     xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31581     int n_reader;
31582     xmlTextReaderErrorFunc * f; /* the callback function or NULL is no callback has been registered */
31583     int n_f;
31584     void ** arg; /* a user argument */
31585     int n_arg;
31586 
31587     for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31588     for (n_f = 0;n_f < gen_nb_xmlTextReaderErrorFunc_ptr;n_f++) {
31589     for (n_arg = 0;n_arg < gen_nb_void_ptr_ptr;n_arg++) {
31590         mem_base = xmlMemBlocks();
31591         reader = gen_xmlTextReaderPtr(n_reader, 0);
31592         f = gen_xmlTextReaderErrorFunc_ptr(n_f, 1);
31593         arg = gen_void_ptr_ptr(n_arg, 2);
31594 
31595         xmlTextReaderGetErrorHandler(reader, f, arg);
31596         call_tests++;
31597         des_xmlTextReaderPtr(n_reader, reader, 0);
31598         des_xmlTextReaderErrorFunc_ptr(n_f, f, 1);
31599         des_void_ptr_ptr(n_arg, arg, 2);
31600         xmlResetLastError();
31601         if (mem_base != xmlMemBlocks()) {
31602             printf("Leak of %d blocks found in xmlTextReaderGetErrorHandler",
31603 	           xmlMemBlocks() - mem_base);
31604 	    test_ret++;
31605             printf(" %d", n_reader);
31606             printf(" %d", n_f);
31607             printf(" %d", n_arg);
31608             printf("\n");
31609         }
31610     }
31611     }
31612     }
31613     function_tests++;
31614 #endif
31615 
31616     return(test_ret);
31617 }
31618 
31619 
31620 static int
test_xmlTextReaderGetLastError(void)31621 test_xmlTextReaderGetLastError(void) {
31622     int test_ret = 0;
31623 
31624 
31625     /* missing type support */
31626     return(test_ret);
31627 }
31628 
31629 
31630 static int
test_xmlTextReaderGetParserColumnNumber(void)31631 test_xmlTextReaderGetParserColumnNumber(void) {
31632     int test_ret = 0;
31633 
31634 #if defined(LIBXML_READER_ENABLED)
31635     int mem_base;
31636     int ret_val;
31637     xmlTextReaderPtr reader; /* the user data (XML reader context) */
31638     int n_reader;
31639 
31640     for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31641         mem_base = xmlMemBlocks();
31642         reader = gen_xmlTextReaderPtr(n_reader, 0);
31643 
31644         ret_val = xmlTextReaderGetParserColumnNumber(reader);
31645         desret_int(ret_val);
31646         call_tests++;
31647         des_xmlTextReaderPtr(n_reader, reader, 0);
31648         xmlResetLastError();
31649         if (mem_base != xmlMemBlocks()) {
31650             printf("Leak of %d blocks found in xmlTextReaderGetParserColumnNumber",
31651 	           xmlMemBlocks() - mem_base);
31652 	    test_ret++;
31653             printf(" %d", n_reader);
31654             printf("\n");
31655         }
31656     }
31657     function_tests++;
31658 #endif
31659 
31660     return(test_ret);
31661 }
31662 
31663 
31664 static int
test_xmlTextReaderGetParserLineNumber(void)31665 test_xmlTextReaderGetParserLineNumber(void) {
31666     int test_ret = 0;
31667 
31668 #if defined(LIBXML_READER_ENABLED)
31669     int mem_base;
31670     int ret_val;
31671     xmlTextReaderPtr reader; /* the user data (XML reader context) */
31672     int n_reader;
31673 
31674     for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31675         mem_base = xmlMemBlocks();
31676         reader = gen_xmlTextReaderPtr(n_reader, 0);
31677 
31678         ret_val = xmlTextReaderGetParserLineNumber(reader);
31679         desret_int(ret_val);
31680         call_tests++;
31681         des_xmlTextReaderPtr(n_reader, reader, 0);
31682         xmlResetLastError();
31683         if (mem_base != xmlMemBlocks()) {
31684             printf("Leak of %d blocks found in xmlTextReaderGetParserLineNumber",
31685 	           xmlMemBlocks() - mem_base);
31686 	    test_ret++;
31687             printf(" %d", n_reader);
31688             printf("\n");
31689         }
31690     }
31691     function_tests++;
31692 #endif
31693 
31694     return(test_ret);
31695 }
31696 
31697 
31698 static int
test_xmlTextReaderGetParserProp(void)31699 test_xmlTextReaderGetParserProp(void) {
31700     int test_ret = 0;
31701 
31702 #if defined(LIBXML_READER_ENABLED)
31703     int mem_base;
31704     int ret_val;
31705     xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31706     int n_reader;
31707     int prop; /* the xmlParserProperties to get */
31708     int n_prop;
31709 
31710     for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31711     for (n_prop = 0;n_prop < gen_nb_int;n_prop++) {
31712         mem_base = xmlMemBlocks();
31713         reader = gen_xmlTextReaderPtr(n_reader, 0);
31714         prop = gen_int(n_prop, 1);
31715 
31716         ret_val = xmlTextReaderGetParserProp(reader, prop);
31717         desret_int(ret_val);
31718         call_tests++;
31719         des_xmlTextReaderPtr(n_reader, reader, 0);
31720         des_int(n_prop, prop, 1);
31721         xmlResetLastError();
31722         if (mem_base != xmlMemBlocks()) {
31723             printf("Leak of %d blocks found in xmlTextReaderGetParserProp",
31724 	           xmlMemBlocks() - mem_base);
31725 	    test_ret++;
31726             printf(" %d", n_reader);
31727             printf(" %d", n_prop);
31728             printf("\n");
31729         }
31730     }
31731     }
31732     function_tests++;
31733 #endif
31734 
31735     return(test_ret);
31736 }
31737 
31738 
31739 static int
test_xmlTextReaderGetRemainder(void)31740 test_xmlTextReaderGetRemainder(void) {
31741     int test_ret = 0;
31742 
31743 #if defined(LIBXML_READER_ENABLED)
31744     int mem_base;
31745     xmlParserInputBufferPtr ret_val;
31746     xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31747     int n_reader;
31748 
31749     for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31750         mem_base = xmlMemBlocks();
31751         reader = gen_xmlTextReaderPtr(n_reader, 0);
31752 
31753         ret_val = xmlTextReaderGetRemainder(reader);
31754         desret_xmlParserInputBufferPtr(ret_val);
31755         call_tests++;
31756         des_xmlTextReaderPtr(n_reader, reader, 0);
31757         xmlResetLastError();
31758         if (mem_base != xmlMemBlocks()) {
31759             printf("Leak of %d blocks found in xmlTextReaderGetRemainder",
31760 	           xmlMemBlocks() - mem_base);
31761 	    test_ret++;
31762             printf(" %d", n_reader);
31763             printf("\n");
31764         }
31765     }
31766     function_tests++;
31767 #endif
31768 
31769     return(test_ret);
31770 }
31771 
31772 
31773 static int
test_xmlTextReaderHasAttributes(void)31774 test_xmlTextReaderHasAttributes(void) {
31775     int test_ret = 0;
31776 
31777 #if defined(LIBXML_READER_ENABLED)
31778     int mem_base;
31779     int ret_val;
31780     xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31781     int n_reader;
31782 
31783     for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31784         mem_base = xmlMemBlocks();
31785         reader = gen_xmlTextReaderPtr(n_reader, 0);
31786 
31787         ret_val = xmlTextReaderHasAttributes(reader);
31788         desret_int(ret_val);
31789         call_tests++;
31790         des_xmlTextReaderPtr(n_reader, reader, 0);
31791         xmlResetLastError();
31792         if (mem_base != xmlMemBlocks()) {
31793             printf("Leak of %d blocks found in xmlTextReaderHasAttributes",
31794 	           xmlMemBlocks() - mem_base);
31795 	    test_ret++;
31796             printf(" %d", n_reader);
31797             printf("\n");
31798         }
31799     }
31800     function_tests++;
31801 #endif
31802 
31803     return(test_ret);
31804 }
31805 
31806 
31807 static int
test_xmlTextReaderHasValue(void)31808 test_xmlTextReaderHasValue(void) {
31809     int test_ret = 0;
31810 
31811 #if defined(LIBXML_READER_ENABLED)
31812     int mem_base;
31813     int ret_val;
31814     xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31815     int n_reader;
31816 
31817     for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31818         mem_base = xmlMemBlocks();
31819         reader = gen_xmlTextReaderPtr(n_reader, 0);
31820 
31821         ret_val = xmlTextReaderHasValue(reader);
31822         desret_int(ret_val);
31823         call_tests++;
31824         des_xmlTextReaderPtr(n_reader, reader, 0);
31825         xmlResetLastError();
31826         if (mem_base != xmlMemBlocks()) {
31827             printf("Leak of %d blocks found in xmlTextReaderHasValue",
31828 	           xmlMemBlocks() - mem_base);
31829 	    test_ret++;
31830             printf(" %d", n_reader);
31831             printf("\n");
31832         }
31833     }
31834     function_tests++;
31835 #endif
31836 
31837     return(test_ret);
31838 }
31839 
31840 
31841 static int
test_xmlTextReaderIsDefault(void)31842 test_xmlTextReaderIsDefault(void) {
31843     int test_ret = 0;
31844 
31845 #if defined(LIBXML_READER_ENABLED)
31846     int mem_base;
31847     int ret_val;
31848     xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31849     int n_reader;
31850 
31851     for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31852         mem_base = xmlMemBlocks();
31853         reader = gen_xmlTextReaderPtr(n_reader, 0);
31854 
31855         ret_val = xmlTextReaderIsDefault(reader);
31856         desret_int(ret_val);
31857         call_tests++;
31858         des_xmlTextReaderPtr(n_reader, reader, 0);
31859         xmlResetLastError();
31860         if (mem_base != xmlMemBlocks()) {
31861             printf("Leak of %d blocks found in xmlTextReaderIsDefault",
31862 	           xmlMemBlocks() - mem_base);
31863 	    test_ret++;
31864             printf(" %d", n_reader);
31865             printf("\n");
31866         }
31867     }
31868     function_tests++;
31869 #endif
31870 
31871     return(test_ret);
31872 }
31873 
31874 
31875 static int
test_xmlTextReaderIsEmptyElement(void)31876 test_xmlTextReaderIsEmptyElement(void) {
31877     int test_ret = 0;
31878 
31879 #if defined(LIBXML_READER_ENABLED)
31880     int mem_base;
31881     int ret_val;
31882     xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31883     int n_reader;
31884 
31885     for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31886         mem_base = xmlMemBlocks();
31887         reader = gen_xmlTextReaderPtr(n_reader, 0);
31888 
31889         ret_val = xmlTextReaderIsEmptyElement(reader);
31890         desret_int(ret_val);
31891         call_tests++;
31892         des_xmlTextReaderPtr(n_reader, reader, 0);
31893         xmlResetLastError();
31894         if (mem_base != xmlMemBlocks()) {
31895             printf("Leak of %d blocks found in xmlTextReaderIsEmptyElement",
31896 	           xmlMemBlocks() - mem_base);
31897 	    test_ret++;
31898             printf(" %d", n_reader);
31899             printf("\n");
31900         }
31901     }
31902     function_tests++;
31903 #endif
31904 
31905     return(test_ret);
31906 }
31907 
31908 
31909 static int
test_xmlTextReaderIsNamespaceDecl(void)31910 test_xmlTextReaderIsNamespaceDecl(void) {
31911     int test_ret = 0;
31912 
31913 #if defined(LIBXML_READER_ENABLED)
31914     int mem_base;
31915     int ret_val;
31916     xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31917     int n_reader;
31918 
31919     for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31920         mem_base = xmlMemBlocks();
31921         reader = gen_xmlTextReaderPtr(n_reader, 0);
31922 
31923         ret_val = xmlTextReaderIsNamespaceDecl(reader);
31924         desret_int(ret_val);
31925         call_tests++;
31926         des_xmlTextReaderPtr(n_reader, reader, 0);
31927         xmlResetLastError();
31928         if (mem_base != xmlMemBlocks()) {
31929             printf("Leak of %d blocks found in xmlTextReaderIsNamespaceDecl",
31930 	           xmlMemBlocks() - mem_base);
31931 	    test_ret++;
31932             printf(" %d", n_reader);
31933             printf("\n");
31934         }
31935     }
31936     function_tests++;
31937 #endif
31938 
31939     return(test_ret);
31940 }
31941 
31942 
31943 static int
test_xmlTextReaderIsValid(void)31944 test_xmlTextReaderIsValid(void) {
31945     int test_ret = 0;
31946 
31947 #if defined(LIBXML_READER_ENABLED)
31948     int mem_base;
31949     int ret_val;
31950     xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31951     int n_reader;
31952 
31953     for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31954         mem_base = xmlMemBlocks();
31955         reader = gen_xmlTextReaderPtr(n_reader, 0);
31956 
31957         ret_val = xmlTextReaderIsValid(reader);
31958         desret_int(ret_val);
31959         call_tests++;
31960         des_xmlTextReaderPtr(n_reader, reader, 0);
31961         xmlResetLastError();
31962         if (mem_base != xmlMemBlocks()) {
31963             printf("Leak of %d blocks found in xmlTextReaderIsValid",
31964 	           xmlMemBlocks() - mem_base);
31965 	    test_ret++;
31966             printf(" %d", n_reader);
31967             printf("\n");
31968         }
31969     }
31970     function_tests++;
31971 #endif
31972 
31973     return(test_ret);
31974 }
31975 
31976 
31977 static int
test_xmlTextReaderLocalName(void)31978 test_xmlTextReaderLocalName(void) {
31979     int test_ret = 0;
31980 
31981 #if defined(LIBXML_READER_ENABLED)
31982     int mem_base;
31983     xmlChar * ret_val;
31984     xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31985     int n_reader;
31986 
31987     for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31988         mem_base = xmlMemBlocks();
31989         reader = gen_xmlTextReaderPtr(n_reader, 0);
31990 
31991         ret_val = xmlTextReaderLocalName(reader);
31992         desret_xmlChar_ptr(ret_val);
31993         call_tests++;
31994         des_xmlTextReaderPtr(n_reader, reader, 0);
31995         xmlResetLastError();
31996         if (mem_base != xmlMemBlocks()) {
31997             printf("Leak of %d blocks found in xmlTextReaderLocalName",
31998 	           xmlMemBlocks() - mem_base);
31999 	    test_ret++;
32000             printf(" %d", n_reader);
32001             printf("\n");
32002         }
32003     }
32004     function_tests++;
32005 #endif
32006 
32007     return(test_ret);
32008 }
32009 
32010 #ifdef LIBXML_READER_ENABLED
32011 
32012 #define gen_nb_xmlTextReaderLocatorPtr 1
32013 #define gen_xmlTextReaderLocatorPtr(no, nr) NULL
32014 #define des_xmlTextReaderLocatorPtr(no, val, nr)
32015 #endif
32016 
32017 
32018 static int
test_xmlTextReaderLocatorBaseURI(void)32019 test_xmlTextReaderLocatorBaseURI(void) {
32020     int test_ret = 0;
32021 
32022 #if defined(LIBXML_READER_ENABLED)
32023     int mem_base;
32024     xmlChar * ret_val;
32025     xmlTextReaderLocatorPtr locator; /* the xmlTextReaderLocatorPtr used */
32026     int n_locator;
32027 
32028     for (n_locator = 0;n_locator < gen_nb_xmlTextReaderLocatorPtr;n_locator++) {
32029         mem_base = xmlMemBlocks();
32030         locator = gen_xmlTextReaderLocatorPtr(n_locator, 0);
32031 
32032         ret_val = xmlTextReaderLocatorBaseURI(locator);
32033         desret_xmlChar_ptr(ret_val);
32034         call_tests++;
32035         des_xmlTextReaderLocatorPtr(n_locator, locator, 0);
32036         xmlResetLastError();
32037         if (mem_base != xmlMemBlocks()) {
32038             printf("Leak of %d blocks found in xmlTextReaderLocatorBaseURI",
32039 	           xmlMemBlocks() - mem_base);
32040 	    test_ret++;
32041             printf(" %d", n_locator);
32042             printf("\n");
32043         }
32044     }
32045     function_tests++;
32046 #endif
32047 
32048     return(test_ret);
32049 }
32050 
32051 
32052 static int
test_xmlTextReaderLocatorLineNumber(void)32053 test_xmlTextReaderLocatorLineNumber(void) {
32054     int test_ret = 0;
32055 
32056 #if defined(LIBXML_READER_ENABLED)
32057     int mem_base;
32058     int ret_val;
32059     xmlTextReaderLocatorPtr locator; /* the xmlTextReaderLocatorPtr used */
32060     int n_locator;
32061 
32062     for (n_locator = 0;n_locator < gen_nb_xmlTextReaderLocatorPtr;n_locator++) {
32063         mem_base = xmlMemBlocks();
32064         locator = gen_xmlTextReaderLocatorPtr(n_locator, 0);
32065 
32066         ret_val = xmlTextReaderLocatorLineNumber(locator);
32067         desret_int(ret_val);
32068         call_tests++;
32069         des_xmlTextReaderLocatorPtr(n_locator, locator, 0);
32070         xmlResetLastError();
32071         if (mem_base != xmlMemBlocks()) {
32072             printf("Leak of %d blocks found in xmlTextReaderLocatorLineNumber",
32073 	           xmlMemBlocks() - mem_base);
32074 	    test_ret++;
32075             printf(" %d", n_locator);
32076             printf("\n");
32077         }
32078     }
32079     function_tests++;
32080 #endif
32081 
32082     return(test_ret);
32083 }
32084 
32085 
32086 static int
test_xmlTextReaderLookupNamespace(void)32087 test_xmlTextReaderLookupNamespace(void) {
32088     int test_ret = 0;
32089 
32090 #if defined(LIBXML_READER_ENABLED)
32091     int mem_base;
32092     xmlChar * ret_val;
32093     xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
32094     int n_reader;
32095     const xmlChar * prefix; /* the prefix whose namespace URI is to be resolved. To return the default namespace, specify NULL */
32096     int n_prefix;
32097 
32098     for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
32099     for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
32100         mem_base = xmlMemBlocks();
32101         reader = gen_xmlTextReaderPtr(n_reader, 0);
32102         prefix = gen_const_xmlChar_ptr(n_prefix, 1);
32103 
32104         ret_val = xmlTextReaderLookupNamespace(reader, prefix);
32105         desret_xmlChar_ptr(ret_val);
32106         call_tests++;
32107         des_xmlTextReaderPtr(n_reader, reader, 0);
32108         des_const_xmlChar_ptr(n_prefix, prefix, 1);
32109         xmlResetLastError();
32110         if (mem_base != xmlMemBlocks()) {
32111             printf("Leak of %d blocks found in xmlTextReaderLookupNamespace",
32112 	           xmlMemBlocks() - mem_base);
32113 	    test_ret++;
32114             printf(" %d", n_reader);
32115             printf(" %d", n_prefix);
32116             printf("\n");
32117         }
32118     }
32119     }
32120     function_tests++;
32121 #endif
32122 
32123     return(test_ret);
32124 }
32125 
32126 
32127 static int
test_xmlTextReaderMoveToAttribute(void)32128 test_xmlTextReaderMoveToAttribute(void) {
32129     int test_ret = 0;
32130 
32131 #if defined(LIBXML_READER_ENABLED)
32132     int mem_base;
32133     int ret_val;
32134     xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
32135     int n_reader;
32136     const xmlChar * name; /* the qualified name of the attribute. */
32137     int n_name;
32138 
32139     for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
32140     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
32141         mem_base = xmlMemBlocks();
32142         reader = gen_xmlTextReaderPtr(n_reader, 0);
32143         name = gen_const_xmlChar_ptr(n_name, 1);
32144 
32145         ret_val = xmlTextReaderMoveToAttribute(reader, name);
32146         desret_int(ret_val);
32147         call_tests++;
32148         des_xmlTextReaderPtr(n_reader, reader, 0);
32149         des_const_xmlChar_ptr(n_name, name, 1);
32150         xmlResetLastError();
32151         if (mem_base != xmlMemBlocks()) {
32152             printf("Leak of %d blocks found in xmlTextReaderMoveToAttribute",
32153 	           xmlMemBlocks() - mem_base);
32154 	    test_ret++;
32155             printf(" %d", n_reader);
32156             printf(" %d", n_name);
32157             printf("\n");
32158         }
32159     }
32160     }
32161     function_tests++;
32162 #endif
32163 
32164     return(test_ret);
32165 }
32166 
32167 
32168 static int
test_xmlTextReaderMoveToAttributeNo(void)32169 test_xmlTextReaderMoveToAttributeNo(void) {
32170     int test_ret = 0;
32171 
32172 #if defined(LIBXML_READER_ENABLED)
32173     int mem_base;
32174     int ret_val;
32175     xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
32176     int n_reader;
32177     int no; /* the zero-based index of the attribute relative to the containing element. */
32178     int n_no;
32179 
32180     for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
32181     for (n_no = 0;n_no < gen_nb_int;n_no++) {
32182         mem_base = xmlMemBlocks();
32183         reader = gen_xmlTextReaderPtr(n_reader, 0);
32184         no = gen_int(n_no, 1);
32185 
32186         ret_val = xmlTextReaderMoveToAttributeNo(reader, no);
32187         desret_int(ret_val);
32188         call_tests++;
32189         des_xmlTextReaderPtr(n_reader, reader, 0);
32190         des_int(n_no, no, 1);
32191         xmlResetLastError();
32192         if (mem_base != xmlMemBlocks()) {
32193             printf("Leak of %d blocks found in xmlTextReaderMoveToAttributeNo",
32194 	           xmlMemBlocks() - mem_base);
32195 	    test_ret++;
32196             printf(" %d", n_reader);
32197             printf(" %d", n_no);
32198             printf("\n");
32199         }
32200     }
32201     }
32202     function_tests++;
32203 #endif
32204 
32205     return(test_ret);
32206 }
32207 
32208 
32209 static int
test_xmlTextReaderMoveToAttributeNs(void)32210 test_xmlTextReaderMoveToAttributeNs(void) {
32211     int test_ret = 0;
32212 
32213 #if defined(LIBXML_READER_ENABLED)
32214     int mem_base;
32215     int ret_val;
32216     xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
32217     int n_reader;
32218     const xmlChar * localName; /* the local name of the attribute. */
32219     int n_localName;
32220     const xmlChar * namespaceURI; /* the namespace URI of the attribute. */
32221     int n_namespaceURI;
32222 
32223     for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
32224     for (n_localName = 0;n_localName < gen_nb_const_xmlChar_ptr;n_localName++) {
32225     for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
32226         mem_base = xmlMemBlocks();
32227         reader = gen_xmlTextReaderPtr(n_reader, 0);
32228         localName = gen_const_xmlChar_ptr(n_localName, 1);
32229         namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 2);
32230 
32231         ret_val = xmlTextReaderMoveToAttributeNs(reader, localName, namespaceURI);
32232         desret_int(ret_val);
32233         call_tests++;
32234         des_xmlTextReaderPtr(n_reader, reader, 0);
32235         des_const_xmlChar_ptr(n_localName, localName, 1);
32236         des_const_xmlChar_ptr(n_namespaceURI, namespaceURI, 2);
32237         xmlResetLastError();
32238         if (mem_base != xmlMemBlocks()) {
32239             printf("Leak of %d blocks found in xmlTextReaderMoveToAttributeNs",
32240 	           xmlMemBlocks() - mem_base);
32241 	    test_ret++;
32242             printf(" %d", n_reader);
32243             printf(" %d", n_localName);
32244             printf(" %d", n_namespaceURI);
32245             printf("\n");
32246         }
32247     }
32248     }
32249     }
32250     function_tests++;
32251 #endif
32252 
32253     return(test_ret);
32254 }
32255 
32256 
32257 static int
test_xmlTextReaderMoveToElement(void)32258 test_xmlTextReaderMoveToElement(void) {
32259     int test_ret = 0;
32260 
32261 #if defined(LIBXML_READER_ENABLED)
32262     int mem_base;
32263     int ret_val;
32264     xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
32265     int n_reader;
32266 
32267     for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
32268         mem_base = xmlMemBlocks();
32269         reader = gen_xmlTextReaderPtr(n_reader, 0);
32270 
32271         ret_val = xmlTextReaderMoveToElement(reader);
32272         desret_int(ret_val);
32273         call_tests++;
32274         des_xmlTextReaderPtr(n_reader, reader, 0);
32275         xmlResetLastError();
32276         if (mem_base != xmlMemBlocks()) {
32277             printf("Leak of %d blocks found in xmlTextReaderMoveToElement",
32278 	           xmlMemBlocks() - mem_base);
32279 	    test_ret++;
32280             printf(" %d", n_reader);
32281             printf("\n");
32282         }
32283     }
32284     function_tests++;
32285 #endif
32286 
32287     return(test_ret);
32288 }
32289 
32290 
32291 static int
test_xmlTextReaderMoveToFirstAttribute(void)32292 test_xmlTextReaderMoveToFirstAttribute(void) {
32293     int test_ret = 0;
32294 
32295 #if defined(LIBXML_READER_ENABLED)
32296     int mem_base;
32297     int ret_val;
32298     xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
32299     int n_reader;
32300 
32301     for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
32302         mem_base = xmlMemBlocks();
32303         reader = gen_xmlTextReaderPtr(n_reader, 0);
32304 
32305         ret_val = xmlTextReaderMoveToFirstAttribute(reader);
32306         desret_int(ret_val);
32307         call_tests++;
32308         des_xmlTextReaderPtr(n_reader, reader, 0);
32309         xmlResetLastError();
32310         if (mem_base != xmlMemBlocks()) {
32311             printf("Leak of %d blocks found in xmlTextReaderMoveToFirstAttribute",
32312 	           xmlMemBlocks() - mem_base);
32313 	    test_ret++;
32314             printf(" %d", n_reader);
32315             printf("\n");
32316         }
32317     }
32318     function_tests++;
32319 #endif
32320 
32321     return(test_ret);
32322 }
32323 
32324 
32325 static int
test_xmlTextReaderMoveToNextAttribute(void)32326 test_xmlTextReaderMoveToNextAttribute(void) {
32327     int test_ret = 0;
32328 
32329 #if defined(LIBXML_READER_ENABLED)
32330     int mem_base;
32331     int ret_val;
32332     xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
32333     int n_reader;
32334 
32335     for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
32336         mem_base = xmlMemBlocks();
32337         reader = gen_xmlTextReaderPtr(n_reader, 0);
32338 
32339         ret_val = xmlTextReaderMoveToNextAttribute(reader);
32340         desret_int(ret_val);
32341         call_tests++;
32342         des_xmlTextReaderPtr(n_reader, reader, 0);
32343         xmlResetLastError();
32344         if (mem_base != xmlMemBlocks()) {
32345             printf("Leak of %d blocks found in xmlTextReaderMoveToNextAttribute",
32346 	           xmlMemBlocks() - mem_base);
32347 	    test_ret++;
32348             printf(" %d", n_reader);
32349             printf("\n");
32350         }
32351     }
32352     function_tests++;
32353 #endif
32354 
32355     return(test_ret);
32356 }
32357 
32358 
32359 static int
test_xmlTextReaderName(void)32360 test_xmlTextReaderName(void) {
32361     int test_ret = 0;
32362 
32363 #if defined(LIBXML_READER_ENABLED)
32364     int mem_base;
32365     xmlChar * ret_val;
32366     xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
32367     int n_reader;
32368 
32369     for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
32370         mem_base = xmlMemBlocks();
32371         reader = gen_xmlTextReaderPtr(n_reader, 0);
32372 
32373         ret_val = xmlTextReaderName(reader);
32374         desret_xmlChar_ptr(ret_val);
32375         call_tests++;
32376         des_xmlTextReaderPtr(n_reader, reader, 0);
32377         xmlResetLastError();
32378         if (mem_base != xmlMemBlocks()) {
32379             printf("Leak of %d blocks found in xmlTextReaderName",
32380 	           xmlMemBlocks() - mem_base);
32381 	    test_ret++;
32382             printf(" %d", n_reader);
32383             printf("\n");
32384         }
32385     }
32386     function_tests++;
32387 #endif
32388 
32389     return(test_ret);
32390 }
32391 
32392 
32393 static int
test_xmlTextReaderNamespaceUri(void)32394 test_xmlTextReaderNamespaceUri(void) {
32395     int test_ret = 0;
32396 
32397 #if defined(LIBXML_READER_ENABLED)
32398     int mem_base;
32399     xmlChar * ret_val;
32400     xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
32401     int n_reader;
32402 
32403     for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
32404         mem_base = xmlMemBlocks();
32405         reader = gen_xmlTextReaderPtr(n_reader, 0);
32406 
32407         ret_val = xmlTextReaderNamespaceUri(reader);
32408         desret_xmlChar_ptr(ret_val);
32409         call_tests++;
32410         des_xmlTextReaderPtr(n_reader, reader, 0);
32411         xmlResetLastError();
32412         if (mem_base != xmlMemBlocks()) {
32413             printf("Leak of %d blocks found in xmlTextReaderNamespaceUri",
32414 	           xmlMemBlocks() - mem_base);
32415 	    test_ret++;
32416             printf(" %d", n_reader);
32417             printf("\n");
32418         }
32419     }
32420     function_tests++;
32421 #endif
32422 
32423     return(test_ret);
32424 }
32425 
32426 
32427 static int
test_xmlTextReaderNext(void)32428 test_xmlTextReaderNext(void) {
32429     int test_ret = 0;
32430 
32431 #if defined(LIBXML_READER_ENABLED)
32432     int mem_base;
32433     int ret_val;
32434     xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
32435     int n_reader;
32436 
32437     for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
32438         mem_base = xmlMemBlocks();
32439         reader = gen_xmlTextReaderPtr(n_reader, 0);
32440 
32441         ret_val = xmlTextReaderNext(reader);
32442         desret_int(ret_val);
32443         call_tests++;
32444         des_xmlTextReaderPtr(n_reader, reader, 0);
32445         xmlResetLastError();
32446         if (mem_base != xmlMemBlocks()) {
32447             printf("Leak of %d blocks found in xmlTextReaderNext",
32448 	           xmlMemBlocks() - mem_base);
32449 	    test_ret++;
32450             printf(" %d", n_reader);
32451             printf("\n");
32452         }
32453     }
32454     function_tests++;
32455 #endif
32456 
32457     return(test_ret);
32458 }
32459 
32460 
32461 static int
test_xmlTextReaderNextSibling(void)32462 test_xmlTextReaderNextSibling(void) {
32463     int test_ret = 0;
32464 
32465 #if defined(LIBXML_READER_ENABLED)
32466     int mem_base;
32467     int ret_val;
32468     xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
32469     int n_reader;
32470 
32471     for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
32472         mem_base = xmlMemBlocks();
32473         reader = gen_xmlTextReaderPtr(n_reader, 0);
32474 
32475         ret_val = xmlTextReaderNextSibling(reader);
32476         desret_int(ret_val);
32477         call_tests++;
32478         des_xmlTextReaderPtr(n_reader, reader, 0);
32479         xmlResetLastError();
32480         if (mem_base != xmlMemBlocks()) {
32481             printf("Leak of %d blocks found in xmlTextReaderNextSibling",
32482 	           xmlMemBlocks() - mem_base);
32483 	    test_ret++;
32484             printf(" %d", n_reader);
32485             printf("\n");
32486         }
32487     }
32488     function_tests++;
32489 #endif
32490 
32491     return(test_ret);
32492 }
32493 
32494 
32495 static int
test_xmlTextReaderNodeType(void)32496 test_xmlTextReaderNodeType(void) {
32497     int test_ret = 0;
32498 
32499 #if defined(LIBXML_READER_ENABLED)
32500     int mem_base;
32501     int ret_val;
32502     xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
32503     int n_reader;
32504 
32505     for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
32506         mem_base = xmlMemBlocks();
32507         reader = gen_xmlTextReaderPtr(n_reader, 0);
32508 
32509         ret_val = xmlTextReaderNodeType(reader);
32510         desret_int(ret_val);
32511         call_tests++;
32512         des_xmlTextReaderPtr(n_reader, reader, 0);
32513         xmlResetLastError();
32514         if (mem_base != xmlMemBlocks()) {
32515             printf("Leak of %d blocks found in xmlTextReaderNodeType",
32516 	           xmlMemBlocks() - mem_base);
32517 	    test_ret++;
32518             printf(" %d", n_reader);
32519             printf("\n");
32520         }
32521     }
32522     function_tests++;
32523 #endif
32524 
32525     return(test_ret);
32526 }
32527 
32528 
32529 static int
test_xmlTextReaderNormalization(void)32530 test_xmlTextReaderNormalization(void) {
32531     int test_ret = 0;
32532 
32533 #if defined(LIBXML_READER_ENABLED)
32534     int mem_base;
32535     int ret_val;
32536     xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
32537     int n_reader;
32538 
32539     for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
32540         mem_base = xmlMemBlocks();
32541         reader = gen_xmlTextReaderPtr(n_reader, 0);
32542 
32543         ret_val = xmlTextReaderNormalization(reader);
32544         desret_int(ret_val);
32545         call_tests++;
32546         des_xmlTextReaderPtr(n_reader, reader, 0);
32547         xmlResetLastError();
32548         if (mem_base != xmlMemBlocks()) {
32549             printf("Leak of %d blocks found in xmlTextReaderNormalization",
32550 	           xmlMemBlocks() - mem_base);
32551 	    test_ret++;
32552             printf(" %d", n_reader);
32553             printf("\n");
32554         }
32555     }
32556     function_tests++;
32557 #endif
32558 
32559     return(test_ret);
32560 }
32561 
32562 
32563 static int
test_xmlTextReaderPrefix(void)32564 test_xmlTextReaderPrefix(void) {
32565     int test_ret = 0;
32566 
32567 #if defined(LIBXML_READER_ENABLED)
32568     int mem_base;
32569     xmlChar * ret_val;
32570     xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
32571     int n_reader;
32572 
32573     for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
32574         mem_base = xmlMemBlocks();
32575         reader = gen_xmlTextReaderPtr(n_reader, 0);
32576 
32577         ret_val = xmlTextReaderPrefix(reader);
32578         desret_xmlChar_ptr(ret_val);
32579         call_tests++;
32580         des_xmlTextReaderPtr(n_reader, reader, 0);
32581         xmlResetLastError();
32582         if (mem_base != xmlMemBlocks()) {
32583             printf("Leak of %d blocks found in xmlTextReaderPrefix",
32584 	           xmlMemBlocks() - mem_base);
32585 	    test_ret++;
32586             printf(" %d", n_reader);
32587             printf("\n");
32588         }
32589     }
32590     function_tests++;
32591 #endif
32592 
32593     return(test_ret);
32594 }
32595 
32596 
32597 static int
test_xmlTextReaderPreserve(void)32598 test_xmlTextReaderPreserve(void) {
32599     int test_ret = 0;
32600 
32601 #if defined(LIBXML_READER_ENABLED)
32602     int mem_base;
32603     xmlNodePtr ret_val;
32604     xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
32605     int n_reader;
32606 
32607     for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
32608         mem_base = xmlMemBlocks();
32609         reader = gen_xmlTextReaderPtr(n_reader, 0);
32610 
32611         ret_val = xmlTextReaderPreserve(reader);
32612         desret_xmlNodePtr(ret_val);
32613         call_tests++;
32614         des_xmlTextReaderPtr(n_reader, reader, 0);
32615         xmlResetLastError();
32616         if (mem_base != xmlMemBlocks()) {
32617             printf("Leak of %d blocks found in xmlTextReaderPreserve",
32618 	           xmlMemBlocks() - mem_base);
32619 	    test_ret++;
32620             printf(" %d", n_reader);
32621             printf("\n");
32622         }
32623     }
32624     function_tests++;
32625 #endif
32626 
32627     return(test_ret);
32628 }
32629 
32630 
32631 static int
test_xmlTextReaderPreservePattern(void)32632 test_xmlTextReaderPreservePattern(void) {
32633     int test_ret = 0;
32634 
32635 #if defined(LIBXML_READER_ENABLED) && defined(LIBXML_PATTERN_ENABLED)
32636 #ifdef LIBXML_PATTERN_ENABLED
32637     int mem_base;
32638     int ret_val;
32639     xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
32640     int n_reader;
32641     const xmlChar * pattern; /* an XPath subset pattern */
32642     int n_pattern;
32643     const xmlChar ** namespaces; /* the prefix definitions, array of [URI, prefix] or NULL */
32644     int n_namespaces;
32645 
32646     for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
32647     for (n_pattern = 0;n_pattern < gen_nb_const_xmlChar_ptr;n_pattern++) {
32648     for (n_namespaces = 0;n_namespaces < gen_nb_const_xmlChar_ptr_ptr;n_namespaces++) {
32649         mem_base = xmlMemBlocks();
32650         reader = gen_xmlTextReaderPtr(n_reader, 0);
32651         pattern = gen_const_xmlChar_ptr(n_pattern, 1);
32652         namespaces = gen_const_xmlChar_ptr_ptr(n_namespaces, 2);
32653 
32654         ret_val = xmlTextReaderPreservePattern(reader, pattern, namespaces);
32655         desret_int(ret_val);
32656         call_tests++;
32657         des_xmlTextReaderPtr(n_reader, reader, 0);
32658         des_const_xmlChar_ptr(n_pattern, pattern, 1);
32659         des_const_xmlChar_ptr_ptr(n_namespaces, namespaces, 2);
32660         xmlResetLastError();
32661         if (mem_base != xmlMemBlocks()) {
32662             printf("Leak of %d blocks found in xmlTextReaderPreservePattern",
32663 	           xmlMemBlocks() - mem_base);
32664 	    test_ret++;
32665             printf(" %d", n_reader);
32666             printf(" %d", n_pattern);
32667             printf(" %d", n_namespaces);
32668             printf("\n");
32669         }
32670     }
32671     }
32672     }
32673     function_tests++;
32674 #endif
32675 #endif
32676 
32677     return(test_ret);
32678 }
32679 
32680 
32681 static int
test_xmlTextReaderQuoteChar(void)32682 test_xmlTextReaderQuoteChar(void) {
32683     int test_ret = 0;
32684 
32685 #if defined(LIBXML_READER_ENABLED)
32686     int mem_base;
32687     int ret_val;
32688     xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
32689     int n_reader;
32690 
32691     for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
32692         mem_base = xmlMemBlocks();
32693         reader = gen_xmlTextReaderPtr(n_reader, 0);
32694 
32695         ret_val = xmlTextReaderQuoteChar(reader);
32696         desret_int(ret_val);
32697         call_tests++;
32698         des_xmlTextReaderPtr(n_reader, reader, 0);
32699         xmlResetLastError();
32700         if (mem_base != xmlMemBlocks()) {
32701             printf("Leak of %d blocks found in xmlTextReaderQuoteChar",
32702 	           xmlMemBlocks() - mem_base);
32703 	    test_ret++;
32704             printf(" %d", n_reader);
32705             printf("\n");
32706         }
32707     }
32708     function_tests++;
32709 #endif
32710 
32711     return(test_ret);
32712 }
32713 
32714 
32715 static int
test_xmlTextReaderRead(void)32716 test_xmlTextReaderRead(void) {
32717     int test_ret = 0;
32718 
32719 #if defined(LIBXML_READER_ENABLED)
32720     int mem_base;
32721     int ret_val;
32722     xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
32723     int n_reader;
32724 
32725     for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
32726         mem_base = xmlMemBlocks();
32727         reader = gen_xmlTextReaderPtr(n_reader, 0);
32728 
32729         ret_val = xmlTextReaderRead(reader);
32730         desret_int(ret_val);
32731         call_tests++;
32732         des_xmlTextReaderPtr(n_reader, reader, 0);
32733         xmlResetLastError();
32734         if (mem_base != xmlMemBlocks()) {
32735             printf("Leak of %d blocks found in xmlTextReaderRead",
32736 	           xmlMemBlocks() - mem_base);
32737 	    test_ret++;
32738             printf(" %d", n_reader);
32739             printf("\n");
32740         }
32741     }
32742     function_tests++;
32743 #endif
32744 
32745     return(test_ret);
32746 }
32747 
32748 
32749 static int
test_xmlTextReaderReadAttributeValue(void)32750 test_xmlTextReaderReadAttributeValue(void) {
32751     int test_ret = 0;
32752 
32753 #if defined(LIBXML_READER_ENABLED)
32754     int mem_base;
32755     int ret_val;
32756     xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
32757     int n_reader;
32758 
32759     for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
32760         mem_base = xmlMemBlocks();
32761         reader = gen_xmlTextReaderPtr(n_reader, 0);
32762 
32763         ret_val = xmlTextReaderReadAttributeValue(reader);
32764         desret_int(ret_val);
32765         call_tests++;
32766         des_xmlTextReaderPtr(n_reader, reader, 0);
32767         xmlResetLastError();
32768         if (mem_base != xmlMemBlocks()) {
32769             printf("Leak of %d blocks found in xmlTextReaderReadAttributeValue",
32770 	           xmlMemBlocks() - mem_base);
32771 	    test_ret++;
32772             printf(" %d", n_reader);
32773             printf("\n");
32774         }
32775     }
32776     function_tests++;
32777 #endif
32778 
32779     return(test_ret);
32780 }
32781 
32782 
32783 static int
test_xmlTextReaderReadState(void)32784 test_xmlTextReaderReadState(void) {
32785     int test_ret = 0;
32786 
32787 #if defined(LIBXML_READER_ENABLED)
32788     int mem_base;
32789     int ret_val;
32790     xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
32791     int n_reader;
32792 
32793     for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
32794         mem_base = xmlMemBlocks();
32795         reader = gen_xmlTextReaderPtr(n_reader, 0);
32796 
32797         ret_val = xmlTextReaderReadState(reader);
32798         desret_int(ret_val);
32799         call_tests++;
32800         des_xmlTextReaderPtr(n_reader, reader, 0);
32801         xmlResetLastError();
32802         if (mem_base != xmlMemBlocks()) {
32803             printf("Leak of %d blocks found in xmlTextReaderReadState",
32804 	           xmlMemBlocks() - mem_base);
32805 	    test_ret++;
32806             printf(" %d", n_reader);
32807             printf("\n");
32808         }
32809     }
32810     function_tests++;
32811 #endif
32812 
32813     return(test_ret);
32814 }
32815 
32816 
32817 static int
test_xmlTextReaderRelaxNGSetSchema(void)32818 test_xmlTextReaderRelaxNGSetSchema(void) {
32819     int test_ret = 0;
32820 
32821 #if defined(LIBXML_READER_ENABLED) && defined(LIBXML_SCHEMAS_ENABLED)
32822     int mem_base;
32823     int ret_val;
32824     xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
32825     int n_reader;
32826     xmlRelaxNGPtr schema; /* a precompiled RelaxNG schema */
32827     int n_schema;
32828 
32829     for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
32830     for (n_schema = 0;n_schema < gen_nb_xmlRelaxNGPtr;n_schema++) {
32831         mem_base = xmlMemBlocks();
32832         reader = gen_xmlTextReaderPtr(n_reader, 0);
32833         schema = gen_xmlRelaxNGPtr(n_schema, 1);
32834 
32835         ret_val = xmlTextReaderRelaxNGSetSchema(reader, schema);
32836         desret_int(ret_val);
32837         call_tests++;
32838         des_xmlTextReaderPtr(n_reader, reader, 0);
32839         des_xmlRelaxNGPtr(n_schema, schema, 1);
32840         xmlResetLastError();
32841         if (mem_base != xmlMemBlocks()) {
32842             printf("Leak of %d blocks found in xmlTextReaderRelaxNGSetSchema",
32843 	           xmlMemBlocks() - mem_base);
32844 	    test_ret++;
32845             printf(" %d", n_reader);
32846             printf(" %d", n_schema);
32847             printf("\n");
32848         }
32849     }
32850     }
32851     function_tests++;
32852 #endif
32853 
32854     return(test_ret);
32855 }
32856 
32857 
32858 static int
test_xmlTextReaderRelaxNGValidate(void)32859 test_xmlTextReaderRelaxNGValidate(void) {
32860     int test_ret = 0;
32861 
32862 #if defined(LIBXML_READER_ENABLED) && defined(LIBXML_SCHEMAS_ENABLED)
32863     int mem_base;
32864     int ret_val;
32865     xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
32866     int n_reader;
32867     const char * rng; /* the path to a RelaxNG schema or NULL */
32868     int n_rng;
32869 
32870     for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
32871     for (n_rng = 0;n_rng < gen_nb_const_char_ptr;n_rng++) {
32872         mem_base = xmlMemBlocks();
32873         reader = gen_xmlTextReaderPtr(n_reader, 0);
32874         rng = gen_const_char_ptr(n_rng, 1);
32875 
32876         ret_val = xmlTextReaderRelaxNGValidate(reader, rng);
32877         desret_int(ret_val);
32878         call_tests++;
32879         des_xmlTextReaderPtr(n_reader, reader, 0);
32880         des_const_char_ptr(n_rng, rng, 1);
32881         xmlResetLastError();
32882         if (mem_base != xmlMemBlocks()) {
32883             printf("Leak of %d blocks found in xmlTextReaderRelaxNGValidate",
32884 	           xmlMemBlocks() - mem_base);
32885 	    test_ret++;
32886             printf(" %d", n_reader);
32887             printf(" %d", n_rng);
32888             printf("\n");
32889         }
32890     }
32891     }
32892     function_tests++;
32893 #endif
32894 
32895     return(test_ret);
32896 }
32897 
32898 
32899 static int
test_xmlTextReaderRelaxNGValidateCtxt(void)32900 test_xmlTextReaderRelaxNGValidateCtxt(void) {
32901     int test_ret = 0;
32902 
32903 #if defined(LIBXML_READER_ENABLED) && defined(LIBXML_SCHEMAS_ENABLED)
32904     int mem_base;
32905     int ret_val;
32906     xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
32907     int n_reader;
32908     xmlRelaxNGValidCtxtPtr ctxt; /* the RelaxNG schema validation context or NULL */
32909     int n_ctxt;
32910     int options; /* options (not used yet) */
32911     int n_options;
32912 
32913     for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
32914     for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
32915     for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
32916         mem_base = xmlMemBlocks();
32917         reader = gen_xmlTextReaderPtr(n_reader, 0);
32918         ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 1);
32919         options = gen_parseroptions(n_options, 2);
32920 
32921         ret_val = xmlTextReaderRelaxNGValidateCtxt(reader, ctxt, options);
32922         desret_int(ret_val);
32923         call_tests++;
32924         des_xmlTextReaderPtr(n_reader, reader, 0);
32925         des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 1);
32926         des_parseroptions(n_options, options, 2);
32927         xmlResetLastError();
32928         if (mem_base != xmlMemBlocks()) {
32929             printf("Leak of %d blocks found in xmlTextReaderRelaxNGValidateCtxt",
32930 	           xmlMemBlocks() - mem_base);
32931 	    test_ret++;
32932             printf(" %d", n_reader);
32933             printf(" %d", n_ctxt);
32934             printf(" %d", n_options);
32935             printf("\n");
32936         }
32937     }
32938     }
32939     }
32940     function_tests++;
32941 #endif
32942 
32943     return(test_ret);
32944 }
32945 
32946 
32947 static int
test_xmlTextReaderSchemaValidate(void)32948 test_xmlTextReaderSchemaValidate(void) {
32949     int test_ret = 0;
32950 
32951 #if defined(LIBXML_READER_ENABLED) && defined(LIBXML_SCHEMAS_ENABLED)
32952     int ret_val;
32953     xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
32954     int n_reader;
32955     const char * xsd; /* the path to a W3C XSD schema or NULL */
32956     int n_xsd;
32957 
32958     for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
32959     for (n_xsd = 0;n_xsd < gen_nb_const_char_ptr;n_xsd++) {
32960         reader = gen_xmlTextReaderPtr(n_reader, 0);
32961         xsd = gen_const_char_ptr(n_xsd, 1);
32962 
32963         ret_val = xmlTextReaderSchemaValidate(reader, xsd);
32964         desret_int(ret_val);
32965         call_tests++;
32966         des_xmlTextReaderPtr(n_reader, reader, 0);
32967         des_const_char_ptr(n_xsd, xsd, 1);
32968         xmlResetLastError();
32969     }
32970     }
32971     function_tests++;
32972 #endif
32973 
32974     return(test_ret);
32975 }
32976 
32977 
32978 static int
test_xmlTextReaderSchemaValidateCtxt(void)32979 test_xmlTextReaderSchemaValidateCtxt(void) {
32980     int test_ret = 0;
32981 
32982 #if defined(LIBXML_READER_ENABLED) && defined(LIBXML_SCHEMAS_ENABLED)
32983     int mem_base;
32984     int ret_val;
32985     xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
32986     int n_reader;
32987     xmlSchemaValidCtxtPtr ctxt; /* the XML Schema validation context or NULL */
32988     int n_ctxt;
32989     int options; /* options (not used yet) */
32990     int n_options;
32991 
32992     for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
32993     for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
32994     for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
32995         mem_base = xmlMemBlocks();
32996         reader = gen_xmlTextReaderPtr(n_reader, 0);
32997         ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 1);
32998         options = gen_parseroptions(n_options, 2);
32999 
33000         ret_val = xmlTextReaderSchemaValidateCtxt(reader, ctxt, options);
33001         desret_int(ret_val);
33002         call_tests++;
33003         des_xmlTextReaderPtr(n_reader, reader, 0);
33004         des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 1);
33005         des_parseroptions(n_options, options, 2);
33006         xmlResetLastError();
33007         if (mem_base != xmlMemBlocks()) {
33008             printf("Leak of %d blocks found in xmlTextReaderSchemaValidateCtxt",
33009 	           xmlMemBlocks() - mem_base);
33010 	    test_ret++;
33011             printf(" %d", n_reader);
33012             printf(" %d", n_ctxt);
33013             printf(" %d", n_options);
33014             printf("\n");
33015         }
33016     }
33017     }
33018     }
33019     function_tests++;
33020 #endif
33021 
33022     return(test_ret);
33023 }
33024 
33025 
33026 static int
test_xmlTextReaderSetErrorHandler(void)33027 test_xmlTextReaderSetErrorHandler(void) {
33028     int test_ret = 0;
33029 
33030 
33031     /* missing type support */
33032     return(test_ret);
33033 }
33034 
33035 
33036 static int
test_xmlTextReaderSetMaxAmplification(void)33037 test_xmlTextReaderSetMaxAmplification(void) {
33038     int test_ret = 0;
33039 
33040 
33041     /* missing type support */
33042     return(test_ret);
33043 }
33044 
33045 
33046 static int
test_xmlTextReaderSetParserProp(void)33047 test_xmlTextReaderSetParserProp(void) {
33048     int test_ret = 0;
33049 
33050 #if defined(LIBXML_READER_ENABLED)
33051     int mem_base;
33052     int ret_val;
33053     xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
33054     int n_reader;
33055     int prop; /* the xmlParserProperties to set */
33056     int n_prop;
33057     int value; /* usually 0 or 1 to (de)activate it */
33058     int n_value;
33059 
33060     for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
33061     for (n_prop = 0;n_prop < gen_nb_int;n_prop++) {
33062     for (n_value = 0;n_value < gen_nb_int;n_value++) {
33063         mem_base = xmlMemBlocks();
33064         reader = gen_xmlTextReaderPtr(n_reader, 0);
33065         prop = gen_int(n_prop, 1);
33066         value = gen_int(n_value, 2);
33067 
33068         ret_val = xmlTextReaderSetParserProp(reader, prop, value);
33069         desret_int(ret_val);
33070         call_tests++;
33071         des_xmlTextReaderPtr(n_reader, reader, 0);
33072         des_int(n_prop, prop, 1);
33073         des_int(n_value, value, 2);
33074         xmlResetLastError();
33075         if (mem_base != xmlMemBlocks()) {
33076             printf("Leak of %d blocks found in xmlTextReaderSetParserProp",
33077 	           xmlMemBlocks() - mem_base);
33078 	    test_ret++;
33079             printf(" %d", n_reader);
33080             printf(" %d", n_prop);
33081             printf(" %d", n_value);
33082             printf("\n");
33083         }
33084     }
33085     }
33086     }
33087     function_tests++;
33088 #endif
33089 
33090     return(test_ret);
33091 }
33092 
33093 
33094 static int
test_xmlTextReaderSetResourceLoader(void)33095 test_xmlTextReaderSetResourceLoader(void) {
33096     int test_ret = 0;
33097 
33098 
33099     /* missing type support */
33100     return(test_ret);
33101 }
33102 
33103 
33104 static int
test_xmlTextReaderSetSchema(void)33105 test_xmlTextReaderSetSchema(void) {
33106     int test_ret = 0;
33107 
33108 #if defined(LIBXML_READER_ENABLED) && defined(LIBXML_SCHEMAS_ENABLED)
33109     int mem_base;
33110     int ret_val;
33111     xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
33112     int n_reader;
33113     xmlSchemaPtr schema; /* a precompiled Schema schema */
33114     int n_schema;
33115 
33116     for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
33117     for (n_schema = 0;n_schema < gen_nb_xmlSchemaPtr;n_schema++) {
33118         mem_base = xmlMemBlocks();
33119         reader = gen_xmlTextReaderPtr(n_reader, 0);
33120         schema = gen_xmlSchemaPtr(n_schema, 1);
33121 
33122         ret_val = xmlTextReaderSetSchema(reader, schema);
33123         desret_int(ret_val);
33124         call_tests++;
33125         des_xmlTextReaderPtr(n_reader, reader, 0);
33126         des_xmlSchemaPtr(n_schema, schema, 1);
33127         xmlResetLastError();
33128         if (mem_base != xmlMemBlocks()) {
33129             printf("Leak of %d blocks found in xmlTextReaderSetSchema",
33130 	           xmlMemBlocks() - mem_base);
33131 	    test_ret++;
33132             printf(" %d", n_reader);
33133             printf(" %d", n_schema);
33134             printf("\n");
33135         }
33136     }
33137     }
33138     function_tests++;
33139 #endif
33140 
33141     return(test_ret);
33142 }
33143 
33144 
33145 static int
test_xmlTextReaderSetStructuredErrorHandler(void)33146 test_xmlTextReaderSetStructuredErrorHandler(void) {
33147     int test_ret = 0;
33148 
33149 
33150     /* missing type support */
33151     return(test_ret);
33152 }
33153 
33154 
33155 static int
test_xmlTextReaderSetup(void)33156 test_xmlTextReaderSetup(void) {
33157     int test_ret = 0;
33158 
33159 #if defined(LIBXML_READER_ENABLED)
33160     int mem_base;
33161     int ret_val;
33162     xmlTextReaderPtr reader; /* an XML reader */
33163     int n_reader;
33164     xmlParserInputBufferPtr input; /* xmlParserInputBufferPtr used to feed the reader, will be destroyed with it. */
33165     int n_input;
33166     const char * URL; /* the base URL to use for the document */
33167     int n_URL;
33168     const char * encoding; /* the document encoding, or NULL */
33169     int n_encoding;
33170     int options; /* a combination of xmlParserOption */
33171     int n_options;
33172 
33173     for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
33174     for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
33175     for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
33176     for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
33177     for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
33178         mem_base = xmlMemBlocks();
33179         reader = gen_xmlTextReaderPtr(n_reader, 0);
33180         input = gen_xmlParserInputBufferPtr(n_input, 1);
33181         URL = gen_filepath(n_URL, 2);
33182         encoding = gen_const_char_ptr(n_encoding, 3);
33183         options = gen_parseroptions(n_options, 4);
33184 
33185         ret_val = xmlTextReaderSetup(reader, input, URL, encoding, options);
33186         desret_int(ret_val);
33187         call_tests++;
33188         des_xmlTextReaderPtr(n_reader, reader, 0);
33189         des_filepath(n_URL, URL, 2);
33190         des_const_char_ptr(n_encoding, encoding, 3);
33191         des_parseroptions(n_options, options, 4);
33192         xmlResetLastError();
33193         if (mem_base != xmlMemBlocks()) {
33194             printf("Leak of %d blocks found in xmlTextReaderSetup",
33195 	           xmlMemBlocks() - mem_base);
33196 	    test_ret++;
33197             printf(" %d", n_reader);
33198             printf(" %d", n_input);
33199             printf(" %d", n_URL);
33200             printf(" %d", n_encoding);
33201             printf(" %d", n_options);
33202             printf("\n");
33203         }
33204     }
33205     }
33206     }
33207     }
33208     }
33209     function_tests++;
33210 #endif
33211 
33212     return(test_ret);
33213 }
33214 
33215 
33216 static int
test_xmlTextReaderStandalone(void)33217 test_xmlTextReaderStandalone(void) {
33218     int test_ret = 0;
33219 
33220 #if defined(LIBXML_READER_ENABLED)
33221     int mem_base;
33222     int ret_val;
33223     xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
33224     int n_reader;
33225 
33226     for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
33227         mem_base = xmlMemBlocks();
33228         reader = gen_xmlTextReaderPtr(n_reader, 0);
33229 
33230         ret_val = xmlTextReaderStandalone(reader);
33231         desret_int(ret_val);
33232         call_tests++;
33233         des_xmlTextReaderPtr(n_reader, reader, 0);
33234         xmlResetLastError();
33235         if (mem_base != xmlMemBlocks()) {
33236             printf("Leak of %d blocks found in xmlTextReaderStandalone",
33237 	           xmlMemBlocks() - mem_base);
33238 	    test_ret++;
33239             printf(" %d", n_reader);
33240             printf("\n");
33241         }
33242     }
33243     function_tests++;
33244 #endif
33245 
33246     return(test_ret);
33247 }
33248 
33249 
33250 static int
test_xmlTextReaderValue(void)33251 test_xmlTextReaderValue(void) {
33252     int test_ret = 0;
33253 
33254 #if defined(LIBXML_READER_ENABLED)
33255     int mem_base;
33256     xmlChar * ret_val;
33257     xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
33258     int n_reader;
33259 
33260     for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
33261         mem_base = xmlMemBlocks();
33262         reader = gen_xmlTextReaderPtr(n_reader, 0);
33263 
33264         ret_val = xmlTextReaderValue(reader);
33265         desret_xmlChar_ptr(ret_val);
33266         call_tests++;
33267         des_xmlTextReaderPtr(n_reader, reader, 0);
33268         xmlResetLastError();
33269         if (mem_base != xmlMemBlocks()) {
33270             printf("Leak of %d blocks found in xmlTextReaderValue",
33271 	           xmlMemBlocks() - mem_base);
33272 	    test_ret++;
33273             printf(" %d", n_reader);
33274             printf("\n");
33275         }
33276     }
33277     function_tests++;
33278 #endif
33279 
33280     return(test_ret);
33281 }
33282 
33283 
33284 static int
test_xmlTextReaderXmlLang(void)33285 test_xmlTextReaderXmlLang(void) {
33286     int test_ret = 0;
33287 
33288 #if defined(LIBXML_READER_ENABLED)
33289     int mem_base;
33290     xmlChar * ret_val;
33291     xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
33292     int n_reader;
33293 
33294     for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
33295         mem_base = xmlMemBlocks();
33296         reader = gen_xmlTextReaderPtr(n_reader, 0);
33297 
33298         ret_val = xmlTextReaderXmlLang(reader);
33299         desret_xmlChar_ptr(ret_val);
33300         call_tests++;
33301         des_xmlTextReaderPtr(n_reader, reader, 0);
33302         xmlResetLastError();
33303         if (mem_base != xmlMemBlocks()) {
33304             printf("Leak of %d blocks found in xmlTextReaderXmlLang",
33305 	           xmlMemBlocks() - mem_base);
33306 	    test_ret++;
33307             printf(" %d", n_reader);
33308             printf("\n");
33309         }
33310     }
33311     function_tests++;
33312 #endif
33313 
33314     return(test_ret);
33315 }
33316 
33317 static int
test_xmlreader(void)33318 test_xmlreader(void) {
33319     int test_ret = 0;
33320 
33321     if (quiet == 0) printf("Testing xmlreader : 76 of 89 functions ...\n");
33322     test_ret += test_xmlNewTextReader();
33323     test_ret += test_xmlNewTextReaderFilename();
33324     test_ret += test_xmlReaderForDoc();
33325     test_ret += test_xmlReaderForFile();
33326     test_ret += test_xmlReaderForMemory();
33327     test_ret += test_xmlReaderNewDoc();
33328     test_ret += test_xmlReaderNewFile();
33329     test_ret += test_xmlReaderNewMemory();
33330     test_ret += test_xmlReaderNewWalker();
33331     test_ret += test_xmlReaderWalker();
33332     test_ret += test_xmlTextReaderAttributeCount();
33333     test_ret += test_xmlTextReaderBaseUri();
33334     test_ret += test_xmlTextReaderByteConsumed();
33335     test_ret += test_xmlTextReaderClose();
33336     test_ret += test_xmlTextReaderConstBaseUri();
33337     test_ret += test_xmlTextReaderConstEncoding();
33338     test_ret += test_xmlTextReaderConstLocalName();
33339     test_ret += test_xmlTextReaderConstName();
33340     test_ret += test_xmlTextReaderConstNamespaceUri();
33341     test_ret += test_xmlTextReaderConstPrefix();
33342     test_ret += test_xmlTextReaderConstString();
33343     test_ret += test_xmlTextReaderConstValue();
33344     test_ret += test_xmlTextReaderConstXmlLang();
33345     test_ret += test_xmlTextReaderConstXmlVersion();
33346     test_ret += test_xmlTextReaderCurrentDoc();
33347     test_ret += test_xmlTextReaderCurrentNode();
33348     test_ret += test_xmlTextReaderDepth();
33349     test_ret += test_xmlTextReaderExpand();
33350     test_ret += test_xmlTextReaderGetAttribute();
33351     test_ret += test_xmlTextReaderGetAttributeNo();
33352     test_ret += test_xmlTextReaderGetAttributeNs();
33353     test_ret += test_xmlTextReaderGetErrorHandler();
33354     test_ret += test_xmlTextReaderGetLastError();
33355     test_ret += test_xmlTextReaderGetParserColumnNumber();
33356     test_ret += test_xmlTextReaderGetParserLineNumber();
33357     test_ret += test_xmlTextReaderGetParserProp();
33358     test_ret += test_xmlTextReaderGetRemainder();
33359     test_ret += test_xmlTextReaderHasAttributes();
33360     test_ret += test_xmlTextReaderHasValue();
33361     test_ret += test_xmlTextReaderIsDefault();
33362     test_ret += test_xmlTextReaderIsEmptyElement();
33363     test_ret += test_xmlTextReaderIsNamespaceDecl();
33364     test_ret += test_xmlTextReaderIsValid();
33365     test_ret += test_xmlTextReaderLocalName();
33366     test_ret += test_xmlTextReaderLocatorBaseURI();
33367     test_ret += test_xmlTextReaderLocatorLineNumber();
33368     test_ret += test_xmlTextReaderLookupNamespace();
33369     test_ret += test_xmlTextReaderMoveToAttribute();
33370     test_ret += test_xmlTextReaderMoveToAttributeNo();
33371     test_ret += test_xmlTextReaderMoveToAttributeNs();
33372     test_ret += test_xmlTextReaderMoveToElement();
33373     test_ret += test_xmlTextReaderMoveToFirstAttribute();
33374     test_ret += test_xmlTextReaderMoveToNextAttribute();
33375     test_ret += test_xmlTextReaderName();
33376     test_ret += test_xmlTextReaderNamespaceUri();
33377     test_ret += test_xmlTextReaderNext();
33378     test_ret += test_xmlTextReaderNextSibling();
33379     test_ret += test_xmlTextReaderNodeType();
33380     test_ret += test_xmlTextReaderNormalization();
33381     test_ret += test_xmlTextReaderPrefix();
33382     test_ret += test_xmlTextReaderPreserve();
33383     test_ret += test_xmlTextReaderPreservePattern();
33384     test_ret += test_xmlTextReaderQuoteChar();
33385     test_ret += test_xmlTextReaderRead();
33386     test_ret += test_xmlTextReaderReadAttributeValue();
33387     test_ret += test_xmlTextReaderReadState();
33388     test_ret += test_xmlTextReaderRelaxNGSetSchema();
33389     test_ret += test_xmlTextReaderRelaxNGValidate();
33390     test_ret += test_xmlTextReaderRelaxNGValidateCtxt();
33391     test_ret += test_xmlTextReaderSchemaValidate();
33392     test_ret += test_xmlTextReaderSchemaValidateCtxt();
33393     test_ret += test_xmlTextReaderSetErrorHandler();
33394     test_ret += test_xmlTextReaderSetMaxAmplification();
33395     test_ret += test_xmlTextReaderSetParserProp();
33396     test_ret += test_xmlTextReaderSetResourceLoader();
33397     test_ret += test_xmlTextReaderSetSchema();
33398     test_ret += test_xmlTextReaderSetStructuredErrorHandler();
33399     test_ret += test_xmlTextReaderSetup();
33400     test_ret += test_xmlTextReaderStandalone();
33401     test_ret += test_xmlTextReaderValue();
33402     test_ret += test_xmlTextReaderXmlLang();
33403 
33404     if (test_ret != 0)
33405 	printf("Module xmlreader: %d errors\n", test_ret);
33406     return(test_ret);
33407 }
33408 #ifdef LIBXML_REGEXP_ENABLED
33409 
33410 #define gen_nb_xmlRegExecCtxtPtr 1
33411 #define gen_xmlRegExecCtxtPtr(no, nr) NULL
33412 #define des_xmlRegExecCtxtPtr(no, val, nr)
33413 #endif
33414 
33415 
33416 static int
test_xmlRegExecErrInfo(void)33417 test_xmlRegExecErrInfo(void) {
33418     int test_ret = 0;
33419 
33420 #if defined(LIBXML_REGEXP_ENABLED)
33421     int mem_base;
33422     int ret_val;
33423     xmlRegExecCtxtPtr exec; /* a regexp execution context generating an error */
33424     int n_exec;
33425     const xmlChar ** string; /* return value for the error string */
33426     int n_string;
33427     int * nbval; /* pointer to the number of accepted values IN/OUT */
33428     int n_nbval;
33429     int * nbneg; /* return number of negative transitions */
33430     int n_nbneg;
33431     xmlChar ** values; /* pointer to the array of acceptable values */
33432     int n_values;
33433     int * terminal; /* return value if this was a terminal state */
33434     int n_terminal;
33435 
33436     for (n_exec = 0;n_exec < gen_nb_xmlRegExecCtxtPtr;n_exec++) {
33437     for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr_ptr;n_string++) {
33438     for (n_nbval = 0;n_nbval < gen_nb_int_ptr;n_nbval++) {
33439     for (n_nbneg = 0;n_nbneg < gen_nb_int_ptr;n_nbneg++) {
33440     for (n_values = 0;n_values < gen_nb_xmlChar_ptr_ptr;n_values++) {
33441     for (n_terminal = 0;n_terminal < gen_nb_int_ptr;n_terminal++) {
33442         mem_base = xmlMemBlocks();
33443         exec = gen_xmlRegExecCtxtPtr(n_exec, 0);
33444         string = gen_const_xmlChar_ptr_ptr(n_string, 1);
33445         nbval = gen_int_ptr(n_nbval, 2);
33446         nbneg = gen_int_ptr(n_nbneg, 3);
33447         values = gen_xmlChar_ptr_ptr(n_values, 4);
33448         terminal = gen_int_ptr(n_terminal, 5);
33449 
33450         ret_val = xmlRegExecErrInfo(exec, string, nbval, nbneg, values, terminal);
33451         desret_int(ret_val);
33452         call_tests++;
33453         des_xmlRegExecCtxtPtr(n_exec, exec, 0);
33454         des_const_xmlChar_ptr_ptr(n_string, string, 1);
33455         des_int_ptr(n_nbval, nbval, 2);
33456         des_int_ptr(n_nbneg, nbneg, 3);
33457         des_xmlChar_ptr_ptr(n_values, values, 4);
33458         des_int_ptr(n_terminal, terminal, 5);
33459         xmlResetLastError();
33460         if (mem_base != xmlMemBlocks()) {
33461             printf("Leak of %d blocks found in xmlRegExecErrInfo",
33462 	           xmlMemBlocks() - mem_base);
33463 	    test_ret++;
33464             printf(" %d", n_exec);
33465             printf(" %d", n_string);
33466             printf(" %d", n_nbval);
33467             printf(" %d", n_nbneg);
33468             printf(" %d", n_values);
33469             printf(" %d", n_terminal);
33470             printf("\n");
33471         }
33472     }
33473     }
33474     }
33475     }
33476     }
33477     }
33478     function_tests++;
33479 #endif
33480 
33481     return(test_ret);
33482 }
33483 
33484 
33485 static int
test_xmlRegExecNextValues(void)33486 test_xmlRegExecNextValues(void) {
33487     int test_ret = 0;
33488 
33489 #if defined(LIBXML_REGEXP_ENABLED)
33490     int mem_base;
33491     int ret_val;
33492     xmlRegExecCtxtPtr exec; /* a regexp execution context */
33493     int n_exec;
33494     int * nbval; /* pointer to the number of accepted values IN/OUT */
33495     int n_nbval;
33496     int * nbneg; /* return number of negative transitions */
33497     int n_nbneg;
33498     xmlChar ** values; /* pointer to the array of acceptable values */
33499     int n_values;
33500     int * terminal; /* return value if this was a terminal state */
33501     int n_terminal;
33502 
33503     for (n_exec = 0;n_exec < gen_nb_xmlRegExecCtxtPtr;n_exec++) {
33504     for (n_nbval = 0;n_nbval < gen_nb_int_ptr;n_nbval++) {
33505     for (n_nbneg = 0;n_nbneg < gen_nb_int_ptr;n_nbneg++) {
33506     for (n_values = 0;n_values < gen_nb_xmlChar_ptr_ptr;n_values++) {
33507     for (n_terminal = 0;n_terminal < gen_nb_int_ptr;n_terminal++) {
33508         mem_base = xmlMemBlocks();
33509         exec = gen_xmlRegExecCtxtPtr(n_exec, 0);
33510         nbval = gen_int_ptr(n_nbval, 1);
33511         nbneg = gen_int_ptr(n_nbneg, 2);
33512         values = gen_xmlChar_ptr_ptr(n_values, 3);
33513         terminal = gen_int_ptr(n_terminal, 4);
33514 
33515         ret_val = xmlRegExecNextValues(exec, nbval, nbneg, values, terminal);
33516         desret_int(ret_val);
33517         call_tests++;
33518         des_xmlRegExecCtxtPtr(n_exec, exec, 0);
33519         des_int_ptr(n_nbval, nbval, 1);
33520         des_int_ptr(n_nbneg, nbneg, 2);
33521         des_xmlChar_ptr_ptr(n_values, values, 3);
33522         des_int_ptr(n_terminal, terminal, 4);
33523         xmlResetLastError();
33524         if (mem_base != xmlMemBlocks()) {
33525             printf("Leak of %d blocks found in xmlRegExecNextValues",
33526 	           xmlMemBlocks() - mem_base);
33527 	    test_ret++;
33528             printf(" %d", n_exec);
33529             printf(" %d", n_nbval);
33530             printf(" %d", n_nbneg);
33531             printf(" %d", n_values);
33532             printf(" %d", n_terminal);
33533             printf("\n");
33534         }
33535     }
33536     }
33537     }
33538     }
33539     }
33540     function_tests++;
33541 #endif
33542 
33543     return(test_ret);
33544 }
33545 
33546 
33547 static int
test_xmlRegExecPushString(void)33548 test_xmlRegExecPushString(void) {
33549     int test_ret = 0;
33550 
33551 #if defined(LIBXML_REGEXP_ENABLED)
33552     int mem_base;
33553     int ret_val;
33554     xmlRegExecCtxtPtr exec; /* a regexp execution context or NULL to indicate the end */
33555     int n_exec;
33556     const xmlChar * value; /* a string token input */
33557     int n_value;
33558     void * data; /* data associated to the token to reuse in callbacks */
33559     int n_data;
33560 
33561     for (n_exec = 0;n_exec < gen_nb_xmlRegExecCtxtPtr;n_exec++) {
33562     for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
33563     for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
33564         mem_base = xmlMemBlocks();
33565         exec = gen_xmlRegExecCtxtPtr(n_exec, 0);
33566         value = gen_const_xmlChar_ptr(n_value, 1);
33567         data = gen_userdata(n_data, 2);
33568 
33569         ret_val = xmlRegExecPushString(exec, value, data);
33570         desret_int(ret_val);
33571         call_tests++;
33572         des_xmlRegExecCtxtPtr(n_exec, exec, 0);
33573         des_const_xmlChar_ptr(n_value, value, 1);
33574         des_userdata(n_data, data, 2);
33575         xmlResetLastError();
33576         if (mem_base != xmlMemBlocks()) {
33577             printf("Leak of %d blocks found in xmlRegExecPushString",
33578 	           xmlMemBlocks() - mem_base);
33579 	    test_ret++;
33580             printf(" %d", n_exec);
33581             printf(" %d", n_value);
33582             printf(" %d", n_data);
33583             printf("\n");
33584         }
33585     }
33586     }
33587     }
33588     function_tests++;
33589 #endif
33590 
33591     return(test_ret);
33592 }
33593 
33594 
33595 static int
test_xmlRegExecPushString2(void)33596 test_xmlRegExecPushString2(void) {
33597     int test_ret = 0;
33598 
33599 #if defined(LIBXML_REGEXP_ENABLED)
33600     int mem_base;
33601     int ret_val;
33602     xmlRegExecCtxtPtr exec; /* a regexp execution context or NULL to indicate the end */
33603     int n_exec;
33604     const xmlChar * value; /* the first string token input */
33605     int n_value;
33606     const xmlChar * value2; /* the second string token input */
33607     int n_value2;
33608     void * data; /* data associated to the token to reuse in callbacks */
33609     int n_data;
33610 
33611     for (n_exec = 0;n_exec < gen_nb_xmlRegExecCtxtPtr;n_exec++) {
33612     for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
33613     for (n_value2 = 0;n_value2 < gen_nb_const_xmlChar_ptr;n_value2++) {
33614     for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
33615         mem_base = xmlMemBlocks();
33616         exec = gen_xmlRegExecCtxtPtr(n_exec, 0);
33617         value = gen_const_xmlChar_ptr(n_value, 1);
33618         value2 = gen_const_xmlChar_ptr(n_value2, 2);
33619         data = gen_userdata(n_data, 3);
33620 
33621         ret_val = xmlRegExecPushString2(exec, value, value2, data);
33622         desret_int(ret_val);
33623         call_tests++;
33624         des_xmlRegExecCtxtPtr(n_exec, exec, 0);
33625         des_const_xmlChar_ptr(n_value, value, 1);
33626         des_const_xmlChar_ptr(n_value2, value2, 2);
33627         des_userdata(n_data, data, 3);
33628         xmlResetLastError();
33629         if (mem_base != xmlMemBlocks()) {
33630             printf("Leak of %d blocks found in xmlRegExecPushString2",
33631 	           xmlMemBlocks() - mem_base);
33632 	    test_ret++;
33633             printf(" %d", n_exec);
33634             printf(" %d", n_value);
33635             printf(" %d", n_value2);
33636             printf(" %d", n_data);
33637             printf("\n");
33638         }
33639     }
33640     }
33641     }
33642     }
33643     function_tests++;
33644 #endif
33645 
33646     return(test_ret);
33647 }
33648 
33649 
33650 static int
test_xmlRegNewExecCtxt(void)33651 test_xmlRegNewExecCtxt(void) {
33652     int test_ret = 0;
33653 
33654 
33655     /* missing type support */
33656     return(test_ret);
33657 }
33658 
33659 
33660 static int
test_xmlRegexpCompile(void)33661 test_xmlRegexpCompile(void) {
33662     int test_ret = 0;
33663 
33664 
33665     /* missing type support */
33666     return(test_ret);
33667 }
33668 
33669 #ifdef LIBXML_REGEXP_ENABLED
33670 
33671 #define gen_nb_xmlRegexpPtr 1
33672 #define gen_xmlRegexpPtr(no, nr) NULL
33673 #define des_xmlRegexpPtr(no, val, nr)
33674 #endif
33675 
33676 
33677 static int
test_xmlRegexpExec(void)33678 test_xmlRegexpExec(void) {
33679     int test_ret = 0;
33680 
33681 #if defined(LIBXML_REGEXP_ENABLED)
33682     int mem_base;
33683     int ret_val;
33684     xmlRegexpPtr comp; /* the compiled regular expression */
33685     int n_comp;
33686     const xmlChar * content; /* the value to check against the regular expression */
33687     int n_content;
33688 
33689     for (n_comp = 0;n_comp < gen_nb_xmlRegexpPtr;n_comp++) {
33690     for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
33691         mem_base = xmlMemBlocks();
33692         comp = gen_xmlRegexpPtr(n_comp, 0);
33693         content = gen_const_xmlChar_ptr(n_content, 1);
33694 
33695         ret_val = xmlRegexpExec(comp, content);
33696         desret_int(ret_val);
33697         call_tests++;
33698         des_xmlRegexpPtr(n_comp, comp, 0);
33699         des_const_xmlChar_ptr(n_content, content, 1);
33700         xmlResetLastError();
33701         if (mem_base != xmlMemBlocks()) {
33702             printf("Leak of %d blocks found in xmlRegexpExec",
33703 	           xmlMemBlocks() - mem_base);
33704 	    test_ret++;
33705             printf(" %d", n_comp);
33706             printf(" %d", n_content);
33707             printf("\n");
33708         }
33709     }
33710     }
33711     function_tests++;
33712 #endif
33713 
33714     return(test_ret);
33715 }
33716 
33717 
33718 static int
test_xmlRegexpIsDeterminist(void)33719 test_xmlRegexpIsDeterminist(void) {
33720     int test_ret = 0;
33721 
33722 #if defined(LIBXML_REGEXP_ENABLED)
33723     int mem_base;
33724     int ret_val;
33725     xmlRegexpPtr comp; /* the compiled regular expression */
33726     int n_comp;
33727 
33728     for (n_comp = 0;n_comp < gen_nb_xmlRegexpPtr;n_comp++) {
33729         mem_base = xmlMemBlocks();
33730         comp = gen_xmlRegexpPtr(n_comp, 0);
33731 
33732         ret_val = xmlRegexpIsDeterminist(comp);
33733         desret_int(ret_val);
33734         call_tests++;
33735         des_xmlRegexpPtr(n_comp, comp, 0);
33736         xmlResetLastError();
33737         if (mem_base != xmlMemBlocks()) {
33738             printf("Leak of %d blocks found in xmlRegexpIsDeterminist",
33739 	           xmlMemBlocks() - mem_base);
33740 	    test_ret++;
33741             printf(" %d", n_comp);
33742             printf("\n");
33743         }
33744     }
33745     function_tests++;
33746 #endif
33747 
33748     return(test_ret);
33749 }
33750 
33751 
33752 static int
test_xmlRegexpPrint(void)33753 test_xmlRegexpPrint(void) {
33754     int test_ret = 0;
33755 
33756 #if defined(LIBXML_REGEXP_ENABLED)
33757     int mem_base;
33758     FILE * output; /* the file for the output debug */
33759     int n_output;
33760     xmlRegexpPtr regexp; /* the compiled regexp */
33761     int n_regexp;
33762 
33763     for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
33764     for (n_regexp = 0;n_regexp < gen_nb_xmlRegexpPtr;n_regexp++) {
33765         mem_base = xmlMemBlocks();
33766         output = gen_FILE_ptr(n_output, 0);
33767         regexp = gen_xmlRegexpPtr(n_regexp, 1);
33768 
33769         xmlRegexpPrint(output, regexp);
33770         call_tests++;
33771         des_FILE_ptr(n_output, output, 0);
33772         des_xmlRegexpPtr(n_regexp, regexp, 1);
33773         xmlResetLastError();
33774         if (mem_base != xmlMemBlocks()) {
33775             printf("Leak of %d blocks found in xmlRegexpPrint",
33776 	           xmlMemBlocks() - mem_base);
33777 	    test_ret++;
33778             printf(" %d", n_output);
33779             printf(" %d", n_regexp);
33780             printf("\n");
33781         }
33782     }
33783     }
33784     function_tests++;
33785 #endif
33786 
33787     return(test_ret);
33788 }
33789 
33790 static int
test_xmlregexp(void)33791 test_xmlregexp(void) {
33792     int test_ret = 0;
33793 
33794     if (quiet == 0) printf("Testing xmlregexp : 7 of 11 functions ...\n");
33795     test_ret += test_xmlRegExecErrInfo();
33796     test_ret += test_xmlRegExecNextValues();
33797     test_ret += test_xmlRegExecPushString();
33798     test_ret += test_xmlRegExecPushString2();
33799     test_ret += test_xmlRegNewExecCtxt();
33800     test_ret += test_xmlRegexpCompile();
33801     test_ret += test_xmlRegexpExec();
33802     test_ret += test_xmlRegexpIsDeterminist();
33803     test_ret += test_xmlRegexpPrint();
33804 
33805     if (test_ret != 0)
33806 	printf("Module xmlregexp: %d errors\n", test_ret);
33807     return(test_ret);
33808 }
33809 #ifdef LIBXML_OUTPUT_ENABLED
33810 
33811 #define gen_nb_xmlSaveCtxtPtr 1
33812 #define gen_xmlSaveCtxtPtr(no, nr) NULL
33813 #define des_xmlSaveCtxtPtr(no, val, nr)
33814 #endif
33815 
33816 
33817 static int
test_xmlSaveClose(void)33818 test_xmlSaveClose(void) {
33819     int test_ret = 0;
33820 
33821 #if defined(LIBXML_OUTPUT_ENABLED)
33822     int mem_base;
33823     int ret_val;
33824     xmlSaveCtxtPtr ctxt; /* a document saving context */
33825     int n_ctxt;
33826 
33827     for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
33828         mem_base = xmlMemBlocks();
33829         ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
33830 
33831         ret_val = xmlSaveClose(ctxt);
33832         desret_int(ret_val);
33833         call_tests++;
33834         des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
33835         xmlResetLastError();
33836         if (mem_base != xmlMemBlocks()) {
33837             printf("Leak of %d blocks found in xmlSaveClose",
33838 	           xmlMemBlocks() - mem_base);
33839 	    test_ret++;
33840             printf(" %d", n_ctxt);
33841             printf("\n");
33842         }
33843     }
33844     function_tests++;
33845 #endif
33846 
33847     return(test_ret);
33848 }
33849 
33850 
33851 static int
test_xmlSaveDoc(void)33852 test_xmlSaveDoc(void) {
33853     int test_ret = 0;
33854 
33855 #if defined(LIBXML_OUTPUT_ENABLED)
33856     int mem_base;
33857     long ret_val;
33858     xmlSaveCtxtPtr ctxt; /* a document saving context */
33859     int n_ctxt;
33860     xmlDocPtr doc; /* a document */
33861     int n_doc;
33862 
33863     for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
33864     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
33865         mem_base = xmlMemBlocks();
33866         ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
33867         doc = gen_xmlDocPtr(n_doc, 1);
33868 
33869         ret_val = xmlSaveDoc(ctxt, doc);
33870         desret_long(ret_val);
33871         call_tests++;
33872         des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
33873         des_xmlDocPtr(n_doc, doc, 1);
33874         xmlResetLastError();
33875         if (mem_base != xmlMemBlocks()) {
33876             printf("Leak of %d blocks found in xmlSaveDoc",
33877 	           xmlMemBlocks() - mem_base);
33878 	    test_ret++;
33879             printf(" %d", n_ctxt);
33880             printf(" %d", n_doc);
33881             printf("\n");
33882         }
33883     }
33884     }
33885     function_tests++;
33886 #endif
33887 
33888     return(test_ret);
33889 }
33890 
33891 
33892 static int
test_xmlSaveFinish(void)33893 test_xmlSaveFinish(void) {
33894     int test_ret = 0;
33895 
33896 #if defined(LIBXML_OUTPUT_ENABLED)
33897     int mem_base;
33898     int ret_val;
33899     xmlSaveCtxtPtr ctxt; /* a document saving context */
33900     int n_ctxt;
33901 
33902     for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
33903         mem_base = xmlMemBlocks();
33904         ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
33905 
33906         ret_val = xmlSaveFinish(ctxt);
33907         desret_int(ret_val);
33908         call_tests++;
33909         des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
33910         xmlResetLastError();
33911         if (mem_base != xmlMemBlocks()) {
33912             printf("Leak of %d blocks found in xmlSaveFinish",
33913 	           xmlMemBlocks() - mem_base);
33914 	    test_ret++;
33915             printf(" %d", n_ctxt);
33916             printf("\n");
33917         }
33918     }
33919     function_tests++;
33920 #endif
33921 
33922     return(test_ret);
33923 }
33924 
33925 
33926 static int
test_xmlSaveFlush(void)33927 test_xmlSaveFlush(void) {
33928     int test_ret = 0;
33929 
33930 #if defined(LIBXML_OUTPUT_ENABLED)
33931     int mem_base;
33932     int ret_val;
33933     xmlSaveCtxtPtr ctxt; /* a document saving context */
33934     int n_ctxt;
33935 
33936     for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
33937         mem_base = xmlMemBlocks();
33938         ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
33939 
33940         ret_val = xmlSaveFlush(ctxt);
33941         desret_int(ret_val);
33942         call_tests++;
33943         des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
33944         xmlResetLastError();
33945         if (mem_base != xmlMemBlocks()) {
33946             printf("Leak of %d blocks found in xmlSaveFlush",
33947 	           xmlMemBlocks() - mem_base);
33948 	    test_ret++;
33949             printf(" %d", n_ctxt);
33950             printf("\n");
33951         }
33952     }
33953     function_tests++;
33954 #endif
33955 
33956     return(test_ret);
33957 }
33958 
33959 
33960 static int
test_xmlSaveSetAttrEscape(void)33961 test_xmlSaveSetAttrEscape(void) {
33962     int test_ret = 0;
33963 
33964 
33965     /* missing type support */
33966     return(test_ret);
33967 }
33968 
33969 
33970 static int
test_xmlSaveSetEscape(void)33971 test_xmlSaveSetEscape(void) {
33972     int test_ret = 0;
33973 
33974 
33975     /* missing type support */
33976     return(test_ret);
33977 }
33978 
33979 
33980 static int
test_xmlSaveSetIndentString(void)33981 test_xmlSaveSetIndentString(void) {
33982     int test_ret = 0;
33983 
33984 #if defined(LIBXML_OUTPUT_ENABLED)
33985     int mem_base;
33986     int ret_val;
33987     xmlSaveCtxtPtr ctxt; /* save context */
33988     int n_ctxt;
33989     const char * indent; /* indent string */
33990     int n_indent;
33991 
33992     for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
33993     for (n_indent = 0;n_indent < gen_nb_const_char_ptr;n_indent++) {
33994         mem_base = xmlMemBlocks();
33995         ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
33996         indent = gen_const_char_ptr(n_indent, 1);
33997 
33998         ret_val = xmlSaveSetIndentString(ctxt, indent);
33999         desret_int(ret_val);
34000         call_tests++;
34001         des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
34002         des_const_char_ptr(n_indent, indent, 1);
34003         xmlResetLastError();
34004         if (mem_base != xmlMemBlocks()) {
34005             printf("Leak of %d blocks found in xmlSaveSetIndentString",
34006 	           xmlMemBlocks() - mem_base);
34007 	    test_ret++;
34008             printf(" %d", n_ctxt);
34009             printf(" %d", n_indent);
34010             printf("\n");
34011         }
34012     }
34013     }
34014     function_tests++;
34015 #endif
34016 
34017     return(test_ret);
34018 }
34019 
34020 
34021 static int
test_xmlSaveToBuffer(void)34022 test_xmlSaveToBuffer(void) {
34023     int test_ret = 0;
34024 
34025 
34026     /* missing type support */
34027     return(test_ret);
34028 }
34029 
34030 
34031 static int
test_xmlSaveToFd(void)34032 test_xmlSaveToFd(void) {
34033     int test_ret = 0;
34034 
34035 
34036     /* missing type support */
34037     return(test_ret);
34038 }
34039 
34040 
34041 static int
test_xmlSaveToFilename(void)34042 test_xmlSaveToFilename(void) {
34043     int test_ret = 0;
34044 
34045 
34046     /* missing type support */
34047     return(test_ret);
34048 }
34049 
34050 
34051 static int
test_xmlSaveTree(void)34052 test_xmlSaveTree(void) {
34053     int test_ret = 0;
34054 
34055 #if defined(LIBXML_OUTPUT_ENABLED)
34056     int mem_base;
34057     long ret_val;
34058     xmlSaveCtxtPtr ctxt; /* a document saving context */
34059     int n_ctxt;
34060     xmlNodePtr cur; /* the top node of the subtree to save */
34061     int n_cur;
34062 
34063     for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
34064     for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
34065         mem_base = xmlMemBlocks();
34066         ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
34067         cur = gen_xmlNodePtr(n_cur, 1);
34068 
34069         ret_val = xmlSaveTree(ctxt, cur);
34070         desret_long(ret_val);
34071         call_tests++;
34072         des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
34073         des_xmlNodePtr(n_cur, cur, 1);
34074         xmlResetLastError();
34075         if (mem_base != xmlMemBlocks()) {
34076             printf("Leak of %d blocks found in xmlSaveTree",
34077 	           xmlMemBlocks() - mem_base);
34078 	    test_ret++;
34079             printf(" %d", n_ctxt);
34080             printf(" %d", n_cur);
34081             printf("\n");
34082         }
34083     }
34084     }
34085     function_tests++;
34086 #endif
34087 
34088     return(test_ret);
34089 }
34090 
34091 
34092 static int
test_xmlThrDefIndentTreeOutput(void)34093 test_xmlThrDefIndentTreeOutput(void) {
34094     int test_ret = 0;
34095 
34096 #if defined(LIBXML_OUTPUT_ENABLED)
34097     int mem_base;
34098     int ret_val;
34099     int v; /*  */
34100     int n_v;
34101 
34102     for (n_v = 0;n_v < gen_nb_int;n_v++) {
34103         mem_base = xmlMemBlocks();
34104         v = gen_int(n_v, 0);
34105 
34106         ret_val = xmlThrDefIndentTreeOutput(v);
34107         desret_int(ret_val);
34108         call_tests++;
34109         des_int(n_v, v, 0);
34110         xmlResetLastError();
34111         if (mem_base != xmlMemBlocks()) {
34112             printf("Leak of %d blocks found in xmlThrDefIndentTreeOutput",
34113 	           xmlMemBlocks() - mem_base);
34114 	    test_ret++;
34115             printf(" %d", n_v);
34116             printf("\n");
34117         }
34118     }
34119     function_tests++;
34120 #endif
34121 
34122     return(test_ret);
34123 }
34124 
34125 
34126 static int
test_xmlThrDefSaveNoEmptyTags(void)34127 test_xmlThrDefSaveNoEmptyTags(void) {
34128     int test_ret = 0;
34129 
34130 #if defined(LIBXML_OUTPUT_ENABLED)
34131     int mem_base;
34132     int ret_val;
34133     int v; /*  */
34134     int n_v;
34135 
34136     for (n_v = 0;n_v < gen_nb_int;n_v++) {
34137         mem_base = xmlMemBlocks();
34138         v = gen_int(n_v, 0);
34139 
34140         ret_val = xmlThrDefSaveNoEmptyTags(v);
34141         desret_int(ret_val);
34142         call_tests++;
34143         des_int(n_v, v, 0);
34144         xmlResetLastError();
34145         if (mem_base != xmlMemBlocks()) {
34146             printf("Leak of %d blocks found in xmlThrDefSaveNoEmptyTags",
34147 	           xmlMemBlocks() - mem_base);
34148 	    test_ret++;
34149             printf(" %d", n_v);
34150             printf("\n");
34151         }
34152     }
34153     function_tests++;
34154 #endif
34155 
34156     return(test_ret);
34157 }
34158 
34159 
34160 static int
test_xmlThrDefTreeIndentString(void)34161 test_xmlThrDefTreeIndentString(void) {
34162     int test_ret = 0;
34163 
34164 #if defined(LIBXML_OUTPUT_ENABLED)
34165     int mem_base;
34166     const char * ret_val;
34167     const char * v; /*  */
34168     int n_v;
34169 
34170     for (n_v = 0;n_v < gen_nb_const_char_ptr;n_v++) {
34171         mem_base = xmlMemBlocks();
34172         v = gen_const_char_ptr(n_v, 0);
34173 
34174         ret_val = xmlThrDefTreeIndentString(v);
34175         desret_const_char_ptr(ret_val);
34176         call_tests++;
34177         des_const_char_ptr(n_v, v, 0);
34178         xmlResetLastError();
34179         if (mem_base != xmlMemBlocks()) {
34180             printf("Leak of %d blocks found in xmlThrDefTreeIndentString",
34181 	           xmlMemBlocks() - mem_base);
34182 	    test_ret++;
34183             printf(" %d", n_v);
34184             printf("\n");
34185         }
34186     }
34187     function_tests++;
34188 #endif
34189 
34190     return(test_ret);
34191 }
34192 
34193 static int
test_xmlsave(void)34194 test_xmlsave(void) {
34195     int test_ret = 0;
34196 
34197     if (quiet == 0) printf("Testing xmlsave : 9 of 15 functions ...\n");
34198     test_ret += test_xmlSaveClose();
34199     test_ret += test_xmlSaveDoc();
34200     test_ret += test_xmlSaveFinish();
34201     test_ret += test_xmlSaveFlush();
34202     test_ret += test_xmlSaveSetAttrEscape();
34203     test_ret += test_xmlSaveSetEscape();
34204     test_ret += test_xmlSaveSetIndentString();
34205     test_ret += test_xmlSaveToBuffer();
34206     test_ret += test_xmlSaveToFd();
34207     test_ret += test_xmlSaveToFilename();
34208     test_ret += test_xmlSaveTree();
34209     test_ret += test_xmlThrDefIndentTreeOutput();
34210     test_ret += test_xmlThrDefSaveNoEmptyTags();
34211     test_ret += test_xmlThrDefTreeIndentString();
34212 
34213     if (test_ret != 0)
34214 	printf("Module xmlsave: %d errors\n", test_ret);
34215     return(test_ret);
34216 }
34217 
34218 static int
test_xmlSchemaDump(void)34219 test_xmlSchemaDump(void) {
34220     int test_ret = 0;
34221 
34222 #if defined(LIBXML_SCHEMAS_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
34223     int mem_base;
34224     FILE * output; /* the file output */
34225     int n_output;
34226     xmlSchemaPtr schema; /* a schema structure */
34227     int n_schema;
34228 
34229     for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
34230     for (n_schema = 0;n_schema < gen_nb_xmlSchemaPtr;n_schema++) {
34231         mem_base = xmlMemBlocks();
34232         output = gen_FILE_ptr(n_output, 0);
34233         schema = gen_xmlSchemaPtr(n_schema, 1);
34234 
34235         xmlSchemaDump(output, schema);
34236         call_tests++;
34237         des_FILE_ptr(n_output, output, 0);
34238         des_xmlSchemaPtr(n_schema, schema, 1);
34239         xmlResetLastError();
34240         if (mem_base != xmlMemBlocks()) {
34241             printf("Leak of %d blocks found in xmlSchemaDump",
34242 	           xmlMemBlocks() - mem_base);
34243 	    test_ret++;
34244             printf(" %d", n_output);
34245             printf(" %d", n_schema);
34246             printf("\n");
34247         }
34248     }
34249     }
34250     function_tests++;
34251 #endif
34252 
34253     return(test_ret);
34254 }
34255 
34256 #ifdef LIBXML_SCHEMAS_ENABLED
34257 
34258 #define gen_nb_xmlSchemaParserCtxtPtr 1
34259 #define gen_xmlSchemaParserCtxtPtr(no, nr) NULL
34260 #define des_xmlSchemaParserCtxtPtr(no, val, nr)
34261 #endif
34262 
34263 #ifdef LIBXML_SCHEMAS_ENABLED
34264 
34265 #define gen_nb_xmlSchemaValidityErrorFunc_ptr 1
34266 #define gen_xmlSchemaValidityErrorFunc_ptr(no, nr) NULL
34267 #define des_xmlSchemaValidityErrorFunc_ptr(no, val, nr)
34268 #endif
34269 
34270 #ifdef LIBXML_SCHEMAS_ENABLED
34271 
34272 #define gen_nb_xmlSchemaValidityWarningFunc_ptr 1
34273 #define gen_xmlSchemaValidityWarningFunc_ptr(no, nr) NULL
34274 #define des_xmlSchemaValidityWarningFunc_ptr(no, val, nr)
34275 #endif
34276 
34277 
34278 static int
test_xmlSchemaGetParserErrors(void)34279 test_xmlSchemaGetParserErrors(void) {
34280     int test_ret = 0;
34281 
34282 #if defined(LIBXML_SCHEMAS_ENABLED)
34283     int mem_base;
34284     int ret_val;
34285     xmlSchemaParserCtxtPtr ctxt; /* a XMl-Schema parser context */
34286     int n_ctxt;
34287     xmlSchemaValidityErrorFunc * err; /* the error callback result */
34288     int n_err;
34289     xmlSchemaValidityWarningFunc * warn; /* the warning callback result */
34290     int n_warn;
34291     void ** ctx; /* contextual data for the callbacks result */
34292     int n_ctx;
34293 
34294     for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaParserCtxtPtr;n_ctxt++) {
34295     for (n_err = 0;n_err < gen_nb_xmlSchemaValidityErrorFunc_ptr;n_err++) {
34296     for (n_warn = 0;n_warn < gen_nb_xmlSchemaValidityWarningFunc_ptr;n_warn++) {
34297     for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
34298         mem_base = xmlMemBlocks();
34299         ctxt = gen_xmlSchemaParserCtxtPtr(n_ctxt, 0);
34300         err = gen_xmlSchemaValidityErrorFunc_ptr(n_err, 1);
34301         warn = gen_xmlSchemaValidityWarningFunc_ptr(n_warn, 2);
34302         ctx = gen_void_ptr_ptr(n_ctx, 3);
34303 
34304         ret_val = xmlSchemaGetParserErrors(ctxt, err, warn, ctx);
34305         desret_int(ret_val);
34306         call_tests++;
34307         des_xmlSchemaParserCtxtPtr(n_ctxt, ctxt, 0);
34308         des_xmlSchemaValidityErrorFunc_ptr(n_err, err, 1);
34309         des_xmlSchemaValidityWarningFunc_ptr(n_warn, warn, 2);
34310         des_void_ptr_ptr(n_ctx, ctx, 3);
34311         xmlResetLastError();
34312         if (mem_base != xmlMemBlocks()) {
34313             printf("Leak of %d blocks found in xmlSchemaGetParserErrors",
34314 	           xmlMemBlocks() - mem_base);
34315 	    test_ret++;
34316             printf(" %d", n_ctxt);
34317             printf(" %d", n_err);
34318             printf(" %d", n_warn);
34319             printf(" %d", n_ctx);
34320             printf("\n");
34321         }
34322     }
34323     }
34324     }
34325     }
34326     function_tests++;
34327 #endif
34328 
34329     return(test_ret);
34330 }
34331 
34332 
34333 static int
test_xmlSchemaGetValidErrors(void)34334 test_xmlSchemaGetValidErrors(void) {
34335     int test_ret = 0;
34336 
34337 #if defined(LIBXML_SCHEMAS_ENABLED)
34338     int mem_base;
34339     int ret_val;
34340     xmlSchemaValidCtxtPtr ctxt; /* a XML-Schema validation context */
34341     int n_ctxt;
34342     xmlSchemaValidityErrorFunc * err; /* the error function result */
34343     int n_err;
34344     xmlSchemaValidityWarningFunc * warn; /* the warning function result */
34345     int n_warn;
34346     void ** ctx; /* the functions context result */
34347     int n_ctx;
34348 
34349     for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
34350     for (n_err = 0;n_err < gen_nb_xmlSchemaValidityErrorFunc_ptr;n_err++) {
34351     for (n_warn = 0;n_warn < gen_nb_xmlSchemaValidityWarningFunc_ptr;n_warn++) {
34352     for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
34353         mem_base = xmlMemBlocks();
34354         ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
34355         err = gen_xmlSchemaValidityErrorFunc_ptr(n_err, 1);
34356         warn = gen_xmlSchemaValidityWarningFunc_ptr(n_warn, 2);
34357         ctx = gen_void_ptr_ptr(n_ctx, 3);
34358 
34359         ret_val = xmlSchemaGetValidErrors(ctxt, err, warn, ctx);
34360         desret_int(ret_val);
34361         call_tests++;
34362         des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
34363         des_xmlSchemaValidityErrorFunc_ptr(n_err, err, 1);
34364         des_xmlSchemaValidityWarningFunc_ptr(n_warn, warn, 2);
34365         des_void_ptr_ptr(n_ctx, ctx, 3);
34366         xmlResetLastError();
34367         if (mem_base != xmlMemBlocks()) {
34368             printf("Leak of %d blocks found in xmlSchemaGetValidErrors",
34369 	           xmlMemBlocks() - mem_base);
34370 	    test_ret++;
34371             printf(" %d", n_ctxt);
34372             printf(" %d", n_err);
34373             printf(" %d", n_warn);
34374             printf(" %d", n_ctx);
34375             printf("\n");
34376         }
34377     }
34378     }
34379     }
34380     }
34381     function_tests++;
34382 #endif
34383 
34384     return(test_ret);
34385 }
34386 
34387 
34388 static int
test_xmlSchemaIsValid(void)34389 test_xmlSchemaIsValid(void) {
34390     int test_ret = 0;
34391 
34392 #if defined(LIBXML_SCHEMAS_ENABLED)
34393     int mem_base;
34394     int ret_val;
34395     xmlSchemaValidCtxtPtr ctxt; /* the schema validation context */
34396     int n_ctxt;
34397 
34398     for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
34399         mem_base = xmlMemBlocks();
34400         ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
34401 
34402         ret_val = xmlSchemaIsValid(ctxt);
34403         desret_int(ret_val);
34404         call_tests++;
34405         des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
34406         xmlResetLastError();
34407         if (mem_base != xmlMemBlocks()) {
34408             printf("Leak of %d blocks found in xmlSchemaIsValid",
34409 	           xmlMemBlocks() - mem_base);
34410 	    test_ret++;
34411             printf(" %d", n_ctxt);
34412             printf("\n");
34413         }
34414     }
34415     function_tests++;
34416 #endif
34417 
34418     return(test_ret);
34419 }
34420 
34421 
34422 static int
test_xmlSchemaNewDocParserCtxt(void)34423 test_xmlSchemaNewDocParserCtxt(void) {
34424     int test_ret = 0;
34425 
34426 #if defined(LIBXML_SCHEMAS_ENABLED)
34427     int mem_base;
34428     xmlSchemaParserCtxtPtr ret_val;
34429     xmlDocPtr doc; /* a preparsed document tree */
34430     int n_doc;
34431 
34432     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
34433         mem_base = xmlMemBlocks();
34434         doc = gen_xmlDocPtr(n_doc, 0);
34435 
34436         ret_val = xmlSchemaNewDocParserCtxt(doc);
34437         desret_xmlSchemaParserCtxtPtr(ret_val);
34438         call_tests++;
34439         des_xmlDocPtr(n_doc, doc, 0);
34440         xmlResetLastError();
34441         if (mem_base != xmlMemBlocks()) {
34442             printf("Leak of %d blocks found in xmlSchemaNewDocParserCtxt",
34443 	           xmlMemBlocks() - mem_base);
34444 	    test_ret++;
34445             printf(" %d", n_doc);
34446             printf("\n");
34447         }
34448     }
34449     function_tests++;
34450 #endif
34451 
34452     return(test_ret);
34453 }
34454 
34455 
34456 static int
test_xmlSchemaNewMemParserCtxt(void)34457 test_xmlSchemaNewMemParserCtxt(void) {
34458     int test_ret = 0;
34459 
34460 #if defined(LIBXML_SCHEMAS_ENABLED)
34461     int mem_base;
34462     xmlSchemaParserCtxtPtr ret_val;
34463     const char * buffer; /* a pointer to a char array containing the schemas */
34464     int n_buffer;
34465     int size; /* the size of the array */
34466     int n_size;
34467 
34468     for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
34469     for (n_size = 0;n_size < gen_nb_int;n_size++) {
34470         mem_base = xmlMemBlocks();
34471         buffer = gen_const_char_ptr(n_buffer, 0);
34472         size = gen_int(n_size, 1);
34473         if ((buffer != NULL) &&
34474             (size > xmlStrlen(BAD_CAST buffer)))
34475             size = 0;
34476 
34477         ret_val = xmlSchemaNewMemParserCtxt(buffer, size);
34478         desret_xmlSchemaParserCtxtPtr(ret_val);
34479         call_tests++;
34480         des_const_char_ptr(n_buffer, buffer, 0);
34481         des_int(n_size, size, 1);
34482         xmlResetLastError();
34483         if (mem_base != xmlMemBlocks()) {
34484             printf("Leak of %d blocks found in xmlSchemaNewMemParserCtxt",
34485 	           xmlMemBlocks() - mem_base);
34486 	    test_ret++;
34487             printf(" %d", n_buffer);
34488             printf(" %d", n_size);
34489             printf("\n");
34490         }
34491     }
34492     }
34493     function_tests++;
34494 #endif
34495 
34496     return(test_ret);
34497 }
34498 
34499 
34500 static int
test_xmlSchemaNewParserCtxt(void)34501 test_xmlSchemaNewParserCtxt(void) {
34502     int test_ret = 0;
34503 
34504 #if defined(LIBXML_SCHEMAS_ENABLED)
34505     int mem_base;
34506     xmlSchemaParserCtxtPtr ret_val;
34507     const char * URL; /* the location of the schema */
34508     int n_URL;
34509 
34510     for (n_URL = 0;n_URL < gen_nb_const_char_ptr;n_URL++) {
34511         mem_base = xmlMemBlocks();
34512         URL = gen_const_char_ptr(n_URL, 0);
34513 
34514         ret_val = xmlSchemaNewParserCtxt(URL);
34515         desret_xmlSchemaParserCtxtPtr(ret_val);
34516         call_tests++;
34517         des_const_char_ptr(n_URL, URL, 0);
34518         xmlResetLastError();
34519         if (mem_base != xmlMemBlocks()) {
34520             printf("Leak of %d blocks found in xmlSchemaNewParserCtxt",
34521 	           xmlMemBlocks() - mem_base);
34522 	    test_ret++;
34523             printf(" %d", n_URL);
34524             printf("\n");
34525         }
34526     }
34527     function_tests++;
34528 #endif
34529 
34530     return(test_ret);
34531 }
34532 
34533 
34534 static int
test_xmlSchemaNewValidCtxt(void)34535 test_xmlSchemaNewValidCtxt(void) {
34536     int test_ret = 0;
34537 
34538 
34539     /* missing type support */
34540     return(test_ret);
34541 }
34542 
34543 
34544 static int
test_xmlSchemaParse(void)34545 test_xmlSchemaParse(void) {
34546     int test_ret = 0;
34547 
34548 
34549     /* missing type support */
34550     return(test_ret);
34551 }
34552 
34553 
34554 static int
test_xmlSchemaSAXPlug(void)34555 test_xmlSchemaSAXPlug(void) {
34556     int test_ret = 0;
34557 
34558 
34559     /* missing type support */
34560     return(test_ret);
34561 }
34562 
34563 #ifdef LIBXML_SCHEMAS_ENABLED
34564 
34565 #define gen_nb_xmlSchemaSAXPlugPtr 1
34566 #define gen_xmlSchemaSAXPlugPtr(no, nr) NULL
34567 #define des_xmlSchemaSAXPlugPtr(no, val, nr)
34568 #endif
34569 
34570 
34571 static int
test_xmlSchemaSAXUnplug(void)34572 test_xmlSchemaSAXUnplug(void) {
34573     int test_ret = 0;
34574 
34575 #if defined(LIBXML_SCHEMAS_ENABLED)
34576     int mem_base;
34577     int ret_val;
34578     xmlSchemaSAXPlugPtr plug; /* a data structure returned by xmlSchemaSAXPlug */
34579     int n_plug;
34580 
34581     for (n_plug = 0;n_plug < gen_nb_xmlSchemaSAXPlugPtr;n_plug++) {
34582         mem_base = xmlMemBlocks();
34583         plug = gen_xmlSchemaSAXPlugPtr(n_plug, 0);
34584 
34585         ret_val = xmlSchemaSAXUnplug(plug);
34586         desret_int(ret_val);
34587         call_tests++;
34588         des_xmlSchemaSAXPlugPtr(n_plug, plug, 0);
34589         xmlResetLastError();
34590         if (mem_base != xmlMemBlocks()) {
34591             printf("Leak of %d blocks found in xmlSchemaSAXUnplug",
34592 	           xmlMemBlocks() - mem_base);
34593 	    test_ret++;
34594             printf(" %d", n_plug);
34595             printf("\n");
34596         }
34597     }
34598     function_tests++;
34599 #endif
34600 
34601     return(test_ret);
34602 }
34603 
34604 
34605 static int
test_xmlSchemaSetParserErrors(void)34606 test_xmlSchemaSetParserErrors(void) {
34607     int test_ret = 0;
34608 
34609 
34610     /* missing type support */
34611     return(test_ret);
34612 }
34613 
34614 
34615 static int
test_xmlSchemaSetParserStructuredErrors(void)34616 test_xmlSchemaSetParserStructuredErrors(void) {
34617     int test_ret = 0;
34618 
34619 
34620     /* missing type support */
34621     return(test_ret);
34622 }
34623 
34624 
34625 static int
test_xmlSchemaSetResourceLoader(void)34626 test_xmlSchemaSetResourceLoader(void) {
34627     int test_ret = 0;
34628 
34629 
34630     /* missing type support */
34631     return(test_ret);
34632 }
34633 
34634 
34635 static int
test_xmlSchemaSetValidErrors(void)34636 test_xmlSchemaSetValidErrors(void) {
34637     int test_ret = 0;
34638 
34639 
34640     /* missing type support */
34641     return(test_ret);
34642 }
34643 
34644 
34645 static int
test_xmlSchemaSetValidOptions(void)34646 test_xmlSchemaSetValidOptions(void) {
34647     int test_ret = 0;
34648 
34649 #if defined(LIBXML_SCHEMAS_ENABLED)
34650     int mem_base;
34651     int ret_val;
34652     xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
34653     int n_ctxt;
34654     int options; /* a combination of xmlSchemaValidOption */
34655     int n_options;
34656 
34657     for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
34658     for (n_options = 0;n_options < gen_nb_int;n_options++) {
34659         mem_base = xmlMemBlocks();
34660         ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
34661         options = gen_int(n_options, 1);
34662 
34663         ret_val = xmlSchemaSetValidOptions(ctxt, options);
34664         desret_int(ret_val);
34665         call_tests++;
34666         des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
34667         des_int(n_options, options, 1);
34668         xmlResetLastError();
34669         if (mem_base != xmlMemBlocks()) {
34670             printf("Leak of %d blocks found in xmlSchemaSetValidOptions",
34671 	           xmlMemBlocks() - mem_base);
34672 	    test_ret++;
34673             printf(" %d", n_ctxt);
34674             printf(" %d", n_options);
34675             printf("\n");
34676         }
34677     }
34678     }
34679     function_tests++;
34680 #endif
34681 
34682     return(test_ret);
34683 }
34684 
34685 
34686 static int
test_xmlSchemaSetValidStructuredErrors(void)34687 test_xmlSchemaSetValidStructuredErrors(void) {
34688     int test_ret = 0;
34689 
34690 
34691     /* missing type support */
34692     return(test_ret);
34693 }
34694 
34695 
34696 static int
test_xmlSchemaValidCtxtGetOptions(void)34697 test_xmlSchemaValidCtxtGetOptions(void) {
34698     int test_ret = 0;
34699 
34700 #if defined(LIBXML_SCHEMAS_ENABLED)
34701     int mem_base;
34702     int ret_val;
34703     xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
34704     int n_ctxt;
34705 
34706     for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
34707         mem_base = xmlMemBlocks();
34708         ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
34709 
34710         ret_val = xmlSchemaValidCtxtGetOptions(ctxt);
34711         desret_int(ret_val);
34712         call_tests++;
34713         des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
34714         xmlResetLastError();
34715         if (mem_base != xmlMemBlocks()) {
34716             printf("Leak of %d blocks found in xmlSchemaValidCtxtGetOptions",
34717 	           xmlMemBlocks() - mem_base);
34718 	    test_ret++;
34719             printf(" %d", n_ctxt);
34720             printf("\n");
34721         }
34722     }
34723     function_tests++;
34724 #endif
34725 
34726     return(test_ret);
34727 }
34728 
34729 
34730 static int
test_xmlSchemaValidCtxtGetParserCtxt(void)34731 test_xmlSchemaValidCtxtGetParserCtxt(void) {
34732     int test_ret = 0;
34733 
34734 #if defined(LIBXML_SCHEMAS_ENABLED)
34735     int mem_base;
34736     xmlParserCtxtPtr ret_val;
34737     xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
34738     int n_ctxt;
34739 
34740     for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
34741         mem_base = xmlMemBlocks();
34742         ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
34743 
34744         ret_val = xmlSchemaValidCtxtGetParserCtxt(ctxt);
34745         desret_xmlParserCtxtPtr(ret_val);
34746         call_tests++;
34747         des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
34748         xmlResetLastError();
34749         if (mem_base != xmlMemBlocks()) {
34750             printf("Leak of %d blocks found in xmlSchemaValidCtxtGetParserCtxt",
34751 	           xmlMemBlocks() - mem_base);
34752 	    test_ret++;
34753             printf(" %d", n_ctxt);
34754             printf("\n");
34755         }
34756     }
34757     function_tests++;
34758 #endif
34759 
34760     return(test_ret);
34761 }
34762 
34763 
34764 static int
test_xmlSchemaValidateDoc(void)34765 test_xmlSchemaValidateDoc(void) {
34766     int test_ret = 0;
34767 
34768 #if defined(LIBXML_SCHEMAS_ENABLED)
34769     int mem_base;
34770     int ret_val;
34771     xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
34772     int n_ctxt;
34773     xmlDocPtr doc; /* a parsed document tree */
34774     int n_doc;
34775 
34776     for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
34777     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
34778         mem_base = xmlMemBlocks();
34779         ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
34780         doc = gen_xmlDocPtr(n_doc, 1);
34781 
34782         ret_val = xmlSchemaValidateDoc(ctxt, doc);
34783         desret_int(ret_val);
34784         call_tests++;
34785         des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
34786         des_xmlDocPtr(n_doc, doc, 1);
34787         xmlResetLastError();
34788         if (mem_base != xmlMemBlocks()) {
34789             printf("Leak of %d blocks found in xmlSchemaValidateDoc",
34790 	           xmlMemBlocks() - mem_base);
34791 	    test_ret++;
34792             printf(" %d", n_ctxt);
34793             printf(" %d", n_doc);
34794             printf("\n");
34795         }
34796     }
34797     }
34798     function_tests++;
34799 #endif
34800 
34801     return(test_ret);
34802 }
34803 
34804 
34805 static int
test_xmlSchemaValidateFile(void)34806 test_xmlSchemaValidateFile(void) {
34807     int test_ret = 0;
34808 
34809 #if defined(LIBXML_SCHEMAS_ENABLED)
34810     int mem_base;
34811     int ret_val;
34812     xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
34813     int n_ctxt;
34814     const char * filename; /* the URI of the instance */
34815     int n_filename;
34816     int options; /* a future set of options, currently unused */
34817     int n_options;
34818 
34819     for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
34820     for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
34821     for (n_options = 0;n_options < gen_nb_int;n_options++) {
34822         mem_base = xmlMemBlocks();
34823         ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
34824         filename = gen_filepath(n_filename, 1);
34825         options = gen_int(n_options, 2);
34826 
34827         ret_val = xmlSchemaValidateFile(ctxt, filename, options);
34828         desret_int(ret_val);
34829         call_tests++;
34830         des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
34831         des_filepath(n_filename, filename, 1);
34832         des_int(n_options, options, 2);
34833         xmlResetLastError();
34834         if (mem_base != xmlMemBlocks()) {
34835             printf("Leak of %d blocks found in xmlSchemaValidateFile",
34836 	           xmlMemBlocks() - mem_base);
34837 	    test_ret++;
34838             printf(" %d", n_ctxt);
34839             printf(" %d", n_filename);
34840             printf(" %d", n_options);
34841             printf("\n");
34842         }
34843     }
34844     }
34845     }
34846     function_tests++;
34847 #endif
34848 
34849     return(test_ret);
34850 }
34851 
34852 
34853 static int
test_xmlSchemaValidateOneElement(void)34854 test_xmlSchemaValidateOneElement(void) {
34855     int test_ret = 0;
34856 
34857 #if defined(LIBXML_SCHEMAS_ENABLED)
34858     int mem_base;
34859     int ret_val;
34860     xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
34861     int n_ctxt;
34862     xmlNodePtr elem; /* an element node */
34863     int n_elem;
34864 
34865     for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
34866     for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
34867         mem_base = xmlMemBlocks();
34868         ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
34869         elem = gen_xmlNodePtr(n_elem, 1);
34870 
34871         ret_val = xmlSchemaValidateOneElement(ctxt, elem);
34872         desret_int(ret_val);
34873         call_tests++;
34874         des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
34875         des_xmlNodePtr(n_elem, elem, 1);
34876         xmlResetLastError();
34877         if (mem_base != xmlMemBlocks()) {
34878             printf("Leak of %d blocks found in xmlSchemaValidateOneElement",
34879 	           xmlMemBlocks() - mem_base);
34880 	    test_ret++;
34881             printf(" %d", n_ctxt);
34882             printf(" %d", n_elem);
34883             printf("\n");
34884         }
34885     }
34886     }
34887     function_tests++;
34888 #endif
34889 
34890     return(test_ret);
34891 }
34892 
34893 
34894 static int
test_xmlSchemaValidateSetFilename(void)34895 test_xmlSchemaValidateSetFilename(void) {
34896     int test_ret = 0;
34897 
34898 #if defined(LIBXML_SCHEMAS_ENABLED)
34899     int mem_base;
34900     xmlSchemaValidCtxtPtr vctxt; /* the schema validation context */
34901     int n_vctxt;
34902     const char * filename; /* the file name */
34903     int n_filename;
34904 
34905     for (n_vctxt = 0;n_vctxt < gen_nb_xmlSchemaValidCtxtPtr;n_vctxt++) {
34906     for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
34907         mem_base = xmlMemBlocks();
34908         vctxt = gen_xmlSchemaValidCtxtPtr(n_vctxt, 0);
34909         filename = gen_filepath(n_filename, 1);
34910 
34911         xmlSchemaValidateSetFilename(vctxt, filename);
34912         call_tests++;
34913         des_xmlSchemaValidCtxtPtr(n_vctxt, vctxt, 0);
34914         des_filepath(n_filename, filename, 1);
34915         xmlResetLastError();
34916         if (mem_base != xmlMemBlocks()) {
34917             printf("Leak of %d blocks found in xmlSchemaValidateSetFilename",
34918 	           xmlMemBlocks() - mem_base);
34919 	    test_ret++;
34920             printf(" %d", n_vctxt);
34921             printf(" %d", n_filename);
34922             printf("\n");
34923         }
34924     }
34925     }
34926     function_tests++;
34927 #endif
34928 
34929     return(test_ret);
34930 }
34931 
34932 
34933 static int
test_xmlSchemaValidateSetLocator(void)34934 test_xmlSchemaValidateSetLocator(void) {
34935     int test_ret = 0;
34936 
34937 
34938     /* missing type support */
34939     return(test_ret);
34940 }
34941 
34942 
34943 static int
test_xmlSchemaValidateStream(void)34944 test_xmlSchemaValidateStream(void) {
34945     int test_ret = 0;
34946 
34947 #if defined(LIBXML_SCHEMAS_ENABLED)
34948     int mem_base;
34949     int ret_val;
34950     xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
34951     int n_ctxt;
34952     xmlParserInputBufferPtr input; /* the input to use for reading the data */
34953     int n_input;
34954     xmlCharEncoding enc; /* an optional encoding information */
34955     int n_enc;
34956     xmlSAXHandlerPtr sax; /* a SAX handler for the resulting events */
34957     int n_sax;
34958     void * user_data; /* the context to provide to the SAX handler. */
34959     int n_user_data;
34960 
34961     for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
34962     for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
34963     for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
34964     for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
34965     for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
34966         mem_base = xmlMemBlocks();
34967         ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
34968         input = gen_xmlParserInputBufferPtr(n_input, 1);
34969         enc = gen_xmlCharEncoding(n_enc, 2);
34970         sax = gen_xmlSAXHandlerPtr(n_sax, 3);
34971         user_data = gen_userdata(n_user_data, 4);
34972 
34973         ret_val = xmlSchemaValidateStream(ctxt, input, enc, sax, user_data);
34974         desret_int(ret_val);
34975         call_tests++;
34976         des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
34977         des_xmlParserInputBufferPtr(n_input, input, 1);
34978         des_xmlCharEncoding(n_enc, enc, 2);
34979         des_xmlSAXHandlerPtr(n_sax, sax, 3);
34980         des_userdata(n_user_data, user_data, 4);
34981         xmlResetLastError();
34982         if (mem_base != xmlMemBlocks()) {
34983             printf("Leak of %d blocks found in xmlSchemaValidateStream",
34984 	           xmlMemBlocks() - mem_base);
34985 	    test_ret++;
34986             printf(" %d", n_ctxt);
34987             printf(" %d", n_input);
34988             printf(" %d", n_enc);
34989             printf(" %d", n_sax);
34990             printf(" %d", n_user_data);
34991             printf("\n");
34992         }
34993     }
34994     }
34995     }
34996     }
34997     }
34998     function_tests++;
34999 #endif
35000 
35001     return(test_ret);
35002 }
35003 
35004 static int
test_xmlschemas(void)35005 test_xmlschemas(void) {
35006     int test_ret = 0;
35007 
35008     if (quiet == 0) printf("Testing xmlschemas : 16 of 28 functions ...\n");
35009     test_ret += test_xmlSchemaDump();
35010     test_ret += test_xmlSchemaGetParserErrors();
35011     test_ret += test_xmlSchemaGetValidErrors();
35012     test_ret += test_xmlSchemaIsValid();
35013     test_ret += test_xmlSchemaNewDocParserCtxt();
35014     test_ret += test_xmlSchemaNewMemParserCtxt();
35015     test_ret += test_xmlSchemaNewParserCtxt();
35016     test_ret += test_xmlSchemaNewValidCtxt();
35017     test_ret += test_xmlSchemaParse();
35018     test_ret += test_xmlSchemaSAXPlug();
35019     test_ret += test_xmlSchemaSAXUnplug();
35020     test_ret += test_xmlSchemaSetParserErrors();
35021     test_ret += test_xmlSchemaSetParserStructuredErrors();
35022     test_ret += test_xmlSchemaSetResourceLoader();
35023     test_ret += test_xmlSchemaSetValidErrors();
35024     test_ret += test_xmlSchemaSetValidOptions();
35025     test_ret += test_xmlSchemaSetValidStructuredErrors();
35026     test_ret += test_xmlSchemaValidCtxtGetOptions();
35027     test_ret += test_xmlSchemaValidCtxtGetParserCtxt();
35028     test_ret += test_xmlSchemaValidateDoc();
35029     test_ret += test_xmlSchemaValidateFile();
35030     test_ret += test_xmlSchemaValidateOneElement();
35031     test_ret += test_xmlSchemaValidateSetFilename();
35032     test_ret += test_xmlSchemaValidateSetLocator();
35033     test_ret += test_xmlSchemaValidateStream();
35034 
35035     if (test_ret != 0)
35036 	printf("Module xmlschemas: %d errors\n", test_ret);
35037     return(test_ret);
35038 }
35039 #ifdef LIBXML_SCHEMAS_ENABLED
35040 
35041 #define gen_nb_xmlSchemaFacetPtr 1
35042 #define gen_xmlSchemaFacetPtr(no, nr) NULL
35043 #define des_xmlSchemaFacetPtr(no, val, nr)
35044 #endif
35045 
35046 #ifdef LIBXML_SCHEMAS_ENABLED
35047 
35048 #define gen_nb_xmlSchemaTypePtr 1
35049 #define gen_xmlSchemaTypePtr(no, nr) NULL
35050 #define des_xmlSchemaTypePtr(no, val, nr)
35051 #endif
35052 
35053 
35054 static int
test_xmlSchemaCheckFacet(void)35055 test_xmlSchemaCheckFacet(void) {
35056     int test_ret = 0;
35057 
35058 #if defined(LIBXML_SCHEMAS_ENABLED)
35059     int mem_base;
35060     int ret_val;
35061     xmlSchemaFacetPtr facet; /* the facet */
35062     int n_facet;
35063     xmlSchemaTypePtr typeDecl; /* the schema type definition */
35064     int n_typeDecl;
35065     xmlSchemaParserCtxtPtr pctxt; /* the schema parser context or NULL */
35066     int n_pctxt;
35067     const xmlChar * name; /* the optional name of the type */
35068     int n_name;
35069 
35070     for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
35071     for (n_typeDecl = 0;n_typeDecl < gen_nb_xmlSchemaTypePtr;n_typeDecl++) {
35072     for (n_pctxt = 0;n_pctxt < gen_nb_xmlSchemaParserCtxtPtr;n_pctxt++) {
35073     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
35074         mem_base = xmlMemBlocks();
35075         facet = gen_xmlSchemaFacetPtr(n_facet, 0);
35076         typeDecl = gen_xmlSchemaTypePtr(n_typeDecl, 1);
35077         pctxt = gen_xmlSchemaParserCtxtPtr(n_pctxt, 2);
35078         name = gen_const_xmlChar_ptr(n_name, 3);
35079 
35080         ret_val = xmlSchemaCheckFacet(facet, typeDecl, pctxt, name);
35081         desret_int(ret_val);
35082         call_tests++;
35083         des_xmlSchemaFacetPtr(n_facet, facet, 0);
35084         des_xmlSchemaTypePtr(n_typeDecl, typeDecl, 1);
35085         des_xmlSchemaParserCtxtPtr(n_pctxt, pctxt, 2);
35086         des_const_xmlChar_ptr(n_name, name, 3);
35087         xmlResetLastError();
35088         if (mem_base != xmlMemBlocks()) {
35089             printf("Leak of %d blocks found in xmlSchemaCheckFacet",
35090 	           xmlMemBlocks() - mem_base);
35091 	    test_ret++;
35092             printf(" %d", n_facet);
35093             printf(" %d", n_typeDecl);
35094             printf(" %d", n_pctxt);
35095             printf(" %d", n_name);
35096             printf("\n");
35097         }
35098     }
35099     }
35100     }
35101     }
35102     function_tests++;
35103 #endif
35104 
35105     return(test_ret);
35106 }
35107 
35108 
35109 static int
test_xmlSchemaCleanupTypes(void)35110 test_xmlSchemaCleanupTypes(void) {
35111     int test_ret = 0;
35112 
35113 #if defined(LIBXML_SCHEMAS_ENABLED)
35114 
35115 
35116         xmlSchemaCleanupTypes();
35117         call_tests++;
35118         xmlResetLastError();
35119     function_tests++;
35120 #endif
35121 
35122     return(test_ret);
35123 }
35124 
35125 
35126 static int
test_xmlSchemaCollapseString(void)35127 test_xmlSchemaCollapseString(void) {
35128     int test_ret = 0;
35129 
35130 #if defined(LIBXML_SCHEMAS_ENABLED)
35131     int mem_base;
35132     xmlChar * ret_val;
35133     const xmlChar * value; /* a value */
35134     int n_value;
35135 
35136     for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
35137         mem_base = xmlMemBlocks();
35138         value = gen_const_xmlChar_ptr(n_value, 0);
35139 
35140         ret_val = xmlSchemaCollapseString(value);
35141         desret_xmlChar_ptr(ret_val);
35142         call_tests++;
35143         des_const_xmlChar_ptr(n_value, value, 0);
35144         xmlResetLastError();
35145         if (mem_base != xmlMemBlocks()) {
35146             printf("Leak of %d blocks found in xmlSchemaCollapseString",
35147 	           xmlMemBlocks() - mem_base);
35148 	    test_ret++;
35149             printf(" %d", n_value);
35150             printf("\n");
35151         }
35152     }
35153     function_tests++;
35154 #endif
35155 
35156     return(test_ret);
35157 }
35158 
35159 #ifdef LIBXML_SCHEMAS_ENABLED
35160 
35161 #define gen_nb_xmlSchemaValPtr 1
35162 #define gen_xmlSchemaValPtr(no, nr) NULL
35163 #define des_xmlSchemaValPtr(no, val, nr)
35164 #endif
35165 
35166 
35167 static int
test_xmlSchemaCompareValues(void)35168 test_xmlSchemaCompareValues(void) {
35169     int test_ret = 0;
35170 
35171 #if defined(LIBXML_SCHEMAS_ENABLED)
35172     int mem_base;
35173     int ret_val;
35174     xmlSchemaValPtr x; /* a first value */
35175     int n_x;
35176     xmlSchemaValPtr y; /* a second value */
35177     int n_y;
35178 
35179     for (n_x = 0;n_x < gen_nb_xmlSchemaValPtr;n_x++) {
35180     for (n_y = 0;n_y < gen_nb_xmlSchemaValPtr;n_y++) {
35181         mem_base = xmlMemBlocks();
35182         x = gen_xmlSchemaValPtr(n_x, 0);
35183         y = gen_xmlSchemaValPtr(n_y, 1);
35184 
35185         ret_val = xmlSchemaCompareValues(x, y);
35186         desret_int(ret_val);
35187         call_tests++;
35188         des_xmlSchemaValPtr(n_x, x, 0);
35189         des_xmlSchemaValPtr(n_y, y, 1);
35190         xmlResetLastError();
35191         if (mem_base != xmlMemBlocks()) {
35192             printf("Leak of %d blocks found in xmlSchemaCompareValues",
35193 	           xmlMemBlocks() - mem_base);
35194 	    test_ret++;
35195             printf(" %d", n_x);
35196             printf(" %d", n_y);
35197             printf("\n");
35198         }
35199     }
35200     }
35201     function_tests++;
35202 #endif
35203 
35204     return(test_ret);
35205 }
35206 
35207 
35208 static int
test_xmlSchemaCompareValuesWhtsp(void)35209 test_xmlSchemaCompareValuesWhtsp(void) {
35210     int test_ret = 0;
35211 
35212 #if defined(LIBXML_SCHEMAS_ENABLED)
35213     int mem_base;
35214     int ret_val;
35215     xmlSchemaValPtr x; /* a first value */
35216     int n_x;
35217     xmlSchemaWhitespaceValueType xws; /* the whitespace value of x */
35218     int n_xws;
35219     xmlSchemaValPtr y; /* a second value */
35220     int n_y;
35221     xmlSchemaWhitespaceValueType yws; /* the whitespace value of y */
35222     int n_yws;
35223 
35224     for (n_x = 0;n_x < gen_nb_xmlSchemaValPtr;n_x++) {
35225     for (n_xws = 0;n_xws < gen_nb_xmlSchemaWhitespaceValueType;n_xws++) {
35226     for (n_y = 0;n_y < gen_nb_xmlSchemaValPtr;n_y++) {
35227     for (n_yws = 0;n_yws < gen_nb_xmlSchemaWhitespaceValueType;n_yws++) {
35228         mem_base = xmlMemBlocks();
35229         x = gen_xmlSchemaValPtr(n_x, 0);
35230         xws = gen_xmlSchemaWhitespaceValueType(n_xws, 1);
35231         y = gen_xmlSchemaValPtr(n_y, 2);
35232         yws = gen_xmlSchemaWhitespaceValueType(n_yws, 3);
35233 
35234         ret_val = xmlSchemaCompareValuesWhtsp(x, xws, y, yws);
35235         desret_int(ret_val);
35236         call_tests++;
35237         des_xmlSchemaValPtr(n_x, x, 0);
35238         des_xmlSchemaWhitespaceValueType(n_xws, xws, 1);
35239         des_xmlSchemaValPtr(n_y, y, 2);
35240         des_xmlSchemaWhitespaceValueType(n_yws, yws, 3);
35241         xmlResetLastError();
35242         if (mem_base != xmlMemBlocks()) {
35243             printf("Leak of %d blocks found in xmlSchemaCompareValuesWhtsp",
35244 	           xmlMemBlocks() - mem_base);
35245 	    test_ret++;
35246             printf(" %d", n_x);
35247             printf(" %d", n_xws);
35248             printf(" %d", n_y);
35249             printf(" %d", n_yws);
35250             printf("\n");
35251         }
35252     }
35253     }
35254     }
35255     }
35256     function_tests++;
35257 #endif
35258 
35259     return(test_ret);
35260 }
35261 
35262 
35263 static int
test_xmlSchemaCopyValue(void)35264 test_xmlSchemaCopyValue(void) {
35265     int test_ret = 0;
35266 
35267 
35268     /* missing type support */
35269     return(test_ret);
35270 }
35271 
35272 
35273 static int
test_xmlSchemaGetBuiltInListSimpleTypeItemType(void)35274 test_xmlSchemaGetBuiltInListSimpleTypeItemType(void) {
35275     int test_ret = 0;
35276 
35277 #if defined(LIBXML_SCHEMAS_ENABLED)
35278     int mem_base;
35279     xmlSchemaTypePtr ret_val;
35280     xmlSchemaTypePtr type; /* the built-in simple type. */
35281     int n_type;
35282 
35283     for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
35284         mem_base = xmlMemBlocks();
35285         type = gen_xmlSchemaTypePtr(n_type, 0);
35286 
35287         ret_val = xmlSchemaGetBuiltInListSimpleTypeItemType(type);
35288         desret_xmlSchemaTypePtr(ret_val);
35289         call_tests++;
35290         des_xmlSchemaTypePtr(n_type, type, 0);
35291         xmlResetLastError();
35292         if (mem_base != xmlMemBlocks()) {
35293             printf("Leak of %d blocks found in xmlSchemaGetBuiltInListSimpleTypeItemType",
35294 	           xmlMemBlocks() - mem_base);
35295 	    test_ret++;
35296             printf(" %d", n_type);
35297             printf("\n");
35298         }
35299     }
35300     function_tests++;
35301 #endif
35302 
35303     return(test_ret);
35304 }
35305 
35306 
35307 static int
test_xmlSchemaGetBuiltInType(void)35308 test_xmlSchemaGetBuiltInType(void) {
35309     int test_ret = 0;
35310 
35311 #if defined(LIBXML_SCHEMAS_ENABLED)
35312     xmlSchemaTypePtr ret_val;
35313     xmlSchemaValType type; /* the type of the built in type */
35314     int n_type;
35315 
35316     for (n_type = 0;n_type < gen_nb_xmlSchemaValType;n_type++) {
35317         type = gen_xmlSchemaValType(n_type, 0);
35318 
35319         ret_val = xmlSchemaGetBuiltInType(type);
35320         desret_xmlSchemaTypePtr(ret_val);
35321         call_tests++;
35322         des_xmlSchemaValType(n_type, type, 0);
35323         xmlResetLastError();
35324     }
35325     function_tests++;
35326 #endif
35327 
35328     return(test_ret);
35329 }
35330 
35331 
35332 static int
test_xmlSchemaGetCanonValue(void)35333 test_xmlSchemaGetCanonValue(void) {
35334     int test_ret = 0;
35335 
35336 #if defined(LIBXML_SCHEMAS_ENABLED)
35337     int mem_base;
35338     int ret_val;
35339     xmlSchemaValPtr val; /* the precomputed value */
35340     int n_val;
35341     const xmlChar ** retValue; /* the returned value */
35342     int n_retValue;
35343 
35344     for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr;n_val++) {
35345     for (n_retValue = 0;n_retValue < gen_nb_const_xmlChar_ptr_ptr;n_retValue++) {
35346         mem_base = xmlMemBlocks();
35347         val = gen_xmlSchemaValPtr(n_val, 0);
35348         retValue = gen_const_xmlChar_ptr_ptr(n_retValue, 1);
35349 
35350         ret_val = xmlSchemaGetCanonValue(val, retValue);
35351         desret_int(ret_val);
35352         call_tests++;
35353         des_xmlSchemaValPtr(n_val, val, 0);
35354         des_const_xmlChar_ptr_ptr(n_retValue, retValue, 1);
35355         xmlResetLastError();
35356         if (mem_base != xmlMemBlocks()) {
35357             printf("Leak of %d blocks found in xmlSchemaGetCanonValue",
35358 	           xmlMemBlocks() - mem_base);
35359 	    test_ret++;
35360             printf(" %d", n_val);
35361             printf(" %d", n_retValue);
35362             printf("\n");
35363         }
35364     }
35365     }
35366     function_tests++;
35367 #endif
35368 
35369     return(test_ret);
35370 }
35371 
35372 
35373 static int
test_xmlSchemaGetCanonValueWhtsp(void)35374 test_xmlSchemaGetCanonValueWhtsp(void) {
35375     int test_ret = 0;
35376 
35377 #if defined(LIBXML_SCHEMAS_ENABLED)
35378     int mem_base;
35379     int ret_val;
35380     xmlSchemaValPtr val; /* the precomputed value */
35381     int n_val;
35382     const xmlChar ** retValue; /* the returned value */
35383     int n_retValue;
35384     xmlSchemaWhitespaceValueType ws; /* the whitespace type of the value */
35385     int n_ws;
35386 
35387     for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr;n_val++) {
35388     for (n_retValue = 0;n_retValue < gen_nb_const_xmlChar_ptr_ptr;n_retValue++) {
35389     for (n_ws = 0;n_ws < gen_nb_xmlSchemaWhitespaceValueType;n_ws++) {
35390         mem_base = xmlMemBlocks();
35391         val = gen_xmlSchemaValPtr(n_val, 0);
35392         retValue = gen_const_xmlChar_ptr_ptr(n_retValue, 1);
35393         ws = gen_xmlSchemaWhitespaceValueType(n_ws, 2);
35394 
35395         ret_val = xmlSchemaGetCanonValueWhtsp(val, retValue, ws);
35396         desret_int(ret_val);
35397         call_tests++;
35398         des_xmlSchemaValPtr(n_val, val, 0);
35399         des_const_xmlChar_ptr_ptr(n_retValue, retValue, 1);
35400         des_xmlSchemaWhitespaceValueType(n_ws, ws, 2);
35401         xmlResetLastError();
35402         if (mem_base != xmlMemBlocks()) {
35403             printf("Leak of %d blocks found in xmlSchemaGetCanonValueWhtsp",
35404 	           xmlMemBlocks() - mem_base);
35405 	    test_ret++;
35406             printf(" %d", n_val);
35407             printf(" %d", n_retValue);
35408             printf(" %d", n_ws);
35409             printf("\n");
35410         }
35411     }
35412     }
35413     }
35414     function_tests++;
35415 #endif
35416 
35417     return(test_ret);
35418 }
35419 
35420 
35421 static int
test_xmlSchemaGetFacetValueAsULong(void)35422 test_xmlSchemaGetFacetValueAsULong(void) {
35423     int test_ret = 0;
35424 
35425 #if defined(LIBXML_SCHEMAS_ENABLED)
35426     int mem_base;
35427     unsigned long ret_val;
35428     xmlSchemaFacetPtr facet; /* an schemas type facet */
35429     int n_facet;
35430 
35431     for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
35432         mem_base = xmlMemBlocks();
35433         facet = gen_xmlSchemaFacetPtr(n_facet, 0);
35434 
35435         ret_val = xmlSchemaGetFacetValueAsULong(facet);
35436         desret_unsigned_long(ret_val);
35437         call_tests++;
35438         des_xmlSchemaFacetPtr(n_facet, facet, 0);
35439         xmlResetLastError();
35440         if (mem_base != xmlMemBlocks()) {
35441             printf("Leak of %d blocks found in xmlSchemaGetFacetValueAsULong",
35442 	           xmlMemBlocks() - mem_base);
35443 	    test_ret++;
35444             printf(" %d", n_facet);
35445             printf("\n");
35446         }
35447     }
35448     function_tests++;
35449 #endif
35450 
35451     return(test_ret);
35452 }
35453 
35454 
35455 static int
test_xmlSchemaGetPredefinedType(void)35456 test_xmlSchemaGetPredefinedType(void) {
35457     int test_ret = 0;
35458 
35459 #if defined(LIBXML_SCHEMAS_ENABLED)
35460     int mem_base;
35461     xmlSchemaTypePtr ret_val;
35462     const xmlChar * name; /* the type name */
35463     int n_name;
35464     const xmlChar * ns; /* the URI of the namespace usually "http://www.w3.org/2001/XMLSchema" */
35465     int n_ns;
35466 
35467     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
35468     for (n_ns = 0;n_ns < gen_nb_const_xmlChar_ptr;n_ns++) {
35469         mem_base = xmlMemBlocks();
35470         name = gen_const_xmlChar_ptr(n_name, 0);
35471         ns = gen_const_xmlChar_ptr(n_ns, 1);
35472 
35473         ret_val = xmlSchemaGetPredefinedType(name, ns);
35474         desret_xmlSchemaTypePtr(ret_val);
35475         call_tests++;
35476         des_const_xmlChar_ptr(n_name, name, 0);
35477         des_const_xmlChar_ptr(n_ns, ns, 1);
35478         xmlResetLastError();
35479         if (mem_base != xmlMemBlocks()) {
35480             printf("Leak of %d blocks found in xmlSchemaGetPredefinedType",
35481 	           xmlMemBlocks() - mem_base);
35482 	    test_ret++;
35483             printf(" %d", n_name);
35484             printf(" %d", n_ns);
35485             printf("\n");
35486         }
35487     }
35488     }
35489     function_tests++;
35490 #endif
35491 
35492     return(test_ret);
35493 }
35494 
35495 
35496 static int
test_xmlSchemaGetValType(void)35497 test_xmlSchemaGetValType(void) {
35498     int test_ret = 0;
35499 
35500 #if defined(LIBXML_SCHEMAS_ENABLED)
35501     int mem_base;
35502     xmlSchemaValType ret_val;
35503     xmlSchemaValPtr val; /* a schemas value */
35504     int n_val;
35505 
35506     for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr;n_val++) {
35507         mem_base = xmlMemBlocks();
35508         val = gen_xmlSchemaValPtr(n_val, 0);
35509 
35510         ret_val = xmlSchemaGetValType(val);
35511         desret_xmlSchemaValType(ret_val);
35512         call_tests++;
35513         des_xmlSchemaValPtr(n_val, val, 0);
35514         xmlResetLastError();
35515         if (mem_base != xmlMemBlocks()) {
35516             printf("Leak of %d blocks found in xmlSchemaGetValType",
35517 	           xmlMemBlocks() - mem_base);
35518 	    test_ret++;
35519             printf(" %d", n_val);
35520             printf("\n");
35521         }
35522     }
35523     function_tests++;
35524 #endif
35525 
35526     return(test_ret);
35527 }
35528 
35529 
35530 static int
test_xmlSchemaInitTypes(void)35531 test_xmlSchemaInitTypes(void) {
35532     int test_ret = 0;
35533 
35534 #if defined(LIBXML_SCHEMAS_ENABLED)
35535     int ret_val;
35536 
35537 
35538         ret_val = xmlSchemaInitTypes();
35539         desret_int(ret_val);
35540         call_tests++;
35541         xmlResetLastError();
35542     function_tests++;
35543 #endif
35544 
35545     return(test_ret);
35546 }
35547 
35548 
35549 static int
test_xmlSchemaIsBuiltInTypeFacet(void)35550 test_xmlSchemaIsBuiltInTypeFacet(void) {
35551     int test_ret = 0;
35552 
35553 #if defined(LIBXML_SCHEMAS_ENABLED)
35554     int mem_base;
35555     int ret_val;
35556     xmlSchemaTypePtr type; /* the built-in type */
35557     int n_type;
35558     int facetType; /* the facet type */
35559     int n_facetType;
35560 
35561     for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
35562     for (n_facetType = 0;n_facetType < gen_nb_int;n_facetType++) {
35563         mem_base = xmlMemBlocks();
35564         type = gen_xmlSchemaTypePtr(n_type, 0);
35565         facetType = gen_int(n_facetType, 1);
35566 
35567         ret_val = xmlSchemaIsBuiltInTypeFacet(type, facetType);
35568         desret_int(ret_val);
35569         call_tests++;
35570         des_xmlSchemaTypePtr(n_type, type, 0);
35571         des_int(n_facetType, facetType, 1);
35572         xmlResetLastError();
35573         if (mem_base != xmlMemBlocks()) {
35574             printf("Leak of %d blocks found in xmlSchemaIsBuiltInTypeFacet",
35575 	           xmlMemBlocks() - mem_base);
35576 	    test_ret++;
35577             printf(" %d", n_type);
35578             printf(" %d", n_facetType);
35579             printf("\n");
35580         }
35581     }
35582     }
35583     function_tests++;
35584 #endif
35585 
35586     return(test_ret);
35587 }
35588 
35589 
35590 static int
test_xmlSchemaNewFacet(void)35591 test_xmlSchemaNewFacet(void) {
35592     int test_ret = 0;
35593 
35594 
35595     /* missing type support */
35596     return(test_ret);
35597 }
35598 
35599 
35600 static int
test_xmlSchemaNewNOTATIONValue(void)35601 test_xmlSchemaNewNOTATIONValue(void) {
35602     int test_ret = 0;
35603 
35604 
35605     /* missing type support */
35606     return(test_ret);
35607 }
35608 
35609 
35610 static int
test_xmlSchemaNewQNameValue(void)35611 test_xmlSchemaNewQNameValue(void) {
35612     int test_ret = 0;
35613 
35614 
35615     /* missing type support */
35616     return(test_ret);
35617 }
35618 
35619 
35620 static int
test_xmlSchemaNewStringValue(void)35621 test_xmlSchemaNewStringValue(void) {
35622     int test_ret = 0;
35623 
35624 
35625     /* missing type support */
35626     return(test_ret);
35627 }
35628 
35629 #ifdef LIBXML_SCHEMAS_ENABLED
35630 
35631 #define gen_nb_xmlSchemaValPtr_ptr 1
35632 #define gen_xmlSchemaValPtr_ptr(no, nr) NULL
35633 #define des_xmlSchemaValPtr_ptr(no, val, nr)
35634 #endif
35635 
35636 
35637 static int
test_xmlSchemaValPredefTypeNode(void)35638 test_xmlSchemaValPredefTypeNode(void) {
35639     int test_ret = 0;
35640 
35641 #if defined(LIBXML_SCHEMAS_ENABLED)
35642     int mem_base;
35643     int ret_val;
35644     xmlSchemaTypePtr type; /* the predefined type */
35645     int n_type;
35646     const xmlChar * value; /* the value to check */
35647     int n_value;
35648     xmlSchemaValPtr * val; /* the return computed value */
35649     int n_val;
35650     xmlNodePtr node; /* the node containing the value */
35651     int n_node;
35652 
35653     for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
35654     for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
35655     for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr_ptr;n_val++) {
35656     for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
35657         mem_base = xmlMemBlocks();
35658         type = gen_xmlSchemaTypePtr(n_type, 0);
35659         value = gen_const_xmlChar_ptr(n_value, 1);
35660         val = gen_xmlSchemaValPtr_ptr(n_val, 2);
35661         node = gen_xmlNodePtr(n_node, 3);
35662 
35663         ret_val = xmlSchemaValPredefTypeNode(type, value, val, node);
35664         desret_int(ret_val);
35665         call_tests++;
35666         des_xmlSchemaTypePtr(n_type, type, 0);
35667         des_const_xmlChar_ptr(n_value, value, 1);
35668         des_xmlSchemaValPtr_ptr(n_val, val, 2);
35669         des_xmlNodePtr(n_node, node, 3);
35670         xmlResetLastError();
35671         if (mem_base != xmlMemBlocks()) {
35672             printf("Leak of %d blocks found in xmlSchemaValPredefTypeNode",
35673 	           xmlMemBlocks() - mem_base);
35674 	    test_ret++;
35675             printf(" %d", n_type);
35676             printf(" %d", n_value);
35677             printf(" %d", n_val);
35678             printf(" %d", n_node);
35679             printf("\n");
35680         }
35681     }
35682     }
35683     }
35684     }
35685     function_tests++;
35686 #endif
35687 
35688     return(test_ret);
35689 }
35690 
35691 
35692 static int
test_xmlSchemaValPredefTypeNodeNoNorm(void)35693 test_xmlSchemaValPredefTypeNodeNoNorm(void) {
35694     int test_ret = 0;
35695 
35696 #if defined(LIBXML_SCHEMAS_ENABLED)
35697     int mem_base;
35698     int ret_val;
35699     xmlSchemaTypePtr type; /* the predefined type */
35700     int n_type;
35701     const xmlChar * value; /* the value to check */
35702     int n_value;
35703     xmlSchemaValPtr * val; /* the return computed value */
35704     int n_val;
35705     xmlNodePtr node; /* the node containing the value */
35706     int n_node;
35707 
35708     for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
35709     for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
35710     for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr_ptr;n_val++) {
35711     for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
35712         mem_base = xmlMemBlocks();
35713         type = gen_xmlSchemaTypePtr(n_type, 0);
35714         value = gen_const_xmlChar_ptr(n_value, 1);
35715         val = gen_xmlSchemaValPtr_ptr(n_val, 2);
35716         node = gen_xmlNodePtr(n_node, 3);
35717 
35718         ret_val = xmlSchemaValPredefTypeNodeNoNorm(type, value, val, node);
35719         desret_int(ret_val);
35720         call_tests++;
35721         des_xmlSchemaTypePtr(n_type, type, 0);
35722         des_const_xmlChar_ptr(n_value, value, 1);
35723         des_xmlSchemaValPtr_ptr(n_val, val, 2);
35724         des_xmlNodePtr(n_node, node, 3);
35725         xmlResetLastError();
35726         if (mem_base != xmlMemBlocks()) {
35727             printf("Leak of %d blocks found in xmlSchemaValPredefTypeNodeNoNorm",
35728 	           xmlMemBlocks() - mem_base);
35729 	    test_ret++;
35730             printf(" %d", n_type);
35731             printf(" %d", n_value);
35732             printf(" %d", n_val);
35733             printf(" %d", n_node);
35734             printf("\n");
35735         }
35736     }
35737     }
35738     }
35739     }
35740     function_tests++;
35741 #endif
35742 
35743     return(test_ret);
35744 }
35745 
35746 
35747 static int
test_xmlSchemaValidateFacet(void)35748 test_xmlSchemaValidateFacet(void) {
35749     int test_ret = 0;
35750 
35751 #if defined(LIBXML_SCHEMAS_ENABLED)
35752     int mem_base;
35753     int ret_val;
35754     xmlSchemaTypePtr base; /* the base type */
35755     int n_base;
35756     xmlSchemaFacetPtr facet; /* the facet to check */
35757     int n_facet;
35758     const xmlChar * value; /* the lexical repr of the value to validate */
35759     int n_value;
35760     xmlSchemaValPtr val; /* the precomputed value */
35761     int n_val;
35762 
35763     for (n_base = 0;n_base < gen_nb_xmlSchemaTypePtr;n_base++) {
35764     for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
35765     for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
35766     for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr;n_val++) {
35767         mem_base = xmlMemBlocks();
35768         base = gen_xmlSchemaTypePtr(n_base, 0);
35769         facet = gen_xmlSchemaFacetPtr(n_facet, 1);
35770         value = gen_const_xmlChar_ptr(n_value, 2);
35771         val = gen_xmlSchemaValPtr(n_val, 3);
35772 
35773         ret_val = xmlSchemaValidateFacet(base, facet, value, val);
35774         desret_int(ret_val);
35775         call_tests++;
35776         des_xmlSchemaTypePtr(n_base, base, 0);
35777         des_xmlSchemaFacetPtr(n_facet, facet, 1);
35778         des_const_xmlChar_ptr(n_value, value, 2);
35779         des_xmlSchemaValPtr(n_val, val, 3);
35780         xmlResetLastError();
35781         if (mem_base != xmlMemBlocks()) {
35782             printf("Leak of %d blocks found in xmlSchemaValidateFacet",
35783 	           xmlMemBlocks() - mem_base);
35784 	    test_ret++;
35785             printf(" %d", n_base);
35786             printf(" %d", n_facet);
35787             printf(" %d", n_value);
35788             printf(" %d", n_val);
35789             printf("\n");
35790         }
35791     }
35792     }
35793     }
35794     }
35795     function_tests++;
35796 #endif
35797 
35798     return(test_ret);
35799 }
35800 
35801 
35802 static int
test_xmlSchemaValidateFacetWhtsp(void)35803 test_xmlSchemaValidateFacetWhtsp(void) {
35804     int test_ret = 0;
35805 
35806 #if defined(LIBXML_SCHEMAS_ENABLED)
35807     int mem_base;
35808     int ret_val;
35809     xmlSchemaFacetPtr facet; /* the facet to check */
35810     int n_facet;
35811     xmlSchemaWhitespaceValueType fws; /* the whitespace type of the facet's value */
35812     int n_fws;
35813     xmlSchemaValType valType; /* the built-in type of the value */
35814     int n_valType;
35815     const xmlChar * value; /* the lexical (or normalized for pattern) repr of the value to validate */
35816     int n_value;
35817     xmlSchemaValPtr val; /* the precomputed value */
35818     int n_val;
35819     xmlSchemaWhitespaceValueType ws; /* the whitespace type of the value */
35820     int n_ws;
35821 
35822     for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
35823     for (n_fws = 0;n_fws < gen_nb_xmlSchemaWhitespaceValueType;n_fws++) {
35824     for (n_valType = 0;n_valType < gen_nb_xmlSchemaValType;n_valType++) {
35825     for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
35826     for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr;n_val++) {
35827     for (n_ws = 0;n_ws < gen_nb_xmlSchemaWhitespaceValueType;n_ws++) {
35828         mem_base = xmlMemBlocks();
35829         facet = gen_xmlSchemaFacetPtr(n_facet, 0);
35830         fws = gen_xmlSchemaWhitespaceValueType(n_fws, 1);
35831         valType = gen_xmlSchemaValType(n_valType, 2);
35832         value = gen_const_xmlChar_ptr(n_value, 3);
35833         val = gen_xmlSchemaValPtr(n_val, 4);
35834         ws = gen_xmlSchemaWhitespaceValueType(n_ws, 5);
35835 
35836         ret_val = xmlSchemaValidateFacetWhtsp(facet, fws, valType, value, val, ws);
35837         desret_int(ret_val);
35838         call_tests++;
35839         des_xmlSchemaFacetPtr(n_facet, facet, 0);
35840         des_xmlSchemaWhitespaceValueType(n_fws, fws, 1);
35841         des_xmlSchemaValType(n_valType, valType, 2);
35842         des_const_xmlChar_ptr(n_value, value, 3);
35843         des_xmlSchemaValPtr(n_val, val, 4);
35844         des_xmlSchemaWhitespaceValueType(n_ws, ws, 5);
35845         xmlResetLastError();
35846         if (mem_base != xmlMemBlocks()) {
35847             printf("Leak of %d blocks found in xmlSchemaValidateFacetWhtsp",
35848 	           xmlMemBlocks() - mem_base);
35849 	    test_ret++;
35850             printf(" %d", n_facet);
35851             printf(" %d", n_fws);
35852             printf(" %d", n_valType);
35853             printf(" %d", n_value);
35854             printf(" %d", n_val);
35855             printf(" %d", n_ws);
35856             printf("\n");
35857         }
35858     }
35859     }
35860     }
35861     }
35862     }
35863     }
35864     function_tests++;
35865 #endif
35866 
35867     return(test_ret);
35868 }
35869 
35870 
35871 static int
test_xmlSchemaValidateLengthFacet(void)35872 test_xmlSchemaValidateLengthFacet(void) {
35873     int test_ret = 0;
35874 
35875 #if defined(LIBXML_SCHEMAS_ENABLED)
35876     int mem_base;
35877     int ret_val;
35878     xmlSchemaTypePtr type; /* the built-in type */
35879     int n_type;
35880     xmlSchemaFacetPtr facet; /* the facet to check */
35881     int n_facet;
35882     const xmlChar * value; /* the lexical repr. of the value to be validated */
35883     int n_value;
35884     xmlSchemaValPtr val; /* the precomputed value */
35885     int n_val;
35886     unsigned long * length; /* the actual length of the value */
35887     int n_length;
35888 
35889     for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
35890     for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
35891     for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
35892     for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr;n_val++) {
35893     for (n_length = 0;n_length < gen_nb_unsigned_long_ptr;n_length++) {
35894         mem_base = xmlMemBlocks();
35895         type = gen_xmlSchemaTypePtr(n_type, 0);
35896         facet = gen_xmlSchemaFacetPtr(n_facet, 1);
35897         value = gen_const_xmlChar_ptr(n_value, 2);
35898         val = gen_xmlSchemaValPtr(n_val, 3);
35899         length = gen_unsigned_long_ptr(n_length, 4);
35900 
35901         ret_val = xmlSchemaValidateLengthFacet(type, facet, value, val, length);
35902         desret_int(ret_val);
35903         call_tests++;
35904         des_xmlSchemaTypePtr(n_type, type, 0);
35905         des_xmlSchemaFacetPtr(n_facet, facet, 1);
35906         des_const_xmlChar_ptr(n_value, value, 2);
35907         des_xmlSchemaValPtr(n_val, val, 3);
35908         des_unsigned_long_ptr(n_length, length, 4);
35909         xmlResetLastError();
35910         if (mem_base != xmlMemBlocks()) {
35911             printf("Leak of %d blocks found in xmlSchemaValidateLengthFacet",
35912 	           xmlMemBlocks() - mem_base);
35913 	    test_ret++;
35914             printf(" %d", n_type);
35915             printf(" %d", n_facet);
35916             printf(" %d", n_value);
35917             printf(" %d", n_val);
35918             printf(" %d", n_length);
35919             printf("\n");
35920         }
35921     }
35922     }
35923     }
35924     }
35925     }
35926     function_tests++;
35927 #endif
35928 
35929     return(test_ret);
35930 }
35931 
35932 
35933 static int
test_xmlSchemaValidateLengthFacetWhtsp(void)35934 test_xmlSchemaValidateLengthFacetWhtsp(void) {
35935     int test_ret = 0;
35936 
35937 #if defined(LIBXML_SCHEMAS_ENABLED)
35938     int mem_base;
35939     int ret_val;
35940     xmlSchemaFacetPtr facet; /* the facet to check */
35941     int n_facet;
35942     xmlSchemaValType valType; /* the built-in type */
35943     int n_valType;
35944     const xmlChar * value; /* the lexical repr. of the value to be validated */
35945     int n_value;
35946     xmlSchemaValPtr val; /* the precomputed value */
35947     int n_val;
35948     unsigned long * length; /* the actual length of the value */
35949     int n_length;
35950     xmlSchemaWhitespaceValueType ws; /* the whitespace type of the value */
35951     int n_ws;
35952 
35953     for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
35954     for (n_valType = 0;n_valType < gen_nb_xmlSchemaValType;n_valType++) {
35955     for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
35956     for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr;n_val++) {
35957     for (n_length = 0;n_length < gen_nb_unsigned_long_ptr;n_length++) {
35958     for (n_ws = 0;n_ws < gen_nb_xmlSchemaWhitespaceValueType;n_ws++) {
35959         mem_base = xmlMemBlocks();
35960         facet = gen_xmlSchemaFacetPtr(n_facet, 0);
35961         valType = gen_xmlSchemaValType(n_valType, 1);
35962         value = gen_const_xmlChar_ptr(n_value, 2);
35963         val = gen_xmlSchemaValPtr(n_val, 3);
35964         length = gen_unsigned_long_ptr(n_length, 4);
35965         ws = gen_xmlSchemaWhitespaceValueType(n_ws, 5);
35966 
35967         ret_val = xmlSchemaValidateLengthFacetWhtsp(facet, valType, value, val, length, ws);
35968         desret_int(ret_val);
35969         call_tests++;
35970         des_xmlSchemaFacetPtr(n_facet, facet, 0);
35971         des_xmlSchemaValType(n_valType, valType, 1);
35972         des_const_xmlChar_ptr(n_value, value, 2);
35973         des_xmlSchemaValPtr(n_val, val, 3);
35974         des_unsigned_long_ptr(n_length, length, 4);
35975         des_xmlSchemaWhitespaceValueType(n_ws, ws, 5);
35976         xmlResetLastError();
35977         if (mem_base != xmlMemBlocks()) {
35978             printf("Leak of %d blocks found in xmlSchemaValidateLengthFacetWhtsp",
35979 	           xmlMemBlocks() - mem_base);
35980 	    test_ret++;
35981             printf(" %d", n_facet);
35982             printf(" %d", n_valType);
35983             printf(" %d", n_value);
35984             printf(" %d", n_val);
35985             printf(" %d", n_length);
35986             printf(" %d", n_ws);
35987             printf("\n");
35988         }
35989     }
35990     }
35991     }
35992     }
35993     }
35994     }
35995     function_tests++;
35996 #endif
35997 
35998     return(test_ret);
35999 }
36000 
36001 
36002 static int
test_xmlSchemaValidateListSimpleTypeFacet(void)36003 test_xmlSchemaValidateListSimpleTypeFacet(void) {
36004     int test_ret = 0;
36005 
36006 #if defined(LIBXML_SCHEMAS_ENABLED)
36007     int mem_base;
36008     int ret_val;
36009     xmlSchemaFacetPtr facet; /* the facet to check */
36010     int n_facet;
36011     const xmlChar * value; /* the lexical repr of the value to validate */
36012     int n_value;
36013     unsigned long actualLen; /* the number of list items */
36014     int n_actualLen;
36015     unsigned long * expectedLen; /* the resulting expected number of list items */
36016     int n_expectedLen;
36017 
36018     for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
36019     for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
36020     for (n_actualLen = 0;n_actualLen < gen_nb_unsigned_long;n_actualLen++) {
36021     for (n_expectedLen = 0;n_expectedLen < gen_nb_unsigned_long_ptr;n_expectedLen++) {
36022         mem_base = xmlMemBlocks();
36023         facet = gen_xmlSchemaFacetPtr(n_facet, 0);
36024         value = gen_const_xmlChar_ptr(n_value, 1);
36025         actualLen = gen_unsigned_long(n_actualLen, 2);
36026         expectedLen = gen_unsigned_long_ptr(n_expectedLen, 3);
36027 
36028         ret_val = xmlSchemaValidateListSimpleTypeFacet(facet, value, actualLen, expectedLen);
36029         desret_int(ret_val);
36030         call_tests++;
36031         des_xmlSchemaFacetPtr(n_facet, facet, 0);
36032         des_const_xmlChar_ptr(n_value, value, 1);
36033         des_unsigned_long(n_actualLen, actualLen, 2);
36034         des_unsigned_long_ptr(n_expectedLen, expectedLen, 3);
36035         xmlResetLastError();
36036         if (mem_base != xmlMemBlocks()) {
36037             printf("Leak of %d blocks found in xmlSchemaValidateListSimpleTypeFacet",
36038 	           xmlMemBlocks() - mem_base);
36039 	    test_ret++;
36040             printf(" %d", n_facet);
36041             printf(" %d", n_value);
36042             printf(" %d", n_actualLen);
36043             printf(" %d", n_expectedLen);
36044             printf("\n");
36045         }
36046     }
36047     }
36048     }
36049     }
36050     function_tests++;
36051 #endif
36052 
36053     return(test_ret);
36054 }
36055 
36056 
36057 static int
test_xmlSchemaValidatePredefinedType(void)36058 test_xmlSchemaValidatePredefinedType(void) {
36059     int test_ret = 0;
36060 
36061 #if defined(LIBXML_SCHEMAS_ENABLED)
36062     int mem_base;
36063     int ret_val;
36064     xmlSchemaTypePtr type; /* the predefined type */
36065     int n_type;
36066     const xmlChar * value; /* the value to check */
36067     int n_value;
36068     xmlSchemaValPtr * val; /* the return computed value */
36069     int n_val;
36070 
36071     for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
36072     for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
36073     for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr_ptr;n_val++) {
36074         mem_base = xmlMemBlocks();
36075         type = gen_xmlSchemaTypePtr(n_type, 0);
36076         value = gen_const_xmlChar_ptr(n_value, 1);
36077         val = gen_xmlSchemaValPtr_ptr(n_val, 2);
36078 
36079         ret_val = xmlSchemaValidatePredefinedType(type, value, val);
36080         desret_int(ret_val);
36081         call_tests++;
36082         des_xmlSchemaTypePtr(n_type, type, 0);
36083         des_const_xmlChar_ptr(n_value, value, 1);
36084         des_xmlSchemaValPtr_ptr(n_val, val, 2);
36085         xmlResetLastError();
36086         if (mem_base != xmlMemBlocks()) {
36087             printf("Leak of %d blocks found in xmlSchemaValidatePredefinedType",
36088 	           xmlMemBlocks() - mem_base);
36089 	    test_ret++;
36090             printf(" %d", n_type);
36091             printf(" %d", n_value);
36092             printf(" %d", n_val);
36093             printf("\n");
36094         }
36095     }
36096     }
36097     }
36098     function_tests++;
36099 #endif
36100 
36101     return(test_ret);
36102 }
36103 
36104 
36105 static int
test_xmlSchemaValueAppend(void)36106 test_xmlSchemaValueAppend(void) {
36107     int test_ret = 0;
36108 
36109 #if defined(LIBXML_SCHEMAS_ENABLED)
36110     int mem_base;
36111     int ret_val;
36112     xmlSchemaValPtr prev; /* the value */
36113     int n_prev;
36114     xmlSchemaValPtr cur; /* the value to be appended */
36115     int n_cur;
36116 
36117     for (n_prev = 0;n_prev < gen_nb_xmlSchemaValPtr;n_prev++) {
36118     for (n_cur = 0;n_cur < gen_nb_xmlSchemaValPtr;n_cur++) {
36119         mem_base = xmlMemBlocks();
36120         prev = gen_xmlSchemaValPtr(n_prev, 0);
36121         cur = gen_xmlSchemaValPtr(n_cur, 1);
36122 
36123         ret_val = xmlSchemaValueAppend(prev, cur);
36124         desret_int(ret_val);
36125         call_tests++;
36126         des_xmlSchemaValPtr(n_prev, prev, 0);
36127         des_xmlSchemaValPtr(n_cur, cur, 1);
36128         xmlResetLastError();
36129         if (mem_base != xmlMemBlocks()) {
36130             printf("Leak of %d blocks found in xmlSchemaValueAppend",
36131 	           xmlMemBlocks() - mem_base);
36132 	    test_ret++;
36133             printf(" %d", n_prev);
36134             printf(" %d", n_cur);
36135             printf("\n");
36136         }
36137     }
36138     }
36139     function_tests++;
36140 #endif
36141 
36142     return(test_ret);
36143 }
36144 
36145 
36146 static int
test_xmlSchemaValueGetAsBoolean(void)36147 test_xmlSchemaValueGetAsBoolean(void) {
36148     int test_ret = 0;
36149 
36150 #if defined(LIBXML_SCHEMAS_ENABLED)
36151     int mem_base;
36152     int ret_val;
36153     xmlSchemaValPtr val; /* the value */
36154     int n_val;
36155 
36156     for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr;n_val++) {
36157         mem_base = xmlMemBlocks();
36158         val = gen_xmlSchemaValPtr(n_val, 0);
36159 
36160         ret_val = xmlSchemaValueGetAsBoolean(val);
36161         desret_int(ret_val);
36162         call_tests++;
36163         des_xmlSchemaValPtr(n_val, val, 0);
36164         xmlResetLastError();
36165         if (mem_base != xmlMemBlocks()) {
36166             printf("Leak of %d blocks found in xmlSchemaValueGetAsBoolean",
36167 	           xmlMemBlocks() - mem_base);
36168 	    test_ret++;
36169             printf(" %d", n_val);
36170             printf("\n");
36171         }
36172     }
36173     function_tests++;
36174 #endif
36175 
36176     return(test_ret);
36177 }
36178 
36179 
36180 static int
test_xmlSchemaValueGetAsString(void)36181 test_xmlSchemaValueGetAsString(void) {
36182     int test_ret = 0;
36183 
36184 #if defined(LIBXML_SCHEMAS_ENABLED)
36185     int mem_base;
36186     const xmlChar * ret_val;
36187     xmlSchemaValPtr val; /* the value */
36188     int n_val;
36189 
36190     for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr;n_val++) {
36191         mem_base = xmlMemBlocks();
36192         val = gen_xmlSchemaValPtr(n_val, 0);
36193 
36194         ret_val = xmlSchemaValueGetAsString(val);
36195         desret_const_xmlChar_ptr(ret_val);
36196         call_tests++;
36197         des_xmlSchemaValPtr(n_val, val, 0);
36198         xmlResetLastError();
36199         if (mem_base != xmlMemBlocks()) {
36200             printf("Leak of %d blocks found in xmlSchemaValueGetAsString",
36201 	           xmlMemBlocks() - mem_base);
36202 	    test_ret++;
36203             printf(" %d", n_val);
36204             printf("\n");
36205         }
36206     }
36207     function_tests++;
36208 #endif
36209 
36210     return(test_ret);
36211 }
36212 
36213 
36214 static int
test_xmlSchemaValueGetNext(void)36215 test_xmlSchemaValueGetNext(void) {
36216     int test_ret = 0;
36217 
36218 
36219     /* missing type support */
36220     return(test_ret);
36221 }
36222 
36223 
36224 static int
test_xmlSchemaWhiteSpaceReplace(void)36225 test_xmlSchemaWhiteSpaceReplace(void) {
36226     int test_ret = 0;
36227 
36228 #if defined(LIBXML_SCHEMAS_ENABLED)
36229     int mem_base;
36230     xmlChar * ret_val;
36231     const xmlChar * value; /* a value */
36232     int n_value;
36233 
36234     for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
36235         mem_base = xmlMemBlocks();
36236         value = gen_const_xmlChar_ptr(n_value, 0);
36237 
36238         ret_val = xmlSchemaWhiteSpaceReplace(value);
36239         desret_xmlChar_ptr(ret_val);
36240         call_tests++;
36241         des_const_xmlChar_ptr(n_value, value, 0);
36242         xmlResetLastError();
36243         if (mem_base != xmlMemBlocks()) {
36244             printf("Leak of %d blocks found in xmlSchemaWhiteSpaceReplace",
36245 	           xmlMemBlocks() - mem_base);
36246 	    test_ret++;
36247             printf(" %d", n_value);
36248             printf("\n");
36249         }
36250     }
36251     function_tests++;
36252 #endif
36253 
36254     return(test_ret);
36255 }
36256 
36257 static int
test_xmlschemastypes(void)36258 test_xmlschemastypes(void) {
36259     int test_ret = 0;
36260 
36261     if (quiet == 0) printf("Testing xmlschemastypes : 26 of 34 functions ...\n");
36262     test_ret += test_xmlSchemaCheckFacet();
36263     test_ret += test_xmlSchemaCleanupTypes();
36264     test_ret += test_xmlSchemaCollapseString();
36265     test_ret += test_xmlSchemaCompareValues();
36266     test_ret += test_xmlSchemaCompareValuesWhtsp();
36267     test_ret += test_xmlSchemaCopyValue();
36268     test_ret += test_xmlSchemaGetBuiltInListSimpleTypeItemType();
36269     test_ret += test_xmlSchemaGetBuiltInType();
36270     test_ret += test_xmlSchemaGetCanonValue();
36271     test_ret += test_xmlSchemaGetCanonValueWhtsp();
36272     test_ret += test_xmlSchemaGetFacetValueAsULong();
36273     test_ret += test_xmlSchemaGetPredefinedType();
36274     test_ret += test_xmlSchemaGetValType();
36275     test_ret += test_xmlSchemaInitTypes();
36276     test_ret += test_xmlSchemaIsBuiltInTypeFacet();
36277     test_ret += test_xmlSchemaNewFacet();
36278     test_ret += test_xmlSchemaNewNOTATIONValue();
36279     test_ret += test_xmlSchemaNewQNameValue();
36280     test_ret += test_xmlSchemaNewStringValue();
36281     test_ret += test_xmlSchemaValPredefTypeNode();
36282     test_ret += test_xmlSchemaValPredefTypeNodeNoNorm();
36283     test_ret += test_xmlSchemaValidateFacet();
36284     test_ret += test_xmlSchemaValidateFacetWhtsp();
36285     test_ret += test_xmlSchemaValidateLengthFacet();
36286     test_ret += test_xmlSchemaValidateLengthFacetWhtsp();
36287     test_ret += test_xmlSchemaValidateListSimpleTypeFacet();
36288     test_ret += test_xmlSchemaValidatePredefinedType();
36289     test_ret += test_xmlSchemaValueAppend();
36290     test_ret += test_xmlSchemaValueGetAsBoolean();
36291     test_ret += test_xmlSchemaValueGetAsString();
36292     test_ret += test_xmlSchemaValueGetNext();
36293     test_ret += test_xmlSchemaWhiteSpaceReplace();
36294 
36295     if (test_ret != 0)
36296 	printf("Module xmlschemastypes: %d errors\n", test_ret);
36297     return(test_ret);
36298 }
36299 
36300 static int
test_xmlCharStrdup(void)36301 test_xmlCharStrdup(void) {
36302     int test_ret = 0;
36303 
36304     int mem_base;
36305     xmlChar * ret_val;
36306     const char * cur; /* the input char * */
36307     int n_cur;
36308 
36309     for (n_cur = 0;n_cur < gen_nb_const_char_ptr;n_cur++) {
36310         mem_base = xmlMemBlocks();
36311         cur = gen_const_char_ptr(n_cur, 0);
36312 
36313         ret_val = xmlCharStrdup(cur);
36314         desret_xmlChar_ptr(ret_val);
36315         call_tests++;
36316         des_const_char_ptr(n_cur, cur, 0);
36317         xmlResetLastError();
36318         if (mem_base != xmlMemBlocks()) {
36319             printf("Leak of %d blocks found in xmlCharStrdup",
36320 	           xmlMemBlocks() - mem_base);
36321 	    test_ret++;
36322             printf(" %d", n_cur);
36323             printf("\n");
36324         }
36325     }
36326     function_tests++;
36327 
36328     return(test_ret);
36329 }
36330 
36331 
36332 static int
test_xmlCharStrndup(void)36333 test_xmlCharStrndup(void) {
36334     int test_ret = 0;
36335 
36336     int mem_base;
36337     xmlChar * ret_val;
36338     const char * cur; /* the input char * */
36339     int n_cur;
36340     int len; /* the len of @cur */
36341     int n_len;
36342 
36343     for (n_cur = 0;n_cur < gen_nb_const_char_ptr;n_cur++) {
36344     for (n_len = 0;n_len < gen_nb_int;n_len++) {
36345         mem_base = xmlMemBlocks();
36346         cur = gen_const_char_ptr(n_cur, 0);
36347         len = gen_int(n_len, 1);
36348         if ((cur != NULL) &&
36349             (len > xmlStrlen(BAD_CAST cur)))
36350             len = 0;
36351 
36352         ret_val = xmlCharStrndup(cur, len);
36353         desret_xmlChar_ptr(ret_val);
36354         call_tests++;
36355         des_const_char_ptr(n_cur, cur, 0);
36356         des_int(n_len, len, 1);
36357         xmlResetLastError();
36358         if (mem_base != xmlMemBlocks()) {
36359             printf("Leak of %d blocks found in xmlCharStrndup",
36360 	           xmlMemBlocks() - mem_base);
36361 	    test_ret++;
36362             printf(" %d", n_cur);
36363             printf(" %d", n_len);
36364             printf("\n");
36365         }
36366     }
36367     }
36368     function_tests++;
36369 
36370     return(test_ret);
36371 }
36372 
36373 
36374 static int
test_xmlCheckUTF8(void)36375 test_xmlCheckUTF8(void) {
36376     int test_ret = 0;
36377 
36378     int mem_base;
36379     int ret_val;
36380     const unsigned char * utf; /* Pointer to putative UTF-8 encoded string. */
36381     int n_utf;
36382 
36383     for (n_utf = 0;n_utf < gen_nb_const_unsigned_char_ptr;n_utf++) {
36384         mem_base = xmlMemBlocks();
36385         utf = gen_const_unsigned_char_ptr(n_utf, 0);
36386 
36387         ret_val = xmlCheckUTF8(utf);
36388         desret_int(ret_val);
36389         call_tests++;
36390         des_const_unsigned_char_ptr(n_utf, utf, 0);
36391         xmlResetLastError();
36392         if (mem_base != xmlMemBlocks()) {
36393             printf("Leak of %d blocks found in xmlCheckUTF8",
36394 	           xmlMemBlocks() - mem_base);
36395 	    test_ret++;
36396             printf(" %d", n_utf);
36397             printf("\n");
36398         }
36399     }
36400     function_tests++;
36401 
36402     return(test_ret);
36403 }
36404 
36405 
36406 static int
test_xmlGetUTF8Char(void)36407 test_xmlGetUTF8Char(void) {
36408     int test_ret = 0;
36409 
36410     int mem_base;
36411     int ret_val;
36412     const unsigned char * utf; /* a sequence of UTF-8 encoded bytes */
36413     int n_utf;
36414     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. */
36415     int n_len;
36416 
36417     for (n_utf = 0;n_utf < gen_nb_const_unsigned_char_ptr;n_utf++) {
36418     for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
36419         mem_base = xmlMemBlocks();
36420         utf = gen_const_unsigned_char_ptr(n_utf, 0);
36421         len = gen_int_ptr(n_len, 1);
36422 
36423         ret_val = xmlGetUTF8Char(utf, len);
36424         desret_int(ret_val);
36425         call_tests++;
36426         des_const_unsigned_char_ptr(n_utf, utf, 0);
36427         des_int_ptr(n_len, len, 1);
36428         xmlResetLastError();
36429         if (mem_base != xmlMemBlocks()) {
36430             printf("Leak of %d blocks found in xmlGetUTF8Char",
36431 	           xmlMemBlocks() - mem_base);
36432 	    test_ret++;
36433             printf(" %d", n_utf);
36434             printf(" %d", n_len);
36435             printf("\n");
36436         }
36437     }
36438     }
36439     function_tests++;
36440 
36441     return(test_ret);
36442 }
36443 
36444 
36445 static int
test_xmlStrEqual(void)36446 test_xmlStrEqual(void) {
36447     int test_ret = 0;
36448 
36449     int mem_base;
36450     int ret_val;
36451     const xmlChar * str1; /* the first xmlChar * */
36452     int n_str1;
36453     const xmlChar * str2; /* the second xmlChar * */
36454     int n_str2;
36455 
36456     for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
36457     for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
36458         mem_base = xmlMemBlocks();
36459         str1 = gen_const_xmlChar_ptr(n_str1, 0);
36460         str2 = gen_const_xmlChar_ptr(n_str2, 1);
36461 
36462         ret_val = xmlStrEqual(str1, str2);
36463         desret_int(ret_val);
36464         call_tests++;
36465         des_const_xmlChar_ptr(n_str1, str1, 0);
36466         des_const_xmlChar_ptr(n_str2, str2, 1);
36467         xmlResetLastError();
36468         if (mem_base != xmlMemBlocks()) {
36469             printf("Leak of %d blocks found in xmlStrEqual",
36470 	           xmlMemBlocks() - mem_base);
36471 	    test_ret++;
36472             printf(" %d", n_str1);
36473             printf(" %d", n_str2);
36474             printf("\n");
36475         }
36476     }
36477     }
36478     function_tests++;
36479 
36480     return(test_ret);
36481 }
36482 
36483 
36484 static int
test_xmlStrPrintf(void)36485 test_xmlStrPrintf(void) {
36486     int test_ret = 0;
36487 
36488 
36489     /* missing type support */
36490     return(test_ret);
36491 }
36492 
36493 
36494 static int
test_xmlStrQEqual(void)36495 test_xmlStrQEqual(void) {
36496     int test_ret = 0;
36497 
36498     int mem_base;
36499     int ret_val;
36500     const xmlChar * pref; /* the prefix of the QName */
36501     int n_pref;
36502     const xmlChar * name; /* the localname of the QName */
36503     int n_name;
36504     const xmlChar * str; /* the second xmlChar * */
36505     int n_str;
36506 
36507     for (n_pref = 0;n_pref < gen_nb_const_xmlChar_ptr;n_pref++) {
36508     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
36509     for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
36510         mem_base = xmlMemBlocks();
36511         pref = gen_const_xmlChar_ptr(n_pref, 0);
36512         name = gen_const_xmlChar_ptr(n_name, 1);
36513         str = gen_const_xmlChar_ptr(n_str, 2);
36514 
36515         ret_val = xmlStrQEqual(pref, name, str);
36516         desret_int(ret_val);
36517         call_tests++;
36518         des_const_xmlChar_ptr(n_pref, pref, 0);
36519         des_const_xmlChar_ptr(n_name, name, 1);
36520         des_const_xmlChar_ptr(n_str, str, 2);
36521         xmlResetLastError();
36522         if (mem_base != xmlMemBlocks()) {
36523             printf("Leak of %d blocks found in xmlStrQEqual",
36524 	           xmlMemBlocks() - mem_base);
36525 	    test_ret++;
36526             printf(" %d", n_pref);
36527             printf(" %d", n_name);
36528             printf(" %d", n_str);
36529             printf("\n");
36530         }
36531     }
36532     }
36533     }
36534     function_tests++;
36535 
36536     return(test_ret);
36537 }
36538 
36539 
36540 static int
test_xmlStrVPrintf(void)36541 test_xmlStrVPrintf(void) {
36542     int test_ret = 0;
36543 
36544 
36545     /* missing type support */
36546     return(test_ret);
36547 }
36548 
36549 
36550 static int
test_xmlStrcasecmp(void)36551 test_xmlStrcasecmp(void) {
36552     int test_ret = 0;
36553 
36554     int mem_base;
36555     int ret_val;
36556     const xmlChar * str1; /* the first xmlChar * */
36557     int n_str1;
36558     const xmlChar * str2; /* the second xmlChar * */
36559     int n_str2;
36560 
36561     for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
36562     for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
36563         mem_base = xmlMemBlocks();
36564         str1 = gen_const_xmlChar_ptr(n_str1, 0);
36565         str2 = gen_const_xmlChar_ptr(n_str2, 1);
36566 
36567         ret_val = xmlStrcasecmp(str1, str2);
36568         desret_int(ret_val);
36569         call_tests++;
36570         des_const_xmlChar_ptr(n_str1, str1, 0);
36571         des_const_xmlChar_ptr(n_str2, str2, 1);
36572         xmlResetLastError();
36573         if (mem_base != xmlMemBlocks()) {
36574             printf("Leak of %d blocks found in xmlStrcasecmp",
36575 	           xmlMemBlocks() - mem_base);
36576 	    test_ret++;
36577             printf(" %d", n_str1);
36578             printf(" %d", n_str2);
36579             printf("\n");
36580         }
36581     }
36582     }
36583     function_tests++;
36584 
36585     return(test_ret);
36586 }
36587 
36588 
36589 static int
test_xmlStrcasestr(void)36590 test_xmlStrcasestr(void) {
36591     int test_ret = 0;
36592 
36593     int mem_base;
36594     const xmlChar * ret_val;
36595     const xmlChar * str; /* the xmlChar * array (haystack) */
36596     int n_str;
36597     const xmlChar * val; /* the xmlChar to search (needle) */
36598     int n_val;
36599 
36600     for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
36601     for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
36602         mem_base = xmlMemBlocks();
36603         str = gen_const_xmlChar_ptr(n_str, 0);
36604         val = gen_const_xmlChar_ptr(n_val, 1);
36605 
36606         ret_val = xmlStrcasestr(str, val);
36607         desret_const_xmlChar_ptr(ret_val);
36608         call_tests++;
36609         des_const_xmlChar_ptr(n_str, str, 0);
36610         des_const_xmlChar_ptr(n_val, val, 1);
36611         xmlResetLastError();
36612         if (mem_base != xmlMemBlocks()) {
36613             printf("Leak of %d blocks found in xmlStrcasestr",
36614 	           xmlMemBlocks() - mem_base);
36615 	    test_ret++;
36616             printf(" %d", n_str);
36617             printf(" %d", n_val);
36618             printf("\n");
36619         }
36620     }
36621     }
36622     function_tests++;
36623 
36624     return(test_ret);
36625 }
36626 
36627 
36628 static int
test_xmlStrchr(void)36629 test_xmlStrchr(void) {
36630     int test_ret = 0;
36631 
36632     int mem_base;
36633     const xmlChar * ret_val;
36634     const xmlChar * str; /* the xmlChar * array */
36635     int n_str;
36636     xmlChar val; /* the xmlChar to search */
36637     int n_val;
36638 
36639     for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
36640     for (n_val = 0;n_val < gen_nb_xmlChar;n_val++) {
36641         mem_base = xmlMemBlocks();
36642         str = gen_const_xmlChar_ptr(n_str, 0);
36643         val = gen_xmlChar(n_val, 1);
36644 
36645         ret_val = xmlStrchr(str, val);
36646         desret_const_xmlChar_ptr(ret_val);
36647         call_tests++;
36648         des_const_xmlChar_ptr(n_str, str, 0);
36649         des_xmlChar(n_val, val, 1);
36650         xmlResetLastError();
36651         if (mem_base != xmlMemBlocks()) {
36652             printf("Leak of %d blocks found in xmlStrchr",
36653 	           xmlMemBlocks() - mem_base);
36654 	    test_ret++;
36655             printf(" %d", n_str);
36656             printf(" %d", n_val);
36657             printf("\n");
36658         }
36659     }
36660     }
36661     function_tests++;
36662 
36663     return(test_ret);
36664 }
36665 
36666 
36667 static int
test_xmlStrcmp(void)36668 test_xmlStrcmp(void) {
36669     int test_ret = 0;
36670 
36671     int mem_base;
36672     int ret_val;
36673     const xmlChar * str1; /* the first xmlChar * */
36674     int n_str1;
36675     const xmlChar * str2; /* the second xmlChar * */
36676     int n_str2;
36677 
36678     for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
36679     for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
36680         mem_base = xmlMemBlocks();
36681         str1 = gen_const_xmlChar_ptr(n_str1, 0);
36682         str2 = gen_const_xmlChar_ptr(n_str2, 1);
36683 
36684         ret_val = xmlStrcmp(str1, str2);
36685         desret_int(ret_val);
36686         call_tests++;
36687         des_const_xmlChar_ptr(n_str1, str1, 0);
36688         des_const_xmlChar_ptr(n_str2, str2, 1);
36689         xmlResetLastError();
36690         if (mem_base != xmlMemBlocks()) {
36691             printf("Leak of %d blocks found in xmlStrcmp",
36692 	           xmlMemBlocks() - mem_base);
36693 	    test_ret++;
36694             printf(" %d", n_str1);
36695             printf(" %d", n_str2);
36696             printf("\n");
36697         }
36698     }
36699     }
36700     function_tests++;
36701 
36702     return(test_ret);
36703 }
36704 
36705 
36706 static int
test_xmlStrdup(void)36707 test_xmlStrdup(void) {
36708     int test_ret = 0;
36709 
36710     int mem_base;
36711     xmlChar * ret_val;
36712     const xmlChar * cur; /* the input xmlChar * */
36713     int n_cur;
36714 
36715     for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
36716         mem_base = xmlMemBlocks();
36717         cur = gen_const_xmlChar_ptr(n_cur, 0);
36718 
36719         ret_val = xmlStrdup(cur);
36720         desret_xmlChar_ptr(ret_val);
36721         call_tests++;
36722         des_const_xmlChar_ptr(n_cur, cur, 0);
36723         xmlResetLastError();
36724         if (mem_base != xmlMemBlocks()) {
36725             printf("Leak of %d blocks found in xmlStrdup",
36726 	           xmlMemBlocks() - mem_base);
36727 	    test_ret++;
36728             printf(" %d", n_cur);
36729             printf("\n");
36730         }
36731     }
36732     function_tests++;
36733 
36734     return(test_ret);
36735 }
36736 
36737 
36738 static int
test_xmlStrlen(void)36739 test_xmlStrlen(void) {
36740     int test_ret = 0;
36741 
36742     int mem_base;
36743     int ret_val;
36744     const xmlChar * str; /* the xmlChar * array */
36745     int n_str;
36746 
36747     for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
36748         mem_base = xmlMemBlocks();
36749         str = gen_const_xmlChar_ptr(n_str, 0);
36750 
36751         ret_val = xmlStrlen(str);
36752         desret_int(ret_val);
36753         call_tests++;
36754         des_const_xmlChar_ptr(n_str, str, 0);
36755         xmlResetLastError();
36756         if (mem_base != xmlMemBlocks()) {
36757             printf("Leak of %d blocks found in xmlStrlen",
36758 	           xmlMemBlocks() - mem_base);
36759 	    test_ret++;
36760             printf(" %d", n_str);
36761             printf("\n");
36762         }
36763     }
36764     function_tests++;
36765 
36766     return(test_ret);
36767 }
36768 
36769 
36770 static int
test_xmlStrncasecmp(void)36771 test_xmlStrncasecmp(void) {
36772     int test_ret = 0;
36773 
36774     int mem_base;
36775     int ret_val;
36776     const xmlChar * str1; /* the first xmlChar * */
36777     int n_str1;
36778     const xmlChar * str2; /* the second xmlChar * */
36779     int n_str2;
36780     int len; /* the max comparison length */
36781     int n_len;
36782 
36783     for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
36784     for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
36785     for (n_len = 0;n_len < gen_nb_int;n_len++) {
36786         mem_base = xmlMemBlocks();
36787         str1 = gen_const_xmlChar_ptr(n_str1, 0);
36788         str2 = gen_const_xmlChar_ptr(n_str2, 1);
36789         len = gen_int(n_len, 2);
36790         if ((str2 != NULL) &&
36791             (len > xmlStrlen(BAD_CAST str2)))
36792             len = 0;
36793 
36794         ret_val = xmlStrncasecmp(str1, str2, len);
36795         desret_int(ret_val);
36796         call_tests++;
36797         des_const_xmlChar_ptr(n_str1, str1, 0);
36798         des_const_xmlChar_ptr(n_str2, str2, 1);
36799         des_int(n_len, len, 2);
36800         xmlResetLastError();
36801         if (mem_base != xmlMemBlocks()) {
36802             printf("Leak of %d blocks found in xmlStrncasecmp",
36803 	           xmlMemBlocks() - mem_base);
36804 	    test_ret++;
36805             printf(" %d", n_str1);
36806             printf(" %d", n_str2);
36807             printf(" %d", n_len);
36808             printf("\n");
36809         }
36810     }
36811     }
36812     }
36813     function_tests++;
36814 
36815     return(test_ret);
36816 }
36817 
36818 
36819 static int
test_xmlStrncatNew(void)36820 test_xmlStrncatNew(void) {
36821     int test_ret = 0;
36822 
36823     int mem_base;
36824     xmlChar * ret_val;
36825     const xmlChar * str1; /* first xmlChar string */
36826     int n_str1;
36827     const xmlChar * str2; /* second xmlChar string */
36828     int n_str2;
36829     int len; /* the len of @str2 or < 0 */
36830     int n_len;
36831 
36832     for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
36833     for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
36834     for (n_len = 0;n_len < gen_nb_int;n_len++) {
36835         mem_base = xmlMemBlocks();
36836         str1 = gen_const_xmlChar_ptr(n_str1, 0);
36837         str2 = gen_const_xmlChar_ptr(n_str2, 1);
36838         len = gen_int(n_len, 2);
36839         if ((str2 != NULL) &&
36840             (len > xmlStrlen(BAD_CAST str2)))
36841             len = 0;
36842 
36843         ret_val = xmlStrncatNew(str1, str2, len);
36844         desret_xmlChar_ptr(ret_val);
36845         call_tests++;
36846         des_const_xmlChar_ptr(n_str1, str1, 0);
36847         des_const_xmlChar_ptr(n_str2, str2, 1);
36848         des_int(n_len, len, 2);
36849         xmlResetLastError();
36850         if (mem_base != xmlMemBlocks()) {
36851             printf("Leak of %d blocks found in xmlStrncatNew",
36852 	           xmlMemBlocks() - mem_base);
36853 	    test_ret++;
36854             printf(" %d", n_str1);
36855             printf(" %d", n_str2);
36856             printf(" %d", n_len);
36857             printf("\n");
36858         }
36859     }
36860     }
36861     }
36862     function_tests++;
36863 
36864     return(test_ret);
36865 }
36866 
36867 
36868 static int
test_xmlStrncmp(void)36869 test_xmlStrncmp(void) {
36870     int test_ret = 0;
36871 
36872     int mem_base;
36873     int ret_val;
36874     const xmlChar * str1; /* the first xmlChar * */
36875     int n_str1;
36876     const xmlChar * str2; /* the second xmlChar * */
36877     int n_str2;
36878     int len; /* the max comparison length */
36879     int n_len;
36880 
36881     for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
36882     for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
36883     for (n_len = 0;n_len < gen_nb_int;n_len++) {
36884         mem_base = xmlMemBlocks();
36885         str1 = gen_const_xmlChar_ptr(n_str1, 0);
36886         str2 = gen_const_xmlChar_ptr(n_str2, 1);
36887         len = gen_int(n_len, 2);
36888         if ((str2 != NULL) &&
36889             (len > xmlStrlen(BAD_CAST str2)))
36890             len = 0;
36891 
36892         ret_val = xmlStrncmp(str1, str2, len);
36893         desret_int(ret_val);
36894         call_tests++;
36895         des_const_xmlChar_ptr(n_str1, str1, 0);
36896         des_const_xmlChar_ptr(n_str2, str2, 1);
36897         des_int(n_len, len, 2);
36898         xmlResetLastError();
36899         if (mem_base != xmlMemBlocks()) {
36900             printf("Leak of %d blocks found in xmlStrncmp",
36901 	           xmlMemBlocks() - mem_base);
36902 	    test_ret++;
36903             printf(" %d", n_str1);
36904             printf(" %d", n_str2);
36905             printf(" %d", n_len);
36906             printf("\n");
36907         }
36908     }
36909     }
36910     }
36911     function_tests++;
36912 
36913     return(test_ret);
36914 }
36915 
36916 
36917 static int
test_xmlStrndup(void)36918 test_xmlStrndup(void) {
36919     int test_ret = 0;
36920 
36921     int mem_base;
36922     xmlChar * ret_val;
36923     const xmlChar * cur; /* the input xmlChar * */
36924     int n_cur;
36925     int len; /* the len of @cur */
36926     int n_len;
36927 
36928     for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
36929     for (n_len = 0;n_len < gen_nb_int;n_len++) {
36930         mem_base = xmlMemBlocks();
36931         cur = gen_const_xmlChar_ptr(n_cur, 0);
36932         len = gen_int(n_len, 1);
36933         if ((cur != NULL) &&
36934             (len > xmlStrlen(BAD_CAST cur)))
36935             len = 0;
36936 
36937         ret_val = xmlStrndup(cur, len);
36938         desret_xmlChar_ptr(ret_val);
36939         call_tests++;
36940         des_const_xmlChar_ptr(n_cur, cur, 0);
36941         des_int(n_len, len, 1);
36942         xmlResetLastError();
36943         if (mem_base != xmlMemBlocks()) {
36944             printf("Leak of %d blocks found in xmlStrndup",
36945 	           xmlMemBlocks() - mem_base);
36946 	    test_ret++;
36947             printf(" %d", n_cur);
36948             printf(" %d", n_len);
36949             printf("\n");
36950         }
36951     }
36952     }
36953     function_tests++;
36954 
36955     return(test_ret);
36956 }
36957 
36958 
36959 static int
test_xmlStrstr(void)36960 test_xmlStrstr(void) {
36961     int test_ret = 0;
36962 
36963     int mem_base;
36964     const xmlChar * ret_val;
36965     const xmlChar * str; /* the xmlChar * array (haystack) */
36966     int n_str;
36967     const xmlChar * val; /* the xmlChar to search (needle) */
36968     int n_val;
36969 
36970     for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
36971     for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
36972         mem_base = xmlMemBlocks();
36973         str = gen_const_xmlChar_ptr(n_str, 0);
36974         val = gen_const_xmlChar_ptr(n_val, 1);
36975 
36976         ret_val = xmlStrstr(str, val);
36977         desret_const_xmlChar_ptr(ret_val);
36978         call_tests++;
36979         des_const_xmlChar_ptr(n_str, str, 0);
36980         des_const_xmlChar_ptr(n_val, val, 1);
36981         xmlResetLastError();
36982         if (mem_base != xmlMemBlocks()) {
36983             printf("Leak of %d blocks found in xmlStrstr",
36984 	           xmlMemBlocks() - mem_base);
36985 	    test_ret++;
36986             printf(" %d", n_str);
36987             printf(" %d", n_val);
36988             printf("\n");
36989         }
36990     }
36991     }
36992     function_tests++;
36993 
36994     return(test_ret);
36995 }
36996 
36997 
36998 static int
test_xmlStrsub(void)36999 test_xmlStrsub(void) {
37000     int test_ret = 0;
37001 
37002     int mem_base;
37003     xmlChar * ret_val;
37004     const xmlChar * str; /* the xmlChar * array (haystack) */
37005     int n_str;
37006     int start; /* the index of the first char (zero based) */
37007     int n_start;
37008     int len; /* the length of the substring */
37009     int n_len;
37010 
37011     for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
37012     for (n_start = 0;n_start < gen_nb_int;n_start++) {
37013     for (n_len = 0;n_len < gen_nb_int;n_len++) {
37014         mem_base = xmlMemBlocks();
37015         str = gen_const_xmlChar_ptr(n_str, 0);
37016         start = gen_int(n_start, 1);
37017         len = gen_int(n_len, 2);
37018         if ((str != NULL) &&
37019             (start > xmlStrlen(BAD_CAST str)))
37020             start = 0;
37021         if ((str != NULL) &&
37022             (len > xmlStrlen(BAD_CAST str)))
37023             len = 0;
37024 
37025         ret_val = xmlStrsub(str, start, len);
37026         desret_xmlChar_ptr(ret_val);
37027         call_tests++;
37028         des_const_xmlChar_ptr(n_str, str, 0);
37029         des_int(n_start, start, 1);
37030         des_int(n_len, len, 2);
37031         xmlResetLastError();
37032         if (mem_base != xmlMemBlocks()) {
37033             printf("Leak of %d blocks found in xmlStrsub",
37034 	           xmlMemBlocks() - mem_base);
37035 	    test_ret++;
37036             printf(" %d", n_str);
37037             printf(" %d", n_start);
37038             printf(" %d", n_len);
37039             printf("\n");
37040         }
37041     }
37042     }
37043     }
37044     function_tests++;
37045 
37046     return(test_ret);
37047 }
37048 
37049 
37050 static int
test_xmlUTF8Charcmp(void)37051 test_xmlUTF8Charcmp(void) {
37052     int test_ret = 0;
37053 
37054     int mem_base;
37055     int ret_val;
37056     const xmlChar * utf1; /* pointer to first UTF8 char */
37057     int n_utf1;
37058     const xmlChar * utf2; /* pointer to second UTF8 char */
37059     int n_utf2;
37060 
37061     for (n_utf1 = 0;n_utf1 < gen_nb_const_xmlChar_ptr;n_utf1++) {
37062     for (n_utf2 = 0;n_utf2 < gen_nb_const_xmlChar_ptr;n_utf2++) {
37063         mem_base = xmlMemBlocks();
37064         utf1 = gen_const_xmlChar_ptr(n_utf1, 0);
37065         utf2 = gen_const_xmlChar_ptr(n_utf2, 1);
37066 
37067         ret_val = xmlUTF8Charcmp(utf1, utf2);
37068         desret_int(ret_val);
37069         call_tests++;
37070         des_const_xmlChar_ptr(n_utf1, utf1, 0);
37071         des_const_xmlChar_ptr(n_utf2, utf2, 1);
37072         xmlResetLastError();
37073         if (mem_base != xmlMemBlocks()) {
37074             printf("Leak of %d blocks found in xmlUTF8Charcmp",
37075 	           xmlMemBlocks() - mem_base);
37076 	    test_ret++;
37077             printf(" %d", n_utf1);
37078             printf(" %d", n_utf2);
37079             printf("\n");
37080         }
37081     }
37082     }
37083     function_tests++;
37084 
37085     return(test_ret);
37086 }
37087 
37088 
37089 static int
test_xmlUTF8Size(void)37090 test_xmlUTF8Size(void) {
37091     int test_ret = 0;
37092 
37093     int mem_base;
37094     int ret_val;
37095     const xmlChar * utf; /* pointer to the UTF8 character */
37096     int n_utf;
37097 
37098     for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
37099         mem_base = xmlMemBlocks();
37100         utf = gen_const_xmlChar_ptr(n_utf, 0);
37101 
37102         ret_val = xmlUTF8Size(utf);
37103         desret_int(ret_val);
37104         call_tests++;
37105         des_const_xmlChar_ptr(n_utf, utf, 0);
37106         xmlResetLastError();
37107         if (mem_base != xmlMemBlocks()) {
37108             printf("Leak of %d blocks found in xmlUTF8Size",
37109 	           xmlMemBlocks() - mem_base);
37110 	    test_ret++;
37111             printf(" %d", n_utf);
37112             printf("\n");
37113         }
37114     }
37115     function_tests++;
37116 
37117     return(test_ret);
37118 }
37119 
37120 
37121 static int
test_xmlUTF8Strlen(void)37122 test_xmlUTF8Strlen(void) {
37123     int test_ret = 0;
37124 
37125     int mem_base;
37126     int ret_val;
37127     const xmlChar * utf; /* a sequence of UTF-8 encoded bytes */
37128     int n_utf;
37129 
37130     for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
37131         mem_base = xmlMemBlocks();
37132         utf = gen_const_xmlChar_ptr(n_utf, 0);
37133 
37134         ret_val = xmlUTF8Strlen(utf);
37135         desret_int(ret_val);
37136         call_tests++;
37137         des_const_xmlChar_ptr(n_utf, utf, 0);
37138         xmlResetLastError();
37139         if (mem_base != xmlMemBlocks()) {
37140             printf("Leak of %d blocks found in xmlUTF8Strlen",
37141 	           xmlMemBlocks() - mem_base);
37142 	    test_ret++;
37143             printf(" %d", n_utf);
37144             printf("\n");
37145         }
37146     }
37147     function_tests++;
37148 
37149     return(test_ret);
37150 }
37151 
37152 
37153 static int
test_xmlUTF8Strloc(void)37154 test_xmlUTF8Strloc(void) {
37155     int test_ret = 0;
37156 
37157     int mem_base;
37158     int ret_val;
37159     const xmlChar * utf; /* the input UTF8 * */
37160     int n_utf;
37161     const xmlChar * utfchar; /* the UTF8 character to be found */
37162     int n_utfchar;
37163 
37164     for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
37165     for (n_utfchar = 0;n_utfchar < gen_nb_const_xmlChar_ptr;n_utfchar++) {
37166         mem_base = xmlMemBlocks();
37167         utf = gen_const_xmlChar_ptr(n_utf, 0);
37168         utfchar = gen_const_xmlChar_ptr(n_utfchar, 1);
37169 
37170         ret_val = xmlUTF8Strloc(utf, utfchar);
37171         desret_int(ret_val);
37172         call_tests++;
37173         des_const_xmlChar_ptr(n_utf, utf, 0);
37174         des_const_xmlChar_ptr(n_utfchar, utfchar, 1);
37175         xmlResetLastError();
37176         if (mem_base != xmlMemBlocks()) {
37177             printf("Leak of %d blocks found in xmlUTF8Strloc",
37178 	           xmlMemBlocks() - mem_base);
37179 	    test_ret++;
37180             printf(" %d", n_utf);
37181             printf(" %d", n_utfchar);
37182             printf("\n");
37183         }
37184     }
37185     }
37186     function_tests++;
37187 
37188     return(test_ret);
37189 }
37190 
37191 
37192 static int
test_xmlUTF8Strndup(void)37193 test_xmlUTF8Strndup(void) {
37194     int test_ret = 0;
37195 
37196     int mem_base;
37197     xmlChar * ret_val;
37198     const xmlChar * utf; /* the input UTF8 * */
37199     int n_utf;
37200     int len; /* the len of @utf (in chars) */
37201     int n_len;
37202 
37203     for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
37204     for (n_len = 0;n_len < gen_nb_int;n_len++) {
37205         mem_base = xmlMemBlocks();
37206         utf = gen_const_xmlChar_ptr(n_utf, 0);
37207         len = gen_int(n_len, 1);
37208         if ((utf != NULL) &&
37209             (len > xmlStrlen(BAD_CAST utf)))
37210             len = 0;
37211 
37212         ret_val = xmlUTF8Strndup(utf, len);
37213         desret_xmlChar_ptr(ret_val);
37214         call_tests++;
37215         des_const_xmlChar_ptr(n_utf, utf, 0);
37216         des_int(n_len, len, 1);
37217         xmlResetLastError();
37218         if (mem_base != xmlMemBlocks()) {
37219             printf("Leak of %d blocks found in xmlUTF8Strndup",
37220 	           xmlMemBlocks() - mem_base);
37221 	    test_ret++;
37222             printf(" %d", n_utf);
37223             printf(" %d", n_len);
37224             printf("\n");
37225         }
37226     }
37227     }
37228     function_tests++;
37229 
37230     return(test_ret);
37231 }
37232 
37233 
37234 static int
test_xmlUTF8Strpos(void)37235 test_xmlUTF8Strpos(void) {
37236     int test_ret = 0;
37237 
37238     int mem_base;
37239     const xmlChar * ret_val;
37240     const xmlChar * utf; /* the input UTF8 * */
37241     int n_utf;
37242     int pos; /* the position of the desired UTF8 char (in chars) */
37243     int n_pos;
37244 
37245     for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
37246     for (n_pos = 0;n_pos < gen_nb_int;n_pos++) {
37247         mem_base = xmlMemBlocks();
37248         utf = gen_const_xmlChar_ptr(n_utf, 0);
37249         pos = gen_int(n_pos, 1);
37250 
37251         ret_val = xmlUTF8Strpos(utf, pos);
37252         desret_const_xmlChar_ptr(ret_val);
37253         call_tests++;
37254         des_const_xmlChar_ptr(n_utf, utf, 0);
37255         des_int(n_pos, pos, 1);
37256         xmlResetLastError();
37257         if (mem_base != xmlMemBlocks()) {
37258             printf("Leak of %d blocks found in xmlUTF8Strpos",
37259 	           xmlMemBlocks() - mem_base);
37260 	    test_ret++;
37261             printf(" %d", n_utf);
37262             printf(" %d", n_pos);
37263             printf("\n");
37264         }
37265     }
37266     }
37267     function_tests++;
37268 
37269     return(test_ret);
37270 }
37271 
37272 
37273 static int
test_xmlUTF8Strsize(void)37274 test_xmlUTF8Strsize(void) {
37275     int test_ret = 0;
37276 
37277     int mem_base;
37278     int ret_val;
37279     const xmlChar * utf; /* a sequence of UTF-8 encoded bytes */
37280     int n_utf;
37281     int len; /* the number of characters in the array */
37282     int n_len;
37283 
37284     for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
37285     for (n_len = 0;n_len < gen_nb_int;n_len++) {
37286         mem_base = xmlMemBlocks();
37287         utf = gen_const_xmlChar_ptr(n_utf, 0);
37288         len = gen_int(n_len, 1);
37289         if ((utf != NULL) &&
37290             (len > xmlStrlen(BAD_CAST utf)))
37291             len = 0;
37292 
37293         ret_val = xmlUTF8Strsize(utf, len);
37294         desret_int(ret_val);
37295         call_tests++;
37296         des_const_xmlChar_ptr(n_utf, utf, 0);
37297         des_int(n_len, len, 1);
37298         xmlResetLastError();
37299         if (mem_base != xmlMemBlocks()) {
37300             printf("Leak of %d blocks found in xmlUTF8Strsize",
37301 	           xmlMemBlocks() - mem_base);
37302 	    test_ret++;
37303             printf(" %d", n_utf);
37304             printf(" %d", n_len);
37305             printf("\n");
37306         }
37307     }
37308     }
37309     function_tests++;
37310 
37311     return(test_ret);
37312 }
37313 
37314 
37315 static int
test_xmlUTF8Strsub(void)37316 test_xmlUTF8Strsub(void) {
37317     int test_ret = 0;
37318 
37319     int mem_base;
37320     xmlChar * ret_val;
37321     const xmlChar * utf; /* a sequence of UTF-8 encoded bytes */
37322     int n_utf;
37323     int start; /* relative pos of first char */
37324     int n_start;
37325     int len; /* total number to copy */
37326     int n_len;
37327 
37328     for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
37329     for (n_start = 0;n_start < gen_nb_int;n_start++) {
37330     for (n_len = 0;n_len < gen_nb_int;n_len++) {
37331         mem_base = xmlMemBlocks();
37332         utf = gen_const_xmlChar_ptr(n_utf, 0);
37333         start = gen_int(n_start, 1);
37334         len = gen_int(n_len, 2);
37335         if ((utf != NULL) &&
37336             (start > xmlStrlen(BAD_CAST utf)))
37337             start = 0;
37338         if ((utf != NULL) &&
37339             (len > xmlStrlen(BAD_CAST utf)))
37340             len = 0;
37341 
37342         ret_val = xmlUTF8Strsub(utf, start, len);
37343         desret_xmlChar_ptr(ret_val);
37344         call_tests++;
37345         des_const_xmlChar_ptr(n_utf, utf, 0);
37346         des_int(n_start, start, 1);
37347         des_int(n_len, len, 2);
37348         xmlResetLastError();
37349         if (mem_base != xmlMemBlocks()) {
37350             printf("Leak of %d blocks found in xmlUTF8Strsub",
37351 	           xmlMemBlocks() - mem_base);
37352 	    test_ret++;
37353             printf(" %d", n_utf);
37354             printf(" %d", n_start);
37355             printf(" %d", n_len);
37356             printf("\n");
37357         }
37358     }
37359     }
37360     }
37361     function_tests++;
37362 
37363     return(test_ret);
37364 }
37365 
37366 static int
test_xmlstring(void)37367 test_xmlstring(void) {
37368     int test_ret = 0;
37369 
37370     if (quiet == 0) printf("Testing xmlstring : 26 of 30 functions ...\n");
37371     test_ret += test_xmlCharStrdup();
37372     test_ret += test_xmlCharStrndup();
37373     test_ret += test_xmlCheckUTF8();
37374     test_ret += test_xmlGetUTF8Char();
37375     test_ret += test_xmlStrEqual();
37376     test_ret += test_xmlStrPrintf();
37377     test_ret += test_xmlStrQEqual();
37378     test_ret += test_xmlStrVPrintf();
37379     test_ret += test_xmlStrcasecmp();
37380     test_ret += test_xmlStrcasestr();
37381     test_ret += test_xmlStrchr();
37382     test_ret += test_xmlStrcmp();
37383     test_ret += test_xmlStrdup();
37384     test_ret += test_xmlStrlen();
37385     test_ret += test_xmlStrncasecmp();
37386     test_ret += test_xmlStrncatNew();
37387     test_ret += test_xmlStrncmp();
37388     test_ret += test_xmlStrndup();
37389     test_ret += test_xmlStrstr();
37390     test_ret += test_xmlStrsub();
37391     test_ret += test_xmlUTF8Charcmp();
37392     test_ret += test_xmlUTF8Size();
37393     test_ret += test_xmlUTF8Strlen();
37394     test_ret += test_xmlUTF8Strloc();
37395     test_ret += test_xmlUTF8Strndup();
37396     test_ret += test_xmlUTF8Strpos();
37397     test_ret += test_xmlUTF8Strsize();
37398     test_ret += test_xmlUTF8Strsub();
37399 
37400     if (test_ret != 0)
37401 	printf("Module xmlstring: %d errors\n", test_ret);
37402     return(test_ret);
37403 }
37404 
37405 static int
test_xmlNewTextWriter(void)37406 test_xmlNewTextWriter(void) {
37407     int test_ret = 0;
37408 
37409 #if defined(LIBXML_WRITER_ENABLED)
37410     int mem_base;
37411     xmlTextWriterPtr ret_val;
37412     xmlOutputBufferPtr out; /* an xmlOutputBufferPtr */
37413     int n_out;
37414 
37415     for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) {
37416         mem_base = xmlMemBlocks();
37417         out = gen_xmlOutputBufferPtr(n_out, 0);
37418 
37419         ret_val = xmlNewTextWriter(out);
37420         if (ret_val != NULL) out = NULL;
37421         desret_xmlTextWriterPtr(ret_val);
37422         call_tests++;
37423         des_xmlOutputBufferPtr(n_out, out, 0);
37424         xmlResetLastError();
37425         if (mem_base != xmlMemBlocks()) {
37426             printf("Leak of %d blocks found in xmlNewTextWriter",
37427 	           xmlMemBlocks() - mem_base);
37428 	    test_ret++;
37429             printf(" %d", n_out);
37430             printf("\n");
37431         }
37432     }
37433     function_tests++;
37434 #endif
37435 
37436     return(test_ret);
37437 }
37438 
37439 
37440 static int
test_xmlNewTextWriterFilename(void)37441 test_xmlNewTextWriterFilename(void) {
37442     int test_ret = 0;
37443 
37444 #if defined(LIBXML_WRITER_ENABLED)
37445     int mem_base;
37446     xmlTextWriterPtr ret_val;
37447     const char * uri; /* the URI of the resource for the output */
37448     int n_uri;
37449     int compression; /* compress the output? */
37450     int n_compression;
37451 
37452     for (n_uri = 0;n_uri < gen_nb_fileoutput;n_uri++) {
37453     for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
37454         mem_base = xmlMemBlocks();
37455         uri = gen_fileoutput(n_uri, 0);
37456         compression = gen_int(n_compression, 1);
37457 
37458         ret_val = xmlNewTextWriterFilename(uri, compression);
37459         desret_xmlTextWriterPtr(ret_val);
37460         call_tests++;
37461         des_fileoutput(n_uri, uri, 0);
37462         des_int(n_compression, compression, 1);
37463         xmlResetLastError();
37464         if (mem_base != xmlMemBlocks()) {
37465             printf("Leak of %d blocks found in xmlNewTextWriterFilename",
37466 	           xmlMemBlocks() - mem_base);
37467 	    test_ret++;
37468             printf(" %d", n_uri);
37469             printf(" %d", n_compression);
37470             printf("\n");
37471         }
37472     }
37473     }
37474     function_tests++;
37475 #endif
37476 
37477     return(test_ret);
37478 }
37479 
37480 
37481 static int
test_xmlNewTextWriterMemory(void)37482 test_xmlNewTextWriterMemory(void) {
37483     int test_ret = 0;
37484 
37485 #if defined(LIBXML_WRITER_ENABLED)
37486     int mem_base;
37487     xmlTextWriterPtr ret_val;
37488     xmlBufferPtr buf; /* xmlBufferPtr */
37489     int n_buf;
37490     int compression; /* compress the output? */
37491     int n_compression;
37492 
37493     for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
37494     for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
37495         mem_base = xmlMemBlocks();
37496         buf = gen_xmlBufferPtr(n_buf, 0);
37497         compression = gen_int(n_compression, 1);
37498 
37499         ret_val = xmlNewTextWriterMemory(buf, compression);
37500         desret_xmlTextWriterPtr(ret_val);
37501         call_tests++;
37502         des_xmlBufferPtr(n_buf, buf, 0);
37503         des_int(n_compression, compression, 1);
37504         xmlResetLastError();
37505         if (mem_base != xmlMemBlocks()) {
37506             printf("Leak of %d blocks found in xmlNewTextWriterMemory",
37507 	           xmlMemBlocks() - mem_base);
37508 	    test_ret++;
37509             printf(" %d", n_buf);
37510             printf(" %d", n_compression);
37511             printf("\n");
37512         }
37513     }
37514     }
37515     function_tests++;
37516 #endif
37517 
37518     return(test_ret);
37519 }
37520 
37521 
37522 static int
test_xmlNewTextWriterPushParser(void)37523 test_xmlNewTextWriterPushParser(void) {
37524     int test_ret = 0;
37525 
37526 #if defined(LIBXML_WRITER_ENABLED)
37527     int mem_base;
37528     xmlTextWriterPtr ret_val;
37529     xmlParserCtxtPtr ctxt; /* xmlParserCtxtPtr to hold the new XML document tree */
37530     int n_ctxt;
37531     int compression; /* compress the output? */
37532     int n_compression;
37533 
37534     for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
37535     for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
37536         mem_base = xmlMemBlocks();
37537         ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
37538         compression = gen_int(n_compression, 1);
37539 
37540         ret_val = xmlNewTextWriterPushParser(ctxt, compression);
37541         if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;} if (ret_val != NULL) ctxt = NULL;
37542         desret_xmlTextWriterPtr(ret_val);
37543         call_tests++;
37544         des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
37545         des_int(n_compression, compression, 1);
37546         xmlResetLastError();
37547         if (mem_base != xmlMemBlocks()) {
37548             printf("Leak of %d blocks found in xmlNewTextWriterPushParser",
37549 	           xmlMemBlocks() - mem_base);
37550 	    test_ret++;
37551             printf(" %d", n_ctxt);
37552             printf(" %d", n_compression);
37553             printf("\n");
37554         }
37555     }
37556     }
37557     function_tests++;
37558 #endif
37559 
37560     return(test_ret);
37561 }
37562 
37563 
37564 static int
test_xmlNewTextWriterTree(void)37565 test_xmlNewTextWriterTree(void) {
37566     int test_ret = 0;
37567 
37568 #if defined(LIBXML_WRITER_ENABLED)
37569     int mem_base;
37570     xmlTextWriterPtr ret_val;
37571     xmlDocPtr doc; /* xmlDocPtr */
37572     int n_doc;
37573     xmlNodePtr node; /* xmlNodePtr or NULL for doc->children */
37574     int n_node;
37575     int compression; /* compress the output? */
37576     int n_compression;
37577 
37578     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
37579     for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
37580     for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
37581         mem_base = xmlMemBlocks();
37582         doc = gen_xmlDocPtr(n_doc, 0);
37583         node = gen_xmlNodePtr(n_node, 1);
37584         compression = gen_int(n_compression, 2);
37585 
37586         ret_val = xmlNewTextWriterTree(doc, node, compression);
37587         desret_xmlTextWriterPtr(ret_val);
37588         call_tests++;
37589         des_xmlDocPtr(n_doc, doc, 0);
37590         des_xmlNodePtr(n_node, node, 1);
37591         des_int(n_compression, compression, 2);
37592         xmlResetLastError();
37593         if (mem_base != xmlMemBlocks()) {
37594             printf("Leak of %d blocks found in xmlNewTextWriterTree",
37595 	           xmlMemBlocks() - mem_base);
37596 	    test_ret++;
37597             printf(" %d", n_doc);
37598             printf(" %d", n_node);
37599             printf(" %d", n_compression);
37600             printf("\n");
37601         }
37602     }
37603     }
37604     }
37605     function_tests++;
37606 #endif
37607 
37608     return(test_ret);
37609 }
37610 
37611 
37612 static int
test_xmlTextWriterClose(void)37613 test_xmlTextWriterClose(void) {
37614     int test_ret = 0;
37615 
37616 #if defined(LIBXML_WRITER_ENABLED)
37617     int mem_base;
37618     int ret_val;
37619     xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
37620     int n_writer;
37621 
37622     for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
37623         mem_base = xmlMemBlocks();
37624         writer = gen_xmlTextWriterPtr(n_writer, 0);
37625 
37626         ret_val = xmlTextWriterClose(writer);
37627         desret_int(ret_val);
37628         call_tests++;
37629         des_xmlTextWriterPtr(n_writer, writer, 0);
37630         xmlResetLastError();
37631         if (mem_base != xmlMemBlocks()) {
37632             printf("Leak of %d blocks found in xmlTextWriterClose",
37633 	           xmlMemBlocks() - mem_base);
37634 	    test_ret++;
37635             printf(" %d", n_writer);
37636             printf("\n");
37637         }
37638     }
37639     function_tests++;
37640 #endif
37641 
37642     return(test_ret);
37643 }
37644 
37645 
37646 static int
test_xmlTextWriterEndAttribute(void)37647 test_xmlTextWriterEndAttribute(void) {
37648     int test_ret = 0;
37649 
37650 #if defined(LIBXML_WRITER_ENABLED)
37651     int mem_base;
37652     int ret_val;
37653     xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
37654     int n_writer;
37655 
37656     for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
37657         mem_base = xmlMemBlocks();
37658         writer = gen_xmlTextWriterPtr(n_writer, 0);
37659 
37660         ret_val = xmlTextWriterEndAttribute(writer);
37661         desret_int(ret_val);
37662         call_tests++;
37663         des_xmlTextWriterPtr(n_writer, writer, 0);
37664         xmlResetLastError();
37665         if (mem_base != xmlMemBlocks()) {
37666             printf("Leak of %d blocks found in xmlTextWriterEndAttribute",
37667 	           xmlMemBlocks() - mem_base);
37668 	    test_ret++;
37669             printf(" %d", n_writer);
37670             printf("\n");
37671         }
37672     }
37673     function_tests++;
37674 #endif
37675 
37676     return(test_ret);
37677 }
37678 
37679 
37680 static int
test_xmlTextWriterEndCDATA(void)37681 test_xmlTextWriterEndCDATA(void) {
37682     int test_ret = 0;
37683 
37684 #if defined(LIBXML_WRITER_ENABLED)
37685     int mem_base;
37686     int ret_val;
37687     xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
37688     int n_writer;
37689 
37690     for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
37691         mem_base = xmlMemBlocks();
37692         writer = gen_xmlTextWriterPtr(n_writer, 0);
37693 
37694         ret_val = xmlTextWriterEndCDATA(writer);
37695         desret_int(ret_val);
37696         call_tests++;
37697         des_xmlTextWriterPtr(n_writer, writer, 0);
37698         xmlResetLastError();
37699         if (mem_base != xmlMemBlocks()) {
37700             printf("Leak of %d blocks found in xmlTextWriterEndCDATA",
37701 	           xmlMemBlocks() - mem_base);
37702 	    test_ret++;
37703             printf(" %d", n_writer);
37704             printf("\n");
37705         }
37706     }
37707     function_tests++;
37708 #endif
37709 
37710     return(test_ret);
37711 }
37712 
37713 
37714 static int
test_xmlTextWriterEndComment(void)37715 test_xmlTextWriterEndComment(void) {
37716     int test_ret = 0;
37717 
37718 #if defined(LIBXML_WRITER_ENABLED)
37719     int mem_base;
37720     int ret_val;
37721     xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
37722     int n_writer;
37723 
37724     for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
37725         mem_base = xmlMemBlocks();
37726         writer = gen_xmlTextWriterPtr(n_writer, 0);
37727 
37728         ret_val = xmlTextWriterEndComment(writer);
37729         desret_int(ret_val);
37730         call_tests++;
37731         des_xmlTextWriterPtr(n_writer, writer, 0);
37732         xmlResetLastError();
37733         if (mem_base != xmlMemBlocks()) {
37734             printf("Leak of %d blocks found in xmlTextWriterEndComment",
37735 	           xmlMemBlocks() - mem_base);
37736 	    test_ret++;
37737             printf(" %d", n_writer);
37738             printf("\n");
37739         }
37740     }
37741     function_tests++;
37742 #endif
37743 
37744     return(test_ret);
37745 }
37746 
37747 
37748 static int
test_xmlTextWriterEndDTD(void)37749 test_xmlTextWriterEndDTD(void) {
37750     int test_ret = 0;
37751 
37752 #if defined(LIBXML_WRITER_ENABLED)
37753     int mem_base;
37754     int ret_val;
37755     xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
37756     int n_writer;
37757 
37758     for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
37759         mem_base = xmlMemBlocks();
37760         writer = gen_xmlTextWriterPtr(n_writer, 0);
37761 
37762         ret_val = xmlTextWriterEndDTD(writer);
37763         desret_int(ret_val);
37764         call_tests++;
37765         des_xmlTextWriterPtr(n_writer, writer, 0);
37766         xmlResetLastError();
37767         if (mem_base != xmlMemBlocks()) {
37768             printf("Leak of %d blocks found in xmlTextWriterEndDTD",
37769 	           xmlMemBlocks() - mem_base);
37770 	    test_ret++;
37771             printf(" %d", n_writer);
37772             printf("\n");
37773         }
37774     }
37775     function_tests++;
37776 #endif
37777 
37778     return(test_ret);
37779 }
37780 
37781 
37782 static int
test_xmlTextWriterEndDTDAttlist(void)37783 test_xmlTextWriterEndDTDAttlist(void) {
37784     int test_ret = 0;
37785 
37786 #if defined(LIBXML_WRITER_ENABLED)
37787     int mem_base;
37788     int ret_val;
37789     xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
37790     int n_writer;
37791 
37792     for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
37793         mem_base = xmlMemBlocks();
37794         writer = gen_xmlTextWriterPtr(n_writer, 0);
37795 
37796         ret_val = xmlTextWriterEndDTDAttlist(writer);
37797         desret_int(ret_val);
37798         call_tests++;
37799         des_xmlTextWriterPtr(n_writer, writer, 0);
37800         xmlResetLastError();
37801         if (mem_base != xmlMemBlocks()) {
37802             printf("Leak of %d blocks found in xmlTextWriterEndDTDAttlist",
37803 	           xmlMemBlocks() - mem_base);
37804 	    test_ret++;
37805             printf(" %d", n_writer);
37806             printf("\n");
37807         }
37808     }
37809     function_tests++;
37810 #endif
37811 
37812     return(test_ret);
37813 }
37814 
37815 
37816 static int
test_xmlTextWriterEndDTDElement(void)37817 test_xmlTextWriterEndDTDElement(void) {
37818     int test_ret = 0;
37819 
37820 #if defined(LIBXML_WRITER_ENABLED)
37821     int mem_base;
37822     int ret_val;
37823     xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
37824     int n_writer;
37825 
37826     for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
37827         mem_base = xmlMemBlocks();
37828         writer = gen_xmlTextWriterPtr(n_writer, 0);
37829 
37830         ret_val = xmlTextWriterEndDTDElement(writer);
37831         desret_int(ret_val);
37832         call_tests++;
37833         des_xmlTextWriterPtr(n_writer, writer, 0);
37834         xmlResetLastError();
37835         if (mem_base != xmlMemBlocks()) {
37836             printf("Leak of %d blocks found in xmlTextWriterEndDTDElement",
37837 	           xmlMemBlocks() - mem_base);
37838 	    test_ret++;
37839             printf(" %d", n_writer);
37840             printf("\n");
37841         }
37842     }
37843     function_tests++;
37844 #endif
37845 
37846     return(test_ret);
37847 }
37848 
37849 
37850 static int
test_xmlTextWriterEndDTDEntity(void)37851 test_xmlTextWriterEndDTDEntity(void) {
37852     int test_ret = 0;
37853 
37854 #if defined(LIBXML_WRITER_ENABLED)
37855     int mem_base;
37856     int ret_val;
37857     xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
37858     int n_writer;
37859 
37860     for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
37861         mem_base = xmlMemBlocks();
37862         writer = gen_xmlTextWriterPtr(n_writer, 0);
37863 
37864         ret_val = xmlTextWriterEndDTDEntity(writer);
37865         desret_int(ret_val);
37866         call_tests++;
37867         des_xmlTextWriterPtr(n_writer, writer, 0);
37868         xmlResetLastError();
37869         if (mem_base != xmlMemBlocks()) {
37870             printf("Leak of %d blocks found in xmlTextWriterEndDTDEntity",
37871 	           xmlMemBlocks() - mem_base);
37872 	    test_ret++;
37873             printf(" %d", n_writer);
37874             printf("\n");
37875         }
37876     }
37877     function_tests++;
37878 #endif
37879 
37880     return(test_ret);
37881 }
37882 
37883 
37884 static int
test_xmlTextWriterEndDocument(void)37885 test_xmlTextWriterEndDocument(void) {
37886     int test_ret = 0;
37887 
37888 #if defined(LIBXML_WRITER_ENABLED)
37889     int mem_base;
37890     int ret_val;
37891     xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
37892     int n_writer;
37893 
37894     for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
37895         mem_base = xmlMemBlocks();
37896         writer = gen_xmlTextWriterPtr(n_writer, 0);
37897 
37898         ret_val = xmlTextWriterEndDocument(writer);
37899         desret_int(ret_val);
37900         call_tests++;
37901         des_xmlTextWriterPtr(n_writer, writer, 0);
37902         xmlResetLastError();
37903         if (mem_base != xmlMemBlocks()) {
37904             printf("Leak of %d blocks found in xmlTextWriterEndDocument",
37905 	           xmlMemBlocks() - mem_base);
37906 	    test_ret++;
37907             printf(" %d", n_writer);
37908             printf("\n");
37909         }
37910     }
37911     function_tests++;
37912 #endif
37913 
37914     return(test_ret);
37915 }
37916 
37917 
37918 static int
test_xmlTextWriterEndElement(void)37919 test_xmlTextWriterEndElement(void) {
37920     int test_ret = 0;
37921 
37922 #if defined(LIBXML_WRITER_ENABLED)
37923     int mem_base;
37924     int ret_val;
37925     xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
37926     int n_writer;
37927 
37928     for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
37929         mem_base = xmlMemBlocks();
37930         writer = gen_xmlTextWriterPtr(n_writer, 0);
37931 
37932         ret_val = xmlTextWriterEndElement(writer);
37933         desret_int(ret_val);
37934         call_tests++;
37935         des_xmlTextWriterPtr(n_writer, writer, 0);
37936         xmlResetLastError();
37937         if (mem_base != xmlMemBlocks()) {
37938             printf("Leak of %d blocks found in xmlTextWriterEndElement",
37939 	           xmlMemBlocks() - mem_base);
37940 	    test_ret++;
37941             printf(" %d", n_writer);
37942             printf("\n");
37943         }
37944     }
37945     function_tests++;
37946 #endif
37947 
37948     return(test_ret);
37949 }
37950 
37951 
37952 static int
test_xmlTextWriterEndPI(void)37953 test_xmlTextWriterEndPI(void) {
37954     int test_ret = 0;
37955 
37956 #if defined(LIBXML_WRITER_ENABLED)
37957     int mem_base;
37958     int ret_val;
37959     xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
37960     int n_writer;
37961 
37962     for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
37963         mem_base = xmlMemBlocks();
37964         writer = gen_xmlTextWriterPtr(n_writer, 0);
37965 
37966         ret_val = xmlTextWriterEndPI(writer);
37967         desret_int(ret_val);
37968         call_tests++;
37969         des_xmlTextWriterPtr(n_writer, writer, 0);
37970         xmlResetLastError();
37971         if (mem_base != xmlMemBlocks()) {
37972             printf("Leak of %d blocks found in xmlTextWriterEndPI",
37973 	           xmlMemBlocks() - mem_base);
37974 	    test_ret++;
37975             printf(" %d", n_writer);
37976             printf("\n");
37977         }
37978     }
37979     function_tests++;
37980 #endif
37981 
37982     return(test_ret);
37983 }
37984 
37985 
37986 static int
test_xmlTextWriterFlush(void)37987 test_xmlTextWriterFlush(void) {
37988     int test_ret = 0;
37989 
37990 #if defined(LIBXML_WRITER_ENABLED)
37991     int mem_base;
37992     int ret_val;
37993     xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
37994     int n_writer;
37995 
37996     for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
37997         mem_base = xmlMemBlocks();
37998         writer = gen_xmlTextWriterPtr(n_writer, 0);
37999 
38000         ret_val = xmlTextWriterFlush(writer);
38001         desret_int(ret_val);
38002         call_tests++;
38003         des_xmlTextWriterPtr(n_writer, writer, 0);
38004         xmlResetLastError();
38005         if (mem_base != xmlMemBlocks()) {
38006             printf("Leak of %d blocks found in xmlTextWriterFlush",
38007 	           xmlMemBlocks() - mem_base);
38008 	    test_ret++;
38009             printf(" %d", n_writer);
38010             printf("\n");
38011         }
38012     }
38013     function_tests++;
38014 #endif
38015 
38016     return(test_ret);
38017 }
38018 
38019 
38020 static int
test_xmlTextWriterFullEndElement(void)38021 test_xmlTextWriterFullEndElement(void) {
38022     int test_ret = 0;
38023 
38024 #if defined(LIBXML_WRITER_ENABLED)
38025     int mem_base;
38026     int ret_val;
38027     xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
38028     int n_writer;
38029 
38030     for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
38031         mem_base = xmlMemBlocks();
38032         writer = gen_xmlTextWriterPtr(n_writer, 0);
38033 
38034         ret_val = xmlTextWriterFullEndElement(writer);
38035         desret_int(ret_val);
38036         call_tests++;
38037         des_xmlTextWriterPtr(n_writer, writer, 0);
38038         xmlResetLastError();
38039         if (mem_base != xmlMemBlocks()) {
38040             printf("Leak of %d blocks found in xmlTextWriterFullEndElement",
38041 	           xmlMemBlocks() - mem_base);
38042 	    test_ret++;
38043             printf(" %d", n_writer);
38044             printf("\n");
38045         }
38046     }
38047     function_tests++;
38048 #endif
38049 
38050     return(test_ret);
38051 }
38052 
38053 
38054 static int
test_xmlTextWriterSetIndent(void)38055 test_xmlTextWriterSetIndent(void) {
38056     int test_ret = 0;
38057 
38058 #if defined(LIBXML_WRITER_ENABLED)
38059     int mem_base;
38060     int ret_val;
38061     xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
38062     int n_writer;
38063     int indent; /* do indentation? */
38064     int n_indent;
38065 
38066     for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
38067     for (n_indent = 0;n_indent < gen_nb_int;n_indent++) {
38068         mem_base = xmlMemBlocks();
38069         writer = gen_xmlTextWriterPtr(n_writer, 0);
38070         indent = gen_int(n_indent, 1);
38071 
38072         ret_val = xmlTextWriterSetIndent(writer, indent);
38073         desret_int(ret_val);
38074         call_tests++;
38075         des_xmlTextWriterPtr(n_writer, writer, 0);
38076         des_int(n_indent, indent, 1);
38077         xmlResetLastError();
38078         if (mem_base != xmlMemBlocks()) {
38079             printf("Leak of %d blocks found in xmlTextWriterSetIndent",
38080 	           xmlMemBlocks() - mem_base);
38081 	    test_ret++;
38082             printf(" %d", n_writer);
38083             printf(" %d", n_indent);
38084             printf("\n");
38085         }
38086     }
38087     }
38088     function_tests++;
38089 #endif
38090 
38091     return(test_ret);
38092 }
38093 
38094 
38095 static int
test_xmlTextWriterSetIndentString(void)38096 test_xmlTextWriterSetIndentString(void) {
38097     int test_ret = 0;
38098 
38099 #if defined(LIBXML_WRITER_ENABLED)
38100     int mem_base;
38101     int ret_val;
38102     xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
38103     int n_writer;
38104     const xmlChar * str; /* the xmlChar string */
38105     int n_str;
38106 
38107     for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
38108     for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
38109         mem_base = xmlMemBlocks();
38110         writer = gen_xmlTextWriterPtr(n_writer, 0);
38111         str = gen_const_xmlChar_ptr(n_str, 1);
38112 
38113         ret_val = xmlTextWriterSetIndentString(writer, str);
38114         desret_int(ret_val);
38115         call_tests++;
38116         des_xmlTextWriterPtr(n_writer, writer, 0);
38117         des_const_xmlChar_ptr(n_str, str, 1);
38118         xmlResetLastError();
38119         if (mem_base != xmlMemBlocks()) {
38120             printf("Leak of %d blocks found in xmlTextWriterSetIndentString",
38121 	           xmlMemBlocks() - mem_base);
38122 	    test_ret++;
38123             printf(" %d", n_writer);
38124             printf(" %d", n_str);
38125             printf("\n");
38126         }
38127     }
38128     }
38129     function_tests++;
38130 #endif
38131 
38132     return(test_ret);
38133 }
38134 
38135 
38136 static int
test_xmlTextWriterSetQuoteChar(void)38137 test_xmlTextWriterSetQuoteChar(void) {
38138     int test_ret = 0;
38139 
38140 #if defined(LIBXML_WRITER_ENABLED)
38141     int mem_base;
38142     int ret_val;
38143     xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
38144     int n_writer;
38145     xmlChar quotechar; /* the quote character */
38146     int n_quotechar;
38147 
38148     for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
38149     for (n_quotechar = 0;n_quotechar < gen_nb_xmlChar;n_quotechar++) {
38150         mem_base = xmlMemBlocks();
38151         writer = gen_xmlTextWriterPtr(n_writer, 0);
38152         quotechar = gen_xmlChar(n_quotechar, 1);
38153 
38154         ret_val = xmlTextWriterSetQuoteChar(writer, quotechar);
38155         desret_int(ret_val);
38156         call_tests++;
38157         des_xmlTextWriterPtr(n_writer, writer, 0);
38158         des_xmlChar(n_quotechar, quotechar, 1);
38159         xmlResetLastError();
38160         if (mem_base != xmlMemBlocks()) {
38161             printf("Leak of %d blocks found in xmlTextWriterSetQuoteChar",
38162 	           xmlMemBlocks() - mem_base);
38163 	    test_ret++;
38164             printf(" %d", n_writer);
38165             printf(" %d", n_quotechar);
38166             printf("\n");
38167         }
38168     }
38169     }
38170     function_tests++;
38171 #endif
38172 
38173     return(test_ret);
38174 }
38175 
38176 
38177 static int
test_xmlTextWriterStartAttribute(void)38178 test_xmlTextWriterStartAttribute(void) {
38179     int test_ret = 0;
38180 
38181 #if defined(LIBXML_WRITER_ENABLED)
38182     int mem_base;
38183     int ret_val;
38184     xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
38185     int n_writer;
38186     const xmlChar * name; /* element name */
38187     int n_name;
38188 
38189     for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
38190     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
38191         mem_base = xmlMemBlocks();
38192         writer = gen_xmlTextWriterPtr(n_writer, 0);
38193         name = gen_const_xmlChar_ptr(n_name, 1);
38194 
38195         ret_val = xmlTextWriterStartAttribute(writer, name);
38196         desret_int(ret_val);
38197         call_tests++;
38198         des_xmlTextWriterPtr(n_writer, writer, 0);
38199         des_const_xmlChar_ptr(n_name, name, 1);
38200         xmlResetLastError();
38201         if (mem_base != xmlMemBlocks()) {
38202             printf("Leak of %d blocks found in xmlTextWriterStartAttribute",
38203 	           xmlMemBlocks() - mem_base);
38204 	    test_ret++;
38205             printf(" %d", n_writer);
38206             printf(" %d", n_name);
38207             printf("\n");
38208         }
38209     }
38210     }
38211     function_tests++;
38212 #endif
38213 
38214     return(test_ret);
38215 }
38216 
38217 
38218 static int
test_xmlTextWriterStartAttributeNS(void)38219 test_xmlTextWriterStartAttributeNS(void) {
38220     int test_ret = 0;
38221 
38222 #if defined(LIBXML_WRITER_ENABLED)
38223     int mem_base;
38224     int ret_val;
38225     xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
38226     int n_writer;
38227     const xmlChar * prefix; /* namespace prefix or NULL */
38228     int n_prefix;
38229     const xmlChar * name; /* element local name */
38230     int n_name;
38231     const xmlChar * namespaceURI; /* namespace URI or NULL */
38232     int n_namespaceURI;
38233 
38234     for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
38235     for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
38236     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
38237     for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
38238         mem_base = xmlMemBlocks();
38239         writer = gen_xmlTextWriterPtr(n_writer, 0);
38240         prefix = gen_const_xmlChar_ptr(n_prefix, 1);
38241         name = gen_const_xmlChar_ptr(n_name, 2);
38242         namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
38243 
38244         ret_val = xmlTextWriterStartAttributeNS(writer, prefix, name, namespaceURI);
38245         desret_int(ret_val);
38246         call_tests++;
38247         des_xmlTextWriterPtr(n_writer, writer, 0);
38248         des_const_xmlChar_ptr(n_prefix, prefix, 1);
38249         des_const_xmlChar_ptr(n_name, name, 2);
38250         des_const_xmlChar_ptr(n_namespaceURI, namespaceURI, 3);
38251         xmlResetLastError();
38252         if (mem_base != xmlMemBlocks()) {
38253             printf("Leak of %d blocks found in xmlTextWriterStartAttributeNS",
38254 	           xmlMemBlocks() - mem_base);
38255 	    test_ret++;
38256             printf(" %d", n_writer);
38257             printf(" %d", n_prefix);
38258             printf(" %d", n_name);
38259             printf(" %d", n_namespaceURI);
38260             printf("\n");
38261         }
38262     }
38263     }
38264     }
38265     }
38266     function_tests++;
38267 #endif
38268 
38269     return(test_ret);
38270 }
38271 
38272 
38273 static int
test_xmlTextWriterStartCDATA(void)38274 test_xmlTextWriterStartCDATA(void) {
38275     int test_ret = 0;
38276 
38277 #if defined(LIBXML_WRITER_ENABLED)
38278     int mem_base;
38279     int ret_val;
38280     xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
38281     int n_writer;
38282 
38283     for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
38284         mem_base = xmlMemBlocks();
38285         writer = gen_xmlTextWriterPtr(n_writer, 0);
38286 
38287         ret_val = xmlTextWriterStartCDATA(writer);
38288         desret_int(ret_val);
38289         call_tests++;
38290         des_xmlTextWriterPtr(n_writer, writer, 0);
38291         xmlResetLastError();
38292         if (mem_base != xmlMemBlocks()) {
38293             printf("Leak of %d blocks found in xmlTextWriterStartCDATA",
38294 	           xmlMemBlocks() - mem_base);
38295 	    test_ret++;
38296             printf(" %d", n_writer);
38297             printf("\n");
38298         }
38299     }
38300     function_tests++;
38301 #endif
38302 
38303     return(test_ret);
38304 }
38305 
38306 
38307 static int
test_xmlTextWriterStartComment(void)38308 test_xmlTextWriterStartComment(void) {
38309     int test_ret = 0;
38310 
38311 #if defined(LIBXML_WRITER_ENABLED)
38312     int mem_base;
38313     int ret_val;
38314     xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
38315     int n_writer;
38316 
38317     for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
38318         mem_base = xmlMemBlocks();
38319         writer = gen_xmlTextWriterPtr(n_writer, 0);
38320 
38321         ret_val = xmlTextWriterStartComment(writer);
38322         desret_int(ret_val);
38323         call_tests++;
38324         des_xmlTextWriterPtr(n_writer, writer, 0);
38325         xmlResetLastError();
38326         if (mem_base != xmlMemBlocks()) {
38327             printf("Leak of %d blocks found in xmlTextWriterStartComment",
38328 	           xmlMemBlocks() - mem_base);
38329 	    test_ret++;
38330             printf(" %d", n_writer);
38331             printf("\n");
38332         }
38333     }
38334     function_tests++;
38335 #endif
38336 
38337     return(test_ret);
38338 }
38339 
38340 
38341 static int
test_xmlTextWriterStartDTD(void)38342 test_xmlTextWriterStartDTD(void) {
38343     int test_ret = 0;
38344 
38345 #if defined(LIBXML_WRITER_ENABLED)
38346     int mem_base;
38347     int ret_val;
38348     xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
38349     int n_writer;
38350     const xmlChar * name; /* the name of the DTD */
38351     int n_name;
38352     const xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
38353     int n_pubid;
38354     const xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
38355     int n_sysid;
38356 
38357     for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
38358     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
38359     for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
38360     for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
38361         mem_base = xmlMemBlocks();
38362         writer = gen_xmlTextWriterPtr(n_writer, 0);
38363         name = gen_const_xmlChar_ptr(n_name, 1);
38364         pubid = gen_const_xmlChar_ptr(n_pubid, 2);
38365         sysid = gen_const_xmlChar_ptr(n_sysid, 3);
38366 
38367         ret_val = xmlTextWriterStartDTD(writer, name, pubid, sysid);
38368         desret_int(ret_val);
38369         call_tests++;
38370         des_xmlTextWriterPtr(n_writer, writer, 0);
38371         des_const_xmlChar_ptr(n_name, name, 1);
38372         des_const_xmlChar_ptr(n_pubid, pubid, 2);
38373         des_const_xmlChar_ptr(n_sysid, sysid, 3);
38374         xmlResetLastError();
38375         if (mem_base != xmlMemBlocks()) {
38376             printf("Leak of %d blocks found in xmlTextWriterStartDTD",
38377 	           xmlMemBlocks() - mem_base);
38378 	    test_ret++;
38379             printf(" %d", n_writer);
38380             printf(" %d", n_name);
38381             printf(" %d", n_pubid);
38382             printf(" %d", n_sysid);
38383             printf("\n");
38384         }
38385     }
38386     }
38387     }
38388     }
38389     function_tests++;
38390 #endif
38391 
38392     return(test_ret);
38393 }
38394 
38395 
38396 static int
test_xmlTextWriterStartDTDAttlist(void)38397 test_xmlTextWriterStartDTDAttlist(void) {
38398     int test_ret = 0;
38399 
38400 #if defined(LIBXML_WRITER_ENABLED)
38401     int mem_base;
38402     int ret_val;
38403     xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
38404     int n_writer;
38405     const xmlChar * name; /* the name of the DTD ATTLIST */
38406     int n_name;
38407 
38408     for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
38409     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
38410         mem_base = xmlMemBlocks();
38411         writer = gen_xmlTextWriterPtr(n_writer, 0);
38412         name = gen_const_xmlChar_ptr(n_name, 1);
38413 
38414         ret_val = xmlTextWriterStartDTDAttlist(writer, name);
38415         desret_int(ret_val);
38416         call_tests++;
38417         des_xmlTextWriterPtr(n_writer, writer, 0);
38418         des_const_xmlChar_ptr(n_name, name, 1);
38419         xmlResetLastError();
38420         if (mem_base != xmlMemBlocks()) {
38421             printf("Leak of %d blocks found in xmlTextWriterStartDTDAttlist",
38422 	           xmlMemBlocks() - mem_base);
38423 	    test_ret++;
38424             printf(" %d", n_writer);
38425             printf(" %d", n_name);
38426             printf("\n");
38427         }
38428     }
38429     }
38430     function_tests++;
38431 #endif
38432 
38433     return(test_ret);
38434 }
38435 
38436 
38437 static int
test_xmlTextWriterStartDTDElement(void)38438 test_xmlTextWriterStartDTDElement(void) {
38439     int test_ret = 0;
38440 
38441 #if defined(LIBXML_WRITER_ENABLED)
38442     int mem_base;
38443     int ret_val;
38444     xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
38445     int n_writer;
38446     const xmlChar * name; /* the name of the DTD element */
38447     int n_name;
38448 
38449     for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
38450     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
38451         mem_base = xmlMemBlocks();
38452         writer = gen_xmlTextWriterPtr(n_writer, 0);
38453         name = gen_const_xmlChar_ptr(n_name, 1);
38454 
38455         ret_val = xmlTextWriterStartDTDElement(writer, name);
38456         desret_int(ret_val);
38457         call_tests++;
38458         des_xmlTextWriterPtr(n_writer, writer, 0);
38459         des_const_xmlChar_ptr(n_name, name, 1);
38460         xmlResetLastError();
38461         if (mem_base != xmlMemBlocks()) {
38462             printf("Leak of %d blocks found in xmlTextWriterStartDTDElement",
38463 	           xmlMemBlocks() - mem_base);
38464 	    test_ret++;
38465             printf(" %d", n_writer);
38466             printf(" %d", n_name);
38467             printf("\n");
38468         }
38469     }
38470     }
38471     function_tests++;
38472 #endif
38473 
38474     return(test_ret);
38475 }
38476 
38477 
38478 static int
test_xmlTextWriterStartDTDEntity(void)38479 test_xmlTextWriterStartDTDEntity(void) {
38480     int test_ret = 0;
38481 
38482 #if defined(LIBXML_WRITER_ENABLED)
38483     int mem_base;
38484     int ret_val;
38485     xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
38486     int n_writer;
38487     int pe; /* TRUE if this is a parameter entity, FALSE if not */
38488     int n_pe;
38489     const xmlChar * name; /* the name of the DTD ATTLIST */
38490     int n_name;
38491 
38492     for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
38493     for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
38494     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
38495         mem_base = xmlMemBlocks();
38496         writer = gen_xmlTextWriterPtr(n_writer, 0);
38497         pe = gen_int(n_pe, 1);
38498         name = gen_const_xmlChar_ptr(n_name, 2);
38499 
38500         ret_val = xmlTextWriterStartDTDEntity(writer, pe, name);
38501         desret_int(ret_val);
38502         call_tests++;
38503         des_xmlTextWriterPtr(n_writer, writer, 0);
38504         des_int(n_pe, pe, 1);
38505         des_const_xmlChar_ptr(n_name, name, 2);
38506         xmlResetLastError();
38507         if (mem_base != xmlMemBlocks()) {
38508             printf("Leak of %d blocks found in xmlTextWriterStartDTDEntity",
38509 	           xmlMemBlocks() - mem_base);
38510 	    test_ret++;
38511             printf(" %d", n_writer);
38512             printf(" %d", n_pe);
38513             printf(" %d", n_name);
38514             printf("\n");
38515         }
38516     }
38517     }
38518     }
38519     function_tests++;
38520 #endif
38521 
38522     return(test_ret);
38523 }
38524 
38525 
38526 static int
test_xmlTextWriterStartDocument(void)38527 test_xmlTextWriterStartDocument(void) {
38528     int test_ret = 0;
38529 
38530 #if defined(LIBXML_WRITER_ENABLED)
38531     int mem_base;
38532     int ret_val;
38533     xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
38534     int n_writer;
38535     const char * version; /* the xml version ("1.0") or NULL for default ("1.0") */
38536     int n_version;
38537     const char * encoding; /* the encoding or NULL for default */
38538     int n_encoding;
38539     const char * standalone; /* "yes" or "no" or NULL for default */
38540     int n_standalone;
38541 
38542     for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
38543     for (n_version = 0;n_version < gen_nb_const_char_ptr;n_version++) {
38544     for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
38545     for (n_standalone = 0;n_standalone < gen_nb_const_char_ptr;n_standalone++) {
38546         mem_base = xmlMemBlocks();
38547         writer = gen_xmlTextWriterPtr(n_writer, 0);
38548         version = gen_const_char_ptr(n_version, 1);
38549         encoding = gen_const_char_ptr(n_encoding, 2);
38550         standalone = gen_const_char_ptr(n_standalone, 3);
38551 
38552         ret_val = xmlTextWriterStartDocument(writer, version, encoding, standalone);
38553         desret_int(ret_val);
38554         call_tests++;
38555         des_xmlTextWriterPtr(n_writer, writer, 0);
38556         des_const_char_ptr(n_version, version, 1);
38557         des_const_char_ptr(n_encoding, encoding, 2);
38558         des_const_char_ptr(n_standalone, standalone, 3);
38559         xmlResetLastError();
38560         if (mem_base != xmlMemBlocks()) {
38561             printf("Leak of %d blocks found in xmlTextWriterStartDocument",
38562 	           xmlMemBlocks() - mem_base);
38563 	    test_ret++;
38564             printf(" %d", n_writer);
38565             printf(" %d", n_version);
38566             printf(" %d", n_encoding);
38567             printf(" %d", n_standalone);
38568             printf("\n");
38569         }
38570     }
38571     }
38572     }
38573     }
38574     function_tests++;
38575 #endif
38576 
38577     return(test_ret);
38578 }
38579 
38580 
38581 static int
test_xmlTextWriterStartElement(void)38582 test_xmlTextWriterStartElement(void) {
38583     int test_ret = 0;
38584 
38585 #if defined(LIBXML_WRITER_ENABLED)
38586     int mem_base;
38587     int ret_val;
38588     xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
38589     int n_writer;
38590     const xmlChar * name; /* element name */
38591     int n_name;
38592 
38593     for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
38594     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
38595         mem_base = xmlMemBlocks();
38596         writer = gen_xmlTextWriterPtr(n_writer, 0);
38597         name = gen_const_xmlChar_ptr(n_name, 1);
38598 
38599         ret_val = xmlTextWriterStartElement(writer, name);
38600         desret_int(ret_val);
38601         call_tests++;
38602         des_xmlTextWriterPtr(n_writer, writer, 0);
38603         des_const_xmlChar_ptr(n_name, name, 1);
38604         xmlResetLastError();
38605         if (mem_base != xmlMemBlocks()) {
38606             printf("Leak of %d blocks found in xmlTextWriterStartElement",
38607 	           xmlMemBlocks() - mem_base);
38608 	    test_ret++;
38609             printf(" %d", n_writer);
38610             printf(" %d", n_name);
38611             printf("\n");
38612         }
38613     }
38614     }
38615     function_tests++;
38616 #endif
38617 
38618     return(test_ret);
38619 }
38620 
38621 
38622 static int
test_xmlTextWriterStartElementNS(void)38623 test_xmlTextWriterStartElementNS(void) {
38624     int test_ret = 0;
38625 
38626 #if defined(LIBXML_WRITER_ENABLED)
38627     int mem_base;
38628     int ret_val;
38629     xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
38630     int n_writer;
38631     const xmlChar * prefix; /* namespace prefix or NULL */
38632     int n_prefix;
38633     const xmlChar * name; /* element local name */
38634     int n_name;
38635     const xmlChar * namespaceURI; /* namespace URI or NULL */
38636     int n_namespaceURI;
38637 
38638     for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
38639     for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
38640     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
38641     for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
38642         mem_base = xmlMemBlocks();
38643         writer = gen_xmlTextWriterPtr(n_writer, 0);
38644         prefix = gen_const_xmlChar_ptr(n_prefix, 1);
38645         name = gen_const_xmlChar_ptr(n_name, 2);
38646         namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
38647 
38648         ret_val = xmlTextWriterStartElementNS(writer, prefix, name, namespaceURI);
38649         desret_int(ret_val);
38650         call_tests++;
38651         des_xmlTextWriterPtr(n_writer, writer, 0);
38652         des_const_xmlChar_ptr(n_prefix, prefix, 1);
38653         des_const_xmlChar_ptr(n_name, name, 2);
38654         des_const_xmlChar_ptr(n_namespaceURI, namespaceURI, 3);
38655         xmlResetLastError();
38656         if (mem_base != xmlMemBlocks()) {
38657             printf("Leak of %d blocks found in xmlTextWriterStartElementNS",
38658 	           xmlMemBlocks() - mem_base);
38659 	    test_ret++;
38660             printf(" %d", n_writer);
38661             printf(" %d", n_prefix);
38662             printf(" %d", n_name);
38663             printf(" %d", n_namespaceURI);
38664             printf("\n");
38665         }
38666     }
38667     }
38668     }
38669     }
38670     function_tests++;
38671 #endif
38672 
38673     return(test_ret);
38674 }
38675 
38676 
38677 static int
test_xmlTextWriterStartPI(void)38678 test_xmlTextWriterStartPI(void) {
38679     int test_ret = 0;
38680 
38681 #if defined(LIBXML_WRITER_ENABLED)
38682     int mem_base;
38683     int ret_val;
38684     xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
38685     int n_writer;
38686     const xmlChar * target; /* PI target */
38687     int n_target;
38688 
38689     for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
38690     for (n_target = 0;n_target < gen_nb_const_xmlChar_ptr;n_target++) {
38691         mem_base = xmlMemBlocks();
38692         writer = gen_xmlTextWriterPtr(n_writer, 0);
38693         target = gen_const_xmlChar_ptr(n_target, 1);
38694 
38695         ret_val = xmlTextWriterStartPI(writer, target);
38696         desret_int(ret_val);
38697         call_tests++;
38698         des_xmlTextWriterPtr(n_writer, writer, 0);
38699         des_const_xmlChar_ptr(n_target, target, 1);
38700         xmlResetLastError();
38701         if (mem_base != xmlMemBlocks()) {
38702             printf("Leak of %d blocks found in xmlTextWriterStartPI",
38703 	           xmlMemBlocks() - mem_base);
38704 	    test_ret++;
38705             printf(" %d", n_writer);
38706             printf(" %d", n_target);
38707             printf("\n");
38708         }
38709     }
38710     }
38711     function_tests++;
38712 #endif
38713 
38714     return(test_ret);
38715 }
38716 
38717 
38718 static int
test_xmlTextWriterWriteAttribute(void)38719 test_xmlTextWriterWriteAttribute(void) {
38720     int test_ret = 0;
38721 
38722 #if defined(LIBXML_WRITER_ENABLED)
38723     int mem_base;
38724     int ret_val;
38725     xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
38726     int n_writer;
38727     const xmlChar * name; /* attribute name */
38728     int n_name;
38729     const xmlChar * content; /* attribute content */
38730     int n_content;
38731 
38732     for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
38733     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
38734     for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
38735         mem_base = xmlMemBlocks();
38736         writer = gen_xmlTextWriterPtr(n_writer, 0);
38737         name = gen_const_xmlChar_ptr(n_name, 1);
38738         content = gen_const_xmlChar_ptr(n_content, 2);
38739 
38740         ret_val = xmlTextWriterWriteAttribute(writer, name, content);
38741         desret_int(ret_val);
38742         call_tests++;
38743         des_xmlTextWriterPtr(n_writer, writer, 0);
38744         des_const_xmlChar_ptr(n_name, name, 1);
38745         des_const_xmlChar_ptr(n_content, content, 2);
38746         xmlResetLastError();
38747         if (mem_base != xmlMemBlocks()) {
38748             printf("Leak of %d blocks found in xmlTextWriterWriteAttribute",
38749 	           xmlMemBlocks() - mem_base);
38750 	    test_ret++;
38751             printf(" %d", n_writer);
38752             printf(" %d", n_name);
38753             printf(" %d", n_content);
38754             printf("\n");
38755         }
38756     }
38757     }
38758     }
38759     function_tests++;
38760 #endif
38761 
38762     return(test_ret);
38763 }
38764 
38765 
38766 static int
test_xmlTextWriterWriteAttributeNS(void)38767 test_xmlTextWriterWriteAttributeNS(void) {
38768     int test_ret = 0;
38769 
38770 #if defined(LIBXML_WRITER_ENABLED)
38771     int mem_base;
38772     int ret_val;
38773     xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
38774     int n_writer;
38775     const xmlChar * prefix; /* namespace prefix */
38776     int n_prefix;
38777     const xmlChar * name; /* attribute local name */
38778     int n_name;
38779     const xmlChar * namespaceURI; /* namespace URI */
38780     int n_namespaceURI;
38781     const xmlChar * content; /* attribute content */
38782     int n_content;
38783 
38784     for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
38785     for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
38786     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
38787     for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
38788     for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
38789         mem_base = xmlMemBlocks();
38790         writer = gen_xmlTextWriterPtr(n_writer, 0);
38791         prefix = gen_const_xmlChar_ptr(n_prefix, 1);
38792         name = gen_const_xmlChar_ptr(n_name, 2);
38793         namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
38794         content = gen_const_xmlChar_ptr(n_content, 4);
38795 
38796         ret_val = xmlTextWriterWriteAttributeNS(writer, prefix, name, namespaceURI, content);
38797         desret_int(ret_val);
38798         call_tests++;
38799         des_xmlTextWriterPtr(n_writer, writer, 0);
38800         des_const_xmlChar_ptr(n_prefix, prefix, 1);
38801         des_const_xmlChar_ptr(n_name, name, 2);
38802         des_const_xmlChar_ptr(n_namespaceURI, namespaceURI, 3);
38803         des_const_xmlChar_ptr(n_content, content, 4);
38804         xmlResetLastError();
38805         if (mem_base != xmlMemBlocks()) {
38806             printf("Leak of %d blocks found in xmlTextWriterWriteAttributeNS",
38807 	           xmlMemBlocks() - mem_base);
38808 	    test_ret++;
38809             printf(" %d", n_writer);
38810             printf(" %d", n_prefix);
38811             printf(" %d", n_name);
38812             printf(" %d", n_namespaceURI);
38813             printf(" %d", n_content);
38814             printf("\n");
38815         }
38816     }
38817     }
38818     }
38819     }
38820     }
38821     function_tests++;
38822 #endif
38823 
38824     return(test_ret);
38825 }
38826 
38827 
38828 static int
test_xmlTextWriterWriteBase64(void)38829 test_xmlTextWriterWriteBase64(void) {
38830     int test_ret = 0;
38831 
38832 #if defined(LIBXML_WRITER_ENABLED)
38833     int mem_base;
38834     int ret_val;
38835     xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
38836     int n_writer;
38837     const char * data; /* binary data */
38838     int n_data;
38839     int start; /* the position within the data of the first byte to encode */
38840     int n_start;
38841     int len; /* the number of bytes to encode */
38842     int n_len;
38843 
38844     for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
38845     for (n_data = 0;n_data < gen_nb_const_char_ptr;n_data++) {
38846     for (n_start = 0;n_start < gen_nb_int;n_start++) {
38847     for (n_len = 0;n_len < gen_nb_int;n_len++) {
38848         mem_base = xmlMemBlocks();
38849         writer = gen_xmlTextWriterPtr(n_writer, 0);
38850         data = gen_const_char_ptr(n_data, 1);
38851         start = gen_int(n_start, 2);
38852         len = gen_int(n_len, 3);
38853         if ((data != NULL) &&
38854             (start > xmlStrlen(BAD_CAST data)))
38855             start = 0;
38856         if ((data != NULL) &&
38857             (len > xmlStrlen(BAD_CAST data)))
38858             len = 0;
38859 
38860         ret_val = xmlTextWriterWriteBase64(writer, data, start, len);
38861         desret_int(ret_val);
38862         call_tests++;
38863         des_xmlTextWriterPtr(n_writer, writer, 0);
38864         des_const_char_ptr(n_data, data, 1);
38865         des_int(n_start, start, 2);
38866         des_int(n_len, len, 3);
38867         xmlResetLastError();
38868         if (mem_base != xmlMemBlocks()) {
38869             printf("Leak of %d blocks found in xmlTextWriterWriteBase64",
38870 	           xmlMemBlocks() - mem_base);
38871 	    test_ret++;
38872             printf(" %d", n_writer);
38873             printf(" %d", n_data);
38874             printf(" %d", n_start);
38875             printf(" %d", n_len);
38876             printf("\n");
38877         }
38878     }
38879     }
38880     }
38881     }
38882     function_tests++;
38883 #endif
38884 
38885     return(test_ret);
38886 }
38887 
38888 
38889 static int
test_xmlTextWriterWriteBinHex(void)38890 test_xmlTextWriterWriteBinHex(void) {
38891     int test_ret = 0;
38892 
38893 #if defined(LIBXML_WRITER_ENABLED)
38894     int mem_base;
38895     int ret_val;
38896     xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
38897     int n_writer;
38898     const char * data; /* binary data */
38899     int n_data;
38900     int start; /* the position within the data of the first byte to encode */
38901     int n_start;
38902     int len; /* the number of bytes to encode */
38903     int n_len;
38904 
38905     for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
38906     for (n_data = 0;n_data < gen_nb_const_char_ptr;n_data++) {
38907     for (n_start = 0;n_start < gen_nb_int;n_start++) {
38908     for (n_len = 0;n_len < gen_nb_int;n_len++) {
38909         mem_base = xmlMemBlocks();
38910         writer = gen_xmlTextWriterPtr(n_writer, 0);
38911         data = gen_const_char_ptr(n_data, 1);
38912         start = gen_int(n_start, 2);
38913         len = gen_int(n_len, 3);
38914         if ((data != NULL) &&
38915             (start > xmlStrlen(BAD_CAST data)))
38916             start = 0;
38917         if ((data != NULL) &&
38918             (len > xmlStrlen(BAD_CAST data)))
38919             len = 0;
38920 
38921         ret_val = xmlTextWriterWriteBinHex(writer, data, start, len);
38922         desret_int(ret_val);
38923         call_tests++;
38924         des_xmlTextWriterPtr(n_writer, writer, 0);
38925         des_const_char_ptr(n_data, data, 1);
38926         des_int(n_start, start, 2);
38927         des_int(n_len, len, 3);
38928         xmlResetLastError();
38929         if (mem_base != xmlMemBlocks()) {
38930             printf("Leak of %d blocks found in xmlTextWriterWriteBinHex",
38931 	           xmlMemBlocks() - mem_base);
38932 	    test_ret++;
38933             printf(" %d", n_writer);
38934             printf(" %d", n_data);
38935             printf(" %d", n_start);
38936             printf(" %d", n_len);
38937             printf("\n");
38938         }
38939     }
38940     }
38941     }
38942     }
38943     function_tests++;
38944 #endif
38945 
38946     return(test_ret);
38947 }
38948 
38949 
38950 static int
test_xmlTextWriterWriteCDATA(void)38951 test_xmlTextWriterWriteCDATA(void) {
38952     int test_ret = 0;
38953 
38954 #if defined(LIBXML_WRITER_ENABLED)
38955     int mem_base;
38956     int ret_val;
38957     xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
38958     int n_writer;
38959     const xmlChar * content; /* CDATA content */
38960     int n_content;
38961 
38962     for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
38963     for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
38964         mem_base = xmlMemBlocks();
38965         writer = gen_xmlTextWriterPtr(n_writer, 0);
38966         content = gen_const_xmlChar_ptr(n_content, 1);
38967 
38968         ret_val = xmlTextWriterWriteCDATA(writer, content);
38969         desret_int(ret_val);
38970         call_tests++;
38971         des_xmlTextWriterPtr(n_writer, writer, 0);
38972         des_const_xmlChar_ptr(n_content, content, 1);
38973         xmlResetLastError();
38974         if (mem_base != xmlMemBlocks()) {
38975             printf("Leak of %d blocks found in xmlTextWriterWriteCDATA",
38976 	           xmlMemBlocks() - mem_base);
38977 	    test_ret++;
38978             printf(" %d", n_writer);
38979             printf(" %d", n_content);
38980             printf("\n");
38981         }
38982     }
38983     }
38984     function_tests++;
38985 #endif
38986 
38987     return(test_ret);
38988 }
38989 
38990 
38991 static int
test_xmlTextWriterWriteComment(void)38992 test_xmlTextWriterWriteComment(void) {
38993     int test_ret = 0;
38994 
38995 #if defined(LIBXML_WRITER_ENABLED)
38996     int mem_base;
38997     int ret_val;
38998     xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
38999     int n_writer;
39000     const xmlChar * content; /* comment string */
39001     int n_content;
39002 
39003     for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
39004     for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
39005         mem_base = xmlMemBlocks();
39006         writer = gen_xmlTextWriterPtr(n_writer, 0);
39007         content = gen_const_xmlChar_ptr(n_content, 1);
39008 
39009         ret_val = xmlTextWriterWriteComment(writer, content);
39010         desret_int(ret_val);
39011         call_tests++;
39012         des_xmlTextWriterPtr(n_writer, writer, 0);
39013         des_const_xmlChar_ptr(n_content, content, 1);
39014         xmlResetLastError();
39015         if (mem_base != xmlMemBlocks()) {
39016             printf("Leak of %d blocks found in xmlTextWriterWriteComment",
39017 	           xmlMemBlocks() - mem_base);
39018 	    test_ret++;
39019             printf(" %d", n_writer);
39020             printf(" %d", n_content);
39021             printf("\n");
39022         }
39023     }
39024     }
39025     function_tests++;
39026 #endif
39027 
39028     return(test_ret);
39029 }
39030 
39031 
39032 static int
test_xmlTextWriterWriteDTD(void)39033 test_xmlTextWriterWriteDTD(void) {
39034     int test_ret = 0;
39035 
39036 #if defined(LIBXML_WRITER_ENABLED)
39037     int mem_base;
39038     int ret_val;
39039     xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
39040     int n_writer;
39041     const xmlChar * name; /* the name of the DTD */
39042     int n_name;
39043     const xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
39044     int n_pubid;
39045     const xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
39046     int n_sysid;
39047     const xmlChar * subset; /* string content of the DTD */
39048     int n_subset;
39049 
39050     for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
39051     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
39052     for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
39053     for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
39054     for (n_subset = 0;n_subset < gen_nb_const_xmlChar_ptr;n_subset++) {
39055         mem_base = xmlMemBlocks();
39056         writer = gen_xmlTextWriterPtr(n_writer, 0);
39057         name = gen_const_xmlChar_ptr(n_name, 1);
39058         pubid = gen_const_xmlChar_ptr(n_pubid, 2);
39059         sysid = gen_const_xmlChar_ptr(n_sysid, 3);
39060         subset = gen_const_xmlChar_ptr(n_subset, 4);
39061 
39062         ret_val = xmlTextWriterWriteDTD(writer, name, pubid, sysid, subset);
39063         desret_int(ret_val);
39064         call_tests++;
39065         des_xmlTextWriterPtr(n_writer, writer, 0);
39066         des_const_xmlChar_ptr(n_name, name, 1);
39067         des_const_xmlChar_ptr(n_pubid, pubid, 2);
39068         des_const_xmlChar_ptr(n_sysid, sysid, 3);
39069         des_const_xmlChar_ptr(n_subset, subset, 4);
39070         xmlResetLastError();
39071         if (mem_base != xmlMemBlocks()) {
39072             printf("Leak of %d blocks found in xmlTextWriterWriteDTD",
39073 	           xmlMemBlocks() - mem_base);
39074 	    test_ret++;
39075             printf(" %d", n_writer);
39076             printf(" %d", n_name);
39077             printf(" %d", n_pubid);
39078             printf(" %d", n_sysid);
39079             printf(" %d", n_subset);
39080             printf("\n");
39081         }
39082     }
39083     }
39084     }
39085     }
39086     }
39087     function_tests++;
39088 #endif
39089 
39090     return(test_ret);
39091 }
39092 
39093 
39094 static int
test_xmlTextWriterWriteDTDAttlist(void)39095 test_xmlTextWriterWriteDTDAttlist(void) {
39096     int test_ret = 0;
39097 
39098 #if defined(LIBXML_WRITER_ENABLED)
39099     int mem_base;
39100     int ret_val;
39101     xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
39102     int n_writer;
39103     const xmlChar * name; /* the name of the DTD ATTLIST */
39104     int n_name;
39105     const xmlChar * content; /* content of the ATTLIST */
39106     int n_content;
39107 
39108     for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
39109     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
39110     for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
39111         mem_base = xmlMemBlocks();
39112         writer = gen_xmlTextWriterPtr(n_writer, 0);
39113         name = gen_const_xmlChar_ptr(n_name, 1);
39114         content = gen_const_xmlChar_ptr(n_content, 2);
39115 
39116         ret_val = xmlTextWriterWriteDTDAttlist(writer, name, content);
39117         desret_int(ret_val);
39118         call_tests++;
39119         des_xmlTextWriterPtr(n_writer, writer, 0);
39120         des_const_xmlChar_ptr(n_name, name, 1);
39121         des_const_xmlChar_ptr(n_content, content, 2);
39122         xmlResetLastError();
39123         if (mem_base != xmlMemBlocks()) {
39124             printf("Leak of %d blocks found in xmlTextWriterWriteDTDAttlist",
39125 	           xmlMemBlocks() - mem_base);
39126 	    test_ret++;
39127             printf(" %d", n_writer);
39128             printf(" %d", n_name);
39129             printf(" %d", n_content);
39130             printf("\n");
39131         }
39132     }
39133     }
39134     }
39135     function_tests++;
39136 #endif
39137 
39138     return(test_ret);
39139 }
39140 
39141 
39142 static int
test_xmlTextWriterWriteDTDElement(void)39143 test_xmlTextWriterWriteDTDElement(void) {
39144     int test_ret = 0;
39145 
39146 #if defined(LIBXML_WRITER_ENABLED)
39147     int mem_base;
39148     int ret_val;
39149     xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
39150     int n_writer;
39151     const xmlChar * name; /* the name of the DTD element */
39152     int n_name;
39153     const xmlChar * content; /* content of the element */
39154     int n_content;
39155 
39156     for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
39157     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
39158     for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
39159         mem_base = xmlMemBlocks();
39160         writer = gen_xmlTextWriterPtr(n_writer, 0);
39161         name = gen_const_xmlChar_ptr(n_name, 1);
39162         content = gen_const_xmlChar_ptr(n_content, 2);
39163 
39164         ret_val = xmlTextWriterWriteDTDElement(writer, name, content);
39165         desret_int(ret_val);
39166         call_tests++;
39167         des_xmlTextWriterPtr(n_writer, writer, 0);
39168         des_const_xmlChar_ptr(n_name, name, 1);
39169         des_const_xmlChar_ptr(n_content, content, 2);
39170         xmlResetLastError();
39171         if (mem_base != xmlMemBlocks()) {
39172             printf("Leak of %d blocks found in xmlTextWriterWriteDTDElement",
39173 	           xmlMemBlocks() - mem_base);
39174 	    test_ret++;
39175             printf(" %d", n_writer);
39176             printf(" %d", n_name);
39177             printf(" %d", n_content);
39178             printf("\n");
39179         }
39180     }
39181     }
39182     }
39183     function_tests++;
39184 #endif
39185 
39186     return(test_ret);
39187 }
39188 
39189 
39190 static int
test_xmlTextWriterWriteDTDEntity(void)39191 test_xmlTextWriterWriteDTDEntity(void) {
39192     int test_ret = 0;
39193 
39194 #if defined(LIBXML_WRITER_ENABLED)
39195     int mem_base;
39196     int ret_val;
39197     xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
39198     int n_writer;
39199     int pe; /* TRUE if this is a parameter entity, FALSE if not */
39200     int n_pe;
39201     const xmlChar * name; /* the name of the DTD entity */
39202     int n_name;
39203     const xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
39204     int n_pubid;
39205     const xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
39206     int n_sysid;
39207     const xmlChar * ndataid; /* the xml notation name. */
39208     int n_ndataid;
39209     const xmlChar * content; /* content of the entity */
39210     int n_content;
39211 
39212     for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
39213     for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
39214     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
39215     for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
39216     for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
39217     for (n_ndataid = 0;n_ndataid < gen_nb_const_xmlChar_ptr;n_ndataid++) {
39218     for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
39219         mem_base = xmlMemBlocks();
39220         writer = gen_xmlTextWriterPtr(n_writer, 0);
39221         pe = gen_int(n_pe, 1);
39222         name = gen_const_xmlChar_ptr(n_name, 2);
39223         pubid = gen_const_xmlChar_ptr(n_pubid, 3);
39224         sysid = gen_const_xmlChar_ptr(n_sysid, 4);
39225         ndataid = gen_const_xmlChar_ptr(n_ndataid, 5);
39226         content = gen_const_xmlChar_ptr(n_content, 6);
39227 
39228         ret_val = xmlTextWriterWriteDTDEntity(writer, pe, name, pubid, sysid, ndataid, content);
39229         desret_int(ret_val);
39230         call_tests++;
39231         des_xmlTextWriterPtr(n_writer, writer, 0);
39232         des_int(n_pe, pe, 1);
39233         des_const_xmlChar_ptr(n_name, name, 2);
39234         des_const_xmlChar_ptr(n_pubid, pubid, 3);
39235         des_const_xmlChar_ptr(n_sysid, sysid, 4);
39236         des_const_xmlChar_ptr(n_ndataid, ndataid, 5);
39237         des_const_xmlChar_ptr(n_content, content, 6);
39238         xmlResetLastError();
39239         if (mem_base != xmlMemBlocks()) {
39240             printf("Leak of %d blocks found in xmlTextWriterWriteDTDEntity",
39241 	           xmlMemBlocks() - mem_base);
39242 	    test_ret++;
39243             printf(" %d", n_writer);
39244             printf(" %d", n_pe);
39245             printf(" %d", n_name);
39246             printf(" %d", n_pubid);
39247             printf(" %d", n_sysid);
39248             printf(" %d", n_ndataid);
39249             printf(" %d", n_content);
39250             printf("\n");
39251         }
39252     }
39253     }
39254     }
39255     }
39256     }
39257     }
39258     }
39259     function_tests++;
39260 #endif
39261 
39262     return(test_ret);
39263 }
39264 
39265 
39266 static int
test_xmlTextWriterWriteDTDExternalEntity(void)39267 test_xmlTextWriterWriteDTDExternalEntity(void) {
39268     int test_ret = 0;
39269 
39270 #if defined(LIBXML_WRITER_ENABLED)
39271     int mem_base;
39272     int ret_val;
39273     xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
39274     int n_writer;
39275     int pe; /* TRUE if this is a parameter entity, FALSE if not */
39276     int n_pe;
39277     const xmlChar * name; /* the name of the DTD entity */
39278     int n_name;
39279     const xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
39280     int n_pubid;
39281     const xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
39282     int n_sysid;
39283     const xmlChar * ndataid; /* the xml notation name. */
39284     int n_ndataid;
39285 
39286     for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
39287     for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
39288     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
39289     for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
39290     for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
39291     for (n_ndataid = 0;n_ndataid < gen_nb_const_xmlChar_ptr;n_ndataid++) {
39292         mem_base = xmlMemBlocks();
39293         writer = gen_xmlTextWriterPtr(n_writer, 0);
39294         pe = gen_int(n_pe, 1);
39295         name = gen_const_xmlChar_ptr(n_name, 2);
39296         pubid = gen_const_xmlChar_ptr(n_pubid, 3);
39297         sysid = gen_const_xmlChar_ptr(n_sysid, 4);
39298         ndataid = gen_const_xmlChar_ptr(n_ndataid, 5);
39299 
39300         ret_val = xmlTextWriterWriteDTDExternalEntity(writer, pe, name, pubid, sysid, ndataid);
39301         desret_int(ret_val);
39302         call_tests++;
39303         des_xmlTextWriterPtr(n_writer, writer, 0);
39304         des_int(n_pe, pe, 1);
39305         des_const_xmlChar_ptr(n_name, name, 2);
39306         des_const_xmlChar_ptr(n_pubid, pubid, 3);
39307         des_const_xmlChar_ptr(n_sysid, sysid, 4);
39308         des_const_xmlChar_ptr(n_ndataid, ndataid, 5);
39309         xmlResetLastError();
39310         if (mem_base != xmlMemBlocks()) {
39311             printf("Leak of %d blocks found in xmlTextWriterWriteDTDExternalEntity",
39312 	           xmlMemBlocks() - mem_base);
39313 	    test_ret++;
39314             printf(" %d", n_writer);
39315             printf(" %d", n_pe);
39316             printf(" %d", n_name);
39317             printf(" %d", n_pubid);
39318             printf(" %d", n_sysid);
39319             printf(" %d", n_ndataid);
39320             printf("\n");
39321         }
39322     }
39323     }
39324     }
39325     }
39326     }
39327     }
39328     function_tests++;
39329 #endif
39330 
39331     return(test_ret);
39332 }
39333 
39334 
39335 static int
test_xmlTextWriterWriteDTDExternalEntityContents(void)39336 test_xmlTextWriterWriteDTDExternalEntityContents(void) {
39337     int test_ret = 0;
39338 
39339 #if defined(LIBXML_WRITER_ENABLED)
39340     int mem_base;
39341     int ret_val;
39342     xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
39343     int n_writer;
39344     const xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
39345     int n_pubid;
39346     const xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
39347     int n_sysid;
39348     const xmlChar * ndataid; /* the xml notation name. */
39349     int n_ndataid;
39350 
39351     for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
39352     for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
39353     for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
39354     for (n_ndataid = 0;n_ndataid < gen_nb_const_xmlChar_ptr;n_ndataid++) {
39355         mem_base = xmlMemBlocks();
39356         writer = gen_xmlTextWriterPtr(n_writer, 0);
39357         pubid = gen_const_xmlChar_ptr(n_pubid, 1);
39358         sysid = gen_const_xmlChar_ptr(n_sysid, 2);
39359         ndataid = gen_const_xmlChar_ptr(n_ndataid, 3);
39360 
39361         ret_val = xmlTextWriterWriteDTDExternalEntityContents(writer, pubid, sysid, ndataid);
39362         desret_int(ret_val);
39363         call_tests++;
39364         des_xmlTextWriterPtr(n_writer, writer, 0);
39365         des_const_xmlChar_ptr(n_pubid, pubid, 1);
39366         des_const_xmlChar_ptr(n_sysid, sysid, 2);
39367         des_const_xmlChar_ptr(n_ndataid, ndataid, 3);
39368         xmlResetLastError();
39369         if (mem_base != xmlMemBlocks()) {
39370             printf("Leak of %d blocks found in xmlTextWriterWriteDTDExternalEntityContents",
39371 	           xmlMemBlocks() - mem_base);
39372 	    test_ret++;
39373             printf(" %d", n_writer);
39374             printf(" %d", n_pubid);
39375             printf(" %d", n_sysid);
39376             printf(" %d", n_ndataid);
39377             printf("\n");
39378         }
39379     }
39380     }
39381     }
39382     }
39383     function_tests++;
39384 #endif
39385 
39386     return(test_ret);
39387 }
39388 
39389 
39390 static int
test_xmlTextWriterWriteDTDInternalEntity(void)39391 test_xmlTextWriterWriteDTDInternalEntity(void) {
39392     int test_ret = 0;
39393 
39394 #if defined(LIBXML_WRITER_ENABLED)
39395     int mem_base;
39396     int ret_val;
39397     xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
39398     int n_writer;
39399     int pe; /* TRUE if this is a parameter entity, FALSE if not */
39400     int n_pe;
39401     const xmlChar * name; /* the name of the DTD entity */
39402     int n_name;
39403     const xmlChar * content; /* content of the entity */
39404     int n_content;
39405 
39406     for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
39407     for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
39408     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
39409     for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
39410         mem_base = xmlMemBlocks();
39411         writer = gen_xmlTextWriterPtr(n_writer, 0);
39412         pe = gen_int(n_pe, 1);
39413         name = gen_const_xmlChar_ptr(n_name, 2);
39414         content = gen_const_xmlChar_ptr(n_content, 3);
39415 
39416         ret_val = xmlTextWriterWriteDTDInternalEntity(writer, pe, name, content);
39417         desret_int(ret_val);
39418         call_tests++;
39419         des_xmlTextWriterPtr(n_writer, writer, 0);
39420         des_int(n_pe, pe, 1);
39421         des_const_xmlChar_ptr(n_name, name, 2);
39422         des_const_xmlChar_ptr(n_content, content, 3);
39423         xmlResetLastError();
39424         if (mem_base != xmlMemBlocks()) {
39425             printf("Leak of %d blocks found in xmlTextWriterWriteDTDInternalEntity",
39426 	           xmlMemBlocks() - mem_base);
39427 	    test_ret++;
39428             printf(" %d", n_writer);
39429             printf(" %d", n_pe);
39430             printf(" %d", n_name);
39431             printf(" %d", n_content);
39432             printf("\n");
39433         }
39434     }
39435     }
39436     }
39437     }
39438     function_tests++;
39439 #endif
39440 
39441     return(test_ret);
39442 }
39443 
39444 
39445 static int
test_xmlTextWriterWriteDTDNotation(void)39446 test_xmlTextWriterWriteDTDNotation(void) {
39447     int test_ret = 0;
39448 
39449 #if defined(LIBXML_WRITER_ENABLED)
39450     int mem_base;
39451     int ret_val;
39452     xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
39453     int n_writer;
39454     const xmlChar * name; /* the name of the xml notation */
39455     int n_name;
39456     const xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
39457     int n_pubid;
39458     const xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
39459     int n_sysid;
39460 
39461     for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
39462     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
39463     for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
39464     for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
39465         mem_base = xmlMemBlocks();
39466         writer = gen_xmlTextWriterPtr(n_writer, 0);
39467         name = gen_const_xmlChar_ptr(n_name, 1);
39468         pubid = gen_const_xmlChar_ptr(n_pubid, 2);
39469         sysid = gen_const_xmlChar_ptr(n_sysid, 3);
39470 
39471         ret_val = xmlTextWriterWriteDTDNotation(writer, name, pubid, sysid);
39472         desret_int(ret_val);
39473         call_tests++;
39474         des_xmlTextWriterPtr(n_writer, writer, 0);
39475         des_const_xmlChar_ptr(n_name, name, 1);
39476         des_const_xmlChar_ptr(n_pubid, pubid, 2);
39477         des_const_xmlChar_ptr(n_sysid, sysid, 3);
39478         xmlResetLastError();
39479         if (mem_base != xmlMemBlocks()) {
39480             printf("Leak of %d blocks found in xmlTextWriterWriteDTDNotation",
39481 	           xmlMemBlocks() - mem_base);
39482 	    test_ret++;
39483             printf(" %d", n_writer);
39484             printf(" %d", n_name);
39485             printf(" %d", n_pubid);
39486             printf(" %d", n_sysid);
39487             printf("\n");
39488         }
39489     }
39490     }
39491     }
39492     }
39493     function_tests++;
39494 #endif
39495 
39496     return(test_ret);
39497 }
39498 
39499 
39500 static int
test_xmlTextWriterWriteElement(void)39501 test_xmlTextWriterWriteElement(void) {
39502     int test_ret = 0;
39503 
39504 #if defined(LIBXML_WRITER_ENABLED)
39505     int mem_base;
39506     int ret_val;
39507     xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
39508     int n_writer;
39509     const xmlChar * name; /* element name */
39510     int n_name;
39511     const xmlChar * content; /* element content */
39512     int n_content;
39513 
39514     for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
39515     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
39516     for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
39517         mem_base = xmlMemBlocks();
39518         writer = gen_xmlTextWriterPtr(n_writer, 0);
39519         name = gen_const_xmlChar_ptr(n_name, 1);
39520         content = gen_const_xmlChar_ptr(n_content, 2);
39521 
39522         ret_val = xmlTextWriterWriteElement(writer, name, content);
39523         desret_int(ret_val);
39524         call_tests++;
39525         des_xmlTextWriterPtr(n_writer, writer, 0);
39526         des_const_xmlChar_ptr(n_name, name, 1);
39527         des_const_xmlChar_ptr(n_content, content, 2);
39528         xmlResetLastError();
39529         if (mem_base != xmlMemBlocks()) {
39530             printf("Leak of %d blocks found in xmlTextWriterWriteElement",
39531 	           xmlMemBlocks() - mem_base);
39532 	    test_ret++;
39533             printf(" %d", n_writer);
39534             printf(" %d", n_name);
39535             printf(" %d", n_content);
39536             printf("\n");
39537         }
39538     }
39539     }
39540     }
39541     function_tests++;
39542 #endif
39543 
39544     return(test_ret);
39545 }
39546 
39547 
39548 static int
test_xmlTextWriterWriteElementNS(void)39549 test_xmlTextWriterWriteElementNS(void) {
39550     int test_ret = 0;
39551 
39552 #if defined(LIBXML_WRITER_ENABLED)
39553     int mem_base;
39554     int ret_val;
39555     xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
39556     int n_writer;
39557     const xmlChar * prefix; /* namespace prefix */
39558     int n_prefix;
39559     const xmlChar * name; /* element local name */
39560     int n_name;
39561     const xmlChar * namespaceURI; /* namespace URI */
39562     int n_namespaceURI;
39563     const xmlChar * content; /* element content */
39564     int n_content;
39565 
39566     for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
39567     for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
39568     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
39569     for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
39570     for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
39571         mem_base = xmlMemBlocks();
39572         writer = gen_xmlTextWriterPtr(n_writer, 0);
39573         prefix = gen_const_xmlChar_ptr(n_prefix, 1);
39574         name = gen_const_xmlChar_ptr(n_name, 2);
39575         namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
39576         content = gen_const_xmlChar_ptr(n_content, 4);
39577 
39578         ret_val = xmlTextWriterWriteElementNS(writer, prefix, name, namespaceURI, content);
39579         desret_int(ret_val);
39580         call_tests++;
39581         des_xmlTextWriterPtr(n_writer, writer, 0);
39582         des_const_xmlChar_ptr(n_prefix, prefix, 1);
39583         des_const_xmlChar_ptr(n_name, name, 2);
39584         des_const_xmlChar_ptr(n_namespaceURI, namespaceURI, 3);
39585         des_const_xmlChar_ptr(n_content, content, 4);
39586         xmlResetLastError();
39587         if (mem_base != xmlMemBlocks()) {
39588             printf("Leak of %d blocks found in xmlTextWriterWriteElementNS",
39589 	           xmlMemBlocks() - mem_base);
39590 	    test_ret++;
39591             printf(" %d", n_writer);
39592             printf(" %d", n_prefix);
39593             printf(" %d", n_name);
39594             printf(" %d", n_namespaceURI);
39595             printf(" %d", n_content);
39596             printf("\n");
39597         }
39598     }
39599     }
39600     }
39601     }
39602     }
39603     function_tests++;
39604 #endif
39605 
39606     return(test_ret);
39607 }
39608 
39609 
39610 static int
test_xmlTextWriterWriteFormatAttribute(void)39611 test_xmlTextWriterWriteFormatAttribute(void) {
39612     int test_ret = 0;
39613 
39614 
39615     /* missing type support */
39616     return(test_ret);
39617 }
39618 
39619 
39620 static int
test_xmlTextWriterWriteFormatAttributeNS(void)39621 test_xmlTextWriterWriteFormatAttributeNS(void) {
39622     int test_ret = 0;
39623 
39624 
39625     /* missing type support */
39626     return(test_ret);
39627 }
39628 
39629 
39630 static int
test_xmlTextWriterWriteFormatCDATA(void)39631 test_xmlTextWriterWriteFormatCDATA(void) {
39632     int test_ret = 0;
39633 
39634 
39635     /* missing type support */
39636     return(test_ret);
39637 }
39638 
39639 
39640 static int
test_xmlTextWriterWriteFormatComment(void)39641 test_xmlTextWriterWriteFormatComment(void) {
39642     int test_ret = 0;
39643 
39644 
39645     /* missing type support */
39646     return(test_ret);
39647 }
39648 
39649 
39650 static int
test_xmlTextWriterWriteFormatDTD(void)39651 test_xmlTextWriterWriteFormatDTD(void) {
39652     int test_ret = 0;
39653 
39654 
39655     /* missing type support */
39656     return(test_ret);
39657 }
39658 
39659 
39660 static int
test_xmlTextWriterWriteFormatDTDAttlist(void)39661 test_xmlTextWriterWriteFormatDTDAttlist(void) {
39662     int test_ret = 0;
39663 
39664 
39665     /* missing type support */
39666     return(test_ret);
39667 }
39668 
39669 
39670 static int
test_xmlTextWriterWriteFormatDTDElement(void)39671 test_xmlTextWriterWriteFormatDTDElement(void) {
39672     int test_ret = 0;
39673 
39674 
39675     /* missing type support */
39676     return(test_ret);
39677 }
39678 
39679 
39680 static int
test_xmlTextWriterWriteFormatDTDInternalEntity(void)39681 test_xmlTextWriterWriteFormatDTDInternalEntity(void) {
39682     int test_ret = 0;
39683 
39684 
39685     /* missing type support */
39686     return(test_ret);
39687 }
39688 
39689 
39690 static int
test_xmlTextWriterWriteFormatElement(void)39691 test_xmlTextWriterWriteFormatElement(void) {
39692     int test_ret = 0;
39693 
39694 
39695     /* missing type support */
39696     return(test_ret);
39697 }
39698 
39699 
39700 static int
test_xmlTextWriterWriteFormatElementNS(void)39701 test_xmlTextWriterWriteFormatElementNS(void) {
39702     int test_ret = 0;
39703 
39704 
39705     /* missing type support */
39706     return(test_ret);
39707 }
39708 
39709 
39710 static int
test_xmlTextWriterWriteFormatPI(void)39711 test_xmlTextWriterWriteFormatPI(void) {
39712     int test_ret = 0;
39713 
39714 
39715     /* missing type support */
39716     return(test_ret);
39717 }
39718 
39719 
39720 static int
test_xmlTextWriterWriteFormatRaw(void)39721 test_xmlTextWriterWriteFormatRaw(void) {
39722     int test_ret = 0;
39723 
39724 
39725     /* missing type support */
39726     return(test_ret);
39727 }
39728 
39729 
39730 static int
test_xmlTextWriterWriteFormatString(void)39731 test_xmlTextWriterWriteFormatString(void) {
39732     int test_ret = 0;
39733 
39734 
39735     /* missing type support */
39736     return(test_ret);
39737 }
39738 
39739 
39740 static int
test_xmlTextWriterWritePI(void)39741 test_xmlTextWriterWritePI(void) {
39742     int test_ret = 0;
39743 
39744 #if defined(LIBXML_WRITER_ENABLED)
39745     int mem_base;
39746     int ret_val;
39747     xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
39748     int n_writer;
39749     const xmlChar * target; /* PI target */
39750     int n_target;
39751     const xmlChar * content; /* PI content */
39752     int n_content;
39753 
39754     for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
39755     for (n_target = 0;n_target < gen_nb_const_xmlChar_ptr;n_target++) {
39756     for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
39757         mem_base = xmlMemBlocks();
39758         writer = gen_xmlTextWriterPtr(n_writer, 0);
39759         target = gen_const_xmlChar_ptr(n_target, 1);
39760         content = gen_const_xmlChar_ptr(n_content, 2);
39761 
39762         ret_val = xmlTextWriterWritePI(writer, target, content);
39763         desret_int(ret_val);
39764         call_tests++;
39765         des_xmlTextWriterPtr(n_writer, writer, 0);
39766         des_const_xmlChar_ptr(n_target, target, 1);
39767         des_const_xmlChar_ptr(n_content, content, 2);
39768         xmlResetLastError();
39769         if (mem_base != xmlMemBlocks()) {
39770             printf("Leak of %d blocks found in xmlTextWriterWritePI",
39771 	           xmlMemBlocks() - mem_base);
39772 	    test_ret++;
39773             printf(" %d", n_writer);
39774             printf(" %d", n_target);
39775             printf(" %d", n_content);
39776             printf("\n");
39777         }
39778     }
39779     }
39780     }
39781     function_tests++;
39782 #endif
39783 
39784     return(test_ret);
39785 }
39786 
39787 
39788 static int
test_xmlTextWriterWriteRaw(void)39789 test_xmlTextWriterWriteRaw(void) {
39790     int test_ret = 0;
39791 
39792 #if defined(LIBXML_WRITER_ENABLED)
39793     int mem_base;
39794     int ret_val;
39795     xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
39796     int n_writer;
39797     const xmlChar * content; /* text string */
39798     int n_content;
39799 
39800     for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
39801     for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
39802         mem_base = xmlMemBlocks();
39803         writer = gen_xmlTextWriterPtr(n_writer, 0);
39804         content = gen_const_xmlChar_ptr(n_content, 1);
39805 
39806         ret_val = xmlTextWriterWriteRaw(writer, content);
39807         desret_int(ret_val);
39808         call_tests++;
39809         des_xmlTextWriterPtr(n_writer, writer, 0);
39810         des_const_xmlChar_ptr(n_content, content, 1);
39811         xmlResetLastError();
39812         if (mem_base != xmlMemBlocks()) {
39813             printf("Leak of %d blocks found in xmlTextWriterWriteRaw",
39814 	           xmlMemBlocks() - mem_base);
39815 	    test_ret++;
39816             printf(" %d", n_writer);
39817             printf(" %d", n_content);
39818             printf("\n");
39819         }
39820     }
39821     }
39822     function_tests++;
39823 #endif
39824 
39825     return(test_ret);
39826 }
39827 
39828 
39829 static int
test_xmlTextWriterWriteRawLen(void)39830 test_xmlTextWriterWriteRawLen(void) {
39831     int test_ret = 0;
39832 
39833 #if defined(LIBXML_WRITER_ENABLED)
39834     int mem_base;
39835     int ret_val;
39836     xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
39837     int n_writer;
39838     const xmlChar * content; /* text string */
39839     int n_content;
39840     int len; /* length of the text string */
39841     int n_len;
39842 
39843     for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
39844     for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
39845     for (n_len = 0;n_len < gen_nb_int;n_len++) {
39846         mem_base = xmlMemBlocks();
39847         writer = gen_xmlTextWriterPtr(n_writer, 0);
39848         content = gen_const_xmlChar_ptr(n_content, 1);
39849         len = gen_int(n_len, 2);
39850         if ((content != NULL) &&
39851             (len > xmlStrlen(BAD_CAST content)))
39852             len = 0;
39853 
39854         ret_val = xmlTextWriterWriteRawLen(writer, content, len);
39855         desret_int(ret_val);
39856         call_tests++;
39857         des_xmlTextWriterPtr(n_writer, writer, 0);
39858         des_const_xmlChar_ptr(n_content, content, 1);
39859         des_int(n_len, len, 2);
39860         xmlResetLastError();
39861         if (mem_base != xmlMemBlocks()) {
39862             printf("Leak of %d blocks found in xmlTextWriterWriteRawLen",
39863 	           xmlMemBlocks() - mem_base);
39864 	    test_ret++;
39865             printf(" %d", n_writer);
39866             printf(" %d", n_content);
39867             printf(" %d", n_len);
39868             printf("\n");
39869         }
39870     }
39871     }
39872     }
39873     function_tests++;
39874 #endif
39875 
39876     return(test_ret);
39877 }
39878 
39879 
39880 static int
test_xmlTextWriterWriteString(void)39881 test_xmlTextWriterWriteString(void) {
39882     int test_ret = 0;
39883 
39884 #if defined(LIBXML_WRITER_ENABLED)
39885     int mem_base;
39886     int ret_val;
39887     xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
39888     int n_writer;
39889     const xmlChar * content; /* text string */
39890     int n_content;
39891 
39892     for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
39893     for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
39894         mem_base = xmlMemBlocks();
39895         writer = gen_xmlTextWriterPtr(n_writer, 0);
39896         content = gen_const_xmlChar_ptr(n_content, 1);
39897 
39898         ret_val = xmlTextWriterWriteString(writer, content);
39899         desret_int(ret_val);
39900         call_tests++;
39901         des_xmlTextWriterPtr(n_writer, writer, 0);
39902         des_const_xmlChar_ptr(n_content, content, 1);
39903         xmlResetLastError();
39904         if (mem_base != xmlMemBlocks()) {
39905             printf("Leak of %d blocks found in xmlTextWriterWriteString",
39906 	           xmlMemBlocks() - mem_base);
39907 	    test_ret++;
39908             printf(" %d", n_writer);
39909             printf(" %d", n_content);
39910             printf("\n");
39911         }
39912     }
39913     }
39914     function_tests++;
39915 #endif
39916 
39917     return(test_ret);
39918 }
39919 
39920 
39921 static int
test_xmlTextWriterWriteVFormatAttribute(void)39922 test_xmlTextWriterWriteVFormatAttribute(void) {
39923     int test_ret = 0;
39924 
39925 
39926     /* missing type support */
39927     return(test_ret);
39928 }
39929 
39930 
39931 static int
test_xmlTextWriterWriteVFormatAttributeNS(void)39932 test_xmlTextWriterWriteVFormatAttributeNS(void) {
39933     int test_ret = 0;
39934 
39935 
39936     /* missing type support */
39937     return(test_ret);
39938 }
39939 
39940 
39941 static int
test_xmlTextWriterWriteVFormatCDATA(void)39942 test_xmlTextWriterWriteVFormatCDATA(void) {
39943     int test_ret = 0;
39944 
39945 
39946     /* missing type support */
39947     return(test_ret);
39948 }
39949 
39950 
39951 static int
test_xmlTextWriterWriteVFormatComment(void)39952 test_xmlTextWriterWriteVFormatComment(void) {
39953     int test_ret = 0;
39954 
39955 
39956     /* missing type support */
39957     return(test_ret);
39958 }
39959 
39960 
39961 static int
test_xmlTextWriterWriteVFormatDTD(void)39962 test_xmlTextWriterWriteVFormatDTD(void) {
39963     int test_ret = 0;
39964 
39965 
39966     /* missing type support */
39967     return(test_ret);
39968 }
39969 
39970 
39971 static int
test_xmlTextWriterWriteVFormatDTDAttlist(void)39972 test_xmlTextWriterWriteVFormatDTDAttlist(void) {
39973     int test_ret = 0;
39974 
39975 
39976     /* missing type support */
39977     return(test_ret);
39978 }
39979 
39980 
39981 static int
test_xmlTextWriterWriteVFormatDTDElement(void)39982 test_xmlTextWriterWriteVFormatDTDElement(void) {
39983     int test_ret = 0;
39984 
39985 
39986     /* missing type support */
39987     return(test_ret);
39988 }
39989 
39990 
39991 static int
test_xmlTextWriterWriteVFormatDTDInternalEntity(void)39992 test_xmlTextWriterWriteVFormatDTDInternalEntity(void) {
39993     int test_ret = 0;
39994 
39995 
39996     /* missing type support */
39997     return(test_ret);
39998 }
39999 
40000 
40001 static int
test_xmlTextWriterWriteVFormatElement(void)40002 test_xmlTextWriterWriteVFormatElement(void) {
40003     int test_ret = 0;
40004 
40005 
40006     /* missing type support */
40007     return(test_ret);
40008 }
40009 
40010 
40011 static int
test_xmlTextWriterWriteVFormatElementNS(void)40012 test_xmlTextWriterWriteVFormatElementNS(void) {
40013     int test_ret = 0;
40014 
40015 
40016     /* missing type support */
40017     return(test_ret);
40018 }
40019 
40020 
40021 static int
test_xmlTextWriterWriteVFormatPI(void)40022 test_xmlTextWriterWriteVFormatPI(void) {
40023     int test_ret = 0;
40024 
40025 
40026     /* missing type support */
40027     return(test_ret);
40028 }
40029 
40030 
40031 static int
test_xmlTextWriterWriteVFormatRaw(void)40032 test_xmlTextWriterWriteVFormatRaw(void) {
40033     int test_ret = 0;
40034 
40035 
40036     /* missing type support */
40037     return(test_ret);
40038 }
40039 
40040 
40041 static int
test_xmlTextWriterWriteVFormatString(void)40042 test_xmlTextWriterWriteVFormatString(void) {
40043     int test_ret = 0;
40044 
40045 
40046     /* missing type support */
40047     return(test_ret);
40048 }
40049 
40050 static int
test_xmlwriter(void)40051 test_xmlwriter(void) {
40052     int test_ret = 0;
40053 
40054     if (quiet == 0) printf("Testing xmlwriter : 53 of 81 functions ...\n");
40055     test_ret += test_xmlNewTextWriter();
40056     test_ret += test_xmlNewTextWriterFilename();
40057     test_ret += test_xmlNewTextWriterMemory();
40058     test_ret += test_xmlNewTextWriterPushParser();
40059     test_ret += test_xmlNewTextWriterTree();
40060     test_ret += test_xmlTextWriterClose();
40061     test_ret += test_xmlTextWriterEndAttribute();
40062     test_ret += test_xmlTextWriterEndCDATA();
40063     test_ret += test_xmlTextWriterEndComment();
40064     test_ret += test_xmlTextWriterEndDTD();
40065     test_ret += test_xmlTextWriterEndDTDAttlist();
40066     test_ret += test_xmlTextWriterEndDTDElement();
40067     test_ret += test_xmlTextWriterEndDTDEntity();
40068     test_ret += test_xmlTextWriterEndDocument();
40069     test_ret += test_xmlTextWriterEndElement();
40070     test_ret += test_xmlTextWriterEndPI();
40071     test_ret += test_xmlTextWriterFlush();
40072     test_ret += test_xmlTextWriterFullEndElement();
40073     test_ret += test_xmlTextWriterSetIndent();
40074     test_ret += test_xmlTextWriterSetIndentString();
40075     test_ret += test_xmlTextWriterSetQuoteChar();
40076     test_ret += test_xmlTextWriterStartAttribute();
40077     test_ret += test_xmlTextWriterStartAttributeNS();
40078     test_ret += test_xmlTextWriterStartCDATA();
40079     test_ret += test_xmlTextWriterStartComment();
40080     test_ret += test_xmlTextWriterStartDTD();
40081     test_ret += test_xmlTextWriterStartDTDAttlist();
40082     test_ret += test_xmlTextWriterStartDTDElement();
40083     test_ret += test_xmlTextWriterStartDTDEntity();
40084     test_ret += test_xmlTextWriterStartDocument();
40085     test_ret += test_xmlTextWriterStartElement();
40086     test_ret += test_xmlTextWriterStartElementNS();
40087     test_ret += test_xmlTextWriterStartPI();
40088     test_ret += test_xmlTextWriterWriteAttribute();
40089     test_ret += test_xmlTextWriterWriteAttributeNS();
40090     test_ret += test_xmlTextWriterWriteBase64();
40091     test_ret += test_xmlTextWriterWriteBinHex();
40092     test_ret += test_xmlTextWriterWriteCDATA();
40093     test_ret += test_xmlTextWriterWriteComment();
40094     test_ret += test_xmlTextWriterWriteDTD();
40095     test_ret += test_xmlTextWriterWriteDTDAttlist();
40096     test_ret += test_xmlTextWriterWriteDTDElement();
40097     test_ret += test_xmlTextWriterWriteDTDEntity();
40098     test_ret += test_xmlTextWriterWriteDTDExternalEntity();
40099     test_ret += test_xmlTextWriterWriteDTDExternalEntityContents();
40100     test_ret += test_xmlTextWriterWriteDTDInternalEntity();
40101     test_ret += test_xmlTextWriterWriteDTDNotation();
40102     test_ret += test_xmlTextWriterWriteElement();
40103     test_ret += test_xmlTextWriterWriteElementNS();
40104     test_ret += test_xmlTextWriterWriteFormatAttribute();
40105     test_ret += test_xmlTextWriterWriteFormatAttributeNS();
40106     test_ret += test_xmlTextWriterWriteFormatCDATA();
40107     test_ret += test_xmlTextWriterWriteFormatComment();
40108     test_ret += test_xmlTextWriterWriteFormatDTD();
40109     test_ret += test_xmlTextWriterWriteFormatDTDAttlist();
40110     test_ret += test_xmlTextWriterWriteFormatDTDElement();
40111     test_ret += test_xmlTextWriterWriteFormatDTDInternalEntity();
40112     test_ret += test_xmlTextWriterWriteFormatElement();
40113     test_ret += test_xmlTextWriterWriteFormatElementNS();
40114     test_ret += test_xmlTextWriterWriteFormatPI();
40115     test_ret += test_xmlTextWriterWriteFormatRaw();
40116     test_ret += test_xmlTextWriterWriteFormatString();
40117     test_ret += test_xmlTextWriterWritePI();
40118     test_ret += test_xmlTextWriterWriteRaw();
40119     test_ret += test_xmlTextWriterWriteRawLen();
40120     test_ret += test_xmlTextWriterWriteString();
40121     test_ret += test_xmlTextWriterWriteVFormatAttribute();
40122     test_ret += test_xmlTextWriterWriteVFormatAttributeNS();
40123     test_ret += test_xmlTextWriterWriteVFormatCDATA();
40124     test_ret += test_xmlTextWriterWriteVFormatComment();
40125     test_ret += test_xmlTextWriterWriteVFormatDTD();
40126     test_ret += test_xmlTextWriterWriteVFormatDTDAttlist();
40127     test_ret += test_xmlTextWriterWriteVFormatDTDElement();
40128     test_ret += test_xmlTextWriterWriteVFormatDTDInternalEntity();
40129     test_ret += test_xmlTextWriterWriteVFormatElement();
40130     test_ret += test_xmlTextWriterWriteVFormatElementNS();
40131     test_ret += test_xmlTextWriterWriteVFormatPI();
40132     test_ret += test_xmlTextWriterWriteVFormatRaw();
40133     test_ret += test_xmlTextWriterWriteVFormatString();
40134 
40135     if (test_ret != 0)
40136 	printf("Module xmlwriter: %d errors\n", test_ret);
40137     return(test_ret);
40138 }
40139 
40140 static int
test_xmlXPathCastBooleanToNumber(void)40141 test_xmlXPathCastBooleanToNumber(void) {
40142     int test_ret = 0;
40143 
40144 #if defined(LIBXML_XPATH_ENABLED)
40145     int mem_base;
40146     double ret_val;
40147     int val; /* a boolean */
40148     int n_val;
40149 
40150     for (n_val = 0;n_val < gen_nb_int;n_val++) {
40151         mem_base = xmlMemBlocks();
40152         val = gen_int(n_val, 0);
40153 
40154         ret_val = xmlXPathCastBooleanToNumber(val);
40155         desret_double(ret_val);
40156         call_tests++;
40157         des_int(n_val, val, 0);
40158         xmlResetLastError();
40159         if (mem_base != xmlMemBlocks()) {
40160             printf("Leak of %d blocks found in xmlXPathCastBooleanToNumber",
40161 	           xmlMemBlocks() - mem_base);
40162 	    test_ret++;
40163             printf(" %d", n_val);
40164             printf("\n");
40165         }
40166     }
40167     function_tests++;
40168 #endif
40169 
40170     return(test_ret);
40171 }
40172 
40173 
40174 static int
test_xmlXPathCastBooleanToString(void)40175 test_xmlXPathCastBooleanToString(void) {
40176     int test_ret = 0;
40177 
40178 #if defined(LIBXML_XPATH_ENABLED)
40179     int mem_base;
40180     xmlChar * ret_val;
40181     int val; /* a boolean */
40182     int n_val;
40183 
40184     for (n_val = 0;n_val < gen_nb_int;n_val++) {
40185         mem_base = xmlMemBlocks();
40186         val = gen_int(n_val, 0);
40187 
40188         ret_val = xmlXPathCastBooleanToString(val);
40189         desret_xmlChar_ptr(ret_val);
40190         call_tests++;
40191         des_int(n_val, val, 0);
40192         xmlResetLastError();
40193         if (mem_base != xmlMemBlocks()) {
40194             printf("Leak of %d blocks found in xmlXPathCastBooleanToString",
40195 	           xmlMemBlocks() - mem_base);
40196 	    test_ret++;
40197             printf(" %d", n_val);
40198             printf("\n");
40199         }
40200     }
40201     function_tests++;
40202 #endif
40203 
40204     return(test_ret);
40205 }
40206 
40207 
40208 static int
test_xmlXPathCastNodeSetToBoolean(void)40209 test_xmlXPathCastNodeSetToBoolean(void) {
40210     int test_ret = 0;
40211 
40212 #if defined(LIBXML_XPATH_ENABLED)
40213     int mem_base;
40214     int ret_val;
40215     xmlNodeSetPtr ns; /* a node-set */
40216     int n_ns;
40217 
40218     for (n_ns = 0;n_ns < gen_nb_xmlNodeSetPtr;n_ns++) {
40219         mem_base = xmlMemBlocks();
40220         ns = gen_xmlNodeSetPtr(n_ns, 0);
40221 
40222         ret_val = xmlXPathCastNodeSetToBoolean(ns);
40223         desret_int(ret_val);
40224         call_tests++;
40225         des_xmlNodeSetPtr(n_ns, ns, 0);
40226         xmlResetLastError();
40227         if (mem_base != xmlMemBlocks()) {
40228             printf("Leak of %d blocks found in xmlXPathCastNodeSetToBoolean",
40229 	           xmlMemBlocks() - mem_base);
40230 	    test_ret++;
40231             printf(" %d", n_ns);
40232             printf("\n");
40233         }
40234     }
40235     function_tests++;
40236 #endif
40237 
40238     return(test_ret);
40239 }
40240 
40241 
40242 static int
test_xmlXPathCastNodeSetToNumber(void)40243 test_xmlXPathCastNodeSetToNumber(void) {
40244     int test_ret = 0;
40245 
40246 #if defined(LIBXML_XPATH_ENABLED)
40247     int mem_base;
40248     double ret_val;
40249     xmlNodeSetPtr ns; /* a node-set */
40250     int n_ns;
40251 
40252     for (n_ns = 0;n_ns < gen_nb_xmlNodeSetPtr;n_ns++) {
40253         mem_base = xmlMemBlocks();
40254         ns = gen_xmlNodeSetPtr(n_ns, 0);
40255 
40256         ret_val = xmlXPathCastNodeSetToNumber(ns);
40257         desret_double(ret_val);
40258         call_tests++;
40259         des_xmlNodeSetPtr(n_ns, ns, 0);
40260         xmlResetLastError();
40261         if (mem_base != xmlMemBlocks()) {
40262             printf("Leak of %d blocks found in xmlXPathCastNodeSetToNumber",
40263 	           xmlMemBlocks() - mem_base);
40264 	    test_ret++;
40265             printf(" %d", n_ns);
40266             printf("\n");
40267         }
40268     }
40269     function_tests++;
40270 #endif
40271 
40272     return(test_ret);
40273 }
40274 
40275 
40276 static int
test_xmlXPathCastNodeSetToString(void)40277 test_xmlXPathCastNodeSetToString(void) {
40278     int test_ret = 0;
40279 
40280 #if defined(LIBXML_XPATH_ENABLED)
40281     int mem_base;
40282     xmlChar * ret_val;
40283     xmlNodeSetPtr ns; /* a node-set */
40284     int n_ns;
40285 
40286     for (n_ns = 0;n_ns < gen_nb_xmlNodeSetPtr;n_ns++) {
40287         mem_base = xmlMemBlocks();
40288         ns = gen_xmlNodeSetPtr(n_ns, 0);
40289 
40290         ret_val = xmlXPathCastNodeSetToString(ns);
40291         desret_xmlChar_ptr(ret_val);
40292         call_tests++;
40293         des_xmlNodeSetPtr(n_ns, ns, 0);
40294         xmlResetLastError();
40295         if (mem_base != xmlMemBlocks()) {
40296             printf("Leak of %d blocks found in xmlXPathCastNodeSetToString",
40297 	           xmlMemBlocks() - mem_base);
40298 	    test_ret++;
40299             printf(" %d", n_ns);
40300             printf("\n");
40301         }
40302     }
40303     function_tests++;
40304 #endif
40305 
40306     return(test_ret);
40307 }
40308 
40309 
40310 static int
test_xmlXPathCastNodeToNumber(void)40311 test_xmlXPathCastNodeToNumber(void) {
40312     int test_ret = 0;
40313 
40314 #if defined(LIBXML_XPATH_ENABLED)
40315     int mem_base;
40316     double ret_val;
40317     xmlNodePtr node; /* a node */
40318     int n_node;
40319 
40320     for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
40321         mem_base = xmlMemBlocks();
40322         node = gen_xmlNodePtr(n_node, 0);
40323 
40324         ret_val = xmlXPathCastNodeToNumber(node);
40325         desret_double(ret_val);
40326         call_tests++;
40327         des_xmlNodePtr(n_node, node, 0);
40328         xmlResetLastError();
40329         if (mem_base != xmlMemBlocks()) {
40330             printf("Leak of %d blocks found in xmlXPathCastNodeToNumber",
40331 	           xmlMemBlocks() - mem_base);
40332 	    test_ret++;
40333             printf(" %d", n_node);
40334             printf("\n");
40335         }
40336     }
40337     function_tests++;
40338 #endif
40339 
40340     return(test_ret);
40341 }
40342 
40343 
40344 static int
test_xmlXPathCastNodeToString(void)40345 test_xmlXPathCastNodeToString(void) {
40346     int test_ret = 0;
40347 
40348 #if defined(LIBXML_XPATH_ENABLED)
40349     int mem_base;
40350     xmlChar * ret_val;
40351     xmlNodePtr node; /* a node */
40352     int n_node;
40353 
40354     for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
40355         mem_base = xmlMemBlocks();
40356         node = gen_xmlNodePtr(n_node, 0);
40357 
40358         ret_val = xmlXPathCastNodeToString(node);
40359         desret_xmlChar_ptr(ret_val);
40360         call_tests++;
40361         des_xmlNodePtr(n_node, node, 0);
40362         xmlResetLastError();
40363         if (mem_base != xmlMemBlocks()) {
40364             printf("Leak of %d blocks found in xmlXPathCastNodeToString",
40365 	           xmlMemBlocks() - mem_base);
40366 	    test_ret++;
40367             printf(" %d", n_node);
40368             printf("\n");
40369         }
40370     }
40371     function_tests++;
40372 #endif
40373 
40374     return(test_ret);
40375 }
40376 
40377 
40378 static int
test_xmlXPathCastNumberToBoolean(void)40379 test_xmlXPathCastNumberToBoolean(void) {
40380     int test_ret = 0;
40381 
40382 #if defined(LIBXML_XPATH_ENABLED)
40383     int mem_base;
40384     int ret_val;
40385     double val; /* a number */
40386     int n_val;
40387 
40388     for (n_val = 0;n_val < gen_nb_double;n_val++) {
40389         mem_base = xmlMemBlocks();
40390         val = gen_double(n_val, 0);
40391 
40392         ret_val = xmlXPathCastNumberToBoolean(val);
40393         desret_int(ret_val);
40394         call_tests++;
40395         des_double(n_val, val, 0);
40396         xmlResetLastError();
40397         if (mem_base != xmlMemBlocks()) {
40398             printf("Leak of %d blocks found in xmlXPathCastNumberToBoolean",
40399 	           xmlMemBlocks() - mem_base);
40400 	    test_ret++;
40401             printf(" %d", n_val);
40402             printf("\n");
40403         }
40404     }
40405     function_tests++;
40406 #endif
40407 
40408     return(test_ret);
40409 }
40410 
40411 
40412 static int
test_xmlXPathCastNumberToString(void)40413 test_xmlXPathCastNumberToString(void) {
40414     int test_ret = 0;
40415 
40416 #if defined(LIBXML_XPATH_ENABLED)
40417     int mem_base;
40418     xmlChar * ret_val;
40419     double val; /* a number */
40420     int n_val;
40421 
40422     for (n_val = 0;n_val < gen_nb_double;n_val++) {
40423         mem_base = xmlMemBlocks();
40424         val = gen_double(n_val, 0);
40425 
40426         ret_val = xmlXPathCastNumberToString(val);
40427         desret_xmlChar_ptr(ret_val);
40428         call_tests++;
40429         des_double(n_val, val, 0);
40430         xmlResetLastError();
40431         if (mem_base != xmlMemBlocks()) {
40432             printf("Leak of %d blocks found in xmlXPathCastNumberToString",
40433 	           xmlMemBlocks() - mem_base);
40434 	    test_ret++;
40435             printf(" %d", n_val);
40436             printf("\n");
40437         }
40438     }
40439     function_tests++;
40440 #endif
40441 
40442     return(test_ret);
40443 }
40444 
40445 
40446 static int
test_xmlXPathCastStringToBoolean(void)40447 test_xmlXPathCastStringToBoolean(void) {
40448     int test_ret = 0;
40449 
40450 #if defined(LIBXML_XPATH_ENABLED)
40451     int mem_base;
40452     int ret_val;
40453     const xmlChar * val; /* a string */
40454     int n_val;
40455 
40456     for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
40457         mem_base = xmlMemBlocks();
40458         val = gen_const_xmlChar_ptr(n_val, 0);
40459 
40460         ret_val = xmlXPathCastStringToBoolean(val);
40461         desret_int(ret_val);
40462         call_tests++;
40463         des_const_xmlChar_ptr(n_val, val, 0);
40464         xmlResetLastError();
40465         if (mem_base != xmlMemBlocks()) {
40466             printf("Leak of %d blocks found in xmlXPathCastStringToBoolean",
40467 	           xmlMemBlocks() - mem_base);
40468 	    test_ret++;
40469             printf(" %d", n_val);
40470             printf("\n");
40471         }
40472     }
40473     function_tests++;
40474 #endif
40475 
40476     return(test_ret);
40477 }
40478 
40479 
40480 static int
test_xmlXPathCastStringToNumber(void)40481 test_xmlXPathCastStringToNumber(void) {
40482     int test_ret = 0;
40483 
40484 #if defined(LIBXML_XPATH_ENABLED)
40485     int mem_base;
40486     double ret_val;
40487     const xmlChar * val; /* a string */
40488     int n_val;
40489 
40490     for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
40491         mem_base = xmlMemBlocks();
40492         val = gen_const_xmlChar_ptr(n_val, 0);
40493 
40494         ret_val = xmlXPathCastStringToNumber(val);
40495         desret_double(ret_val);
40496         call_tests++;
40497         des_const_xmlChar_ptr(n_val, val, 0);
40498         xmlResetLastError();
40499         if (mem_base != xmlMemBlocks()) {
40500             printf("Leak of %d blocks found in xmlXPathCastStringToNumber",
40501 	           xmlMemBlocks() - mem_base);
40502 	    test_ret++;
40503             printf(" %d", n_val);
40504             printf("\n");
40505         }
40506     }
40507     function_tests++;
40508 #endif
40509 
40510     return(test_ret);
40511 }
40512 
40513 
40514 static int
test_xmlXPathCastToBoolean(void)40515 test_xmlXPathCastToBoolean(void) {
40516     int test_ret = 0;
40517 
40518 #if defined(LIBXML_XPATH_ENABLED)
40519     int mem_base;
40520     int ret_val;
40521     xmlXPathObjectPtr val; /* an XPath object */
40522     int n_val;
40523 
40524     for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
40525         mem_base = xmlMemBlocks();
40526         val = gen_xmlXPathObjectPtr(n_val, 0);
40527 
40528         ret_val = xmlXPathCastToBoolean(val);
40529         desret_int(ret_val);
40530         call_tests++;
40531         des_xmlXPathObjectPtr(n_val, val, 0);
40532         xmlResetLastError();
40533         if (mem_base != xmlMemBlocks()) {
40534             printf("Leak of %d blocks found in xmlXPathCastToBoolean",
40535 	           xmlMemBlocks() - mem_base);
40536 	    test_ret++;
40537             printf(" %d", n_val);
40538             printf("\n");
40539         }
40540     }
40541     function_tests++;
40542 #endif
40543 
40544     return(test_ret);
40545 }
40546 
40547 
40548 static int
test_xmlXPathCastToNumber(void)40549 test_xmlXPathCastToNumber(void) {
40550     int test_ret = 0;
40551 
40552 #if defined(LIBXML_XPATH_ENABLED)
40553     int mem_base;
40554     double ret_val;
40555     xmlXPathObjectPtr val; /* an XPath object */
40556     int n_val;
40557 
40558     for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
40559         mem_base = xmlMemBlocks();
40560         val = gen_xmlXPathObjectPtr(n_val, 0);
40561 
40562         ret_val = xmlXPathCastToNumber(val);
40563         desret_double(ret_val);
40564         call_tests++;
40565         des_xmlXPathObjectPtr(n_val, val, 0);
40566         xmlResetLastError();
40567         if (mem_base != xmlMemBlocks()) {
40568             printf("Leak of %d blocks found in xmlXPathCastToNumber",
40569 	           xmlMemBlocks() - mem_base);
40570 	    test_ret++;
40571             printf(" %d", n_val);
40572             printf("\n");
40573         }
40574     }
40575     function_tests++;
40576 #endif
40577 
40578     return(test_ret);
40579 }
40580 
40581 
40582 static int
test_xmlXPathCastToString(void)40583 test_xmlXPathCastToString(void) {
40584     int test_ret = 0;
40585 
40586 #if defined(LIBXML_XPATH_ENABLED)
40587     int mem_base;
40588     xmlChar * ret_val;
40589     xmlXPathObjectPtr val; /* an XPath object */
40590     int n_val;
40591 
40592     for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
40593         mem_base = xmlMemBlocks();
40594         val = gen_xmlXPathObjectPtr(n_val, 0);
40595 
40596         ret_val = xmlXPathCastToString(val);
40597         desret_xmlChar_ptr(ret_val);
40598         call_tests++;
40599         des_xmlXPathObjectPtr(n_val, val, 0);
40600         xmlResetLastError();
40601         if (mem_base != xmlMemBlocks()) {
40602             printf("Leak of %d blocks found in xmlXPathCastToString",
40603 	           xmlMemBlocks() - mem_base);
40604 	    test_ret++;
40605             printf(" %d", n_val);
40606             printf("\n");
40607         }
40608     }
40609     function_tests++;
40610 #endif
40611 
40612     return(test_ret);
40613 }
40614 
40615 
40616 static int
test_xmlXPathCmpNodes(void)40617 test_xmlXPathCmpNodes(void) {
40618     int test_ret = 0;
40619 
40620 #if defined(LIBXML_XPATH_ENABLED)
40621     int mem_base;
40622     int ret_val;
40623     xmlNodePtr node1; /* the first node */
40624     int n_node1;
40625     xmlNodePtr node2; /* the second node */
40626     int n_node2;
40627 
40628     for (n_node1 = 0;n_node1 < gen_nb_xmlNodePtr;n_node1++) {
40629     for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
40630         mem_base = xmlMemBlocks();
40631         node1 = gen_xmlNodePtr(n_node1, 0);
40632         node2 = gen_xmlNodePtr(n_node2, 1);
40633 
40634         ret_val = xmlXPathCmpNodes(node1, node2);
40635         desret_int(ret_val);
40636         call_tests++;
40637         des_xmlNodePtr(n_node1, node1, 0);
40638         des_xmlNodePtr(n_node2, node2, 1);
40639         xmlResetLastError();
40640         if (mem_base != xmlMemBlocks()) {
40641             printf("Leak of %d blocks found in xmlXPathCmpNodes",
40642 	           xmlMemBlocks() - mem_base);
40643 	    test_ret++;
40644             printf(" %d", n_node1);
40645             printf(" %d", n_node2);
40646             printf("\n");
40647         }
40648     }
40649     }
40650     function_tests++;
40651 #endif
40652 
40653     return(test_ret);
40654 }
40655 
40656 
40657 static int
test_xmlXPathCompile(void)40658 test_xmlXPathCompile(void) {
40659     int test_ret = 0;
40660 
40661 
40662     /* missing type support */
40663     return(test_ret);
40664 }
40665 
40666 #ifdef LIBXML_XPATH_ENABLED
40667 
40668 #define gen_nb_xmlXPathCompExprPtr 1
40669 #define gen_xmlXPathCompExprPtr(no, nr) NULL
40670 #define des_xmlXPathCompExprPtr(no, val, nr)
40671 #endif
40672 
40673 #ifdef LIBXML_XPATH_ENABLED
40674 
40675 #define gen_nb_xmlXPathContextPtr 1
40676 #define gen_xmlXPathContextPtr(no, nr) NULL
40677 #define des_xmlXPathContextPtr(no, val, nr)
40678 #endif
40679 
40680 
40681 static int
test_xmlXPathCompiledEval(void)40682 test_xmlXPathCompiledEval(void) {
40683     int test_ret = 0;
40684 
40685 #if defined(LIBXML_XPATH_ENABLED)
40686     int mem_base;
40687     xmlXPathObjectPtr ret_val;
40688     xmlXPathCompExprPtr comp; /* the compiled XPath expression */
40689     int n_comp;
40690     xmlXPathContextPtr ctx; /* the XPath context */
40691     int n_ctx;
40692 
40693     for (n_comp = 0;n_comp < gen_nb_xmlXPathCompExprPtr;n_comp++) {
40694     for (n_ctx = 0;n_ctx < gen_nb_xmlXPathContextPtr;n_ctx++) {
40695         mem_base = xmlMemBlocks();
40696         comp = gen_xmlXPathCompExprPtr(n_comp, 0);
40697         ctx = gen_xmlXPathContextPtr(n_ctx, 1);
40698 
40699         ret_val = xmlXPathCompiledEval(comp, ctx);
40700         desret_xmlXPathObjectPtr(ret_val);
40701         call_tests++;
40702         des_xmlXPathCompExprPtr(n_comp, comp, 0);
40703         des_xmlXPathContextPtr(n_ctx, ctx, 1);
40704         xmlResetLastError();
40705         if (mem_base != xmlMemBlocks()) {
40706             printf("Leak of %d blocks found in xmlXPathCompiledEval",
40707 	           xmlMemBlocks() - mem_base);
40708 	    test_ret++;
40709             printf(" %d", n_comp);
40710             printf(" %d", n_ctx);
40711             printf("\n");
40712         }
40713     }
40714     }
40715     function_tests++;
40716 #endif
40717 
40718     return(test_ret);
40719 }
40720 
40721 
40722 static int
test_xmlXPathCompiledEvalToBoolean(void)40723 test_xmlXPathCompiledEvalToBoolean(void) {
40724     int test_ret = 0;
40725 
40726 #if defined(LIBXML_XPATH_ENABLED)
40727     int mem_base;
40728     int ret_val;
40729     xmlXPathCompExprPtr comp; /* the compiled XPath expression */
40730     int n_comp;
40731     xmlXPathContextPtr ctxt; /* the XPath context */
40732     int n_ctxt;
40733 
40734     for (n_comp = 0;n_comp < gen_nb_xmlXPathCompExprPtr;n_comp++) {
40735     for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
40736         mem_base = xmlMemBlocks();
40737         comp = gen_xmlXPathCompExprPtr(n_comp, 0);
40738         ctxt = gen_xmlXPathContextPtr(n_ctxt, 1);
40739 
40740         ret_val = xmlXPathCompiledEvalToBoolean(comp, ctxt);
40741         desret_int(ret_val);
40742         call_tests++;
40743         des_xmlXPathCompExprPtr(n_comp, comp, 0);
40744         des_xmlXPathContextPtr(n_ctxt, ctxt, 1);
40745         xmlResetLastError();
40746         if (mem_base != xmlMemBlocks()) {
40747             printf("Leak of %d blocks found in xmlXPathCompiledEvalToBoolean",
40748 	           xmlMemBlocks() - mem_base);
40749 	    test_ret++;
40750             printf(" %d", n_comp);
40751             printf(" %d", n_ctxt);
40752             printf("\n");
40753         }
40754     }
40755     }
40756     function_tests++;
40757 #endif
40758 
40759     return(test_ret);
40760 }
40761 
40762 
40763 static int
test_xmlXPathContextSetCache(void)40764 test_xmlXPathContextSetCache(void) {
40765     int test_ret = 0;
40766 
40767 #if defined(LIBXML_XPATH_ENABLED)
40768     int mem_base;
40769     int ret_val;
40770     xmlXPathContextPtr ctxt; /* the XPath context */
40771     int n_ctxt;
40772     int active; /* enables/disables (creates/frees) the cache */
40773     int n_active;
40774     int value; /* a value with semantics dependent on @options */
40775     int n_value;
40776     int options; /* options (currently only the value 0 is used) */
40777     int n_options;
40778 
40779     for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
40780     for (n_active = 0;n_active < gen_nb_int;n_active++) {
40781     for (n_value = 0;n_value < gen_nb_int;n_value++) {
40782     for (n_options = 0;n_options < gen_nb_int;n_options++) {
40783         mem_base = xmlMemBlocks();
40784         ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
40785         active = gen_int(n_active, 1);
40786         value = gen_int(n_value, 2);
40787         options = gen_int(n_options, 3);
40788 
40789         ret_val = xmlXPathContextSetCache(ctxt, active, value, options);
40790         desret_int(ret_val);
40791         call_tests++;
40792         des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
40793         des_int(n_active, active, 1);
40794         des_int(n_value, value, 2);
40795         des_int(n_options, options, 3);
40796         xmlResetLastError();
40797         if (mem_base != xmlMemBlocks()) {
40798             printf("Leak of %d blocks found in xmlXPathContextSetCache",
40799 	           xmlMemBlocks() - mem_base);
40800 	    test_ret++;
40801             printf(" %d", n_ctxt);
40802             printf(" %d", n_active);
40803             printf(" %d", n_value);
40804             printf(" %d", n_options);
40805             printf("\n");
40806         }
40807     }
40808     }
40809     }
40810     }
40811     function_tests++;
40812 #endif
40813 
40814     return(test_ret);
40815 }
40816 
40817 
40818 static int
test_xmlXPathConvertBoolean(void)40819 test_xmlXPathConvertBoolean(void) {
40820     int test_ret = 0;
40821 
40822 #if defined(LIBXML_XPATH_ENABLED)
40823     int mem_base;
40824     xmlXPathObjectPtr ret_val;
40825     xmlXPathObjectPtr val; /* an XPath object */
40826     int n_val;
40827 
40828     for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
40829         mem_base = xmlMemBlocks();
40830         val = gen_xmlXPathObjectPtr(n_val, 0);
40831 
40832         ret_val = xmlXPathConvertBoolean(val);
40833         val = NULL;
40834         desret_xmlXPathObjectPtr(ret_val);
40835         call_tests++;
40836         des_xmlXPathObjectPtr(n_val, val, 0);
40837         xmlResetLastError();
40838         if (mem_base != xmlMemBlocks()) {
40839             printf("Leak of %d blocks found in xmlXPathConvertBoolean",
40840 	           xmlMemBlocks() - mem_base);
40841 	    test_ret++;
40842             printf(" %d", n_val);
40843             printf("\n");
40844         }
40845     }
40846     function_tests++;
40847 #endif
40848 
40849     return(test_ret);
40850 }
40851 
40852 
40853 static int
test_xmlXPathConvertNumber(void)40854 test_xmlXPathConvertNumber(void) {
40855     int test_ret = 0;
40856 
40857 #if defined(LIBXML_XPATH_ENABLED)
40858     int mem_base;
40859     xmlXPathObjectPtr ret_val;
40860     xmlXPathObjectPtr val; /* an XPath object */
40861     int n_val;
40862 
40863     for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
40864         mem_base = xmlMemBlocks();
40865         val = gen_xmlXPathObjectPtr(n_val, 0);
40866 
40867         ret_val = xmlXPathConvertNumber(val);
40868         val = NULL;
40869         desret_xmlXPathObjectPtr(ret_val);
40870         call_tests++;
40871         des_xmlXPathObjectPtr(n_val, val, 0);
40872         xmlResetLastError();
40873         if (mem_base != xmlMemBlocks()) {
40874             printf("Leak of %d blocks found in xmlXPathConvertNumber",
40875 	           xmlMemBlocks() - mem_base);
40876 	    test_ret++;
40877             printf(" %d", n_val);
40878             printf("\n");
40879         }
40880     }
40881     function_tests++;
40882 #endif
40883 
40884     return(test_ret);
40885 }
40886 
40887 
40888 static int
test_xmlXPathConvertString(void)40889 test_xmlXPathConvertString(void) {
40890     int test_ret = 0;
40891 
40892 #if defined(LIBXML_XPATH_ENABLED)
40893     int mem_base;
40894     xmlXPathObjectPtr ret_val;
40895     xmlXPathObjectPtr val; /* an XPath object */
40896     int n_val;
40897 
40898     for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
40899         mem_base = xmlMemBlocks();
40900         val = gen_xmlXPathObjectPtr(n_val, 0);
40901 
40902         ret_val = xmlXPathConvertString(val);
40903         val = NULL;
40904         desret_xmlXPathObjectPtr(ret_val);
40905         call_tests++;
40906         des_xmlXPathObjectPtr(n_val, val, 0);
40907         xmlResetLastError();
40908         if (mem_base != xmlMemBlocks()) {
40909             printf("Leak of %d blocks found in xmlXPathConvertString",
40910 	           xmlMemBlocks() - mem_base);
40911 	    test_ret++;
40912             printf(" %d", n_val);
40913             printf("\n");
40914         }
40915     }
40916     function_tests++;
40917 #endif
40918 
40919     return(test_ret);
40920 }
40921 
40922 
40923 static int
test_xmlXPathCtxtCompile(void)40924 test_xmlXPathCtxtCompile(void) {
40925     int test_ret = 0;
40926 
40927 
40928     /* missing type support */
40929     return(test_ret);
40930 }
40931 
40932 
40933 static int
test_xmlXPathEval(void)40934 test_xmlXPathEval(void) {
40935     int test_ret = 0;
40936 
40937 #if defined(LIBXML_XPATH_ENABLED)
40938     int mem_base;
40939     xmlXPathObjectPtr ret_val;
40940     const xmlChar * str; /* the XPath expression */
40941     int n_str;
40942     xmlXPathContextPtr ctx; /* the XPath context */
40943     int n_ctx;
40944 
40945     for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
40946     for (n_ctx = 0;n_ctx < gen_nb_xmlXPathContextPtr;n_ctx++) {
40947         mem_base = xmlMemBlocks();
40948         str = gen_const_xmlChar_ptr(n_str, 0);
40949         ctx = gen_xmlXPathContextPtr(n_ctx, 1);
40950 
40951         ret_val = xmlXPathEval(str, ctx);
40952         desret_xmlXPathObjectPtr(ret_val);
40953         call_tests++;
40954         des_const_xmlChar_ptr(n_str, str, 0);
40955         des_xmlXPathContextPtr(n_ctx, ctx, 1);
40956         xmlResetLastError();
40957         if (mem_base != xmlMemBlocks()) {
40958             printf("Leak of %d blocks found in xmlXPathEval",
40959 	           xmlMemBlocks() - mem_base);
40960 	    test_ret++;
40961             printf(" %d", n_str);
40962             printf(" %d", n_ctx);
40963             printf("\n");
40964         }
40965     }
40966     }
40967     function_tests++;
40968 #endif
40969 
40970     return(test_ret);
40971 }
40972 
40973 
40974 static int
test_xmlXPathEvalExpression(void)40975 test_xmlXPathEvalExpression(void) {
40976     int test_ret = 0;
40977 
40978 #if defined(LIBXML_XPATH_ENABLED)
40979     int mem_base;
40980     xmlXPathObjectPtr ret_val;
40981     const xmlChar * str; /* the XPath expression */
40982     int n_str;
40983     xmlXPathContextPtr ctxt; /* the XPath context */
40984     int n_ctxt;
40985 
40986     for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
40987     for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
40988         mem_base = xmlMemBlocks();
40989         str = gen_const_xmlChar_ptr(n_str, 0);
40990         ctxt = gen_xmlXPathContextPtr(n_ctxt, 1);
40991 
40992         ret_val = xmlXPathEvalExpression(str, ctxt);
40993         desret_xmlXPathObjectPtr(ret_val);
40994         call_tests++;
40995         des_const_xmlChar_ptr(n_str, str, 0);
40996         des_xmlXPathContextPtr(n_ctxt, ctxt, 1);
40997         xmlResetLastError();
40998         if (mem_base != xmlMemBlocks()) {
40999             printf("Leak of %d blocks found in xmlXPathEvalExpression",
41000 	           xmlMemBlocks() - mem_base);
41001 	    test_ret++;
41002             printf(" %d", n_str);
41003             printf(" %d", n_ctxt);
41004             printf("\n");
41005         }
41006     }
41007     }
41008     function_tests++;
41009 #endif
41010 
41011     return(test_ret);
41012 }
41013 
41014 
41015 static int
test_xmlXPathEvalPredicate(void)41016 test_xmlXPathEvalPredicate(void) {
41017     int test_ret = 0;
41018 
41019 #if defined(LIBXML_XPATH_ENABLED)
41020     int mem_base;
41021     int ret_val;
41022     xmlXPathContextPtr ctxt; /* the XPath context */
41023     int n_ctxt;
41024     xmlXPathObjectPtr res; /* the Predicate Expression evaluation result */
41025     int n_res;
41026 
41027     for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
41028     for (n_res = 0;n_res < gen_nb_xmlXPathObjectPtr;n_res++) {
41029         mem_base = xmlMemBlocks();
41030         ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
41031         res = gen_xmlXPathObjectPtr(n_res, 1);
41032 
41033         ret_val = xmlXPathEvalPredicate(ctxt, res);
41034         desret_int(ret_val);
41035         call_tests++;
41036         des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
41037         des_xmlXPathObjectPtr(n_res, res, 1);
41038         xmlResetLastError();
41039         if (mem_base != xmlMemBlocks()) {
41040             printf("Leak of %d blocks found in xmlXPathEvalPredicate",
41041 	           xmlMemBlocks() - mem_base);
41042 	    test_ret++;
41043             printf(" %d", n_ctxt);
41044             printf(" %d", n_res);
41045             printf("\n");
41046         }
41047     }
41048     }
41049     function_tests++;
41050 #endif
41051 
41052     return(test_ret);
41053 }
41054 
41055 
41056 static int
test_xmlXPathInit(void)41057 test_xmlXPathInit(void) {
41058     int test_ret = 0;
41059 
41060 #if defined(LIBXML_XPATH_ENABLED)
41061     int mem_base;
41062 
41063         mem_base = xmlMemBlocks();
41064 
41065         xmlXPathInit();
41066         call_tests++;
41067         xmlResetLastError();
41068         if (mem_base != xmlMemBlocks()) {
41069             printf("Leak of %d blocks found in xmlXPathInit",
41070 	           xmlMemBlocks() - mem_base);
41071 	    test_ret++;
41072             printf("\n");
41073         }
41074     function_tests++;
41075 #endif
41076 
41077     return(test_ret);
41078 }
41079 
41080 
41081 static int
test_xmlXPathIsInf(void)41082 test_xmlXPathIsInf(void) {
41083     int test_ret = 0;
41084 
41085 #if defined(LIBXML_XPATH_ENABLED)
41086     int mem_base;
41087     int ret_val;
41088     double val; /* a double value */
41089     int n_val;
41090 
41091     for (n_val = 0;n_val < gen_nb_double;n_val++) {
41092         mem_base = xmlMemBlocks();
41093         val = gen_double(n_val, 0);
41094 
41095         ret_val = xmlXPathIsInf(val);
41096         desret_int(ret_val);
41097         call_tests++;
41098         des_double(n_val, val, 0);
41099         xmlResetLastError();
41100         if (mem_base != xmlMemBlocks()) {
41101             printf("Leak of %d blocks found in xmlXPathIsInf",
41102 	           xmlMemBlocks() - mem_base);
41103 	    test_ret++;
41104             printf(" %d", n_val);
41105             printf("\n");
41106         }
41107     }
41108     function_tests++;
41109 #endif
41110 
41111     return(test_ret);
41112 }
41113 
41114 
41115 static int
test_xmlXPathIsNaN(void)41116 test_xmlXPathIsNaN(void) {
41117     int test_ret = 0;
41118 
41119 #if defined(LIBXML_XPATH_ENABLED)
41120     int mem_base;
41121     int ret_val;
41122     double val; /* a double value */
41123     int n_val;
41124 
41125     for (n_val = 0;n_val < gen_nb_double;n_val++) {
41126         mem_base = xmlMemBlocks();
41127         val = gen_double(n_val, 0);
41128 
41129         ret_val = xmlXPathIsNaN(val);
41130         desret_int(ret_val);
41131         call_tests++;
41132         des_double(n_val, val, 0);
41133         xmlResetLastError();
41134         if (mem_base != xmlMemBlocks()) {
41135             printf("Leak of %d blocks found in xmlXPathIsNaN",
41136 	           xmlMemBlocks() - mem_base);
41137 	    test_ret++;
41138             printf(" %d", n_val);
41139             printf("\n");
41140         }
41141     }
41142     function_tests++;
41143 #endif
41144 
41145     return(test_ret);
41146 }
41147 
41148 
41149 static int
test_xmlXPathNewContext(void)41150 test_xmlXPathNewContext(void) {
41151     int test_ret = 0;
41152 
41153 
41154     /* missing type support */
41155     return(test_ret);
41156 }
41157 
41158 
41159 static int
test_xmlXPathNodeEval(void)41160 test_xmlXPathNodeEval(void) {
41161     int test_ret = 0;
41162 
41163 #if defined(LIBXML_XPATH_ENABLED)
41164     int mem_base;
41165     xmlXPathObjectPtr ret_val;
41166     xmlNodePtr node; /* the node to to use as the context node */
41167     int n_node;
41168     const xmlChar * str; /* the XPath expression */
41169     int n_str;
41170     xmlXPathContextPtr ctx; /* the XPath context */
41171     int n_ctx;
41172 
41173     for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
41174     for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
41175     for (n_ctx = 0;n_ctx < gen_nb_xmlXPathContextPtr;n_ctx++) {
41176         mem_base = xmlMemBlocks();
41177         node = gen_xmlNodePtr(n_node, 0);
41178         str = gen_const_xmlChar_ptr(n_str, 1);
41179         ctx = gen_xmlXPathContextPtr(n_ctx, 2);
41180 
41181         ret_val = xmlXPathNodeEval(node, str, ctx);
41182         desret_xmlXPathObjectPtr(ret_val);
41183         call_tests++;
41184         des_xmlNodePtr(n_node, node, 0);
41185         des_const_xmlChar_ptr(n_str, str, 1);
41186         des_xmlXPathContextPtr(n_ctx, ctx, 2);
41187         xmlResetLastError();
41188         if (mem_base != xmlMemBlocks()) {
41189             printf("Leak of %d blocks found in xmlXPathNodeEval",
41190 	           xmlMemBlocks() - mem_base);
41191 	    test_ret++;
41192             printf(" %d", n_node);
41193             printf(" %d", n_str);
41194             printf(" %d", n_ctx);
41195             printf("\n");
41196         }
41197     }
41198     }
41199     }
41200     function_tests++;
41201 #endif
41202 
41203     return(test_ret);
41204 }
41205 
41206 
41207 static int
test_xmlXPathNodeSetCreate(void)41208 test_xmlXPathNodeSetCreate(void) {
41209     int test_ret = 0;
41210 
41211 #if defined(LIBXML_XPATH_ENABLED)
41212     int mem_base;
41213     xmlNodeSetPtr ret_val;
41214     xmlNodePtr val; /* an initial xmlNodePtr, or NULL */
41215     int n_val;
41216 
41217     for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
41218         mem_base = xmlMemBlocks();
41219         val = gen_xmlNodePtr(n_val, 0);
41220 
41221         ret_val = xmlXPathNodeSetCreate(val);
41222         desret_xmlNodeSetPtr(ret_val);
41223         call_tests++;
41224         des_xmlNodePtr(n_val, val, 0);
41225         xmlResetLastError();
41226         if (mem_base != xmlMemBlocks()) {
41227             printf("Leak of %d blocks found in xmlXPathNodeSetCreate",
41228 	           xmlMemBlocks() - mem_base);
41229 	    test_ret++;
41230             printf(" %d", n_val);
41231             printf("\n");
41232         }
41233     }
41234     function_tests++;
41235 #endif
41236 
41237     return(test_ret);
41238 }
41239 
41240 
41241 static int
test_xmlXPathObjectCopy(void)41242 test_xmlXPathObjectCopy(void) {
41243     int test_ret = 0;
41244 
41245 #if defined(LIBXML_XPATH_ENABLED)
41246     int mem_base;
41247     xmlXPathObjectPtr ret_val;
41248     xmlXPathObjectPtr val; /* the original object */
41249     int n_val;
41250 
41251     for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
41252         mem_base = xmlMemBlocks();
41253         val = gen_xmlXPathObjectPtr(n_val, 0);
41254 
41255         ret_val = xmlXPathObjectCopy(val);
41256         desret_xmlXPathObjectPtr(ret_val);
41257         call_tests++;
41258         des_xmlXPathObjectPtr(n_val, val, 0);
41259         xmlResetLastError();
41260         if (mem_base != xmlMemBlocks()) {
41261             printf("Leak of %d blocks found in xmlXPathObjectCopy",
41262 	           xmlMemBlocks() - mem_base);
41263 	    test_ret++;
41264             printf(" %d", n_val);
41265             printf("\n");
41266         }
41267     }
41268     function_tests++;
41269 #endif
41270 
41271     return(test_ret);
41272 }
41273 
41274 
41275 static int
test_xmlXPathOrderDocElems(void)41276 test_xmlXPathOrderDocElems(void) {
41277     int test_ret = 0;
41278 
41279 #if defined(LIBXML_XPATH_ENABLED)
41280     int mem_base;
41281     long ret_val;
41282     xmlDocPtr doc; /* an input document */
41283     int n_doc;
41284 
41285     for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
41286         mem_base = xmlMemBlocks();
41287         doc = gen_xmlDocPtr(n_doc, 0);
41288 
41289         ret_val = xmlXPathOrderDocElems(doc);
41290         desret_long(ret_val);
41291         call_tests++;
41292         des_xmlDocPtr(n_doc, doc, 0);
41293         xmlResetLastError();
41294         if (mem_base != xmlMemBlocks()) {
41295             printf("Leak of %d blocks found in xmlXPathOrderDocElems",
41296 	           xmlMemBlocks() - mem_base);
41297 	    test_ret++;
41298             printf(" %d", n_doc);
41299             printf("\n");
41300         }
41301     }
41302     function_tests++;
41303 #endif
41304 
41305     return(test_ret);
41306 }
41307 
41308 
41309 static int
test_xmlXPathSetContextNode(void)41310 test_xmlXPathSetContextNode(void) {
41311     int test_ret = 0;
41312 
41313 #if defined(LIBXML_XPATH_ENABLED)
41314     int mem_base;
41315     int ret_val;
41316     xmlNodePtr node; /* the node to to use as the context node */
41317     int n_node;
41318     xmlXPathContextPtr ctx; /* the XPath context */
41319     int n_ctx;
41320 
41321     for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
41322     for (n_ctx = 0;n_ctx < gen_nb_xmlXPathContextPtr;n_ctx++) {
41323         mem_base = xmlMemBlocks();
41324         node = gen_xmlNodePtr(n_node, 0);
41325         ctx = gen_xmlXPathContextPtr(n_ctx, 1);
41326 
41327         ret_val = xmlXPathSetContextNode(node, ctx);
41328         desret_int(ret_val);
41329         call_tests++;
41330         des_xmlNodePtr(n_node, node, 0);
41331         des_xmlXPathContextPtr(n_ctx, ctx, 1);
41332         xmlResetLastError();
41333         if (mem_base != xmlMemBlocks()) {
41334             printf("Leak of %d blocks found in xmlXPathSetContextNode",
41335 	           xmlMemBlocks() - mem_base);
41336 	    test_ret++;
41337             printf(" %d", n_node);
41338             printf(" %d", n_ctx);
41339             printf("\n");
41340         }
41341     }
41342     }
41343     function_tests++;
41344 #endif
41345 
41346     return(test_ret);
41347 }
41348 
41349 
41350 static int
test_xmlXPathSetErrorHandler(void)41351 test_xmlXPathSetErrorHandler(void) {
41352     int test_ret = 0;
41353 
41354 
41355     /* missing type support */
41356     return(test_ret);
41357 }
41358 
41359 static int
test_xpath(void)41360 test_xpath(void) {
41361     int test_ret = 0;
41362 
41363     if (quiet == 0) printf("Testing xpath : 32 of 41 functions ...\n");
41364     test_ret += test_xmlXPathCastBooleanToNumber();
41365     test_ret += test_xmlXPathCastBooleanToString();
41366     test_ret += test_xmlXPathCastNodeSetToBoolean();
41367     test_ret += test_xmlXPathCastNodeSetToNumber();
41368     test_ret += test_xmlXPathCastNodeSetToString();
41369     test_ret += test_xmlXPathCastNodeToNumber();
41370     test_ret += test_xmlXPathCastNodeToString();
41371     test_ret += test_xmlXPathCastNumberToBoolean();
41372     test_ret += test_xmlXPathCastNumberToString();
41373     test_ret += test_xmlXPathCastStringToBoolean();
41374     test_ret += test_xmlXPathCastStringToNumber();
41375     test_ret += test_xmlXPathCastToBoolean();
41376     test_ret += test_xmlXPathCastToNumber();
41377     test_ret += test_xmlXPathCastToString();
41378     test_ret += test_xmlXPathCmpNodes();
41379     test_ret += test_xmlXPathCompile();
41380     test_ret += test_xmlXPathCompiledEval();
41381     test_ret += test_xmlXPathCompiledEvalToBoolean();
41382     test_ret += test_xmlXPathContextSetCache();
41383     test_ret += test_xmlXPathConvertBoolean();
41384     test_ret += test_xmlXPathConvertNumber();
41385     test_ret += test_xmlXPathConvertString();
41386     test_ret += test_xmlXPathCtxtCompile();
41387     test_ret += test_xmlXPathEval();
41388     test_ret += test_xmlXPathEvalExpression();
41389     test_ret += test_xmlXPathEvalPredicate();
41390     test_ret += test_xmlXPathInit();
41391     test_ret += test_xmlXPathIsInf();
41392     test_ret += test_xmlXPathIsNaN();
41393     test_ret += test_xmlXPathNewContext();
41394     test_ret += test_xmlXPathNodeEval();
41395     test_ret += test_xmlXPathNodeSetCreate();
41396     test_ret += test_xmlXPathObjectCopy();
41397     test_ret += test_xmlXPathOrderDocElems();
41398     test_ret += test_xmlXPathSetContextNode();
41399     test_ret += test_xmlXPathSetErrorHandler();
41400 
41401     if (test_ret != 0)
41402 	printf("Module xpath: %d errors\n", test_ret);
41403     return(test_ret);
41404 }
41405 #ifdef LIBXML_XPATH_ENABLED
41406 
41407 #define gen_nb_xmlXPathParserContextPtr 1
41408 #define gen_xmlXPathParserContextPtr(no, nr) NULL
41409 #define des_xmlXPathParserContextPtr(no, val, nr)
41410 #endif
41411 
41412 
41413 static int
test_valuePop(void)41414 test_valuePop(void) {
41415     int test_ret = 0;
41416 
41417 #if defined(LIBXML_XPATH_ENABLED)
41418     int mem_base;
41419     xmlXPathObjectPtr ret_val;
41420     xmlXPathParserContextPtr ctxt; /* an XPath evaluation context */
41421     int n_ctxt;
41422 
41423     for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
41424         mem_base = xmlMemBlocks();
41425         ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
41426 
41427         ret_val = valuePop(ctxt);
41428         desret_xmlXPathObjectPtr(ret_val);
41429         call_tests++;
41430         des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
41431         xmlResetLastError();
41432         if (mem_base != xmlMemBlocks()) {
41433             printf("Leak of %d blocks found in valuePop",
41434 	           xmlMemBlocks() - mem_base);
41435 	    test_ret++;
41436             printf(" %d", n_ctxt);
41437             printf("\n");
41438         }
41439     }
41440     function_tests++;
41441 #endif
41442 
41443     return(test_ret);
41444 }
41445 
41446 
41447 static int
test_valuePush(void)41448 test_valuePush(void) {
41449     int test_ret = 0;
41450 
41451 #if defined(LIBXML_XPATH_ENABLED)
41452     int mem_base;
41453     int ret_val;
41454     xmlXPathParserContextPtr ctxt; /* an XPath evaluation context */
41455     int n_ctxt;
41456     xmlXPathObjectPtr value; /* the XPath object */
41457     int n_value;
41458 
41459     for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
41460     for (n_value = 0;n_value < gen_nb_xmlXPathObjectPtr;n_value++) {
41461         mem_base = xmlMemBlocks();
41462         ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
41463         value = gen_xmlXPathObjectPtr(n_value, 1);
41464 
41465         ret_val = valuePush(ctxt, value);
41466         desret_int(ret_val);
41467         call_tests++;
41468         des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
41469         des_xmlXPathObjectPtr(n_value, value, 1);
41470         xmlResetLastError();
41471         if (mem_base != xmlMemBlocks()) {
41472             printf("Leak of %d blocks found in valuePush",
41473 	           xmlMemBlocks() - mem_base);
41474 	    test_ret++;
41475             printf(" %d", n_ctxt);
41476             printf(" %d", n_value);
41477             printf("\n");
41478         }
41479     }
41480     }
41481     function_tests++;
41482 #endif
41483 
41484     return(test_ret);
41485 }
41486 
41487 
41488 static int
test_xmlXPathAddValues(void)41489 test_xmlXPathAddValues(void) {
41490     int test_ret = 0;
41491 
41492 #if defined(LIBXML_XPATH_ENABLED)
41493     int mem_base;
41494     xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
41495     int n_ctxt;
41496 
41497     for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
41498         mem_base = xmlMemBlocks();
41499         ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
41500 
41501         xmlXPathAddValues(ctxt);
41502         call_tests++;
41503         des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
41504         xmlResetLastError();
41505         if (mem_base != xmlMemBlocks()) {
41506             printf("Leak of %d blocks found in xmlXPathAddValues",
41507 	           xmlMemBlocks() - mem_base);
41508 	    test_ret++;
41509             printf(" %d", n_ctxt);
41510             printf("\n");
41511         }
41512     }
41513     function_tests++;
41514 #endif
41515 
41516     return(test_ret);
41517 }
41518 
41519 
41520 static int
test_xmlXPathBooleanFunction(void)41521 test_xmlXPathBooleanFunction(void) {
41522     int test_ret = 0;
41523 
41524 #if defined(LIBXML_XPATH_ENABLED)
41525     int mem_base;
41526     xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
41527     int n_ctxt;
41528     int nargs; /* the number of arguments */
41529     int n_nargs;
41530 
41531     for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
41532     for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
41533         mem_base = xmlMemBlocks();
41534         ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
41535         nargs = gen_int(n_nargs, 1);
41536 
41537         xmlXPathBooleanFunction(ctxt, nargs);
41538         call_tests++;
41539         des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
41540         des_int(n_nargs, nargs, 1);
41541         xmlResetLastError();
41542         if (mem_base != xmlMemBlocks()) {
41543             printf("Leak of %d blocks found in xmlXPathBooleanFunction",
41544 	           xmlMemBlocks() - mem_base);
41545 	    test_ret++;
41546             printf(" %d", n_ctxt);
41547             printf(" %d", n_nargs);
41548             printf("\n");
41549         }
41550     }
41551     }
41552     function_tests++;
41553 #endif
41554 
41555     return(test_ret);
41556 }
41557 
41558 
41559 static int
test_xmlXPathCeilingFunction(void)41560 test_xmlXPathCeilingFunction(void) {
41561     int test_ret = 0;
41562 
41563 #if defined(LIBXML_XPATH_ENABLED)
41564     int mem_base;
41565     xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
41566     int n_ctxt;
41567     int nargs; /* the number of arguments */
41568     int n_nargs;
41569 
41570     for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
41571     for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
41572         mem_base = xmlMemBlocks();
41573         ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
41574         nargs = gen_int(n_nargs, 1);
41575 
41576         xmlXPathCeilingFunction(ctxt, nargs);
41577         call_tests++;
41578         des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
41579         des_int(n_nargs, nargs, 1);
41580         xmlResetLastError();
41581         if (mem_base != xmlMemBlocks()) {
41582             printf("Leak of %d blocks found in xmlXPathCeilingFunction",
41583 	           xmlMemBlocks() - mem_base);
41584 	    test_ret++;
41585             printf(" %d", n_ctxt);
41586             printf(" %d", n_nargs);
41587             printf("\n");
41588         }
41589     }
41590     }
41591     function_tests++;
41592 #endif
41593 
41594     return(test_ret);
41595 }
41596 
41597 
41598 static int
test_xmlXPathCompareValues(void)41599 test_xmlXPathCompareValues(void) {
41600     int test_ret = 0;
41601 
41602 #if defined(LIBXML_XPATH_ENABLED)
41603     int mem_base;
41604     int ret_val;
41605     xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
41606     int n_ctxt;
41607     int inf; /* less than (1) or greater than (0) */
41608     int n_inf;
41609     int strict; /* is the comparison strict */
41610     int n_strict;
41611 
41612     for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
41613     for (n_inf = 0;n_inf < gen_nb_int;n_inf++) {
41614     for (n_strict = 0;n_strict < gen_nb_int;n_strict++) {
41615         mem_base = xmlMemBlocks();
41616         ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
41617         inf = gen_int(n_inf, 1);
41618         strict = gen_int(n_strict, 2);
41619 
41620         ret_val = xmlXPathCompareValues(ctxt, inf, strict);
41621         desret_int(ret_val);
41622         call_tests++;
41623         des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
41624         des_int(n_inf, inf, 1);
41625         des_int(n_strict, strict, 2);
41626         xmlResetLastError();
41627         if (mem_base != xmlMemBlocks()) {
41628             printf("Leak of %d blocks found in xmlXPathCompareValues",
41629 	           xmlMemBlocks() - mem_base);
41630 	    test_ret++;
41631             printf(" %d", n_ctxt);
41632             printf(" %d", n_inf);
41633             printf(" %d", n_strict);
41634             printf("\n");
41635         }
41636     }
41637     }
41638     }
41639     function_tests++;
41640 #endif
41641 
41642     return(test_ret);
41643 }
41644 
41645 
41646 static int
test_xmlXPathConcatFunction(void)41647 test_xmlXPathConcatFunction(void) {
41648     int test_ret = 0;
41649 
41650 #if defined(LIBXML_XPATH_ENABLED)
41651     int mem_base;
41652     xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
41653     int n_ctxt;
41654     int nargs; /* the number of arguments */
41655     int n_nargs;
41656 
41657     for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
41658     for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
41659         mem_base = xmlMemBlocks();
41660         ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
41661         nargs = gen_int(n_nargs, 1);
41662 
41663         xmlXPathConcatFunction(ctxt, nargs);
41664         call_tests++;
41665         des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
41666         des_int(n_nargs, nargs, 1);
41667         xmlResetLastError();
41668         if (mem_base != xmlMemBlocks()) {
41669             printf("Leak of %d blocks found in xmlXPathConcatFunction",
41670 	           xmlMemBlocks() - mem_base);
41671 	    test_ret++;
41672             printf(" %d", n_ctxt);
41673             printf(" %d", n_nargs);
41674             printf("\n");
41675         }
41676     }
41677     }
41678     function_tests++;
41679 #endif
41680 
41681     return(test_ret);
41682 }
41683 
41684 
41685 static int
test_xmlXPathContainsFunction(void)41686 test_xmlXPathContainsFunction(void) {
41687     int test_ret = 0;
41688 
41689 #if defined(LIBXML_XPATH_ENABLED)
41690     int mem_base;
41691     xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
41692     int n_ctxt;
41693     int nargs; /* the number of arguments */
41694     int n_nargs;
41695 
41696     for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
41697     for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
41698         mem_base = xmlMemBlocks();
41699         ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
41700         nargs = gen_int(n_nargs, 1);
41701 
41702         xmlXPathContainsFunction(ctxt, nargs);
41703         call_tests++;
41704         des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
41705         des_int(n_nargs, nargs, 1);
41706         xmlResetLastError();
41707         if (mem_base != xmlMemBlocks()) {
41708             printf("Leak of %d blocks found in xmlXPathContainsFunction",
41709 	           xmlMemBlocks() - mem_base);
41710 	    test_ret++;
41711             printf(" %d", n_ctxt);
41712             printf(" %d", n_nargs);
41713             printf("\n");
41714         }
41715     }
41716     }
41717     function_tests++;
41718 #endif
41719 
41720     return(test_ret);
41721 }
41722 
41723 
41724 static int
test_xmlXPathCountFunction(void)41725 test_xmlXPathCountFunction(void) {
41726     int test_ret = 0;
41727 
41728 #if defined(LIBXML_XPATH_ENABLED)
41729     int mem_base;
41730     xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
41731     int n_ctxt;
41732     int nargs; /* the number of arguments */
41733     int n_nargs;
41734 
41735     for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
41736     for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
41737         mem_base = xmlMemBlocks();
41738         ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
41739         nargs = gen_int(n_nargs, 1);
41740 
41741         xmlXPathCountFunction(ctxt, nargs);
41742         call_tests++;
41743         des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
41744         des_int(n_nargs, nargs, 1);
41745         xmlResetLastError();
41746         if (mem_base != xmlMemBlocks()) {
41747             printf("Leak of %d blocks found in xmlXPathCountFunction",
41748 	           xmlMemBlocks() - mem_base);
41749 	    test_ret++;
41750             printf(" %d", n_ctxt);
41751             printf(" %d", n_nargs);
41752             printf("\n");
41753         }
41754     }
41755     }
41756     function_tests++;
41757 #endif
41758 
41759     return(test_ret);
41760 }
41761 
41762 
41763 static int
test_xmlXPathDebugDumpCompExpr(void)41764 test_xmlXPathDebugDumpCompExpr(void) {
41765     int test_ret = 0;
41766 
41767 #if defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_DEBUG_ENABLED)
41768     int mem_base;
41769     FILE * output; /* the FILE * for the output */
41770     int n_output;
41771     xmlXPathCompExprPtr comp; /* the precompiled XPath expression */
41772     int n_comp;
41773     int depth; /* the indentation level. */
41774     int n_depth;
41775 
41776     for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
41777     for (n_comp = 0;n_comp < gen_nb_xmlXPathCompExprPtr;n_comp++) {
41778     for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
41779         mem_base = xmlMemBlocks();
41780         output = gen_FILE_ptr(n_output, 0);
41781         comp = gen_xmlXPathCompExprPtr(n_comp, 1);
41782         depth = gen_int(n_depth, 2);
41783 
41784         xmlXPathDebugDumpCompExpr(output, comp, depth);
41785         call_tests++;
41786         des_FILE_ptr(n_output, output, 0);
41787         des_xmlXPathCompExprPtr(n_comp, comp, 1);
41788         des_int(n_depth, depth, 2);
41789         xmlResetLastError();
41790         if (mem_base != xmlMemBlocks()) {
41791             printf("Leak of %d blocks found in xmlXPathDebugDumpCompExpr",
41792 	           xmlMemBlocks() - mem_base);
41793 	    test_ret++;
41794             printf(" %d", n_output);
41795             printf(" %d", n_comp);
41796             printf(" %d", n_depth);
41797             printf("\n");
41798         }
41799     }
41800     }
41801     }
41802     function_tests++;
41803 #endif
41804 
41805     return(test_ret);
41806 }
41807 
41808 
41809 static int
test_xmlXPathDebugDumpObject(void)41810 test_xmlXPathDebugDumpObject(void) {
41811     int test_ret = 0;
41812 
41813 #if defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_DEBUG_ENABLED)
41814     int mem_base;
41815     FILE * output; /* the FILE * to dump the output */
41816     int n_output;
41817     xmlXPathObjectPtr cur; /* the object to inspect */
41818     int n_cur;
41819     int depth; /* indentation level */
41820     int n_depth;
41821 
41822     for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
41823     for (n_cur = 0;n_cur < gen_nb_xmlXPathObjectPtr;n_cur++) {
41824     for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
41825         mem_base = xmlMemBlocks();
41826         output = gen_FILE_ptr(n_output, 0);
41827         cur = gen_xmlXPathObjectPtr(n_cur, 1);
41828         depth = gen_int(n_depth, 2);
41829 
41830         xmlXPathDebugDumpObject(output, cur, depth);
41831         call_tests++;
41832         des_FILE_ptr(n_output, output, 0);
41833         des_xmlXPathObjectPtr(n_cur, cur, 1);
41834         des_int(n_depth, depth, 2);
41835         xmlResetLastError();
41836         if (mem_base != xmlMemBlocks()) {
41837             printf("Leak of %d blocks found in xmlXPathDebugDumpObject",
41838 	           xmlMemBlocks() - mem_base);
41839 	    test_ret++;
41840             printf(" %d", n_output);
41841             printf(" %d", n_cur);
41842             printf(" %d", n_depth);
41843             printf("\n");
41844         }
41845     }
41846     }
41847     }
41848     function_tests++;
41849 #endif
41850 
41851     return(test_ret);
41852 }
41853 
41854 
41855 static int
test_xmlXPathDifference(void)41856 test_xmlXPathDifference(void) {
41857     int test_ret = 0;
41858 
41859 #if defined(LIBXML_XPATH_ENABLED)
41860     int mem_base;
41861     xmlNodeSetPtr ret_val;
41862     xmlNodeSetPtr nodes1; /* a node-set */
41863     int n_nodes1;
41864     xmlNodeSetPtr nodes2; /* a node-set */
41865     int n_nodes2;
41866 
41867     for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
41868     for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
41869         mem_base = xmlMemBlocks();
41870         nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
41871         nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
41872 
41873         ret_val = xmlXPathDifference(nodes1, nodes2);
41874         desret_xmlNodeSetPtr(ret_val);
41875         call_tests++;
41876         des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
41877         des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
41878         xmlResetLastError();
41879         if (mem_base != xmlMemBlocks()) {
41880             printf("Leak of %d blocks found in xmlXPathDifference",
41881 	           xmlMemBlocks() - mem_base);
41882 	    test_ret++;
41883             printf(" %d", n_nodes1);
41884             printf(" %d", n_nodes2);
41885             printf("\n");
41886         }
41887     }
41888     }
41889     function_tests++;
41890 #endif
41891 
41892     return(test_ret);
41893 }
41894 
41895 
41896 static int
test_xmlXPathDistinct(void)41897 test_xmlXPathDistinct(void) {
41898     int test_ret = 0;
41899 
41900 #if defined(LIBXML_XPATH_ENABLED)
41901     int mem_base;
41902     xmlNodeSetPtr ret_val;
41903     xmlNodeSetPtr nodes; /* a node-set */
41904     int n_nodes;
41905 
41906     for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
41907         mem_base = xmlMemBlocks();
41908         nodes = gen_xmlNodeSetPtr(n_nodes, 0);
41909 
41910         ret_val = xmlXPathDistinct(nodes);
41911         desret_xmlNodeSetPtr(ret_val);
41912         call_tests++;
41913         des_xmlNodeSetPtr(n_nodes, nodes, 0);
41914         xmlResetLastError();
41915         if (mem_base != xmlMemBlocks()) {
41916             printf("Leak of %d blocks found in xmlXPathDistinct",
41917 	           xmlMemBlocks() - mem_base);
41918 	    test_ret++;
41919             printf(" %d", n_nodes);
41920             printf("\n");
41921         }
41922     }
41923     function_tests++;
41924 #endif
41925 
41926     return(test_ret);
41927 }
41928 
41929 
41930 static int
test_xmlXPathDistinctSorted(void)41931 test_xmlXPathDistinctSorted(void) {
41932     int test_ret = 0;
41933 
41934 #if defined(LIBXML_XPATH_ENABLED)
41935     int mem_base;
41936     xmlNodeSetPtr ret_val;
41937     xmlNodeSetPtr nodes; /* a node-set, sorted by document order */
41938     int n_nodes;
41939 
41940     for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
41941         mem_base = xmlMemBlocks();
41942         nodes = gen_xmlNodeSetPtr(n_nodes, 0);
41943 
41944         ret_val = xmlXPathDistinctSorted(nodes);
41945         desret_xmlNodeSetPtr(ret_val);
41946         call_tests++;
41947         des_xmlNodeSetPtr(n_nodes, nodes, 0);
41948         xmlResetLastError();
41949         if (mem_base != xmlMemBlocks()) {
41950             printf("Leak of %d blocks found in xmlXPathDistinctSorted",
41951 	           xmlMemBlocks() - mem_base);
41952 	    test_ret++;
41953             printf(" %d", n_nodes);
41954             printf("\n");
41955         }
41956     }
41957     function_tests++;
41958 #endif
41959 
41960     return(test_ret);
41961 }
41962 
41963 
41964 static int
test_xmlXPathDivValues(void)41965 test_xmlXPathDivValues(void) {
41966     int test_ret = 0;
41967 
41968 #if defined(LIBXML_XPATH_ENABLED)
41969     int mem_base;
41970     xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
41971     int n_ctxt;
41972 
41973     for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
41974         mem_base = xmlMemBlocks();
41975         ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
41976 
41977         xmlXPathDivValues(ctxt);
41978         call_tests++;
41979         des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
41980         xmlResetLastError();
41981         if (mem_base != xmlMemBlocks()) {
41982             printf("Leak of %d blocks found in xmlXPathDivValues",
41983 	           xmlMemBlocks() - mem_base);
41984 	    test_ret++;
41985             printf(" %d", n_ctxt);
41986             printf("\n");
41987         }
41988     }
41989     function_tests++;
41990 #endif
41991 
41992     return(test_ret);
41993 }
41994 
41995 
41996 static int
test_xmlXPathEqualValues(void)41997 test_xmlXPathEqualValues(void) {
41998     int test_ret = 0;
41999 
42000 #if defined(LIBXML_XPATH_ENABLED)
42001     int mem_base;
42002     int ret_val;
42003     xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
42004     int n_ctxt;
42005 
42006     for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
42007         mem_base = xmlMemBlocks();
42008         ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
42009 
42010         ret_val = xmlXPathEqualValues(ctxt);
42011         desret_int(ret_val);
42012         call_tests++;
42013         des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
42014         xmlResetLastError();
42015         if (mem_base != xmlMemBlocks()) {
42016             printf("Leak of %d blocks found in xmlXPathEqualValues",
42017 	           xmlMemBlocks() - mem_base);
42018 	    test_ret++;
42019             printf(" %d", n_ctxt);
42020             printf("\n");
42021         }
42022     }
42023     function_tests++;
42024 #endif
42025 
42026     return(test_ret);
42027 }
42028 
42029 
42030 static int
test_xmlXPathErr(void)42031 test_xmlXPathErr(void) {
42032     int test_ret = 0;
42033 
42034 #if defined(LIBXML_XPATH_ENABLED)
42035     int mem_base;
42036     xmlXPathParserContextPtr ctxt; /* a XPath parser context */
42037     int n_ctxt;
42038     int code; /* the error code */
42039     int n_code;
42040 
42041     for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
42042     for (n_code = 0;n_code < gen_nb_int;n_code++) {
42043         mem_base = xmlMemBlocks();
42044         ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
42045         code = gen_int(n_code, 1);
42046 
42047         xmlXPathErr(ctxt, code);
42048         call_tests++;
42049         des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
42050         des_int(n_code, code, 1);
42051         xmlResetLastError();
42052         if (mem_base != xmlMemBlocks()) {
42053             printf("Leak of %d blocks found in xmlXPathErr",
42054 	           xmlMemBlocks() - mem_base);
42055 	    test_ret++;
42056             printf(" %d", n_ctxt);
42057             printf(" %d", n_code);
42058             printf("\n");
42059         }
42060     }
42061     }
42062     function_tests++;
42063 #endif
42064 
42065     return(test_ret);
42066 }
42067 
42068 
42069 static int
test_xmlXPathEvalExpr(void)42070 test_xmlXPathEvalExpr(void) {
42071     int test_ret = 0;
42072 
42073 #if defined(LIBXML_XPATH_ENABLED)
42074     int mem_base;
42075     xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
42076     int n_ctxt;
42077 
42078     for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
42079         mem_base = xmlMemBlocks();
42080         ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
42081 
42082         xmlXPathEvalExpr(ctxt);
42083         call_tests++;
42084         des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
42085         xmlResetLastError();
42086         if (mem_base != xmlMemBlocks()) {
42087             printf("Leak of %d blocks found in xmlXPathEvalExpr",
42088 	           xmlMemBlocks() - mem_base);
42089 	    test_ret++;
42090             printf(" %d", n_ctxt);
42091             printf("\n");
42092         }
42093     }
42094     function_tests++;
42095 #endif
42096 
42097     return(test_ret);
42098 }
42099 
42100 
42101 static int
test_xmlXPathEvaluatePredicateResult(void)42102 test_xmlXPathEvaluatePredicateResult(void) {
42103     int test_ret = 0;
42104 
42105 #if defined(LIBXML_XPATH_ENABLED)
42106     int mem_base;
42107     int ret_val;
42108     xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
42109     int n_ctxt;
42110     xmlXPathObjectPtr res; /* the Predicate Expression evaluation result */
42111     int n_res;
42112 
42113     for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
42114     for (n_res = 0;n_res < gen_nb_xmlXPathObjectPtr;n_res++) {
42115         mem_base = xmlMemBlocks();
42116         ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
42117         res = gen_xmlXPathObjectPtr(n_res, 1);
42118 
42119         ret_val = xmlXPathEvaluatePredicateResult(ctxt, res);
42120         desret_int(ret_val);
42121         call_tests++;
42122         des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
42123         des_xmlXPathObjectPtr(n_res, res, 1);
42124         xmlResetLastError();
42125         if (mem_base != xmlMemBlocks()) {
42126             printf("Leak of %d blocks found in xmlXPathEvaluatePredicateResult",
42127 	           xmlMemBlocks() - mem_base);
42128 	    test_ret++;
42129             printf(" %d", n_ctxt);
42130             printf(" %d", n_res);
42131             printf("\n");
42132         }
42133     }
42134     }
42135     function_tests++;
42136 #endif
42137 
42138     return(test_ret);
42139 }
42140 
42141 
42142 static int
test_xmlXPathFalseFunction(void)42143 test_xmlXPathFalseFunction(void) {
42144     int test_ret = 0;
42145 
42146 #if defined(LIBXML_XPATH_ENABLED)
42147     int mem_base;
42148     xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
42149     int n_ctxt;
42150     int nargs; /* the number of arguments */
42151     int n_nargs;
42152 
42153     for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
42154     for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
42155         mem_base = xmlMemBlocks();
42156         ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
42157         nargs = gen_int(n_nargs, 1);
42158 
42159         xmlXPathFalseFunction(ctxt, nargs);
42160         call_tests++;
42161         des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
42162         des_int(n_nargs, nargs, 1);
42163         xmlResetLastError();
42164         if (mem_base != xmlMemBlocks()) {
42165             printf("Leak of %d blocks found in xmlXPathFalseFunction",
42166 	           xmlMemBlocks() - mem_base);
42167 	    test_ret++;
42168             printf(" %d", n_ctxt);
42169             printf(" %d", n_nargs);
42170             printf("\n");
42171         }
42172     }
42173     }
42174     function_tests++;
42175 #endif
42176 
42177     return(test_ret);
42178 }
42179 
42180 
42181 static int
test_xmlXPathFloorFunction(void)42182 test_xmlXPathFloorFunction(void) {
42183     int test_ret = 0;
42184 
42185 #if defined(LIBXML_XPATH_ENABLED)
42186     int mem_base;
42187     xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
42188     int n_ctxt;
42189     int nargs; /* the number of arguments */
42190     int n_nargs;
42191 
42192     for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
42193     for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
42194         mem_base = xmlMemBlocks();
42195         ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
42196         nargs = gen_int(n_nargs, 1);
42197 
42198         xmlXPathFloorFunction(ctxt, nargs);
42199         call_tests++;
42200         des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
42201         des_int(n_nargs, nargs, 1);
42202         xmlResetLastError();
42203         if (mem_base != xmlMemBlocks()) {
42204             printf("Leak of %d blocks found in xmlXPathFloorFunction",
42205 	           xmlMemBlocks() - mem_base);
42206 	    test_ret++;
42207             printf(" %d", n_ctxt);
42208             printf(" %d", n_nargs);
42209             printf("\n");
42210         }
42211     }
42212     }
42213     function_tests++;
42214 #endif
42215 
42216     return(test_ret);
42217 }
42218 
42219 
42220 static int
test_xmlXPathFunctionLookup(void)42221 test_xmlXPathFunctionLookup(void) {
42222     int test_ret = 0;
42223 
42224 
42225     /* missing type support */
42226     return(test_ret);
42227 }
42228 
42229 
42230 static int
test_xmlXPathFunctionLookupNS(void)42231 test_xmlXPathFunctionLookupNS(void) {
42232     int test_ret = 0;
42233 
42234 
42235     /* missing type support */
42236     return(test_ret);
42237 }
42238 
42239 
42240 static int
test_xmlXPathHasSameNodes(void)42241 test_xmlXPathHasSameNodes(void) {
42242     int test_ret = 0;
42243 
42244 #if defined(LIBXML_XPATH_ENABLED)
42245     int mem_base;
42246     int ret_val;
42247     xmlNodeSetPtr nodes1; /* a node-set */
42248     int n_nodes1;
42249     xmlNodeSetPtr nodes2; /* a node-set */
42250     int n_nodes2;
42251 
42252     for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
42253     for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
42254         mem_base = xmlMemBlocks();
42255         nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
42256         nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
42257 
42258         ret_val = xmlXPathHasSameNodes(nodes1, nodes2);
42259         desret_int(ret_val);
42260         call_tests++;
42261         des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
42262         des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
42263         xmlResetLastError();
42264         if (mem_base != xmlMemBlocks()) {
42265             printf("Leak of %d blocks found in xmlXPathHasSameNodes",
42266 	           xmlMemBlocks() - mem_base);
42267 	    test_ret++;
42268             printf(" %d", n_nodes1);
42269             printf(" %d", n_nodes2);
42270             printf("\n");
42271         }
42272     }
42273     }
42274     function_tests++;
42275 #endif
42276 
42277     return(test_ret);
42278 }
42279 
42280 
42281 static int
test_xmlXPathIdFunction(void)42282 test_xmlXPathIdFunction(void) {
42283     int test_ret = 0;
42284 
42285 #if defined(LIBXML_XPATH_ENABLED)
42286     int mem_base;
42287     xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
42288     int n_ctxt;
42289     int nargs; /* the number of arguments */
42290     int n_nargs;
42291 
42292     for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
42293     for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
42294         mem_base = xmlMemBlocks();
42295         ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
42296         nargs = gen_int(n_nargs, 1);
42297 
42298         xmlXPathIdFunction(ctxt, nargs);
42299         call_tests++;
42300         des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
42301         des_int(n_nargs, nargs, 1);
42302         xmlResetLastError();
42303         if (mem_base != xmlMemBlocks()) {
42304             printf("Leak of %d blocks found in xmlXPathIdFunction",
42305 	           xmlMemBlocks() - mem_base);
42306 	    test_ret++;
42307             printf(" %d", n_ctxt);
42308             printf(" %d", n_nargs);
42309             printf("\n");
42310         }
42311     }
42312     }
42313     function_tests++;
42314 #endif
42315 
42316     return(test_ret);
42317 }
42318 
42319 
42320 static int
test_xmlXPathIntersection(void)42321 test_xmlXPathIntersection(void) {
42322     int test_ret = 0;
42323 
42324 #if defined(LIBXML_XPATH_ENABLED)
42325     int mem_base;
42326     xmlNodeSetPtr ret_val;
42327     xmlNodeSetPtr nodes1; /* a node-set */
42328     int n_nodes1;
42329     xmlNodeSetPtr nodes2; /* a node-set */
42330     int n_nodes2;
42331 
42332     for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
42333     for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
42334         mem_base = xmlMemBlocks();
42335         nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
42336         nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
42337 
42338         ret_val = xmlXPathIntersection(nodes1, nodes2);
42339         desret_xmlNodeSetPtr(ret_val);
42340         call_tests++;
42341         des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
42342         des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
42343         xmlResetLastError();
42344         if (mem_base != xmlMemBlocks()) {
42345             printf("Leak of %d blocks found in xmlXPathIntersection",
42346 	           xmlMemBlocks() - mem_base);
42347 	    test_ret++;
42348             printf(" %d", n_nodes1);
42349             printf(" %d", n_nodes2);
42350             printf("\n");
42351         }
42352     }
42353     }
42354     function_tests++;
42355 #endif
42356 
42357     return(test_ret);
42358 }
42359 
42360 
42361 static int
test_xmlXPathIsNodeType(void)42362 test_xmlXPathIsNodeType(void) {
42363     int test_ret = 0;
42364 
42365 #if defined(LIBXML_XPATH_ENABLED)
42366     int mem_base;
42367     int ret_val;
42368     const xmlChar * name; /* a name string */
42369     int n_name;
42370 
42371     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
42372         mem_base = xmlMemBlocks();
42373         name = gen_const_xmlChar_ptr(n_name, 0);
42374 
42375         ret_val = xmlXPathIsNodeType(name);
42376         desret_int(ret_val);
42377         call_tests++;
42378         des_const_xmlChar_ptr(n_name, name, 0);
42379         xmlResetLastError();
42380         if (mem_base != xmlMemBlocks()) {
42381             printf("Leak of %d blocks found in xmlXPathIsNodeType",
42382 	           xmlMemBlocks() - mem_base);
42383 	    test_ret++;
42384             printf(" %d", n_name);
42385             printf("\n");
42386         }
42387     }
42388     function_tests++;
42389 #endif
42390 
42391     return(test_ret);
42392 }
42393 
42394 
42395 static int
test_xmlXPathLangFunction(void)42396 test_xmlXPathLangFunction(void) {
42397     int test_ret = 0;
42398 
42399 #if defined(LIBXML_XPATH_ENABLED)
42400     int mem_base;
42401     xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
42402     int n_ctxt;
42403     int nargs; /* the number of arguments */
42404     int n_nargs;
42405 
42406     for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
42407     for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
42408         mem_base = xmlMemBlocks();
42409         ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
42410         nargs = gen_int(n_nargs, 1);
42411 
42412         xmlXPathLangFunction(ctxt, nargs);
42413         call_tests++;
42414         des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
42415         des_int(n_nargs, nargs, 1);
42416         xmlResetLastError();
42417         if (mem_base != xmlMemBlocks()) {
42418             printf("Leak of %d blocks found in xmlXPathLangFunction",
42419 	           xmlMemBlocks() - mem_base);
42420 	    test_ret++;
42421             printf(" %d", n_ctxt);
42422             printf(" %d", n_nargs);
42423             printf("\n");
42424         }
42425     }
42426     }
42427     function_tests++;
42428 #endif
42429 
42430     return(test_ret);
42431 }
42432 
42433 
42434 static int
test_xmlXPathLastFunction(void)42435 test_xmlXPathLastFunction(void) {
42436     int test_ret = 0;
42437 
42438 #if defined(LIBXML_XPATH_ENABLED)
42439     int mem_base;
42440     xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
42441     int n_ctxt;
42442     int nargs; /* the number of arguments */
42443     int n_nargs;
42444 
42445     for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
42446     for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
42447         mem_base = xmlMemBlocks();
42448         ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
42449         nargs = gen_int(n_nargs, 1);
42450 
42451         xmlXPathLastFunction(ctxt, nargs);
42452         call_tests++;
42453         des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
42454         des_int(n_nargs, nargs, 1);
42455         xmlResetLastError();
42456         if (mem_base != xmlMemBlocks()) {
42457             printf("Leak of %d blocks found in xmlXPathLastFunction",
42458 	           xmlMemBlocks() - mem_base);
42459 	    test_ret++;
42460             printf(" %d", n_ctxt);
42461             printf(" %d", n_nargs);
42462             printf("\n");
42463         }
42464     }
42465     }
42466     function_tests++;
42467 #endif
42468 
42469     return(test_ret);
42470 }
42471 
42472 
42473 static int
test_xmlXPathLeading(void)42474 test_xmlXPathLeading(void) {
42475     int test_ret = 0;
42476 
42477 #if defined(LIBXML_XPATH_ENABLED)
42478     int mem_base;
42479     xmlNodeSetPtr ret_val;
42480     xmlNodeSetPtr nodes1; /* a node-set */
42481     int n_nodes1;
42482     xmlNodeSetPtr nodes2; /* a node-set */
42483     int n_nodes2;
42484 
42485     for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
42486     for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
42487         mem_base = xmlMemBlocks();
42488         nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
42489         nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
42490 
42491         ret_val = xmlXPathLeading(nodes1, nodes2);
42492         desret_xmlNodeSetPtr(ret_val);
42493         call_tests++;
42494         des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
42495         des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
42496         xmlResetLastError();
42497         if (mem_base != xmlMemBlocks()) {
42498             printf("Leak of %d blocks found in xmlXPathLeading",
42499 	           xmlMemBlocks() - mem_base);
42500 	    test_ret++;
42501             printf(" %d", n_nodes1);
42502             printf(" %d", n_nodes2);
42503             printf("\n");
42504         }
42505     }
42506     }
42507     function_tests++;
42508 #endif
42509 
42510     return(test_ret);
42511 }
42512 
42513 
42514 static int
test_xmlXPathLeadingSorted(void)42515 test_xmlXPathLeadingSorted(void) {
42516     int test_ret = 0;
42517 
42518 #if defined(LIBXML_XPATH_ENABLED)
42519     int mem_base;
42520     xmlNodeSetPtr ret_val;
42521     xmlNodeSetPtr nodes1; /* a node-set, sorted by document order */
42522     int n_nodes1;
42523     xmlNodeSetPtr nodes2; /* a node-set, sorted by document order */
42524     int n_nodes2;
42525 
42526     for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
42527     for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
42528         mem_base = xmlMemBlocks();
42529         nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
42530         nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
42531 
42532         ret_val = xmlXPathLeadingSorted(nodes1, nodes2);
42533         desret_xmlNodeSetPtr(ret_val);
42534         call_tests++;
42535         des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
42536         des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
42537         xmlResetLastError();
42538         if (mem_base != xmlMemBlocks()) {
42539             printf("Leak of %d blocks found in xmlXPathLeadingSorted",
42540 	           xmlMemBlocks() - mem_base);
42541 	    test_ret++;
42542             printf(" %d", n_nodes1);
42543             printf(" %d", n_nodes2);
42544             printf("\n");
42545         }
42546     }
42547     }
42548     function_tests++;
42549 #endif
42550 
42551     return(test_ret);
42552 }
42553 
42554 
42555 static int
test_xmlXPathLocalNameFunction(void)42556 test_xmlXPathLocalNameFunction(void) {
42557     int test_ret = 0;
42558 
42559 #if defined(LIBXML_XPATH_ENABLED)
42560     int mem_base;
42561     xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
42562     int n_ctxt;
42563     int nargs; /* the number of arguments */
42564     int n_nargs;
42565 
42566     for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
42567     for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
42568         mem_base = xmlMemBlocks();
42569         ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
42570         nargs = gen_int(n_nargs, 1);
42571 
42572         xmlXPathLocalNameFunction(ctxt, nargs);
42573         call_tests++;
42574         des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
42575         des_int(n_nargs, nargs, 1);
42576         xmlResetLastError();
42577         if (mem_base != xmlMemBlocks()) {
42578             printf("Leak of %d blocks found in xmlXPathLocalNameFunction",
42579 	           xmlMemBlocks() - mem_base);
42580 	    test_ret++;
42581             printf(" %d", n_ctxt);
42582             printf(" %d", n_nargs);
42583             printf("\n");
42584         }
42585     }
42586     }
42587     function_tests++;
42588 #endif
42589 
42590     return(test_ret);
42591 }
42592 
42593 
42594 static int
test_xmlXPathModValues(void)42595 test_xmlXPathModValues(void) {
42596     int test_ret = 0;
42597 
42598 #if defined(LIBXML_XPATH_ENABLED)
42599     int mem_base;
42600     xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
42601     int n_ctxt;
42602 
42603     for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
42604         mem_base = xmlMemBlocks();
42605         ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
42606 
42607         xmlXPathModValues(ctxt);
42608         call_tests++;
42609         des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
42610         xmlResetLastError();
42611         if (mem_base != xmlMemBlocks()) {
42612             printf("Leak of %d blocks found in xmlXPathModValues",
42613 	           xmlMemBlocks() - mem_base);
42614 	    test_ret++;
42615             printf(" %d", n_ctxt);
42616             printf("\n");
42617         }
42618     }
42619     function_tests++;
42620 #endif
42621 
42622     return(test_ret);
42623 }
42624 
42625 
42626 static int
test_xmlXPathMultValues(void)42627 test_xmlXPathMultValues(void) {
42628     int test_ret = 0;
42629 
42630 #if defined(LIBXML_XPATH_ENABLED)
42631     int mem_base;
42632     xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
42633     int n_ctxt;
42634 
42635     for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
42636         mem_base = xmlMemBlocks();
42637         ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
42638 
42639         xmlXPathMultValues(ctxt);
42640         call_tests++;
42641         des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
42642         xmlResetLastError();
42643         if (mem_base != xmlMemBlocks()) {
42644             printf("Leak of %d blocks found in xmlXPathMultValues",
42645 	           xmlMemBlocks() - mem_base);
42646 	    test_ret++;
42647             printf(" %d", n_ctxt);
42648             printf("\n");
42649         }
42650     }
42651     function_tests++;
42652 #endif
42653 
42654     return(test_ret);
42655 }
42656 
42657 
42658 static int
test_xmlXPathNamespaceURIFunction(void)42659 test_xmlXPathNamespaceURIFunction(void) {
42660     int test_ret = 0;
42661 
42662 #if defined(LIBXML_XPATH_ENABLED)
42663     int mem_base;
42664     xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
42665     int n_ctxt;
42666     int nargs; /* the number of arguments */
42667     int n_nargs;
42668 
42669     for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
42670     for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
42671         mem_base = xmlMemBlocks();
42672         ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
42673         nargs = gen_int(n_nargs, 1);
42674 
42675         xmlXPathNamespaceURIFunction(ctxt, nargs);
42676         call_tests++;
42677         des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
42678         des_int(n_nargs, nargs, 1);
42679         xmlResetLastError();
42680         if (mem_base != xmlMemBlocks()) {
42681             printf("Leak of %d blocks found in xmlXPathNamespaceURIFunction",
42682 	           xmlMemBlocks() - mem_base);
42683 	    test_ret++;
42684             printf(" %d", n_ctxt);
42685             printf(" %d", n_nargs);
42686             printf("\n");
42687         }
42688     }
42689     }
42690     function_tests++;
42691 #endif
42692 
42693     return(test_ret);
42694 }
42695 
42696 
42697 static int
test_xmlXPathNewBoolean(void)42698 test_xmlXPathNewBoolean(void) {
42699     int test_ret = 0;
42700 
42701 #if defined(LIBXML_XPATH_ENABLED)
42702     int mem_base;
42703     xmlXPathObjectPtr ret_val;
42704     int val; /* the boolean value */
42705     int n_val;
42706 
42707     for (n_val = 0;n_val < gen_nb_int;n_val++) {
42708         mem_base = xmlMemBlocks();
42709         val = gen_int(n_val, 0);
42710 
42711         ret_val = xmlXPathNewBoolean(val);
42712         desret_xmlXPathObjectPtr(ret_val);
42713         call_tests++;
42714         des_int(n_val, val, 0);
42715         xmlResetLastError();
42716         if (mem_base != xmlMemBlocks()) {
42717             printf("Leak of %d blocks found in xmlXPathNewBoolean",
42718 	           xmlMemBlocks() - mem_base);
42719 	    test_ret++;
42720             printf(" %d", n_val);
42721             printf("\n");
42722         }
42723     }
42724     function_tests++;
42725 #endif
42726 
42727     return(test_ret);
42728 }
42729 
42730 
42731 static int
test_xmlXPathNewCString(void)42732 test_xmlXPathNewCString(void) {
42733     int test_ret = 0;
42734 
42735 #if defined(LIBXML_XPATH_ENABLED)
42736     int mem_base;
42737     xmlXPathObjectPtr ret_val;
42738     const char * val; /* the char * value */
42739     int n_val;
42740 
42741     for (n_val = 0;n_val < gen_nb_const_char_ptr;n_val++) {
42742         mem_base = xmlMemBlocks();
42743         val = gen_const_char_ptr(n_val, 0);
42744 
42745         ret_val = xmlXPathNewCString(val);
42746         desret_xmlXPathObjectPtr(ret_val);
42747         call_tests++;
42748         des_const_char_ptr(n_val, val, 0);
42749         xmlResetLastError();
42750         if (mem_base != xmlMemBlocks()) {
42751             printf("Leak of %d blocks found in xmlXPathNewCString",
42752 	           xmlMemBlocks() - mem_base);
42753 	    test_ret++;
42754             printf(" %d", n_val);
42755             printf("\n");
42756         }
42757     }
42758     function_tests++;
42759 #endif
42760 
42761     return(test_ret);
42762 }
42763 
42764 
42765 static int
test_xmlXPathNewFloat(void)42766 test_xmlXPathNewFloat(void) {
42767     int test_ret = 0;
42768 
42769 #if defined(LIBXML_XPATH_ENABLED)
42770     int mem_base;
42771     xmlXPathObjectPtr ret_val;
42772     double val; /* the double value */
42773     int n_val;
42774 
42775     for (n_val = 0;n_val < gen_nb_double;n_val++) {
42776         mem_base = xmlMemBlocks();
42777         val = gen_double(n_val, 0);
42778 
42779         ret_val = xmlXPathNewFloat(val);
42780         desret_xmlXPathObjectPtr(ret_val);
42781         call_tests++;
42782         des_double(n_val, val, 0);
42783         xmlResetLastError();
42784         if (mem_base != xmlMemBlocks()) {
42785             printf("Leak of %d blocks found in xmlXPathNewFloat",
42786 	           xmlMemBlocks() - mem_base);
42787 	    test_ret++;
42788             printf(" %d", n_val);
42789             printf("\n");
42790         }
42791     }
42792     function_tests++;
42793 #endif
42794 
42795     return(test_ret);
42796 }
42797 
42798 
42799 static int
test_xmlXPathNewNodeSet(void)42800 test_xmlXPathNewNodeSet(void) {
42801     int test_ret = 0;
42802 
42803 #if defined(LIBXML_XPATH_ENABLED)
42804     int mem_base;
42805     xmlXPathObjectPtr ret_val;
42806     xmlNodePtr val; /* the NodePtr value */
42807     int n_val;
42808 
42809     for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
42810         mem_base = xmlMemBlocks();
42811         val = gen_xmlNodePtr(n_val, 0);
42812 
42813         ret_val = xmlXPathNewNodeSet(val);
42814         desret_xmlXPathObjectPtr(ret_val);
42815         call_tests++;
42816         des_xmlNodePtr(n_val, val, 0);
42817         xmlResetLastError();
42818         if (mem_base != xmlMemBlocks()) {
42819             printf("Leak of %d blocks found in xmlXPathNewNodeSet",
42820 	           xmlMemBlocks() - mem_base);
42821 	    test_ret++;
42822             printf(" %d", n_val);
42823             printf("\n");
42824         }
42825     }
42826     function_tests++;
42827 #endif
42828 
42829     return(test_ret);
42830 }
42831 
42832 
42833 static int
test_xmlXPathNewNodeSetList(void)42834 test_xmlXPathNewNodeSetList(void) {
42835     int test_ret = 0;
42836 
42837 #if defined(LIBXML_XPATH_ENABLED)
42838     int mem_base;
42839     xmlXPathObjectPtr ret_val;
42840     xmlNodeSetPtr val; /* an existing NodeSet */
42841     int n_val;
42842 
42843     for (n_val = 0;n_val < gen_nb_xmlNodeSetPtr;n_val++) {
42844         mem_base = xmlMemBlocks();
42845         val = gen_xmlNodeSetPtr(n_val, 0);
42846 
42847         ret_val = xmlXPathNewNodeSetList(val);
42848         desret_xmlXPathObjectPtr(ret_val);
42849         call_tests++;
42850         des_xmlNodeSetPtr(n_val, val, 0);
42851         xmlResetLastError();
42852         if (mem_base != xmlMemBlocks()) {
42853             printf("Leak of %d blocks found in xmlXPathNewNodeSetList",
42854 	           xmlMemBlocks() - mem_base);
42855 	    test_ret++;
42856             printf(" %d", n_val);
42857             printf("\n");
42858         }
42859     }
42860     function_tests++;
42861 #endif
42862 
42863     return(test_ret);
42864 }
42865 
42866 
42867 static int
test_xmlXPathNewParserContext(void)42868 test_xmlXPathNewParserContext(void) {
42869     int test_ret = 0;
42870 
42871 
42872     /* missing type support */
42873     return(test_ret);
42874 }
42875 
42876 
42877 static int
test_xmlXPathNewString(void)42878 test_xmlXPathNewString(void) {
42879     int test_ret = 0;
42880 
42881 #if defined(LIBXML_XPATH_ENABLED)
42882     int mem_base;
42883     xmlXPathObjectPtr ret_val;
42884     const xmlChar * val; /* the xmlChar * value */
42885     int n_val;
42886 
42887     for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
42888         mem_base = xmlMemBlocks();
42889         val = gen_const_xmlChar_ptr(n_val, 0);
42890 
42891         ret_val = xmlXPathNewString(val);
42892         desret_xmlXPathObjectPtr(ret_val);
42893         call_tests++;
42894         des_const_xmlChar_ptr(n_val, val, 0);
42895         xmlResetLastError();
42896         if (mem_base != xmlMemBlocks()) {
42897             printf("Leak of %d blocks found in xmlXPathNewString",
42898 	           xmlMemBlocks() - mem_base);
42899 	    test_ret++;
42900             printf(" %d", n_val);
42901             printf("\n");
42902         }
42903     }
42904     function_tests++;
42905 #endif
42906 
42907     return(test_ret);
42908 }
42909 
42910 
42911 static int
test_xmlXPathNextAncestor(void)42912 test_xmlXPathNextAncestor(void) {
42913     int test_ret = 0;
42914 
42915 #if defined(LIBXML_XPATH_ENABLED)
42916     int mem_base;
42917     xmlNodePtr ret_val;
42918     xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
42919     int n_ctxt;
42920     xmlNodePtr cur; /* the current node in the traversal */
42921     int n_cur;
42922 
42923     for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
42924     for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
42925         mem_base = xmlMemBlocks();
42926         ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
42927         cur = gen_xmlNodePtr(n_cur, 1);
42928 
42929         ret_val = xmlXPathNextAncestor(ctxt, cur);
42930         desret_xmlNodePtr(ret_val);
42931         call_tests++;
42932         des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
42933         des_xmlNodePtr(n_cur, cur, 1);
42934         xmlResetLastError();
42935         if (mem_base != xmlMemBlocks()) {
42936             printf("Leak of %d blocks found in xmlXPathNextAncestor",
42937 	           xmlMemBlocks() - mem_base);
42938 	    test_ret++;
42939             printf(" %d", n_ctxt);
42940             printf(" %d", n_cur);
42941             printf("\n");
42942         }
42943     }
42944     }
42945     function_tests++;
42946 #endif
42947 
42948     return(test_ret);
42949 }
42950 
42951 
42952 static int
test_xmlXPathNextAncestorOrSelf(void)42953 test_xmlXPathNextAncestorOrSelf(void) {
42954     int test_ret = 0;
42955 
42956 #if defined(LIBXML_XPATH_ENABLED)
42957     int mem_base;
42958     xmlNodePtr ret_val;
42959     xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
42960     int n_ctxt;
42961     xmlNodePtr cur; /* the current node in the traversal */
42962     int n_cur;
42963 
42964     for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
42965     for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
42966         mem_base = xmlMemBlocks();
42967         ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
42968         cur = gen_xmlNodePtr(n_cur, 1);
42969 
42970         ret_val = xmlXPathNextAncestorOrSelf(ctxt, cur);
42971         desret_xmlNodePtr(ret_val);
42972         call_tests++;
42973         des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
42974         des_xmlNodePtr(n_cur, cur, 1);
42975         xmlResetLastError();
42976         if (mem_base != xmlMemBlocks()) {
42977             printf("Leak of %d blocks found in xmlXPathNextAncestorOrSelf",
42978 	           xmlMemBlocks() - mem_base);
42979 	    test_ret++;
42980             printf(" %d", n_ctxt);
42981             printf(" %d", n_cur);
42982             printf("\n");
42983         }
42984     }
42985     }
42986     function_tests++;
42987 #endif
42988 
42989     return(test_ret);
42990 }
42991 
42992 
42993 static int
test_xmlXPathNextAttribute(void)42994 test_xmlXPathNextAttribute(void) {
42995     int test_ret = 0;
42996 
42997 #if defined(LIBXML_XPATH_ENABLED)
42998     int mem_base;
42999     xmlNodePtr ret_val;
43000     xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43001     int n_ctxt;
43002     xmlNodePtr cur; /* the current attribute in the traversal */
43003     int n_cur;
43004 
43005     for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43006     for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
43007         mem_base = xmlMemBlocks();
43008         ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43009         cur = gen_xmlNodePtr(n_cur, 1);
43010 
43011         ret_val = xmlXPathNextAttribute(ctxt, cur);
43012         desret_xmlNodePtr(ret_val);
43013         call_tests++;
43014         des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43015         des_xmlNodePtr(n_cur, cur, 1);
43016         xmlResetLastError();
43017         if (mem_base != xmlMemBlocks()) {
43018             printf("Leak of %d blocks found in xmlXPathNextAttribute",
43019 	           xmlMemBlocks() - mem_base);
43020 	    test_ret++;
43021             printf(" %d", n_ctxt);
43022             printf(" %d", n_cur);
43023             printf("\n");
43024         }
43025     }
43026     }
43027     function_tests++;
43028 #endif
43029 
43030     return(test_ret);
43031 }
43032 
43033 
43034 static int
test_xmlXPathNextChild(void)43035 test_xmlXPathNextChild(void) {
43036     int test_ret = 0;
43037 
43038 #if defined(LIBXML_XPATH_ENABLED)
43039     int mem_base;
43040     xmlNodePtr ret_val;
43041     xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43042     int n_ctxt;
43043     xmlNodePtr cur; /* the current node in the traversal */
43044     int n_cur;
43045 
43046     for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43047     for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
43048         mem_base = xmlMemBlocks();
43049         ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43050         cur = gen_xmlNodePtr(n_cur, 1);
43051 
43052         ret_val = xmlXPathNextChild(ctxt, cur);
43053         desret_xmlNodePtr(ret_val);
43054         call_tests++;
43055         des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43056         des_xmlNodePtr(n_cur, cur, 1);
43057         xmlResetLastError();
43058         if (mem_base != xmlMemBlocks()) {
43059             printf("Leak of %d blocks found in xmlXPathNextChild",
43060 	           xmlMemBlocks() - mem_base);
43061 	    test_ret++;
43062             printf(" %d", n_ctxt);
43063             printf(" %d", n_cur);
43064             printf("\n");
43065         }
43066     }
43067     }
43068     function_tests++;
43069 #endif
43070 
43071     return(test_ret);
43072 }
43073 
43074 
43075 static int
test_xmlXPathNextDescendant(void)43076 test_xmlXPathNextDescendant(void) {
43077     int test_ret = 0;
43078 
43079 #if defined(LIBXML_XPATH_ENABLED)
43080     int mem_base;
43081     xmlNodePtr ret_val;
43082     xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43083     int n_ctxt;
43084     xmlNodePtr cur; /* the current node in the traversal */
43085     int n_cur;
43086 
43087     for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43088     for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
43089         mem_base = xmlMemBlocks();
43090         ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43091         cur = gen_xmlNodePtr(n_cur, 1);
43092 
43093         ret_val = xmlXPathNextDescendant(ctxt, cur);
43094         desret_xmlNodePtr(ret_val);
43095         call_tests++;
43096         des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43097         des_xmlNodePtr(n_cur, cur, 1);
43098         xmlResetLastError();
43099         if (mem_base != xmlMemBlocks()) {
43100             printf("Leak of %d blocks found in xmlXPathNextDescendant",
43101 	           xmlMemBlocks() - mem_base);
43102 	    test_ret++;
43103             printf(" %d", n_ctxt);
43104             printf(" %d", n_cur);
43105             printf("\n");
43106         }
43107     }
43108     }
43109     function_tests++;
43110 #endif
43111 
43112     return(test_ret);
43113 }
43114 
43115 
43116 static int
test_xmlXPathNextDescendantOrSelf(void)43117 test_xmlXPathNextDescendantOrSelf(void) {
43118     int test_ret = 0;
43119 
43120 #if defined(LIBXML_XPATH_ENABLED)
43121     int mem_base;
43122     xmlNodePtr ret_val;
43123     xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43124     int n_ctxt;
43125     xmlNodePtr cur; /* the current node in the traversal */
43126     int n_cur;
43127 
43128     for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43129     for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
43130         mem_base = xmlMemBlocks();
43131         ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43132         cur = gen_xmlNodePtr(n_cur, 1);
43133 
43134         ret_val = xmlXPathNextDescendantOrSelf(ctxt, cur);
43135         desret_xmlNodePtr(ret_val);
43136         call_tests++;
43137         des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43138         des_xmlNodePtr(n_cur, cur, 1);
43139         xmlResetLastError();
43140         if (mem_base != xmlMemBlocks()) {
43141             printf("Leak of %d blocks found in xmlXPathNextDescendantOrSelf",
43142 	           xmlMemBlocks() - mem_base);
43143 	    test_ret++;
43144             printf(" %d", n_ctxt);
43145             printf(" %d", n_cur);
43146             printf("\n");
43147         }
43148     }
43149     }
43150     function_tests++;
43151 #endif
43152 
43153     return(test_ret);
43154 }
43155 
43156 
43157 static int
test_xmlXPathNextFollowing(void)43158 test_xmlXPathNextFollowing(void) {
43159     int test_ret = 0;
43160 
43161 #if defined(LIBXML_XPATH_ENABLED)
43162     int mem_base;
43163     xmlNodePtr ret_val;
43164     xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43165     int n_ctxt;
43166     xmlNodePtr cur; /* the current node in the traversal */
43167     int n_cur;
43168 
43169     for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43170     for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
43171         mem_base = xmlMemBlocks();
43172         ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43173         cur = gen_xmlNodePtr(n_cur, 1);
43174 
43175         ret_val = xmlXPathNextFollowing(ctxt, cur);
43176         desret_xmlNodePtr(ret_val);
43177         call_tests++;
43178         des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43179         des_xmlNodePtr(n_cur, cur, 1);
43180         xmlResetLastError();
43181         if (mem_base != xmlMemBlocks()) {
43182             printf("Leak of %d blocks found in xmlXPathNextFollowing",
43183 	           xmlMemBlocks() - mem_base);
43184 	    test_ret++;
43185             printf(" %d", n_ctxt);
43186             printf(" %d", n_cur);
43187             printf("\n");
43188         }
43189     }
43190     }
43191     function_tests++;
43192 #endif
43193 
43194     return(test_ret);
43195 }
43196 
43197 
43198 static int
test_xmlXPathNextFollowingSibling(void)43199 test_xmlXPathNextFollowingSibling(void) {
43200     int test_ret = 0;
43201 
43202 #if defined(LIBXML_XPATH_ENABLED)
43203     int mem_base;
43204     xmlNodePtr ret_val;
43205     xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43206     int n_ctxt;
43207     xmlNodePtr cur; /* the current node in the traversal */
43208     int n_cur;
43209 
43210     for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43211     for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
43212         mem_base = xmlMemBlocks();
43213         ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43214         cur = gen_xmlNodePtr(n_cur, 1);
43215 
43216         ret_val = xmlXPathNextFollowingSibling(ctxt, cur);
43217         desret_xmlNodePtr(ret_val);
43218         call_tests++;
43219         des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43220         des_xmlNodePtr(n_cur, cur, 1);
43221         xmlResetLastError();
43222         if (mem_base != xmlMemBlocks()) {
43223             printf("Leak of %d blocks found in xmlXPathNextFollowingSibling",
43224 	           xmlMemBlocks() - mem_base);
43225 	    test_ret++;
43226             printf(" %d", n_ctxt);
43227             printf(" %d", n_cur);
43228             printf("\n");
43229         }
43230     }
43231     }
43232     function_tests++;
43233 #endif
43234 
43235     return(test_ret);
43236 }
43237 
43238 
43239 static int
test_xmlXPathNextNamespace(void)43240 test_xmlXPathNextNamespace(void) {
43241     int test_ret = 0;
43242 
43243 #if defined(LIBXML_XPATH_ENABLED)
43244     int mem_base;
43245     xmlNodePtr ret_val;
43246     xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43247     int n_ctxt;
43248     xmlNodePtr cur; /* the current attribute in the traversal */
43249     int n_cur;
43250 
43251     for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43252     for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
43253         mem_base = xmlMemBlocks();
43254         ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43255         cur = gen_xmlNodePtr(n_cur, 1);
43256 
43257         ret_val = xmlXPathNextNamespace(ctxt, cur);
43258         desret_xmlNodePtr(ret_val);
43259         call_tests++;
43260         des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43261         des_xmlNodePtr(n_cur, cur, 1);
43262         xmlResetLastError();
43263         if (mem_base != xmlMemBlocks()) {
43264             printf("Leak of %d blocks found in xmlXPathNextNamespace",
43265 	           xmlMemBlocks() - mem_base);
43266 	    test_ret++;
43267             printf(" %d", n_ctxt);
43268             printf(" %d", n_cur);
43269             printf("\n");
43270         }
43271     }
43272     }
43273     function_tests++;
43274 #endif
43275 
43276     return(test_ret);
43277 }
43278 
43279 
43280 static int
test_xmlXPathNextParent(void)43281 test_xmlXPathNextParent(void) {
43282     int test_ret = 0;
43283 
43284 #if defined(LIBXML_XPATH_ENABLED)
43285     int mem_base;
43286     xmlNodePtr ret_val;
43287     xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43288     int n_ctxt;
43289     xmlNodePtr cur; /* the current node in the traversal */
43290     int n_cur;
43291 
43292     for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43293     for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
43294         mem_base = xmlMemBlocks();
43295         ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43296         cur = gen_xmlNodePtr(n_cur, 1);
43297 
43298         ret_val = xmlXPathNextParent(ctxt, cur);
43299         desret_xmlNodePtr(ret_val);
43300         call_tests++;
43301         des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43302         des_xmlNodePtr(n_cur, cur, 1);
43303         xmlResetLastError();
43304         if (mem_base != xmlMemBlocks()) {
43305             printf("Leak of %d blocks found in xmlXPathNextParent",
43306 	           xmlMemBlocks() - mem_base);
43307 	    test_ret++;
43308             printf(" %d", n_ctxt);
43309             printf(" %d", n_cur);
43310             printf("\n");
43311         }
43312     }
43313     }
43314     function_tests++;
43315 #endif
43316 
43317     return(test_ret);
43318 }
43319 
43320 
43321 static int
test_xmlXPathNextPreceding(void)43322 test_xmlXPathNextPreceding(void) {
43323     int test_ret = 0;
43324 
43325 #if defined(LIBXML_XPATH_ENABLED)
43326     int mem_base;
43327     xmlNodePtr ret_val;
43328     xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43329     int n_ctxt;
43330     xmlNodePtr cur; /* the current node in the traversal */
43331     int n_cur;
43332 
43333     for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43334     for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
43335         mem_base = xmlMemBlocks();
43336         ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43337         cur = gen_xmlNodePtr(n_cur, 1);
43338 
43339         ret_val = xmlXPathNextPreceding(ctxt, cur);
43340         desret_xmlNodePtr(ret_val);
43341         call_tests++;
43342         des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43343         des_xmlNodePtr(n_cur, cur, 1);
43344         xmlResetLastError();
43345         if (mem_base != xmlMemBlocks()) {
43346             printf("Leak of %d blocks found in xmlXPathNextPreceding",
43347 	           xmlMemBlocks() - mem_base);
43348 	    test_ret++;
43349             printf(" %d", n_ctxt);
43350             printf(" %d", n_cur);
43351             printf("\n");
43352         }
43353     }
43354     }
43355     function_tests++;
43356 #endif
43357 
43358     return(test_ret);
43359 }
43360 
43361 
43362 static int
test_xmlXPathNextPrecedingSibling(void)43363 test_xmlXPathNextPrecedingSibling(void) {
43364     int test_ret = 0;
43365 
43366 #if defined(LIBXML_XPATH_ENABLED)
43367     int mem_base;
43368     xmlNodePtr ret_val;
43369     xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43370     int n_ctxt;
43371     xmlNodePtr cur; /* the current node in the traversal */
43372     int n_cur;
43373 
43374     for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43375     for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
43376         mem_base = xmlMemBlocks();
43377         ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43378         cur = gen_xmlNodePtr(n_cur, 1);
43379 
43380         ret_val = xmlXPathNextPrecedingSibling(ctxt, cur);
43381         desret_xmlNodePtr(ret_val);
43382         call_tests++;
43383         des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43384         des_xmlNodePtr(n_cur, cur, 1);
43385         xmlResetLastError();
43386         if (mem_base != xmlMemBlocks()) {
43387             printf("Leak of %d blocks found in xmlXPathNextPrecedingSibling",
43388 	           xmlMemBlocks() - mem_base);
43389 	    test_ret++;
43390             printf(" %d", n_ctxt);
43391             printf(" %d", n_cur);
43392             printf("\n");
43393         }
43394     }
43395     }
43396     function_tests++;
43397 #endif
43398 
43399     return(test_ret);
43400 }
43401 
43402 
43403 static int
test_xmlXPathNextSelf(void)43404 test_xmlXPathNextSelf(void) {
43405     int test_ret = 0;
43406 
43407 #if defined(LIBXML_XPATH_ENABLED)
43408     int mem_base;
43409     xmlNodePtr ret_val;
43410     xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43411     int n_ctxt;
43412     xmlNodePtr cur; /* the current node in the traversal */
43413     int n_cur;
43414 
43415     for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43416     for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
43417         mem_base = xmlMemBlocks();
43418         ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43419         cur = gen_xmlNodePtr(n_cur, 1);
43420 
43421         ret_val = xmlXPathNextSelf(ctxt, cur);
43422         desret_xmlNodePtr(ret_val);
43423         call_tests++;
43424         des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43425         des_xmlNodePtr(n_cur, cur, 1);
43426         xmlResetLastError();
43427         if (mem_base != xmlMemBlocks()) {
43428             printf("Leak of %d blocks found in xmlXPathNextSelf",
43429 	           xmlMemBlocks() - mem_base);
43430 	    test_ret++;
43431             printf(" %d", n_ctxt);
43432             printf(" %d", n_cur);
43433             printf("\n");
43434         }
43435     }
43436     }
43437     function_tests++;
43438 #endif
43439 
43440     return(test_ret);
43441 }
43442 
43443 
43444 static int
test_xmlXPathNodeLeading(void)43445 test_xmlXPathNodeLeading(void) {
43446     int test_ret = 0;
43447 
43448 #if defined(LIBXML_XPATH_ENABLED)
43449     int mem_base;
43450     xmlNodeSetPtr ret_val;
43451     xmlNodeSetPtr nodes; /* a node-set */
43452     int n_nodes;
43453     xmlNodePtr node; /* a node */
43454     int n_node;
43455 
43456     for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
43457     for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
43458         mem_base = xmlMemBlocks();
43459         nodes = gen_xmlNodeSetPtr(n_nodes, 0);
43460         node = gen_xmlNodePtr(n_node, 1);
43461 
43462         ret_val = xmlXPathNodeLeading(nodes, node);
43463         desret_xmlNodeSetPtr(ret_val);
43464         call_tests++;
43465         des_xmlNodeSetPtr(n_nodes, nodes, 0);
43466         des_xmlNodePtr(n_node, node, 1);
43467         xmlResetLastError();
43468         if (mem_base != xmlMemBlocks()) {
43469             printf("Leak of %d blocks found in xmlXPathNodeLeading",
43470 	           xmlMemBlocks() - mem_base);
43471 	    test_ret++;
43472             printf(" %d", n_nodes);
43473             printf(" %d", n_node);
43474             printf("\n");
43475         }
43476     }
43477     }
43478     function_tests++;
43479 #endif
43480 
43481     return(test_ret);
43482 }
43483 
43484 
43485 static int
test_xmlXPathNodeLeadingSorted(void)43486 test_xmlXPathNodeLeadingSorted(void) {
43487     int test_ret = 0;
43488 
43489 #if defined(LIBXML_XPATH_ENABLED)
43490     int mem_base;
43491     xmlNodeSetPtr ret_val;
43492     xmlNodeSetPtr nodes; /* a node-set, sorted by document order */
43493     int n_nodes;
43494     xmlNodePtr node; /* a node */
43495     int n_node;
43496 
43497     for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
43498     for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
43499         mem_base = xmlMemBlocks();
43500         nodes = gen_xmlNodeSetPtr(n_nodes, 0);
43501         node = gen_xmlNodePtr(n_node, 1);
43502 
43503         ret_val = xmlXPathNodeLeadingSorted(nodes, node);
43504         desret_xmlNodeSetPtr(ret_val);
43505         call_tests++;
43506         des_xmlNodeSetPtr(n_nodes, nodes, 0);
43507         des_xmlNodePtr(n_node, node, 1);
43508         xmlResetLastError();
43509         if (mem_base != xmlMemBlocks()) {
43510             printf("Leak of %d blocks found in xmlXPathNodeLeadingSorted",
43511 	           xmlMemBlocks() - mem_base);
43512 	    test_ret++;
43513             printf(" %d", n_nodes);
43514             printf(" %d", n_node);
43515             printf("\n");
43516         }
43517     }
43518     }
43519     function_tests++;
43520 #endif
43521 
43522     return(test_ret);
43523 }
43524 
43525 
43526 static int
test_xmlXPathNodeSetAdd(void)43527 test_xmlXPathNodeSetAdd(void) {
43528     int test_ret = 0;
43529 
43530 #if defined(LIBXML_XPATH_ENABLED)
43531     int mem_base;
43532     int ret_val;
43533     xmlNodeSetPtr cur; /* the initial node set */
43534     int n_cur;
43535     xmlNodePtr val; /* a new xmlNodePtr */
43536     int n_val;
43537 
43538     for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
43539     for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
43540         mem_base = xmlMemBlocks();
43541         cur = gen_xmlNodeSetPtr(n_cur, 0);
43542         val = gen_xmlNodePtr(n_val, 1);
43543 
43544         ret_val = xmlXPathNodeSetAdd(cur, val);
43545         desret_int(ret_val);
43546         call_tests++;
43547         des_xmlNodeSetPtr(n_cur, cur, 0);
43548         des_xmlNodePtr(n_val, val, 1);
43549         xmlResetLastError();
43550         if (mem_base != xmlMemBlocks()) {
43551             printf("Leak of %d blocks found in xmlXPathNodeSetAdd",
43552 	           xmlMemBlocks() - mem_base);
43553 	    test_ret++;
43554             printf(" %d", n_cur);
43555             printf(" %d", n_val);
43556             printf("\n");
43557         }
43558     }
43559     }
43560     function_tests++;
43561 #endif
43562 
43563     return(test_ret);
43564 }
43565 
43566 
43567 static int
test_xmlXPathNodeSetAddNs(void)43568 test_xmlXPathNodeSetAddNs(void) {
43569     int test_ret = 0;
43570 
43571 #if defined(LIBXML_XPATH_ENABLED)
43572     int mem_base;
43573     int ret_val;
43574     xmlNodeSetPtr cur; /* the initial node set */
43575     int n_cur;
43576     xmlNodePtr node; /* the hosting node */
43577     int n_node;
43578     xmlNsPtr ns; /* a the namespace node */
43579     int n_ns;
43580 
43581     for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
43582     for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
43583     for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
43584         mem_base = xmlMemBlocks();
43585         cur = gen_xmlNodeSetPtr(n_cur, 0);
43586         node = gen_xmlNodePtr(n_node, 1);
43587         ns = gen_xmlNsPtr(n_ns, 2);
43588 
43589         ret_val = xmlXPathNodeSetAddNs(cur, node, ns);
43590         desret_int(ret_val);
43591         call_tests++;
43592         des_xmlNodeSetPtr(n_cur, cur, 0);
43593         des_xmlNodePtr(n_node, node, 1);
43594         des_xmlNsPtr(n_ns, ns, 2);
43595         xmlResetLastError();
43596         if (mem_base != xmlMemBlocks()) {
43597             printf("Leak of %d blocks found in xmlXPathNodeSetAddNs",
43598 	           xmlMemBlocks() - mem_base);
43599 	    test_ret++;
43600             printf(" %d", n_cur);
43601             printf(" %d", n_node);
43602             printf(" %d", n_ns);
43603             printf("\n");
43604         }
43605     }
43606     }
43607     }
43608     function_tests++;
43609 #endif
43610 
43611     return(test_ret);
43612 }
43613 
43614 
43615 static int
test_xmlXPathNodeSetAddUnique(void)43616 test_xmlXPathNodeSetAddUnique(void) {
43617     int test_ret = 0;
43618 
43619 #if defined(LIBXML_XPATH_ENABLED)
43620     int mem_base;
43621     int ret_val;
43622     xmlNodeSetPtr cur; /* the initial node set */
43623     int n_cur;
43624     xmlNodePtr val; /* a new xmlNodePtr */
43625     int n_val;
43626 
43627     for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
43628     for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
43629         mem_base = xmlMemBlocks();
43630         cur = gen_xmlNodeSetPtr(n_cur, 0);
43631         val = gen_xmlNodePtr(n_val, 1);
43632 
43633         ret_val = xmlXPathNodeSetAddUnique(cur, val);
43634         desret_int(ret_val);
43635         call_tests++;
43636         des_xmlNodeSetPtr(n_cur, cur, 0);
43637         des_xmlNodePtr(n_val, val, 1);
43638         xmlResetLastError();
43639         if (mem_base != xmlMemBlocks()) {
43640             printf("Leak of %d blocks found in xmlXPathNodeSetAddUnique",
43641 	           xmlMemBlocks() - mem_base);
43642 	    test_ret++;
43643             printf(" %d", n_cur);
43644             printf(" %d", n_val);
43645             printf("\n");
43646         }
43647     }
43648     }
43649     function_tests++;
43650 #endif
43651 
43652     return(test_ret);
43653 }
43654 
43655 
43656 static int
test_xmlXPathNodeSetContains(void)43657 test_xmlXPathNodeSetContains(void) {
43658     int test_ret = 0;
43659 
43660 #if defined(LIBXML_XPATH_ENABLED)
43661     int mem_base;
43662     int ret_val;
43663     xmlNodeSetPtr cur; /* the node-set */
43664     int n_cur;
43665     xmlNodePtr val; /* the node */
43666     int n_val;
43667 
43668     for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
43669     for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
43670         mem_base = xmlMemBlocks();
43671         cur = gen_xmlNodeSetPtr(n_cur, 0);
43672         val = gen_xmlNodePtr(n_val, 1);
43673 
43674         ret_val = xmlXPathNodeSetContains(cur, val);
43675         desret_int(ret_val);
43676         call_tests++;
43677         des_xmlNodeSetPtr(n_cur, cur, 0);
43678         des_xmlNodePtr(n_val, val, 1);
43679         xmlResetLastError();
43680         if (mem_base != xmlMemBlocks()) {
43681             printf("Leak of %d blocks found in xmlXPathNodeSetContains",
43682 	           xmlMemBlocks() - mem_base);
43683 	    test_ret++;
43684             printf(" %d", n_cur);
43685             printf(" %d", n_val);
43686             printf("\n");
43687         }
43688     }
43689     }
43690     function_tests++;
43691 #endif
43692 
43693     return(test_ret);
43694 }
43695 
43696 
43697 static int
test_xmlXPathNodeSetDel(void)43698 test_xmlXPathNodeSetDel(void) {
43699     int test_ret = 0;
43700 
43701 #if defined(LIBXML_XPATH_ENABLED)
43702     int mem_base;
43703     xmlNodeSetPtr cur; /* the initial node set */
43704     int n_cur;
43705     xmlNodePtr val; /* an xmlNodePtr */
43706     int n_val;
43707 
43708     for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
43709     for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
43710         mem_base = xmlMemBlocks();
43711         cur = gen_xmlNodeSetPtr(n_cur, 0);
43712         val = gen_xmlNodePtr(n_val, 1);
43713 
43714         xmlXPathNodeSetDel(cur, val);
43715         call_tests++;
43716         des_xmlNodeSetPtr(n_cur, cur, 0);
43717         des_xmlNodePtr(n_val, val, 1);
43718         xmlResetLastError();
43719         if (mem_base != xmlMemBlocks()) {
43720             printf("Leak of %d blocks found in xmlXPathNodeSetDel",
43721 	           xmlMemBlocks() - mem_base);
43722 	    test_ret++;
43723             printf(" %d", n_cur);
43724             printf(" %d", n_val);
43725             printf("\n");
43726         }
43727     }
43728     }
43729     function_tests++;
43730 #endif
43731 
43732     return(test_ret);
43733 }
43734 
43735 
43736 static int
test_xmlXPathNodeSetMerge(void)43737 test_xmlXPathNodeSetMerge(void) {
43738     int test_ret = 0;
43739 
43740 #if defined(LIBXML_XPATH_ENABLED)
43741     int mem_base;
43742     xmlNodeSetPtr ret_val;
43743     xmlNodeSetPtr val1; /* the first NodeSet or NULL */
43744     int n_val1;
43745     xmlNodeSetPtr val2; /* the second NodeSet */
43746     int n_val2;
43747 
43748     for (n_val1 = 0;n_val1 < gen_nb_xmlNodeSetPtr;n_val1++) {
43749     for (n_val2 = 0;n_val2 < gen_nb_xmlNodeSetPtr;n_val2++) {
43750         mem_base = xmlMemBlocks();
43751         val1 = gen_xmlNodeSetPtr(n_val1, 0);
43752         val2 = gen_xmlNodeSetPtr(n_val2, 1);
43753 
43754         ret_val = xmlXPathNodeSetMerge(val1, val2);
43755         desret_xmlNodeSetPtr(ret_val);
43756         call_tests++;
43757         des_xmlNodeSetPtr(n_val1, val1, 0);
43758         des_xmlNodeSetPtr(n_val2, val2, 1);
43759         xmlResetLastError();
43760         if (mem_base != xmlMemBlocks()) {
43761             printf("Leak of %d blocks found in xmlXPathNodeSetMerge",
43762 	           xmlMemBlocks() - mem_base);
43763 	    test_ret++;
43764             printf(" %d", n_val1);
43765             printf(" %d", n_val2);
43766             printf("\n");
43767         }
43768     }
43769     }
43770     function_tests++;
43771 #endif
43772 
43773     return(test_ret);
43774 }
43775 
43776 
43777 static int
test_xmlXPathNodeSetRemove(void)43778 test_xmlXPathNodeSetRemove(void) {
43779     int test_ret = 0;
43780 
43781 #if defined(LIBXML_XPATH_ENABLED)
43782     int mem_base;
43783     xmlNodeSetPtr cur; /* the initial node set */
43784     int n_cur;
43785     int val; /* the index to remove */
43786     int n_val;
43787 
43788     for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
43789     for (n_val = 0;n_val < gen_nb_int;n_val++) {
43790         mem_base = xmlMemBlocks();
43791         cur = gen_xmlNodeSetPtr(n_cur, 0);
43792         val = gen_int(n_val, 1);
43793 
43794         xmlXPathNodeSetRemove(cur, val);
43795         call_tests++;
43796         des_xmlNodeSetPtr(n_cur, cur, 0);
43797         des_int(n_val, val, 1);
43798         xmlResetLastError();
43799         if (mem_base != xmlMemBlocks()) {
43800             printf("Leak of %d blocks found in xmlXPathNodeSetRemove",
43801 	           xmlMemBlocks() - mem_base);
43802 	    test_ret++;
43803             printf(" %d", n_cur);
43804             printf(" %d", n_val);
43805             printf("\n");
43806         }
43807     }
43808     }
43809     function_tests++;
43810 #endif
43811 
43812     return(test_ret);
43813 }
43814 
43815 
43816 static int
test_xmlXPathNodeSetSort(void)43817 test_xmlXPathNodeSetSort(void) {
43818     int test_ret = 0;
43819 
43820 #if defined(LIBXML_XPATH_ENABLED)
43821     int mem_base;
43822     xmlNodeSetPtr set; /* the node set */
43823     int n_set;
43824 
43825     for (n_set = 0;n_set < gen_nb_xmlNodeSetPtr;n_set++) {
43826         mem_base = xmlMemBlocks();
43827         set = gen_xmlNodeSetPtr(n_set, 0);
43828 
43829         xmlXPathNodeSetSort(set);
43830         call_tests++;
43831         des_xmlNodeSetPtr(n_set, set, 0);
43832         xmlResetLastError();
43833         if (mem_base != xmlMemBlocks()) {
43834             printf("Leak of %d blocks found in xmlXPathNodeSetSort",
43835 	           xmlMemBlocks() - mem_base);
43836 	    test_ret++;
43837             printf(" %d", n_set);
43838             printf("\n");
43839         }
43840     }
43841     function_tests++;
43842 #endif
43843 
43844     return(test_ret);
43845 }
43846 
43847 
43848 static int
test_xmlXPathNodeTrailing(void)43849 test_xmlXPathNodeTrailing(void) {
43850     int test_ret = 0;
43851 
43852 #if defined(LIBXML_XPATH_ENABLED)
43853     int mem_base;
43854     xmlNodeSetPtr ret_val;
43855     xmlNodeSetPtr nodes; /* a node-set */
43856     int n_nodes;
43857     xmlNodePtr node; /* a node */
43858     int n_node;
43859 
43860     for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
43861     for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
43862         mem_base = xmlMemBlocks();
43863         nodes = gen_xmlNodeSetPtr(n_nodes, 0);
43864         node = gen_xmlNodePtr(n_node, 1);
43865 
43866         ret_val = xmlXPathNodeTrailing(nodes, node);
43867         desret_xmlNodeSetPtr(ret_val);
43868         call_tests++;
43869         des_xmlNodeSetPtr(n_nodes, nodes, 0);
43870         des_xmlNodePtr(n_node, node, 1);
43871         xmlResetLastError();
43872         if (mem_base != xmlMemBlocks()) {
43873             printf("Leak of %d blocks found in xmlXPathNodeTrailing",
43874 	           xmlMemBlocks() - mem_base);
43875 	    test_ret++;
43876             printf(" %d", n_nodes);
43877             printf(" %d", n_node);
43878             printf("\n");
43879         }
43880     }
43881     }
43882     function_tests++;
43883 #endif
43884 
43885     return(test_ret);
43886 }
43887 
43888 
43889 static int
test_xmlXPathNodeTrailingSorted(void)43890 test_xmlXPathNodeTrailingSorted(void) {
43891     int test_ret = 0;
43892 
43893 #if defined(LIBXML_XPATH_ENABLED)
43894     int mem_base;
43895     xmlNodeSetPtr ret_val;
43896     xmlNodeSetPtr nodes; /* a node-set, sorted by document order */
43897     int n_nodes;
43898     xmlNodePtr node; /* a node */
43899     int n_node;
43900 
43901     for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
43902     for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
43903         mem_base = xmlMemBlocks();
43904         nodes = gen_xmlNodeSetPtr(n_nodes, 0);
43905         node = gen_xmlNodePtr(n_node, 1);
43906 
43907         ret_val = xmlXPathNodeTrailingSorted(nodes, node);
43908         desret_xmlNodeSetPtr(ret_val);
43909         call_tests++;
43910         des_xmlNodeSetPtr(n_nodes, nodes, 0);
43911         des_xmlNodePtr(n_node, node, 1);
43912         xmlResetLastError();
43913         if (mem_base != xmlMemBlocks()) {
43914             printf("Leak of %d blocks found in xmlXPathNodeTrailingSorted",
43915 	           xmlMemBlocks() - mem_base);
43916 	    test_ret++;
43917             printf(" %d", n_nodes);
43918             printf(" %d", n_node);
43919             printf("\n");
43920         }
43921     }
43922     }
43923     function_tests++;
43924 #endif
43925 
43926     return(test_ret);
43927 }
43928 
43929 
43930 static int
test_xmlXPathNormalizeFunction(void)43931 test_xmlXPathNormalizeFunction(void) {
43932     int test_ret = 0;
43933 
43934 #if defined(LIBXML_XPATH_ENABLED)
43935     int mem_base;
43936     xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43937     int n_ctxt;
43938     int nargs; /* the number of arguments */
43939     int n_nargs;
43940 
43941     for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43942     for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
43943         mem_base = xmlMemBlocks();
43944         ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43945         nargs = gen_int(n_nargs, 1);
43946 
43947         xmlXPathNormalizeFunction(ctxt, nargs);
43948         call_tests++;
43949         des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43950         des_int(n_nargs, nargs, 1);
43951         xmlResetLastError();
43952         if (mem_base != xmlMemBlocks()) {
43953             printf("Leak of %d blocks found in xmlXPathNormalizeFunction",
43954 	           xmlMemBlocks() - mem_base);
43955 	    test_ret++;
43956             printf(" %d", n_ctxt);
43957             printf(" %d", n_nargs);
43958             printf("\n");
43959         }
43960     }
43961     }
43962     function_tests++;
43963 #endif
43964 
43965     return(test_ret);
43966 }
43967 
43968 
43969 static int
test_xmlXPathNotEqualValues(void)43970 test_xmlXPathNotEqualValues(void) {
43971     int test_ret = 0;
43972 
43973 #if defined(LIBXML_XPATH_ENABLED)
43974     int mem_base;
43975     int ret_val;
43976     xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43977     int n_ctxt;
43978 
43979     for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43980         mem_base = xmlMemBlocks();
43981         ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43982 
43983         ret_val = xmlXPathNotEqualValues(ctxt);
43984         desret_int(ret_val);
43985         call_tests++;
43986         des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43987         xmlResetLastError();
43988         if (mem_base != xmlMemBlocks()) {
43989             printf("Leak of %d blocks found in xmlXPathNotEqualValues",
43990 	           xmlMemBlocks() - mem_base);
43991 	    test_ret++;
43992             printf(" %d", n_ctxt);
43993             printf("\n");
43994         }
43995     }
43996     function_tests++;
43997 #endif
43998 
43999     return(test_ret);
44000 }
44001 
44002 
44003 static int
test_xmlXPathNotFunction(void)44004 test_xmlXPathNotFunction(void) {
44005     int test_ret = 0;
44006 
44007 #if defined(LIBXML_XPATH_ENABLED)
44008     int mem_base;
44009     xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44010     int n_ctxt;
44011     int nargs; /* the number of arguments */
44012     int n_nargs;
44013 
44014     for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44015     for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44016         mem_base = xmlMemBlocks();
44017         ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44018         nargs = gen_int(n_nargs, 1);
44019 
44020         xmlXPathNotFunction(ctxt, nargs);
44021         call_tests++;
44022         des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44023         des_int(n_nargs, nargs, 1);
44024         xmlResetLastError();
44025         if (mem_base != xmlMemBlocks()) {
44026             printf("Leak of %d blocks found in xmlXPathNotFunction",
44027 	           xmlMemBlocks() - mem_base);
44028 	    test_ret++;
44029             printf(" %d", n_ctxt);
44030             printf(" %d", n_nargs);
44031             printf("\n");
44032         }
44033     }
44034     }
44035     function_tests++;
44036 #endif
44037 
44038     return(test_ret);
44039 }
44040 
44041 
44042 static int
test_xmlXPathNsLookup(void)44043 test_xmlXPathNsLookup(void) {
44044     int test_ret = 0;
44045 
44046 #if defined(LIBXML_XPATH_ENABLED)
44047     int mem_base;
44048     const xmlChar * ret_val;
44049     xmlXPathContextPtr ctxt; /* the XPath context */
44050     int n_ctxt;
44051     const xmlChar * prefix; /* the namespace prefix value */
44052     int n_prefix;
44053 
44054     for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
44055     for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
44056         mem_base = xmlMemBlocks();
44057         ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
44058         prefix = gen_const_xmlChar_ptr(n_prefix, 1);
44059 
44060         ret_val = xmlXPathNsLookup(ctxt, prefix);
44061         desret_const_xmlChar_ptr(ret_val);
44062         call_tests++;
44063         des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
44064         des_const_xmlChar_ptr(n_prefix, prefix, 1);
44065         xmlResetLastError();
44066         if (mem_base != xmlMemBlocks()) {
44067             printf("Leak of %d blocks found in xmlXPathNsLookup",
44068 	           xmlMemBlocks() - mem_base);
44069 	    test_ret++;
44070             printf(" %d", n_ctxt);
44071             printf(" %d", n_prefix);
44072             printf("\n");
44073         }
44074     }
44075     }
44076     function_tests++;
44077 #endif
44078 
44079     return(test_ret);
44080 }
44081 
44082 
44083 static int
test_xmlXPathNumberFunction(void)44084 test_xmlXPathNumberFunction(void) {
44085     int test_ret = 0;
44086 
44087 #if defined(LIBXML_XPATH_ENABLED)
44088     int mem_base;
44089     xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44090     int n_ctxt;
44091     int nargs; /* the number of arguments */
44092     int n_nargs;
44093 
44094     for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44095     for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44096         mem_base = xmlMemBlocks();
44097         ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44098         nargs = gen_int(n_nargs, 1);
44099 
44100         xmlXPathNumberFunction(ctxt, nargs);
44101         call_tests++;
44102         des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44103         des_int(n_nargs, nargs, 1);
44104         xmlResetLastError();
44105         if (mem_base != xmlMemBlocks()) {
44106             printf("Leak of %d blocks found in xmlXPathNumberFunction",
44107 	           xmlMemBlocks() - mem_base);
44108 	    test_ret++;
44109             printf(" %d", n_ctxt);
44110             printf(" %d", n_nargs);
44111             printf("\n");
44112         }
44113     }
44114     }
44115     function_tests++;
44116 #endif
44117 
44118     return(test_ret);
44119 }
44120 
44121 
44122 static int
test_xmlXPathParseNCName(void)44123 test_xmlXPathParseNCName(void) {
44124     int test_ret = 0;
44125 
44126 #if defined(LIBXML_XPATH_ENABLED)
44127     int mem_base;
44128     xmlChar * ret_val;
44129     xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44130     int n_ctxt;
44131 
44132     for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44133         mem_base = xmlMemBlocks();
44134         ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44135 
44136         ret_val = xmlXPathParseNCName(ctxt);
44137         desret_xmlChar_ptr(ret_val);
44138         call_tests++;
44139         des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44140         xmlResetLastError();
44141         if (mem_base != xmlMemBlocks()) {
44142             printf("Leak of %d blocks found in xmlXPathParseNCName",
44143 	           xmlMemBlocks() - mem_base);
44144 	    test_ret++;
44145             printf(" %d", n_ctxt);
44146             printf("\n");
44147         }
44148     }
44149     function_tests++;
44150 #endif
44151 
44152     return(test_ret);
44153 }
44154 
44155 
44156 static int
test_xmlXPathParseName(void)44157 test_xmlXPathParseName(void) {
44158     int test_ret = 0;
44159 
44160 #if defined(LIBXML_XPATH_ENABLED)
44161     int mem_base;
44162     xmlChar * ret_val;
44163     xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44164     int n_ctxt;
44165 
44166     for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44167         mem_base = xmlMemBlocks();
44168         ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44169 
44170         ret_val = xmlXPathParseName(ctxt);
44171         desret_xmlChar_ptr(ret_val);
44172         call_tests++;
44173         des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44174         xmlResetLastError();
44175         if (mem_base != xmlMemBlocks()) {
44176             printf("Leak of %d blocks found in xmlXPathParseName",
44177 	           xmlMemBlocks() - mem_base);
44178 	    test_ret++;
44179             printf(" %d", n_ctxt);
44180             printf("\n");
44181         }
44182     }
44183     function_tests++;
44184 #endif
44185 
44186     return(test_ret);
44187 }
44188 
44189 
44190 static int
test_xmlXPathPopBoolean(void)44191 test_xmlXPathPopBoolean(void) {
44192     int test_ret = 0;
44193 
44194 #if defined(LIBXML_XPATH_ENABLED)
44195     int mem_base;
44196     int ret_val;
44197     xmlXPathParserContextPtr ctxt; /* an XPath parser context */
44198     int n_ctxt;
44199 
44200     for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44201         mem_base = xmlMemBlocks();
44202         ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44203 
44204         ret_val = xmlXPathPopBoolean(ctxt);
44205         desret_int(ret_val);
44206         call_tests++;
44207         des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44208         xmlResetLastError();
44209         if (mem_base != xmlMemBlocks()) {
44210             printf("Leak of %d blocks found in xmlXPathPopBoolean",
44211 	           xmlMemBlocks() - mem_base);
44212 	    test_ret++;
44213             printf(" %d", n_ctxt);
44214             printf("\n");
44215         }
44216     }
44217     function_tests++;
44218 #endif
44219 
44220     return(test_ret);
44221 }
44222 
44223 
44224 static int
test_xmlXPathPopExternal(void)44225 test_xmlXPathPopExternal(void) {
44226     int test_ret = 0;
44227 
44228 #if defined(LIBXML_XPATH_ENABLED)
44229     int mem_base;
44230     void * ret_val;
44231     xmlXPathParserContextPtr ctxt; /* an XPath parser context */
44232     int n_ctxt;
44233 
44234     for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44235         mem_base = xmlMemBlocks();
44236         ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44237 
44238         ret_val = xmlXPathPopExternal(ctxt);
44239         desret_void_ptr(ret_val);
44240         call_tests++;
44241         des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44242         xmlResetLastError();
44243         if (mem_base != xmlMemBlocks()) {
44244             printf("Leak of %d blocks found in xmlXPathPopExternal",
44245 	           xmlMemBlocks() - mem_base);
44246 	    test_ret++;
44247             printf(" %d", n_ctxt);
44248             printf("\n");
44249         }
44250     }
44251     function_tests++;
44252 #endif
44253 
44254     return(test_ret);
44255 }
44256 
44257 
44258 static int
test_xmlXPathPopNodeSet(void)44259 test_xmlXPathPopNodeSet(void) {
44260     int test_ret = 0;
44261 
44262 #if defined(LIBXML_XPATH_ENABLED)
44263     int mem_base;
44264     xmlNodeSetPtr ret_val;
44265     xmlXPathParserContextPtr ctxt; /* an XPath parser context */
44266     int n_ctxt;
44267 
44268     for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44269         mem_base = xmlMemBlocks();
44270         ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44271 
44272         ret_val = xmlXPathPopNodeSet(ctxt);
44273         desret_xmlNodeSetPtr(ret_val);
44274         call_tests++;
44275         des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44276         xmlResetLastError();
44277         if (mem_base != xmlMemBlocks()) {
44278             printf("Leak of %d blocks found in xmlXPathPopNodeSet",
44279 	           xmlMemBlocks() - mem_base);
44280 	    test_ret++;
44281             printf(" %d", n_ctxt);
44282             printf("\n");
44283         }
44284     }
44285     function_tests++;
44286 #endif
44287 
44288     return(test_ret);
44289 }
44290 
44291 
44292 static int
test_xmlXPathPopNumber(void)44293 test_xmlXPathPopNumber(void) {
44294     int test_ret = 0;
44295 
44296 #if defined(LIBXML_XPATH_ENABLED)
44297     int mem_base;
44298     double ret_val;
44299     xmlXPathParserContextPtr ctxt; /* an XPath parser context */
44300     int n_ctxt;
44301 
44302     for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44303         mem_base = xmlMemBlocks();
44304         ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44305 
44306         ret_val = xmlXPathPopNumber(ctxt);
44307         desret_double(ret_val);
44308         call_tests++;
44309         des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44310         xmlResetLastError();
44311         if (mem_base != xmlMemBlocks()) {
44312             printf("Leak of %d blocks found in xmlXPathPopNumber",
44313 	           xmlMemBlocks() - mem_base);
44314 	    test_ret++;
44315             printf(" %d", n_ctxt);
44316             printf("\n");
44317         }
44318     }
44319     function_tests++;
44320 #endif
44321 
44322     return(test_ret);
44323 }
44324 
44325 
44326 static int
test_xmlXPathPopString(void)44327 test_xmlXPathPopString(void) {
44328     int test_ret = 0;
44329 
44330 #if defined(LIBXML_XPATH_ENABLED)
44331     int mem_base;
44332     xmlChar * ret_val;
44333     xmlXPathParserContextPtr ctxt; /* an XPath parser context */
44334     int n_ctxt;
44335 
44336     for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44337         mem_base = xmlMemBlocks();
44338         ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44339 
44340         ret_val = xmlXPathPopString(ctxt);
44341         desret_xmlChar_ptr(ret_val);
44342         call_tests++;
44343         des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44344         xmlResetLastError();
44345         if (mem_base != xmlMemBlocks()) {
44346             printf("Leak of %d blocks found in xmlXPathPopString",
44347 	           xmlMemBlocks() - mem_base);
44348 	    test_ret++;
44349             printf(" %d", n_ctxt);
44350             printf("\n");
44351         }
44352     }
44353     function_tests++;
44354 #endif
44355 
44356     return(test_ret);
44357 }
44358 
44359 
44360 static int
test_xmlXPathPositionFunction(void)44361 test_xmlXPathPositionFunction(void) {
44362     int test_ret = 0;
44363 
44364 #if defined(LIBXML_XPATH_ENABLED)
44365     int mem_base;
44366     xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44367     int n_ctxt;
44368     int nargs; /* the number of arguments */
44369     int n_nargs;
44370 
44371     for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44372     for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44373         mem_base = xmlMemBlocks();
44374         ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44375         nargs = gen_int(n_nargs, 1);
44376 
44377         xmlXPathPositionFunction(ctxt, nargs);
44378         call_tests++;
44379         des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44380         des_int(n_nargs, nargs, 1);
44381         xmlResetLastError();
44382         if (mem_base != xmlMemBlocks()) {
44383             printf("Leak of %d blocks found in xmlXPathPositionFunction",
44384 	           xmlMemBlocks() - mem_base);
44385 	    test_ret++;
44386             printf(" %d", n_ctxt);
44387             printf(" %d", n_nargs);
44388             printf("\n");
44389         }
44390     }
44391     }
44392     function_tests++;
44393 #endif
44394 
44395     return(test_ret);
44396 }
44397 
44398 
44399 static int
test_xmlXPathRegisterAllFunctions(void)44400 test_xmlXPathRegisterAllFunctions(void) {
44401     int test_ret = 0;
44402 
44403 #if defined(LIBXML_XPATH_ENABLED)
44404     int mem_base;
44405     xmlXPathContextPtr ctxt; /* the XPath context */
44406     int n_ctxt;
44407 
44408     for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
44409         mem_base = xmlMemBlocks();
44410         ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
44411 
44412         xmlXPathRegisterAllFunctions(ctxt);
44413         call_tests++;
44414         des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
44415         xmlResetLastError();
44416         if (mem_base != xmlMemBlocks()) {
44417             printf("Leak of %d blocks found in xmlXPathRegisterAllFunctions",
44418 	           xmlMemBlocks() - mem_base);
44419 	    test_ret++;
44420             printf(" %d", n_ctxt);
44421             printf("\n");
44422         }
44423     }
44424     function_tests++;
44425 #endif
44426 
44427     return(test_ret);
44428 }
44429 
44430 
44431 static int
test_xmlXPathRegisterFunc(void)44432 test_xmlXPathRegisterFunc(void) {
44433     int test_ret = 0;
44434 
44435 
44436     /* missing type support */
44437     return(test_ret);
44438 }
44439 
44440 
44441 static int
test_xmlXPathRegisterFuncLookup(void)44442 test_xmlXPathRegisterFuncLookup(void) {
44443     int test_ret = 0;
44444 
44445 
44446     /* missing type support */
44447     return(test_ret);
44448 }
44449 
44450 
44451 static int
test_xmlXPathRegisterFuncNS(void)44452 test_xmlXPathRegisterFuncNS(void) {
44453     int test_ret = 0;
44454 
44455 
44456     /* missing type support */
44457     return(test_ret);
44458 }
44459 
44460 
44461 static int
test_xmlXPathRegisterNs(void)44462 test_xmlXPathRegisterNs(void) {
44463     int test_ret = 0;
44464 
44465 #if defined(LIBXML_XPATH_ENABLED)
44466     int mem_base;
44467     int ret_val;
44468     xmlXPathContextPtr ctxt; /* the XPath context */
44469     int n_ctxt;
44470     const xmlChar * prefix; /* the namespace prefix cannot be NULL or empty string */
44471     int n_prefix;
44472     const xmlChar * ns_uri; /* the namespace name */
44473     int n_ns_uri;
44474 
44475     for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
44476     for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
44477     for (n_ns_uri = 0;n_ns_uri < gen_nb_const_xmlChar_ptr;n_ns_uri++) {
44478         mem_base = xmlMemBlocks();
44479         ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
44480         prefix = gen_const_xmlChar_ptr(n_prefix, 1);
44481         ns_uri = gen_const_xmlChar_ptr(n_ns_uri, 2);
44482 
44483         ret_val = xmlXPathRegisterNs(ctxt, prefix, ns_uri);
44484         desret_int(ret_val);
44485         call_tests++;
44486         des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
44487         des_const_xmlChar_ptr(n_prefix, prefix, 1);
44488         des_const_xmlChar_ptr(n_ns_uri, ns_uri, 2);
44489         xmlResetLastError();
44490         if (mem_base != xmlMemBlocks()) {
44491             printf("Leak of %d blocks found in xmlXPathRegisterNs",
44492 	           xmlMemBlocks() - mem_base);
44493 	    test_ret++;
44494             printf(" %d", n_ctxt);
44495             printf(" %d", n_prefix);
44496             printf(" %d", n_ns_uri);
44497             printf("\n");
44498         }
44499     }
44500     }
44501     }
44502     function_tests++;
44503 #endif
44504 
44505     return(test_ret);
44506 }
44507 
44508 
44509 static int
test_xmlXPathRegisterVariable(void)44510 test_xmlXPathRegisterVariable(void) {
44511     int test_ret = 0;
44512 
44513 #if defined(LIBXML_XPATH_ENABLED)
44514     int mem_base;
44515     int ret_val;
44516     xmlXPathContextPtr ctxt; /* the XPath context */
44517     int n_ctxt;
44518     const xmlChar * name; /* the variable name */
44519     int n_name;
44520     xmlXPathObjectPtr value; /* the variable value or NULL */
44521     int n_value;
44522 
44523     for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
44524     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
44525     for (n_value = 0;n_value < gen_nb_xmlXPathObjectPtr;n_value++) {
44526         mem_base = xmlMemBlocks();
44527         ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
44528         name = gen_const_xmlChar_ptr(n_name, 1);
44529         value = gen_xmlXPathObjectPtr(n_value, 2);
44530 
44531         ret_val = xmlXPathRegisterVariable(ctxt, name, value);
44532         desret_int(ret_val);
44533         call_tests++;
44534         des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
44535         des_const_xmlChar_ptr(n_name, name, 1);
44536         des_xmlXPathObjectPtr(n_value, value, 2);
44537         xmlResetLastError();
44538         if (mem_base != xmlMemBlocks()) {
44539             printf("Leak of %d blocks found in xmlXPathRegisterVariable",
44540 	           xmlMemBlocks() - mem_base);
44541 	    test_ret++;
44542             printf(" %d", n_ctxt);
44543             printf(" %d", n_name);
44544             printf(" %d", n_value);
44545             printf("\n");
44546         }
44547     }
44548     }
44549     }
44550     function_tests++;
44551 #endif
44552 
44553     return(test_ret);
44554 }
44555 
44556 
44557 static int
test_xmlXPathRegisterVariableLookup(void)44558 test_xmlXPathRegisterVariableLookup(void) {
44559     int test_ret = 0;
44560 
44561 
44562     /* missing type support */
44563     return(test_ret);
44564 }
44565 
44566 
44567 static int
test_xmlXPathRegisterVariableNS(void)44568 test_xmlXPathRegisterVariableNS(void) {
44569     int test_ret = 0;
44570 
44571 #if defined(LIBXML_XPATH_ENABLED)
44572     int mem_base;
44573     int ret_val;
44574     xmlXPathContextPtr ctxt; /* the XPath context */
44575     int n_ctxt;
44576     const xmlChar * name; /* the variable name */
44577     int n_name;
44578     const xmlChar * ns_uri; /* the variable namespace URI */
44579     int n_ns_uri;
44580     xmlXPathObjectPtr value; /* the variable value or NULL */
44581     int n_value;
44582 
44583     for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
44584     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
44585     for (n_ns_uri = 0;n_ns_uri < gen_nb_const_xmlChar_ptr;n_ns_uri++) {
44586     for (n_value = 0;n_value < gen_nb_xmlXPathObjectPtr;n_value++) {
44587         mem_base = xmlMemBlocks();
44588         ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
44589         name = gen_const_xmlChar_ptr(n_name, 1);
44590         ns_uri = gen_const_xmlChar_ptr(n_ns_uri, 2);
44591         value = gen_xmlXPathObjectPtr(n_value, 3);
44592 
44593         ret_val = xmlXPathRegisterVariableNS(ctxt, name, ns_uri, value);
44594         desret_int(ret_val);
44595         call_tests++;
44596         des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
44597         des_const_xmlChar_ptr(n_name, name, 1);
44598         des_const_xmlChar_ptr(n_ns_uri, ns_uri, 2);
44599         des_xmlXPathObjectPtr(n_value, value, 3);
44600         xmlResetLastError();
44601         if (mem_base != xmlMemBlocks()) {
44602             printf("Leak of %d blocks found in xmlXPathRegisterVariableNS",
44603 	           xmlMemBlocks() - mem_base);
44604 	    test_ret++;
44605             printf(" %d", n_ctxt);
44606             printf(" %d", n_name);
44607             printf(" %d", n_ns_uri);
44608             printf(" %d", n_value);
44609             printf("\n");
44610         }
44611     }
44612     }
44613     }
44614     }
44615     function_tests++;
44616 #endif
44617 
44618     return(test_ret);
44619 }
44620 
44621 
44622 static int
test_xmlXPathRegisteredFuncsCleanup(void)44623 test_xmlXPathRegisteredFuncsCleanup(void) {
44624     int test_ret = 0;
44625 
44626 #if defined(LIBXML_XPATH_ENABLED)
44627     int mem_base;
44628     xmlXPathContextPtr ctxt; /* the XPath context */
44629     int n_ctxt;
44630 
44631     for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
44632         mem_base = xmlMemBlocks();
44633         ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
44634 
44635         xmlXPathRegisteredFuncsCleanup(ctxt);
44636         call_tests++;
44637         des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
44638         xmlResetLastError();
44639         if (mem_base != xmlMemBlocks()) {
44640             printf("Leak of %d blocks found in xmlXPathRegisteredFuncsCleanup",
44641 	           xmlMemBlocks() - mem_base);
44642 	    test_ret++;
44643             printf(" %d", n_ctxt);
44644             printf("\n");
44645         }
44646     }
44647     function_tests++;
44648 #endif
44649 
44650     return(test_ret);
44651 }
44652 
44653 
44654 static int
test_xmlXPathRegisteredNsCleanup(void)44655 test_xmlXPathRegisteredNsCleanup(void) {
44656     int test_ret = 0;
44657 
44658 #if defined(LIBXML_XPATH_ENABLED)
44659     int mem_base;
44660     xmlXPathContextPtr ctxt; /* the XPath context */
44661     int n_ctxt;
44662 
44663     for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
44664         mem_base = xmlMemBlocks();
44665         ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
44666 
44667         xmlXPathRegisteredNsCleanup(ctxt);
44668         call_tests++;
44669         des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
44670         xmlResetLastError();
44671         if (mem_base != xmlMemBlocks()) {
44672             printf("Leak of %d blocks found in xmlXPathRegisteredNsCleanup",
44673 	           xmlMemBlocks() - mem_base);
44674 	    test_ret++;
44675             printf(" %d", n_ctxt);
44676             printf("\n");
44677         }
44678     }
44679     function_tests++;
44680 #endif
44681 
44682     return(test_ret);
44683 }
44684 
44685 
44686 static int
test_xmlXPathRegisteredVariablesCleanup(void)44687 test_xmlXPathRegisteredVariablesCleanup(void) {
44688     int test_ret = 0;
44689 
44690 #if defined(LIBXML_XPATH_ENABLED)
44691     int mem_base;
44692     xmlXPathContextPtr ctxt; /* the XPath context */
44693     int n_ctxt;
44694 
44695     for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
44696         mem_base = xmlMemBlocks();
44697         ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
44698 
44699         xmlXPathRegisteredVariablesCleanup(ctxt);
44700         call_tests++;
44701         des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
44702         xmlResetLastError();
44703         if (mem_base != xmlMemBlocks()) {
44704             printf("Leak of %d blocks found in xmlXPathRegisteredVariablesCleanup",
44705 	           xmlMemBlocks() - mem_base);
44706 	    test_ret++;
44707             printf(" %d", n_ctxt);
44708             printf("\n");
44709         }
44710     }
44711     function_tests++;
44712 #endif
44713 
44714     return(test_ret);
44715 }
44716 
44717 
44718 static int
test_xmlXPathRoot(void)44719 test_xmlXPathRoot(void) {
44720     int test_ret = 0;
44721 
44722 #if defined(LIBXML_XPATH_ENABLED)
44723     int mem_base;
44724     xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44725     int n_ctxt;
44726 
44727     for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44728         mem_base = xmlMemBlocks();
44729         ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44730 
44731         xmlXPathRoot(ctxt);
44732         call_tests++;
44733         des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44734         xmlResetLastError();
44735         if (mem_base != xmlMemBlocks()) {
44736             printf("Leak of %d blocks found in xmlXPathRoot",
44737 	           xmlMemBlocks() - mem_base);
44738 	    test_ret++;
44739             printf(" %d", n_ctxt);
44740             printf("\n");
44741         }
44742     }
44743     function_tests++;
44744 #endif
44745 
44746     return(test_ret);
44747 }
44748 
44749 
44750 static int
test_xmlXPathRoundFunction(void)44751 test_xmlXPathRoundFunction(void) {
44752     int test_ret = 0;
44753 
44754 #if defined(LIBXML_XPATH_ENABLED)
44755     int mem_base;
44756     xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44757     int n_ctxt;
44758     int nargs; /* the number of arguments */
44759     int n_nargs;
44760 
44761     for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44762     for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44763         mem_base = xmlMemBlocks();
44764         ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44765         nargs = gen_int(n_nargs, 1);
44766 
44767         xmlXPathRoundFunction(ctxt, nargs);
44768         call_tests++;
44769         des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44770         des_int(n_nargs, nargs, 1);
44771         xmlResetLastError();
44772         if (mem_base != xmlMemBlocks()) {
44773             printf("Leak of %d blocks found in xmlXPathRoundFunction",
44774 	           xmlMemBlocks() - mem_base);
44775 	    test_ret++;
44776             printf(" %d", n_ctxt);
44777             printf(" %d", n_nargs);
44778             printf("\n");
44779         }
44780     }
44781     }
44782     function_tests++;
44783 #endif
44784 
44785     return(test_ret);
44786 }
44787 
44788 
44789 static int
test_xmlXPathStartsWithFunction(void)44790 test_xmlXPathStartsWithFunction(void) {
44791     int test_ret = 0;
44792 
44793 #if defined(LIBXML_XPATH_ENABLED)
44794     int mem_base;
44795     xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44796     int n_ctxt;
44797     int nargs; /* the number of arguments */
44798     int n_nargs;
44799 
44800     for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44801     for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44802         mem_base = xmlMemBlocks();
44803         ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44804         nargs = gen_int(n_nargs, 1);
44805 
44806         xmlXPathStartsWithFunction(ctxt, nargs);
44807         call_tests++;
44808         des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44809         des_int(n_nargs, nargs, 1);
44810         xmlResetLastError();
44811         if (mem_base != xmlMemBlocks()) {
44812             printf("Leak of %d blocks found in xmlXPathStartsWithFunction",
44813 	           xmlMemBlocks() - mem_base);
44814 	    test_ret++;
44815             printf(" %d", n_ctxt);
44816             printf(" %d", n_nargs);
44817             printf("\n");
44818         }
44819     }
44820     }
44821     function_tests++;
44822 #endif
44823 
44824     return(test_ret);
44825 }
44826 
44827 
44828 static int
test_xmlXPathStringEvalNumber(void)44829 test_xmlXPathStringEvalNumber(void) {
44830     int test_ret = 0;
44831 
44832 #if defined(LIBXML_XPATH_ENABLED)
44833     int mem_base;
44834     double ret_val;
44835     const xmlChar * str; /* A string to scan */
44836     int n_str;
44837 
44838     for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
44839         mem_base = xmlMemBlocks();
44840         str = gen_const_xmlChar_ptr(n_str, 0);
44841 
44842         ret_val = xmlXPathStringEvalNumber(str);
44843         desret_double(ret_val);
44844         call_tests++;
44845         des_const_xmlChar_ptr(n_str, str, 0);
44846         xmlResetLastError();
44847         if (mem_base != xmlMemBlocks()) {
44848             printf("Leak of %d blocks found in xmlXPathStringEvalNumber",
44849 	           xmlMemBlocks() - mem_base);
44850 	    test_ret++;
44851             printf(" %d", n_str);
44852             printf("\n");
44853         }
44854     }
44855     function_tests++;
44856 #endif
44857 
44858     return(test_ret);
44859 }
44860 
44861 
44862 static int
test_xmlXPathStringFunction(void)44863 test_xmlXPathStringFunction(void) {
44864     int test_ret = 0;
44865 
44866 #if defined(LIBXML_XPATH_ENABLED)
44867     int mem_base;
44868     xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44869     int n_ctxt;
44870     int nargs; /* the number of arguments */
44871     int n_nargs;
44872 
44873     for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44874     for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44875         mem_base = xmlMemBlocks();
44876         ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44877         nargs = gen_int(n_nargs, 1);
44878 
44879         xmlXPathStringFunction(ctxt, nargs);
44880         call_tests++;
44881         des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44882         des_int(n_nargs, nargs, 1);
44883         xmlResetLastError();
44884         if (mem_base != xmlMemBlocks()) {
44885             printf("Leak of %d blocks found in xmlXPathStringFunction",
44886 	           xmlMemBlocks() - mem_base);
44887 	    test_ret++;
44888             printf(" %d", n_ctxt);
44889             printf(" %d", n_nargs);
44890             printf("\n");
44891         }
44892     }
44893     }
44894     function_tests++;
44895 #endif
44896 
44897     return(test_ret);
44898 }
44899 
44900 
44901 static int
test_xmlXPathStringLengthFunction(void)44902 test_xmlXPathStringLengthFunction(void) {
44903     int test_ret = 0;
44904 
44905 #if defined(LIBXML_XPATH_ENABLED)
44906     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         xmlXPathStringLengthFunction(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 xmlXPathStringLengthFunction",
44925 	           xmlMemBlocks() - mem_base);
44926 	    test_ret++;
44927             printf(" %d", n_ctxt);
44928             printf(" %d", n_nargs);
44929             printf("\n");
44930         }
44931     }
44932     }
44933     function_tests++;
44934 #endif
44935 
44936     return(test_ret);
44937 }
44938 
44939 
44940 static int
test_xmlXPathSubValues(void)44941 test_xmlXPathSubValues(void) {
44942     int test_ret = 0;
44943 
44944 #if defined(LIBXML_XPATH_ENABLED)
44945     int mem_base;
44946     xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44947     int n_ctxt;
44948 
44949     for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44950         mem_base = xmlMemBlocks();
44951         ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44952 
44953         xmlXPathSubValues(ctxt);
44954         call_tests++;
44955         des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44956         xmlResetLastError();
44957         if (mem_base != xmlMemBlocks()) {
44958             printf("Leak of %d blocks found in xmlXPathSubValues",
44959 	           xmlMemBlocks() - mem_base);
44960 	    test_ret++;
44961             printf(" %d", n_ctxt);
44962             printf("\n");
44963         }
44964     }
44965     function_tests++;
44966 #endif
44967 
44968     return(test_ret);
44969 }
44970 
44971 
44972 static int
test_xmlXPathSubstringAfterFunction(void)44973 test_xmlXPathSubstringAfterFunction(void) {
44974     int test_ret = 0;
44975 
44976 #if defined(LIBXML_XPATH_ENABLED)
44977     int mem_base;
44978     xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44979     int n_ctxt;
44980     int nargs; /* the number of arguments */
44981     int n_nargs;
44982 
44983     for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44984     for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44985         mem_base = xmlMemBlocks();
44986         ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44987         nargs = gen_int(n_nargs, 1);
44988 
44989         xmlXPathSubstringAfterFunction(ctxt, nargs);
44990         call_tests++;
44991         des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44992         des_int(n_nargs, nargs, 1);
44993         xmlResetLastError();
44994         if (mem_base != xmlMemBlocks()) {
44995             printf("Leak of %d blocks found in xmlXPathSubstringAfterFunction",
44996 	           xmlMemBlocks() - mem_base);
44997 	    test_ret++;
44998             printf(" %d", n_ctxt);
44999             printf(" %d", n_nargs);
45000             printf("\n");
45001         }
45002     }
45003     }
45004     function_tests++;
45005 #endif
45006 
45007     return(test_ret);
45008 }
45009 
45010 
45011 static int
test_xmlXPathSubstringBeforeFunction(void)45012 test_xmlXPathSubstringBeforeFunction(void) {
45013     int test_ret = 0;
45014 
45015 #if defined(LIBXML_XPATH_ENABLED)
45016     int mem_base;
45017     xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45018     int n_ctxt;
45019     int nargs; /* the number of arguments */
45020     int n_nargs;
45021 
45022     for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45023     for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
45024         mem_base = xmlMemBlocks();
45025         ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45026         nargs = gen_int(n_nargs, 1);
45027 
45028         xmlXPathSubstringBeforeFunction(ctxt, nargs);
45029         call_tests++;
45030         des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45031         des_int(n_nargs, nargs, 1);
45032         xmlResetLastError();
45033         if (mem_base != xmlMemBlocks()) {
45034             printf("Leak of %d blocks found in xmlXPathSubstringBeforeFunction",
45035 	           xmlMemBlocks() - mem_base);
45036 	    test_ret++;
45037             printf(" %d", n_ctxt);
45038             printf(" %d", n_nargs);
45039             printf("\n");
45040         }
45041     }
45042     }
45043     function_tests++;
45044 #endif
45045 
45046     return(test_ret);
45047 }
45048 
45049 
45050 static int
test_xmlXPathSubstringFunction(void)45051 test_xmlXPathSubstringFunction(void) {
45052     int test_ret = 0;
45053 
45054 #if defined(LIBXML_XPATH_ENABLED)
45055     int mem_base;
45056     xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45057     int n_ctxt;
45058     int nargs; /* the number of arguments */
45059     int n_nargs;
45060 
45061     for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45062     for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
45063         mem_base = xmlMemBlocks();
45064         ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45065         nargs = gen_int(n_nargs, 1);
45066 
45067         xmlXPathSubstringFunction(ctxt, nargs);
45068         call_tests++;
45069         des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45070         des_int(n_nargs, nargs, 1);
45071         xmlResetLastError();
45072         if (mem_base != xmlMemBlocks()) {
45073             printf("Leak of %d blocks found in xmlXPathSubstringFunction",
45074 	           xmlMemBlocks() - mem_base);
45075 	    test_ret++;
45076             printf(" %d", n_ctxt);
45077             printf(" %d", n_nargs);
45078             printf("\n");
45079         }
45080     }
45081     }
45082     function_tests++;
45083 #endif
45084 
45085     return(test_ret);
45086 }
45087 
45088 
45089 static int
test_xmlXPathSumFunction(void)45090 test_xmlXPathSumFunction(void) {
45091     int test_ret = 0;
45092 
45093 #if defined(LIBXML_XPATH_ENABLED)
45094     int mem_base;
45095     xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45096     int n_ctxt;
45097     int nargs; /* the number of arguments */
45098     int n_nargs;
45099 
45100     for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45101     for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
45102         mem_base = xmlMemBlocks();
45103         ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45104         nargs = gen_int(n_nargs, 1);
45105 
45106         xmlXPathSumFunction(ctxt, nargs);
45107         call_tests++;
45108         des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45109         des_int(n_nargs, nargs, 1);
45110         xmlResetLastError();
45111         if (mem_base != xmlMemBlocks()) {
45112             printf("Leak of %d blocks found in xmlXPathSumFunction",
45113 	           xmlMemBlocks() - mem_base);
45114 	    test_ret++;
45115             printf(" %d", n_ctxt);
45116             printf(" %d", n_nargs);
45117             printf("\n");
45118         }
45119     }
45120     }
45121     function_tests++;
45122 #endif
45123 
45124     return(test_ret);
45125 }
45126 
45127 
45128 static int
test_xmlXPathTrailing(void)45129 test_xmlXPathTrailing(void) {
45130     int test_ret = 0;
45131 
45132 #if defined(LIBXML_XPATH_ENABLED)
45133     int mem_base;
45134     xmlNodeSetPtr ret_val;
45135     xmlNodeSetPtr nodes1; /* a node-set */
45136     int n_nodes1;
45137     xmlNodeSetPtr nodes2; /* a node-set */
45138     int n_nodes2;
45139 
45140     for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
45141     for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
45142         mem_base = xmlMemBlocks();
45143         nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
45144         nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
45145 
45146         ret_val = xmlXPathTrailing(nodes1, nodes2);
45147         desret_xmlNodeSetPtr(ret_val);
45148         call_tests++;
45149         des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
45150         des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
45151         xmlResetLastError();
45152         if (mem_base != xmlMemBlocks()) {
45153             printf("Leak of %d blocks found in xmlXPathTrailing",
45154 	           xmlMemBlocks() - mem_base);
45155 	    test_ret++;
45156             printf(" %d", n_nodes1);
45157             printf(" %d", n_nodes2);
45158             printf("\n");
45159         }
45160     }
45161     }
45162     function_tests++;
45163 #endif
45164 
45165     return(test_ret);
45166 }
45167 
45168 
45169 static int
test_xmlXPathTrailingSorted(void)45170 test_xmlXPathTrailingSorted(void) {
45171     int test_ret = 0;
45172 
45173 #if defined(LIBXML_XPATH_ENABLED)
45174     int mem_base;
45175     xmlNodeSetPtr ret_val;
45176     xmlNodeSetPtr nodes1; /* a node-set, sorted by document order */
45177     int n_nodes1;
45178     xmlNodeSetPtr nodes2; /* a node-set, sorted by document order */
45179     int n_nodes2;
45180 
45181     for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
45182     for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
45183         mem_base = xmlMemBlocks();
45184         nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
45185         nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
45186 
45187         ret_val = xmlXPathTrailingSorted(nodes1, nodes2);
45188         desret_xmlNodeSetPtr(ret_val);
45189         call_tests++;
45190         des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
45191         des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
45192         xmlResetLastError();
45193         if (mem_base != xmlMemBlocks()) {
45194             printf("Leak of %d blocks found in xmlXPathTrailingSorted",
45195 	           xmlMemBlocks() - mem_base);
45196 	    test_ret++;
45197             printf(" %d", n_nodes1);
45198             printf(" %d", n_nodes2);
45199             printf("\n");
45200         }
45201     }
45202     }
45203     function_tests++;
45204 #endif
45205 
45206     return(test_ret);
45207 }
45208 
45209 
45210 static int
test_xmlXPathTranslateFunction(void)45211 test_xmlXPathTranslateFunction(void) {
45212     int test_ret = 0;
45213 
45214 #if defined(LIBXML_XPATH_ENABLED)
45215     int mem_base;
45216     xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45217     int n_ctxt;
45218     int nargs; /* the number of arguments */
45219     int n_nargs;
45220 
45221     for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45222     for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
45223         mem_base = xmlMemBlocks();
45224         ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45225         nargs = gen_int(n_nargs, 1);
45226 
45227         xmlXPathTranslateFunction(ctxt, nargs);
45228         call_tests++;
45229         des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45230         des_int(n_nargs, nargs, 1);
45231         xmlResetLastError();
45232         if (mem_base != xmlMemBlocks()) {
45233             printf("Leak of %d blocks found in xmlXPathTranslateFunction",
45234 	           xmlMemBlocks() - mem_base);
45235 	    test_ret++;
45236             printf(" %d", n_ctxt);
45237             printf(" %d", n_nargs);
45238             printf("\n");
45239         }
45240     }
45241     }
45242     function_tests++;
45243 #endif
45244 
45245     return(test_ret);
45246 }
45247 
45248 
45249 static int
test_xmlXPathTrueFunction(void)45250 test_xmlXPathTrueFunction(void) {
45251     int test_ret = 0;
45252 
45253 #if defined(LIBXML_XPATH_ENABLED)
45254     int mem_base;
45255     xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45256     int n_ctxt;
45257     int nargs; /* the number of arguments */
45258     int n_nargs;
45259 
45260     for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45261     for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
45262         mem_base = xmlMemBlocks();
45263         ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45264         nargs = gen_int(n_nargs, 1);
45265 
45266         xmlXPathTrueFunction(ctxt, nargs);
45267         call_tests++;
45268         des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45269         des_int(n_nargs, nargs, 1);
45270         xmlResetLastError();
45271         if (mem_base != xmlMemBlocks()) {
45272             printf("Leak of %d blocks found in xmlXPathTrueFunction",
45273 	           xmlMemBlocks() - mem_base);
45274 	    test_ret++;
45275             printf(" %d", n_ctxt);
45276             printf(" %d", n_nargs);
45277             printf("\n");
45278         }
45279     }
45280     }
45281     function_tests++;
45282 #endif
45283 
45284     return(test_ret);
45285 }
45286 
45287 
45288 static int
test_xmlXPathValueFlipSign(void)45289 test_xmlXPathValueFlipSign(void) {
45290     int test_ret = 0;
45291 
45292 #if defined(LIBXML_XPATH_ENABLED)
45293     int mem_base;
45294     xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45295     int n_ctxt;
45296 
45297     for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45298         mem_base = xmlMemBlocks();
45299         ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45300 
45301         xmlXPathValueFlipSign(ctxt);
45302         call_tests++;
45303         des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45304         xmlResetLastError();
45305         if (mem_base != xmlMemBlocks()) {
45306             printf("Leak of %d blocks found in xmlXPathValueFlipSign",
45307 	           xmlMemBlocks() - mem_base);
45308 	    test_ret++;
45309             printf(" %d", n_ctxt);
45310             printf("\n");
45311         }
45312     }
45313     function_tests++;
45314 #endif
45315 
45316     return(test_ret);
45317 }
45318 
45319 
45320 static int
test_xmlXPathVariableLookup(void)45321 test_xmlXPathVariableLookup(void) {
45322     int test_ret = 0;
45323 
45324 #if defined(LIBXML_XPATH_ENABLED)
45325     int mem_base;
45326     xmlXPathObjectPtr ret_val;
45327     xmlXPathContextPtr ctxt; /* the XPath context */
45328     int n_ctxt;
45329     const xmlChar * name; /* the variable name */
45330     int n_name;
45331 
45332     for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
45333     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
45334         mem_base = xmlMemBlocks();
45335         ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
45336         name = gen_const_xmlChar_ptr(n_name, 1);
45337 
45338         ret_val = xmlXPathVariableLookup(ctxt, name);
45339         desret_xmlXPathObjectPtr(ret_val);
45340         call_tests++;
45341         des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
45342         des_const_xmlChar_ptr(n_name, name, 1);
45343         xmlResetLastError();
45344         if (mem_base != xmlMemBlocks()) {
45345             printf("Leak of %d blocks found in xmlXPathVariableLookup",
45346 	           xmlMemBlocks() - mem_base);
45347 	    test_ret++;
45348             printf(" %d", n_ctxt);
45349             printf(" %d", n_name);
45350             printf("\n");
45351         }
45352     }
45353     }
45354     function_tests++;
45355 #endif
45356 
45357     return(test_ret);
45358 }
45359 
45360 
45361 static int
test_xmlXPathVariableLookupNS(void)45362 test_xmlXPathVariableLookupNS(void) {
45363     int test_ret = 0;
45364 
45365 #if defined(LIBXML_XPATH_ENABLED)
45366     int mem_base;
45367     xmlXPathObjectPtr ret_val;
45368     xmlXPathContextPtr ctxt; /* the XPath context */
45369     int n_ctxt;
45370     const xmlChar * name; /* the variable name */
45371     int n_name;
45372     const xmlChar * ns_uri; /* the variable namespace URI */
45373     int n_ns_uri;
45374 
45375     for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
45376     for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
45377     for (n_ns_uri = 0;n_ns_uri < gen_nb_const_xmlChar_ptr;n_ns_uri++) {
45378         mem_base = xmlMemBlocks();
45379         ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
45380         name = gen_const_xmlChar_ptr(n_name, 1);
45381         ns_uri = gen_const_xmlChar_ptr(n_ns_uri, 2);
45382 
45383         ret_val = xmlXPathVariableLookupNS(ctxt, name, ns_uri);
45384         desret_xmlXPathObjectPtr(ret_val);
45385         call_tests++;
45386         des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
45387         des_const_xmlChar_ptr(n_name, name, 1);
45388         des_const_xmlChar_ptr(n_ns_uri, ns_uri, 2);
45389         xmlResetLastError();
45390         if (mem_base != xmlMemBlocks()) {
45391             printf("Leak of %d blocks found in xmlXPathVariableLookupNS",
45392 	           xmlMemBlocks() - mem_base);
45393 	    test_ret++;
45394             printf(" %d", n_ctxt);
45395             printf(" %d", n_name);
45396             printf(" %d", n_ns_uri);
45397             printf("\n");
45398         }
45399     }
45400     }
45401     }
45402     function_tests++;
45403 #endif
45404 
45405     return(test_ret);
45406 }
45407 
45408 
45409 static int
test_xmlXPathWrapCString(void)45410 test_xmlXPathWrapCString(void) {
45411     int test_ret = 0;
45412 
45413 #if defined(LIBXML_XPATH_ENABLED)
45414     int mem_base;
45415     xmlXPathObjectPtr ret_val;
45416     char * val; /* the char * value */
45417     int n_val;
45418 
45419     for (n_val = 0;n_val < gen_nb_char_ptr;n_val++) {
45420         mem_base = xmlMemBlocks();
45421         val = gen_char_ptr(n_val, 0);
45422 
45423         ret_val = xmlXPathWrapCString(val);
45424         desret_xmlXPathObjectPtr(ret_val);
45425         call_tests++;
45426         des_char_ptr(n_val, val, 0);
45427         xmlResetLastError();
45428         if (mem_base != xmlMemBlocks()) {
45429             printf("Leak of %d blocks found in xmlXPathWrapCString",
45430 	           xmlMemBlocks() - mem_base);
45431 	    test_ret++;
45432             printf(" %d", n_val);
45433             printf("\n");
45434         }
45435     }
45436     function_tests++;
45437 #endif
45438 
45439     return(test_ret);
45440 }
45441 
45442 
45443 static int
test_xmlXPathWrapExternal(void)45444 test_xmlXPathWrapExternal(void) {
45445     int test_ret = 0;
45446 
45447 #if defined(LIBXML_XPATH_ENABLED)
45448     int mem_base;
45449     xmlXPathObjectPtr ret_val;
45450     void * val; /* the user data */
45451     int n_val;
45452 
45453     for (n_val = 0;n_val < gen_nb_void_ptr;n_val++) {
45454         mem_base = xmlMemBlocks();
45455         val = gen_void_ptr(n_val, 0);
45456 
45457         ret_val = xmlXPathWrapExternal(val);
45458         desret_xmlXPathObjectPtr(ret_val);
45459         call_tests++;
45460         des_void_ptr(n_val, val, 0);
45461         xmlResetLastError();
45462         if (mem_base != xmlMemBlocks()) {
45463             printf("Leak of %d blocks found in xmlXPathWrapExternal",
45464 	           xmlMemBlocks() - mem_base);
45465 	    test_ret++;
45466             printf(" %d", n_val);
45467             printf("\n");
45468         }
45469     }
45470     function_tests++;
45471 #endif
45472 
45473     return(test_ret);
45474 }
45475 
45476 
45477 static int
test_xmlXPathWrapNodeSet(void)45478 test_xmlXPathWrapNodeSet(void) {
45479     int test_ret = 0;
45480 
45481 #if defined(LIBXML_XPATH_ENABLED)
45482     int mem_base;
45483     xmlXPathObjectPtr ret_val;
45484     xmlNodeSetPtr val; /* the NodePtr value */
45485     int n_val;
45486 
45487     for (n_val = 0;n_val < gen_nb_xmlNodeSetPtr;n_val++) {
45488         mem_base = xmlMemBlocks();
45489         val = gen_xmlNodeSetPtr(n_val, 0);
45490 
45491         ret_val = xmlXPathWrapNodeSet(val);
45492         desret_xmlXPathObjectPtr(ret_val);
45493         call_tests++;
45494         des_xmlNodeSetPtr(n_val, val, 0);
45495         xmlResetLastError();
45496         if (mem_base != xmlMemBlocks()) {
45497             printf("Leak of %d blocks found in xmlXPathWrapNodeSet",
45498 	           xmlMemBlocks() - mem_base);
45499 	    test_ret++;
45500             printf(" %d", n_val);
45501             printf("\n");
45502         }
45503     }
45504     function_tests++;
45505 #endif
45506 
45507     return(test_ret);
45508 }
45509 
45510 
45511 static int
test_xmlXPatherror(void)45512 test_xmlXPatherror(void) {
45513     int test_ret = 0;
45514 
45515 #if defined(LIBXML_XPATH_ENABLED)
45516     int mem_base;
45517     xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45518     int n_ctxt;
45519     const char * file; /* the file name */
45520     int n_file;
45521     int line; /* the line number */
45522     int n_line;
45523     int no; /* the error number */
45524     int n_no;
45525 
45526     for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45527     for (n_file = 0;n_file < gen_nb_filepath;n_file++) {
45528     for (n_line = 0;n_line < gen_nb_int;n_line++) {
45529     for (n_no = 0;n_no < gen_nb_int;n_no++) {
45530         mem_base = xmlMemBlocks();
45531         ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45532         file = gen_filepath(n_file, 1);
45533         line = gen_int(n_line, 2);
45534         no = gen_int(n_no, 3);
45535 
45536         xmlXPatherror(ctxt, file, line, no);
45537         call_tests++;
45538         des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45539         des_filepath(n_file, file, 1);
45540         des_int(n_line, line, 2);
45541         des_int(n_no, no, 3);
45542         xmlResetLastError();
45543         if (mem_base != xmlMemBlocks()) {
45544             printf("Leak of %d blocks found in xmlXPatherror",
45545 	           xmlMemBlocks() - mem_base);
45546 	    test_ret++;
45547             printf(" %d", n_ctxt);
45548             printf(" %d", n_file);
45549             printf(" %d", n_line);
45550             printf(" %d", n_no);
45551             printf("\n");
45552         }
45553     }
45554     }
45555     }
45556     }
45557     function_tests++;
45558 #endif
45559 
45560     return(test_ret);
45561 }
45562 
45563 static int
test_xpathInternals(void)45564 test_xpathInternals(void) {
45565     int test_ret = 0;
45566 
45567     if (quiet == 0) printf("Testing xpathInternals : 106 of 117 functions ...\n");
45568     test_ret += test_valuePop();
45569     test_ret += test_valuePush();
45570     test_ret += test_xmlXPathAddValues();
45571     test_ret += test_xmlXPathBooleanFunction();
45572     test_ret += test_xmlXPathCeilingFunction();
45573     test_ret += test_xmlXPathCompareValues();
45574     test_ret += test_xmlXPathConcatFunction();
45575     test_ret += test_xmlXPathContainsFunction();
45576     test_ret += test_xmlXPathCountFunction();
45577     test_ret += test_xmlXPathDebugDumpCompExpr();
45578     test_ret += test_xmlXPathDebugDumpObject();
45579     test_ret += test_xmlXPathDifference();
45580     test_ret += test_xmlXPathDistinct();
45581     test_ret += test_xmlXPathDistinctSorted();
45582     test_ret += test_xmlXPathDivValues();
45583     test_ret += test_xmlXPathEqualValues();
45584     test_ret += test_xmlXPathErr();
45585     test_ret += test_xmlXPathEvalExpr();
45586     test_ret += test_xmlXPathEvaluatePredicateResult();
45587     test_ret += test_xmlXPathFalseFunction();
45588     test_ret += test_xmlXPathFloorFunction();
45589     test_ret += test_xmlXPathFunctionLookup();
45590     test_ret += test_xmlXPathFunctionLookupNS();
45591     test_ret += test_xmlXPathHasSameNodes();
45592     test_ret += test_xmlXPathIdFunction();
45593     test_ret += test_xmlXPathIntersection();
45594     test_ret += test_xmlXPathIsNodeType();
45595     test_ret += test_xmlXPathLangFunction();
45596     test_ret += test_xmlXPathLastFunction();
45597     test_ret += test_xmlXPathLeading();
45598     test_ret += test_xmlXPathLeadingSorted();
45599     test_ret += test_xmlXPathLocalNameFunction();
45600     test_ret += test_xmlXPathModValues();
45601     test_ret += test_xmlXPathMultValues();
45602     test_ret += test_xmlXPathNamespaceURIFunction();
45603     test_ret += test_xmlXPathNewBoolean();
45604     test_ret += test_xmlXPathNewCString();
45605     test_ret += test_xmlXPathNewFloat();
45606     test_ret += test_xmlXPathNewNodeSet();
45607     test_ret += test_xmlXPathNewNodeSetList();
45608     test_ret += test_xmlXPathNewParserContext();
45609     test_ret += test_xmlXPathNewString();
45610     test_ret += test_xmlXPathNextAncestor();
45611     test_ret += test_xmlXPathNextAncestorOrSelf();
45612     test_ret += test_xmlXPathNextAttribute();
45613     test_ret += test_xmlXPathNextChild();
45614     test_ret += test_xmlXPathNextDescendant();
45615     test_ret += test_xmlXPathNextDescendantOrSelf();
45616     test_ret += test_xmlXPathNextFollowing();
45617     test_ret += test_xmlXPathNextFollowingSibling();
45618     test_ret += test_xmlXPathNextNamespace();
45619     test_ret += test_xmlXPathNextParent();
45620     test_ret += test_xmlXPathNextPreceding();
45621     test_ret += test_xmlXPathNextPrecedingSibling();
45622     test_ret += test_xmlXPathNextSelf();
45623     test_ret += test_xmlXPathNodeLeading();
45624     test_ret += test_xmlXPathNodeLeadingSorted();
45625     test_ret += test_xmlXPathNodeSetAdd();
45626     test_ret += test_xmlXPathNodeSetAddNs();
45627     test_ret += test_xmlXPathNodeSetAddUnique();
45628     test_ret += test_xmlXPathNodeSetContains();
45629     test_ret += test_xmlXPathNodeSetDel();
45630     test_ret += test_xmlXPathNodeSetMerge();
45631     test_ret += test_xmlXPathNodeSetRemove();
45632     test_ret += test_xmlXPathNodeSetSort();
45633     test_ret += test_xmlXPathNodeTrailing();
45634     test_ret += test_xmlXPathNodeTrailingSorted();
45635     test_ret += test_xmlXPathNormalizeFunction();
45636     test_ret += test_xmlXPathNotEqualValues();
45637     test_ret += test_xmlXPathNotFunction();
45638     test_ret += test_xmlXPathNsLookup();
45639     test_ret += test_xmlXPathNumberFunction();
45640     test_ret += test_xmlXPathParseNCName();
45641     test_ret += test_xmlXPathParseName();
45642     test_ret += test_xmlXPathPopBoolean();
45643     test_ret += test_xmlXPathPopExternal();
45644     test_ret += test_xmlXPathPopNodeSet();
45645     test_ret += test_xmlXPathPopNumber();
45646     test_ret += test_xmlXPathPopString();
45647     test_ret += test_xmlXPathPositionFunction();
45648     test_ret += test_xmlXPathRegisterAllFunctions();
45649     test_ret += test_xmlXPathRegisterFunc();
45650     test_ret += test_xmlXPathRegisterFuncLookup();
45651     test_ret += test_xmlXPathRegisterFuncNS();
45652     test_ret += test_xmlXPathRegisterNs();
45653     test_ret += test_xmlXPathRegisterVariable();
45654     test_ret += test_xmlXPathRegisterVariableLookup();
45655     test_ret += test_xmlXPathRegisterVariableNS();
45656     test_ret += test_xmlXPathRegisteredFuncsCleanup();
45657     test_ret += test_xmlXPathRegisteredNsCleanup();
45658     test_ret += test_xmlXPathRegisteredVariablesCleanup();
45659     test_ret += test_xmlXPathRoot();
45660     test_ret += test_xmlXPathRoundFunction();
45661     test_ret += test_xmlXPathStartsWithFunction();
45662     test_ret += test_xmlXPathStringEvalNumber();
45663     test_ret += test_xmlXPathStringFunction();
45664     test_ret += test_xmlXPathStringLengthFunction();
45665     test_ret += test_xmlXPathSubValues();
45666     test_ret += test_xmlXPathSubstringAfterFunction();
45667     test_ret += test_xmlXPathSubstringBeforeFunction();
45668     test_ret += test_xmlXPathSubstringFunction();
45669     test_ret += test_xmlXPathSumFunction();
45670     test_ret += test_xmlXPathTrailing();
45671     test_ret += test_xmlXPathTrailingSorted();
45672     test_ret += test_xmlXPathTranslateFunction();
45673     test_ret += test_xmlXPathTrueFunction();
45674     test_ret += test_xmlXPathValueFlipSign();
45675     test_ret += test_xmlXPathVariableLookup();
45676     test_ret += test_xmlXPathVariableLookupNS();
45677     test_ret += test_xmlXPathWrapCString();
45678     test_ret += test_xmlXPathWrapExternal();
45679     test_ret += test_xmlXPathWrapNodeSet();
45680     test_ret += test_xmlXPatherror();
45681 
45682     if (test_ret != 0)
45683 	printf("Module xpathInternals: %d errors\n", test_ret);
45684     return(test_ret);
45685 }
45686 
45687 static int
test_xmlXPtrEval(void)45688 test_xmlXPtrEval(void) {
45689     int test_ret = 0;
45690 
45691 #if defined(LIBXML_XPTR_ENABLED)
45692     int mem_base;
45693     xmlXPathObjectPtr ret_val;
45694     const xmlChar * str; /* the XPointer expression */
45695     int n_str;
45696     xmlXPathContextPtr ctx; /* the XPointer context */
45697     int n_ctx;
45698 
45699     for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
45700     for (n_ctx = 0;n_ctx < gen_nb_xmlXPathContextPtr;n_ctx++) {
45701         mem_base = xmlMemBlocks();
45702         str = gen_const_xmlChar_ptr(n_str, 0);
45703         ctx = gen_xmlXPathContextPtr(n_ctx, 1);
45704 
45705         ret_val = xmlXPtrEval(str, ctx);
45706         desret_xmlXPathObjectPtr(ret_val);
45707         call_tests++;
45708         des_const_xmlChar_ptr(n_str, str, 0);
45709         des_xmlXPathContextPtr(n_ctx, ctx, 1);
45710         xmlResetLastError();
45711         if (mem_base != xmlMemBlocks()) {
45712             printf("Leak of %d blocks found in xmlXPtrEval",
45713 	           xmlMemBlocks() - mem_base);
45714 	    test_ret++;
45715             printf(" %d", n_str);
45716             printf(" %d", n_ctx);
45717             printf("\n");
45718         }
45719     }
45720     }
45721     function_tests++;
45722 #endif
45723 
45724     return(test_ret);
45725 }
45726 
45727 
45728 static int
test_xmlXPtrNewContext(void)45729 test_xmlXPtrNewContext(void) {
45730     int test_ret = 0;
45731 
45732 
45733     /* missing type support */
45734     return(test_ret);
45735 }
45736 
45737 static int
test_xpointer(void)45738 test_xpointer(void) {
45739     int test_ret = 0;
45740 
45741     if (quiet == 0) printf("Testing xpointer : 1 of 2 functions ...\n");
45742     test_ret += test_xmlXPtrEval();
45743     test_ret += test_xmlXPtrNewContext();
45744 
45745     if (test_ret != 0)
45746 	printf("Module xpointer: %d errors\n", test_ret);
45747     return(test_ret);
45748 }
45749 static int
test_module(const char * module)45750 test_module(const char *module) {
45751     if (!strcmp(module, "HTMLparser")) return(test_HTMLparser());
45752     if (!strcmp(module, "HTMLtree")) return(test_HTMLtree());
45753     if (!strcmp(module, "SAX2")) return(test_SAX2());
45754     if (!strcmp(module, "c14n")) return(test_c14n());
45755     if (!strcmp(module, "catalog")) return(test_catalog());
45756     if (!strcmp(module, "chvalid")) return(test_chvalid());
45757     if (!strcmp(module, "debugXML")) return(test_debugXML());
45758     if (!strcmp(module, "dict")) return(test_dict());
45759     if (!strcmp(module, "encoding")) return(test_encoding());
45760     if (!strcmp(module, "entities")) return(test_entities());
45761     if (!strcmp(module, "hash")) return(test_hash());
45762     if (!strcmp(module, "list")) return(test_list());
45763     if (!strcmp(module, "nanohttp")) return(test_nanohttp());
45764     if (!strcmp(module, "parser")) return(test_parser());
45765     if (!strcmp(module, "parserInternals")) return(test_parserInternals());
45766     if (!strcmp(module, "pattern")) return(test_pattern());
45767     if (!strcmp(module, "relaxng")) return(test_relaxng());
45768     if (!strcmp(module, "schemasInternals")) return(test_schemasInternals());
45769     if (!strcmp(module, "schematron")) return(test_schematron());
45770     if (!strcmp(module, "tree")) return(test_tree());
45771     if (!strcmp(module, "uri")) return(test_uri());
45772     if (!strcmp(module, "valid")) return(test_valid());
45773     if (!strcmp(module, "xinclude")) return(test_xinclude());
45774     if (!strcmp(module, "xmlIO")) return(test_xmlIO());
45775     if (!strcmp(module, "xmlautomata")) return(test_xmlautomata());
45776     if (!strcmp(module, "xmlerror")) return(test_xmlerror());
45777     if (!strcmp(module, "xmlmodule")) return(test_xmlmodule());
45778     if (!strcmp(module, "xmlreader")) return(test_xmlreader());
45779     if (!strcmp(module, "xmlregexp")) return(test_xmlregexp());
45780     if (!strcmp(module, "xmlsave")) return(test_xmlsave());
45781     if (!strcmp(module, "xmlschemas")) return(test_xmlschemas());
45782     if (!strcmp(module, "xmlschemastypes")) return(test_xmlschemastypes());
45783     if (!strcmp(module, "xmlstring")) return(test_xmlstring());
45784     if (!strcmp(module, "xmlwriter")) return(test_xmlwriter());
45785     if (!strcmp(module, "xpath")) return(test_xpath());
45786     if (!strcmp(module, "xpathInternals")) return(test_xpathInternals());
45787     if (!strcmp(module, "xpointer")) return(test_xpointer());
45788     return(0);
45789 }
45790