Bug Summary

File:testapi.c
Location:line 22844, column 9
Description:Value stored to 'ret_val' is never read

Annotated Source Code

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 * daniel@veillard.com
9 */
10
11#ifdef HAVE_CONFIG_H1
12#include "libxml.h"
13#else
14#include <stdio.h>
15#endif
16
17#include <stdlib.h> /* for putenv() */
18#include <string.h>
19#include <libxml/xmlerror.h>
20#include <libxml/relaxng.h>
21
22#if defined(_WIN32) && !defined(__CYGWIN__)
23#define snprintf _snprintf
24#endif
25
26static int testlibxml2(void);
27static int test_module(const char *module);
28
29static int generic_errors = 0;
30static int call_tests = 0;
31static int function_tests = 0;
32
33static xmlChar chartab[1024];
34static int inttab[1024];
35static unsigned long longtab[1024];
36
37static xmlDocPtr api_doc = NULL((void*)0);
38static xmlDtdPtr api_dtd = NULL((void*)0);
39static xmlNodePtr api_root = NULL((void*)0);
40static xmlAttrPtr api_attr = NULL((void*)0);
41static xmlNsPtr api_ns = NULL((void*)0);
42
43static void
44structured_errors(void *userData ATTRIBUTE_UNUSED__attribute__((unused)),
45 xmlErrorPtr error ATTRIBUTE_UNUSED__attribute__((unused))) {
46 generic_errors++;
47}
48
49static void
50free_api_doc(void) {
51 xmlFreeDoc(api_doc);
52 api_doc = NULL((void*)0);
53 api_dtd = NULL((void*)0);
54 api_root = NULL((void*)0);
55 api_attr = NULL((void*)0);
56 api_ns = NULL((void*)0);
57}
58
59static xmlDocPtr
60get_api_doc(void) {
61 if (api_doc == NULL((void*)0)) {
62 api_doc = xmlReadMemory("<!DOCTYPE root [<!ELEMENT root EMPTY>]><root xmlns:h='http://example.com/' h:foo='bar'/>", 88, "root_test", NULL((void*)0), 0);
63 api_root = NULL((void*)0);
64 api_attr = NULL((void*)0);
65 }
66 return(api_doc);
67}
68
69static xmlDtdPtr
70get_api_dtd(void) {
71 if ((api_dtd == NULL((void*)0)) || (api_dtd->type != XML_DTD_NODE)) {
72 get_api_doc();
73 if ((api_doc != NULL((void*)0)) && (api_doc->children != NULL((void*)0)) &&
74 (api_doc->children->type == XML_DTD_NODE))
75 api_dtd = (xmlDtdPtr) api_doc->children;
76 }
77 return(api_dtd);
78}
79
80static xmlNodePtr
81get_api_root(void) {
82 if ((api_root == NULL((void*)0)) || (api_root->type != XML_ELEMENT_NODE)) {
83 get_api_doc();
84 if ((api_doc != NULL((void*)0)) && (api_doc->children != NULL((void*)0)) &&
85 (api_doc->children->next != NULL((void*)0)) &&
86 (api_doc->children->next->type == XML_ELEMENT_NODE))
87 api_root = api_doc->children->next;
88 }
89 return(api_root);
90}
91
92static xmlNsPtr
93get_api_ns(void) {
94 get_api_root();
95 if (api_root != NULL((void*)0))
96 api_ns = api_root->nsDef;
97 return(api_ns);
98}
99
100static xmlAttrPtr
101get_api_attr(void) {
102#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED)
103 static int nr = 0;
104 xmlChar name[20];
105#endif
106
107 if ((api_root == NULL((void*)0)) || (api_root->type != XML_ELEMENT_NODE)) {
108 get_api_root();
109 }
110 if (api_root == NULL((void*)0))
111 return(NULL((void*)0));
112 if (api_root->properties != NULL((void*)0)) {
113 api_attr = api_root->properties;
114 return(api_root->properties);
115 }
116 api_attr = NULL((void*)0);
117#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED)
118 snprintf((char *) name, 20, "foo%d", nr++);
119 api_attr = xmlSetProp(api_root, name, (const xmlChar *) "bar");
120#endif
121 return(api_attr);
122}
123
124static int quiet = 0;
125
126int main(int argc, char **argv) {
127 int ret;
128 int blocks, mem;
129
130 /* access to the proxy can slow up regression tests a lot */
131 putenv((char *) "http_proxy=");
132
133 memset(chartab, 0, sizeof(chartab));
134 strncpy((char *) chartab, " chartab\n", 20);
135 memset(inttab, 0, sizeof(inttab));
136 memset(longtab, 0, sizeof(longtab));
137
138 xmlInitParser();
139#ifdef LIBXML_SCHEMAS_ENABLED
140 xmlRelaxNGInitTypes();
141#endif
142
143 LIBXML_TEST_VERSIONxmlCheckVersion(20703);
144
145 xmlSetStructuredErrorFunc(NULL((void*)0), structured_errors);
146
147 if (argc >= 2) {
148 if (!strcmp(argv[1], "-q")) {
149 quiet = 1;
150 if (argc >= 3)
151 ret = test_module(argv[2]);
152 else
153 ret = testlibxml2();
154 } else {
155 ret = test_module(argv[1]);
156 }
157 } else
158 ret = testlibxml2();
159
160 xmlCleanupParser();
161 blocks = xmlMemBlocks();
162 mem = xmlMemUsed();
163 if ((blocks != 0) || (mem != 0)) {
164 printf("testapi leaked %d bytes in %d blocks\n", mem, blocks);
165 }
166 xmlMemoryDump();
167
168 return (ret != 0);
169}
170
171#include <libxml/HTMLparser.h>
172#include <libxml/HTMLtree.h>
173#include <libxml/catalog.h>
174#include <libxml/chvalid.h>
175#include <libxml/dict.h>
176#include <libxml/encoding.h>
177#include <libxml/entities.h>
178#include <libxml/hash.h>
179#include <libxml/list.h>
180#include <libxml/nanoftp.h>
181#include <libxml/nanohttp.h>
182#include <libxml/parser.h>
183#include <libxml/parserInternals.h>
184#include <libxml/pattern.h>
185#include <libxml/relaxng.h>
186#include <libxml/schemasInternals.h>
187#include <libxml/schematron.h>
188#include <libxml/tree.h>
189#include <libxml/uri.h>
190#include <libxml/valid.h>
191#include <libxml/xinclude.h>
192#include <libxml/xmlIO.h>
193#include <libxml/xmlerror.h>
194#include <libxml/xmlreader.h>
195#include <libxml/xmlsave.h>
196#include <libxml/xmlschemas.h>
197#include <libxml/xmlschemastypes.h>
198#include <libxml/xmlstring.h>
199#include <libxml/xmlwriter.h>
200#include <libxml/xpath.h>
201#include <libxml/xpointer.h>
202#include <libxml/debugXML.h>
203
204/*
205 We manually define xmlErrMemory because it's normal declaration
206 is "hidden" by #ifdef IN_LIBXML
207*/
208void xmlErrMemory(xmlParserCtxtPtr ctxt, const char *extra);
209
210/*
211 We need some "remote" addresses, but want to avoid getting into
212 name resolution delays, so we use these
213*/
214#define REMOTE1GOOD"http://localhost/" "http://localhost/"
215#define REMOTE1BAD"http:http://http" "http:http://http"
216#define REMOTE2GOOD"ftp://localhost/foo" "ftp://localhost/foo"
217
218#define gen_nb_void_ptr2 2
219
220static void *gen_void_ptr(int no ATTRIBUTE_UNUSED__attribute__((unused)), int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
221 return(NULL((void*)0));
222}
223static void des_void_ptr(int no ATTRIBUTE_UNUSED__attribute__((unused)), void *val ATTRIBUTE_UNUSED__attribute__((unused)), int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
224}
225
226#if 0
227#define gen_nb_const_void_ptr 2
228
229static const void *gen_const_void_ptr(int no, int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
230 if (no == 0) return((const void *) "immutable string");
231 return(NULL((void*)0));
232}
233static void des_const_void_ptr(int no ATTRIBUTE_UNUSED__attribute__((unused)), const void *val ATTRIBUTE_UNUSED__attribute__((unused)), int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
234}
235#endif
236
237#define gen_nb_userdata3 3
238
239static void *gen_userdata(int no, int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
240 if (no == 0) return((void *) &call_tests);
241 if (no == 1) return((void *) -1);
242 return(NULL((void*)0));
243}
244static void des_userdata(int no ATTRIBUTE_UNUSED__attribute__((unused)), void *val ATTRIBUTE_UNUSED__attribute__((unused)), int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
245}
246
247
248#define gen_nb_int4 4
249
250static int gen_int(int no, int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
251 if (no == 0) return(0);
252 if (no == 1) return(1);
253 if (no == 2) return(-1);
254 if (no == 3) return(122);
255 return(-1);
256}
257
258static void des_int(int no ATTRIBUTE_UNUSED__attribute__((unused)), int val ATTRIBUTE_UNUSED__attribute__((unused)), int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
259}
260
261#define gen_nb_parseroptions5 5
262
263static int gen_parseroptions(int no, int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
264 if (no == 0) return(XML_PARSE_NOBLANKS | XML_PARSE_RECOVER);
265 if (no == 1) return(XML_PARSE_NOENT | XML_PARSE_DTDLOAD | XML_PARSE_DTDATTR | XML_PARSE_DTDVALID | XML_PARSE_NOCDATA);
266 if (no == 2) return(XML_PARSE_XINCLUDE | XML_PARSE_NOXINCNODE | XML_PARSE_NSCLEAN);
267 if (no == 3) return(XML_PARSE_XINCLUDE | XML_PARSE_NODICT);
268 return(XML_PARSE_SAX1);
269}
270
271static void des_parseroptions(int no ATTRIBUTE_UNUSED__attribute__((unused)), int val ATTRIBUTE_UNUSED__attribute__((unused)), int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
272}
273
274#if 0
275#define gen_nb_long 5
276
277static long gen_long(int no, int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
278 if (no == 0) return(0);
279 if (no == 1) return(1);
280 if (no == 2) return(-1);
281 if (no == 3) return(122);
282 return(-1);
283}
284
285static void des_long(int no ATTRIBUTE_UNUSED__attribute__((unused)), long val ATTRIBUTE_UNUSED__attribute__((unused)), int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
286}
287#endif
288
289#define gen_nb_xmlChar4 4
290
291static xmlChar gen_xmlChar(int no, int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
292 if (no == 0) return('a');
293 if (no == 1) return(' ');
294 if (no == 2) return((xmlChar) 'ø');
295 return(0);
296}
297
298static void des_xmlChar(int no ATTRIBUTE_UNUSED__attribute__((unused)), xmlChar val ATTRIBUTE_UNUSED__attribute__((unused)), int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
299}
300
301#define gen_nb_unsigned_int3 3
302
303static unsigned int gen_unsigned_int(int no, int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
304 if (no == 0) return(0);
305 if (no == 1) return(1);
306 if (no == 2) return(122);
307 return((unsigned int) -1);
308}
309
310static void des_unsigned_int(int no ATTRIBUTE_UNUSED__attribute__((unused)), unsigned int val ATTRIBUTE_UNUSED__attribute__((unused)), int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
311}
312
313#define gen_nb_unsigned_long4 4
314
315static unsigned long gen_unsigned_long(int no, int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
316 if (no == 0) return(0);
317 if (no == 1) return(1);
318 if (no == 2) return(122);
319 return((unsigned long) -1);
320}
321
322static void des_unsigned_long(int no ATTRIBUTE_UNUSED__attribute__((unused)), unsigned long val ATTRIBUTE_UNUSED__attribute__((unused)), int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
323}
324
325#define gen_nb_double4 4
326
327static double gen_double(int no, int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
328 if (no == 0) return(0);
329 if (no == 1) return(-1.1);
330#if defined(LIBXML_XPATH_ENABLED)
331 if (no == 2) return(xmlXPathNAN);
332#endif
333 return(-1);
334}
335
336static void des_double(int no ATTRIBUTE_UNUSED__attribute__((unused)), double val ATTRIBUTE_UNUSED__attribute__((unused)), int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
337}
338
339#define gen_nb_unsigned_long_ptr2 2
340
341static unsigned long *gen_unsigned_long_ptr(int no, int nr) {
342 if (no == 0) return(&longtab[nr]);
343 return(NULL((void*)0));
344}
345
346static void des_unsigned_long_ptr(int no ATTRIBUTE_UNUSED__attribute__((unused)), unsigned long *val ATTRIBUTE_UNUSED__attribute__((unused)), int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
347}
348
349#define gen_nb_int_ptr2 2
350
351static int *gen_int_ptr(int no, int nr) {
352 if (no == 0) return(&inttab[nr]);
353 return(NULL((void*)0));
354}
355
356static void des_int_ptr(int no ATTRIBUTE_UNUSED__attribute__((unused)), int *val ATTRIBUTE_UNUSED__attribute__((unused)), int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
357}
358
359#define gen_nb_const_char_ptr4 4
360
361static char *gen_const_char_ptr(int no, int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
362 if (no == 0) return((char *) "foo");
363 if (no == 1) return((char *) "<foo/>");
364 if (no == 2) return((char *) "test/ent2");
365 return(NULL((void*)0));
366}
367static void des_const_char_ptr(int no ATTRIBUTE_UNUSED__attribute__((unused)), const char *val ATTRIBUTE_UNUSED__attribute__((unused)), int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
368}
369
370#define gen_nb_xmlChar_ptr2 2
371
372static xmlChar *gen_xmlChar_ptr(int no, int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
373 if (no == 0) return(&chartab[0]);
374 return(NULL((void*)0));
375}
376static void des_xmlChar_ptr(int no ATTRIBUTE_UNUSED__attribute__((unused)), xmlChar *val ATTRIBUTE_UNUSED__attribute__((unused)), int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
377}
378
379#define gen_nb_FILE_ptr2 2
380
381static FILE *gen_FILE_ptr(int no, int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
382 if (no == 0) return(fopen("test.out", "a+"));
383 return(NULL((void*)0));
384}
385static void des_FILE_ptr(int no ATTRIBUTE_UNUSED__attribute__((unused)), FILE *val, int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
386 if (val != NULL((void*)0)) fclose(val);
387}
388
389#define gen_nb_debug_FILE_ptr2 2
390static FILE *gen_debug_FILE_ptr(int no ATTRIBUTE_UNUSED__attribute__((unused)), int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
391 return(fopen("test.out", "a+"));
392}
393static void des_debug_FILE_ptr(int no ATTRIBUTE_UNUSED__attribute__((unused)), FILE *val, int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
394 if (val != NULL((void*)0)) fclose(val);
395}
396
397#define gen_nb_const_xmlChar_ptr5 5
398
399static xmlChar *gen_const_xmlChar_ptr(int no, int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
400 if (no == 0) return((xmlChar *) "foo");
401 if (no == 1) return((xmlChar *) "<foo/>");
402 if (no == 2) return((xmlChar *) "nøne");
403 if (no == 3) return((xmlChar *) " 2ab ");
404 return(NULL((void*)0));
405}
406static void des_const_xmlChar_ptr(int no ATTRIBUTE_UNUSED__attribute__((unused)), const xmlChar *val ATTRIBUTE_UNUSED__attribute__((unused)), int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
407}
408
409#define gen_nb_filepath8 8
410
411static const char *gen_filepath(int no, int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
412 if (no == 0) return("missing.xml");
413 if (no == 1) return("<foo/>");
414 if (no == 2) return("test/ent2");
415 if (no == 3) return("test/valid/REC-xml-19980210.xml");
416 if (no == 4) return("test/valid/dtds/xhtml1-strict.dtd");
417 if (no == 5) return(REMOTE1GOOD"http://localhost/");
418 if (no == 6) return(REMOTE1BAD"http:http://http");
419 return(NULL((void*)0));
420}
421static void des_filepath(int no ATTRIBUTE_UNUSED__attribute__((unused)), const char *val ATTRIBUTE_UNUSED__attribute__((unused)), int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
422}
423
424#define gen_nb_eaten_name2 2
425
426static xmlChar *gen_eaten_name(int no, int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
427 if (no == 0) return(xmlStrdup(BAD_CAST(xmlChar *) "eaten"));
428 return(NULL((void*)0));
429}
430static void des_eaten_name(int no ATTRIBUTE_UNUSED__attribute__((unused)), xmlChar *val ATTRIBUTE_UNUSED__attribute__((unused)), int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
431}
432
433#define gen_nb_fileoutput6 6
434
435static const char *gen_fileoutput(int no, int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
436 if (no == 0) return("/missing.xml");
437 if (no == 1) return("<foo/>");
438 if (no == 2) return(REMOTE2GOOD"ftp://localhost/foo");
439 if (no == 3) return(REMOTE1GOOD"http://localhost/");
440 if (no == 4) return(REMOTE1BAD"http:http://http");
441 return(NULL((void*)0));
442}
443static void des_fileoutput(int no ATTRIBUTE_UNUSED__attribute__((unused)), const char *val ATTRIBUTE_UNUSED__attribute__((unused)), int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
444}
445
446#define gen_nb_xmlParserCtxtPtr3 3
447static xmlParserCtxtPtr gen_xmlParserCtxtPtr(int no, int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
448 if (no == 0) return(xmlNewParserCtxt());
449 if (no == 1) return(xmlCreateMemoryParserCtxt("<doc/>", 6));
450 return(NULL((void*)0));
451}
452static void des_xmlParserCtxtPtr(int no ATTRIBUTE_UNUSED__attribute__((unused)), xmlParserCtxtPtr val, int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
453 if (val != NULL((void*)0))
454 xmlFreeParserCtxt(val);
455}
456
457#define gen_nb_xmlSAXHandlerPtr2 2
458static xmlSAXHandlerPtr gen_xmlSAXHandlerPtr(int no, int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
459#ifdef LIBXML_SAX1_ENABLED
460 if (no == 0) return((xmlSAXHandlerPtr) &xmlDefaultSAXHandler(*(__xmlDefaultSAXHandler())));
461#endif
462 return(NULL((void*)0));
463}
464static void des_xmlSAXHandlerPtr(int no ATTRIBUTE_UNUSED__attribute__((unused)), xmlSAXHandlerPtr val ATTRIBUTE_UNUSED__attribute__((unused)), int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
465}
466
467#define gen_nb_xmlValidCtxtPtr2 2
468static xmlValidCtxtPtr gen_xmlValidCtxtPtr(int no, int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
469#ifdef LIBXML_VALID_ENABLED
470 if (no == 0) return(xmlNewValidCtxt());
471#endif
472 return(NULL((void*)0));
473}
474static void des_xmlValidCtxtPtr(int no ATTRIBUTE_UNUSED__attribute__((unused)), xmlValidCtxtPtr val, int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
475#ifdef LIBXML_VALID_ENABLED
476 if (val != NULL((void*)0))
477 xmlFreeValidCtxt(val);
478#endif
479}
480
481#define gen_nb_xmlParserInputBufferPtr8 8
482
483static xmlParserInputBufferPtr gen_xmlParserInputBufferPtr(int no, int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
484 if (no == 0) return(xmlParserInputBufferCreateFilename("missing.xml", XML_CHAR_ENCODING_NONE));
485 if (no == 1) return(xmlParserInputBufferCreateFilename("<foo/>", XML_CHAR_ENCODING_NONE));
486 if (no == 2) return(xmlParserInputBufferCreateFilename("test/ent2", XML_CHAR_ENCODING_NONE));
487 if (no == 3) return(xmlParserInputBufferCreateFilename("test/valid/REC-xml-19980210.xml", XML_CHAR_ENCODING_NONE));
488 if (no == 4) return(xmlParserInputBufferCreateFilename("test/valid/dtds/xhtml1-strict.dtd", XML_CHAR_ENCODING_NONE));
489 if (no == 5) return(xmlParserInputBufferCreateFilename(REMOTE1GOOD"http://localhost/", XML_CHAR_ENCODING_NONE));
490 if (no == 6) return(xmlParserInputBufferCreateFilename(REMOTE1BAD"http:http://http", XML_CHAR_ENCODING_NONE));
491 return(NULL((void*)0));
492}
493static void des_xmlParserInputBufferPtr(int no ATTRIBUTE_UNUSED__attribute__((unused)), xmlParserInputBufferPtr val, int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
494 xmlFreeParserInputBuffer(val);
495}
496
497#define gen_nb_xmlDocPtr4 4
498static xmlDocPtr gen_xmlDocPtr(int no, int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
499 if (no == 0) return(xmlNewDoc(BAD_CAST(xmlChar *) "1.0"));
500 if (no == 1) return(xmlReadMemory("<foo/>", 6, "test", NULL((void*)0), 0));
501 if (no == 2) return(xmlReadMemory("<!DOCTYPE foo []> <foo/>", 24, "test", NULL((void*)0), 0));
502 return(NULL((void*)0));
503}
504static void des_xmlDocPtr(int no ATTRIBUTE_UNUSED__attribute__((unused)), xmlDocPtr val, int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
505 if ((val != NULL((void*)0)) && (val != api_doc) && (val->doc != api_doc))
506 xmlFreeDoc(val);
507}
508
509#define gen_nb_xmlAttrPtr2 2
510static xmlAttrPtr gen_xmlAttrPtr(int no, int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
511 if (no == 0) return(get_api_attr());
512 return(NULL((void*)0));
513}
514static void des_xmlAttrPtr(int no, xmlAttrPtr val ATTRIBUTE_UNUSED__attribute__((unused)), int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
515 if (no == 0) free_api_doc();
516}
517
518#define gen_nb_xmlDictPtr2 2
519static xmlDictPtr gen_xmlDictPtr(int no, int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
520 if (no == 0) return(xmlDictCreate());
521 return(NULL((void*)0));
522}
523static void des_xmlDictPtr(int no ATTRIBUTE_UNUSED__attribute__((unused)), xmlDictPtr val, int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
524 if (val != NULL((void*)0))
525 xmlDictFree(val);
526}
527
528#define gen_nb_xmlNodePtr3 3
529static xmlNodePtr gen_xmlNodePtr(int no, int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
530 if (no == 0) return(xmlNewPI(BAD_CAST(xmlChar *) "test", NULL((void*)0)));
531 if (no == 1) return(get_api_root());
532 return(NULL((void*)0));
533/* if (no == 2) return((xmlNodePtr) get_api_doc()); */
534}
535static void des_xmlNodePtr(int no, xmlNodePtr val, int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
536 if (no == 1) {
537 free_api_doc();
538 } else if (val != NULL((void*)0)) {
539 xmlUnlinkNode(val);
540 xmlFreeNode(val);
541 }
542}
543
544#define gen_nb_xmlDtdPtr3 3
545static xmlDtdPtr gen_xmlDtdPtr(int no, int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
546 if (no == 0)
547 return(xmlNewDtd(NULL((void*)0), BAD_CAST(xmlChar *) "dtd", BAD_CAST(xmlChar *)"foo", BAD_CAST(xmlChar *)"bar"));
548 if (no == 1) return(get_api_dtd());
549 return(NULL((void*)0));
550}
551static void des_xmlDtdPtr(int no, xmlDtdPtr val, int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
552 if (no == 1) free_api_doc();
553 else if (val != NULL((void*)0)) {
554 xmlUnlinkNode((xmlNodePtr) val);
555 xmlFreeNode((xmlNodePtr) val);
556 }
557}
558
559#define gen_nb_xmlNsPtr2 2
560static xmlNsPtr gen_xmlNsPtr(int no, int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
561 if (no == 0) return(get_api_ns());
562 return(NULL((void*)0));
563}
564static void des_xmlNsPtr(int no, xmlNsPtr val ATTRIBUTE_UNUSED__attribute__((unused)), int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
565 if (no == 0) free_api_doc();
566}
567
568#define gen_nb_xmlNodePtr_in3 3
569static xmlNodePtr gen_xmlNodePtr_in(int no, int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
570 if (no == 0) return(xmlNewPI(BAD_CAST(xmlChar *) "test", NULL((void*)0)));
571 if (no == 0) return(xmlNewText(BAD_CAST(xmlChar *) "text"));
572 return(NULL((void*)0));
573}
574static void des_xmlNodePtr_in(int no ATTRIBUTE_UNUSED__attribute__((unused)), xmlNodePtr val ATTRIBUTE_UNUSED__attribute__((unused)), int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
575}
576
577#ifdef LIBXML_WRITER_ENABLED
578#define gen_nb_xmlTextWriterPtr2 2
579static xmlTextWriterPtr gen_xmlTextWriterPtr(int no, int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
580 if (no == 0) return(xmlNewTextWriterFilename("test.out", 0));
581 return(NULL((void*)0));
582}
583static void des_xmlTextWriterPtr(int no ATTRIBUTE_UNUSED__attribute__((unused)), xmlTextWriterPtr val, int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
584 if (val != NULL((void*)0)) xmlFreeTextWriter(val);
585}
586#endif
587
588#ifdef LIBXML_READER_ENABLED
589#define gen_nb_xmlTextReaderPtr4 4
590static xmlTextReaderPtr gen_xmlTextReaderPtr(int no, int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
591 if (no == 0) return(xmlNewTextReaderFilename("test/ent2"));
592 if (no == 1) return(xmlNewTextReaderFilename("test/valid/REC-xml-19980210.xml"));
593 if (no == 2) return(xmlNewTextReaderFilename("test/valid/dtds/xhtml1-strict.dtd"));
594 return(NULL((void*)0));
595}
596static void des_xmlTextReaderPtr(int no ATTRIBUTE_UNUSED__attribute__((unused)), xmlTextReaderPtr val, int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
597 if (val != NULL((void*)0)) xmlFreeTextReader(val);
598}
599#endif
600
601#define gen_nb_xmlBufferPtr3 3
602static const char *static_buf_content = "a static buffer";
603static xmlBufferPtr gen_xmlBufferPtr(int no, int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
604 if (no == 0) return(xmlBufferCreate());
605 if (no == 1) return(xmlBufferCreateStatic((void *)static_buf_content, 13));
606 return(NULL((void*)0));
607}
608static void des_xmlBufferPtr(int no ATTRIBUTE_UNUSED__attribute__((unused)), xmlBufferPtr val, int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
609 if (val != NULL((void*)0)) {
610 xmlBufferFree(val);
611 }
612}
613
614#define gen_nb_xmlListPtr2 2
615static xmlListPtr gen_xmlListPtr(int no, int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
616 if (no == 0) return(xmlListCreate(NULL((void*)0), NULL((void*)0)));
617 return(NULL((void*)0));
618}
619static void des_xmlListPtr(int no ATTRIBUTE_UNUSED__attribute__((unused)), xmlListPtr val, int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
620 if (val != NULL((void*)0)) {
621 xmlListDelete(val);
622 }
623}
624
625#define gen_nb_xmlHashTablePtr2 2
626static xmlHashTablePtr gen_xmlHashTablePtr(int no, int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
627 if (no == 0) return(xmlHashCreate(10));
628 return(NULL((void*)0));
629}
630static void des_xmlHashTablePtr(int no ATTRIBUTE_UNUSED__attribute__((unused)), xmlHashTablePtr val, int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
631 if (val != NULL((void*)0)) {
632 xmlHashFree(val, NULL((void*)0));
633 }
634}
635
636#include <libxml/xpathInternals.h>
637
638#ifdef LIBXML_XPATH_ENABLED
639#define gen_nb_xmlXPathObjectPtr5 5
640static xmlXPathObjectPtr gen_xmlXPathObjectPtr(int no, int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
641 if (no == 0) return(xmlXPathNewString(BAD_CAST(xmlChar *) "string object"));
642 if (no == 1) return(xmlXPathNewFloat(1.1));
643 if (no == 2) return(xmlXPathNewBoolean(1));
644 if (no == 3) return(xmlXPathNewNodeSet(NULL((void*)0)));
645 return(NULL((void*)0));
646}
647static void des_xmlXPathObjectPtr(int no ATTRIBUTE_UNUSED__attribute__((unused)), xmlXPathObjectPtr val, int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
648 if (val != NULL((void*)0)) {
649 xmlXPathFreeObject(val);
650 }
651}
652#endif
653
654#ifdef LIBXML_OUTPUT_ENABLED
655#define gen_nb_xmlOutputBufferPtr2 2
656static xmlOutputBufferPtr gen_xmlOutputBufferPtr(int no, int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
657 if (no == 0) return(xmlOutputBufferCreateFilename("test.out", NULL((void*)0), 0));
658 return(NULL((void*)0));
659}
660static void des_xmlOutputBufferPtr(int no ATTRIBUTE_UNUSED__attribute__((unused)), xmlOutputBufferPtr val, int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
661 if (val != NULL((void*)0)) {
662 xmlOutputBufferClose(val);
663 }
664}
665#endif
666
667#ifdef LIBXML_FTP_ENABLED
668#define gen_nb_xmlNanoFTPCtxtPtr4 4
669static void *gen_xmlNanoFTPCtxtPtr(int no, int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
670 if (no == 0) return(xmlNanoFTPNewCtxt(REMOTE2GOOD"ftp://localhost/foo"));
671 if (no == 1) return(xmlNanoFTPNewCtxt(REMOTE1GOOD"http://localhost/"));
672 if (no == 2) return(xmlNanoFTPNewCtxt("foo"));
673 return(NULL((void*)0));
674}
675static void des_xmlNanoFTPCtxtPtr(int no ATTRIBUTE_UNUSED__attribute__((unused)), void *val, int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
676 if (val != NULL((void*)0)) {
677 xmlNanoFTPFreeCtxt(val);
678 }
679}
680#endif
681
682#ifdef LIBXML_HTTP_ENABLED
683#define gen_nb_xmlNanoHTTPCtxtPtr1 1
684static void *gen_xmlNanoHTTPCtxtPtr(int no, int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
685 if (no == 0) return(xmlNanoHTTPOpen(REMOTE1GOOD"http://localhost/", NULL((void*)0)));
686 if (no == 1) return(xmlNanoHTTPOpen(REMOTE2GOOD"ftp://localhost/foo", NULL((void*)0)));
687 if (no == 2) return(xmlNanoHTTPOpen(REMOTE1BAD"http:http://http", NULL((void*)0)));
688 return(NULL((void*)0));
689}
690static void des_xmlNanoHTTPCtxtPtr(int no ATTRIBUTE_UNUSED__attribute__((unused)), void *val, int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
691 if (val != NULL((void*)0)) {
692 xmlNanoHTTPClose(val);
693 }
694}
695#endif
696
697#define gen_nb_xmlCharEncoding4 4
698static xmlCharEncoding gen_xmlCharEncoding(int no, int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
699 if (no == 0) return(XML_CHAR_ENCODING_UTF8);
700 if (no == 1) return(XML_CHAR_ENCODING_NONE);
701 if (no == 2) return(XML_CHAR_ENCODING_8859_1);
702 return(XML_CHAR_ENCODING_ERROR);
703}
704static void des_xmlCharEncoding(int no ATTRIBUTE_UNUSED__attribute__((unused)), xmlCharEncoding val ATTRIBUTE_UNUSED__attribute__((unused)), int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
705}
706
707#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_EXPR_ENABLED)
708
709#define gen_nb_xmlExpCtxtPtr1 1
710static xmlExpCtxtPtr gen_xmlExpCtxtPtr(int no ATTRIBUTE_UNUSED__attribute__((unused)), int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
711 return(NULL((void*)0));
712}
713static void des_xmlExpCtxtPtr(int no ATTRIBUTE_UNUSED__attribute__((unused)), xmlExpCtxtPtr val ATTRIBUTE_UNUSED__attribute__((unused)), int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
714}
715
716#define gen_nb_xmlExpNodePtr1 1
717static xmlExpNodePtr gen_xmlExpNodePtr(int no ATTRIBUTE_UNUSED__attribute__((unused)), int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
718 return(NULL((void*)0));
719}
720static void des_xmlExpNodePtr(int no ATTRIBUTE_UNUSED__attribute__((unused)), xmlExpNodePtr val ATTRIBUTE_UNUSED__attribute__((unused)), int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
721}
722
723#endif
724
725#if defined(LIBXML_SCHEMAS_ENABLED)
726#define gen_nb_xmlSchemaPtr1 1
727static xmlSchemaPtr gen_xmlSchemaPtr(int no ATTRIBUTE_UNUSED__attribute__((unused)), int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
728 return(NULL((void*)0));
729}
730static void des_xmlSchemaPtr(int no ATTRIBUTE_UNUSED__attribute__((unused)), xmlSchemaPtr val ATTRIBUTE_UNUSED__attribute__((unused)), int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
731}
732
733#define gen_nb_xmlSchemaValidCtxtPtr1 1
734static xmlSchemaValidCtxtPtr gen_xmlSchemaValidCtxtPtr(int no ATTRIBUTE_UNUSED__attribute__((unused)), int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
735 return(NULL((void*)0));
736}
737static void des_xmlSchemaValidCtxtPtr(int no ATTRIBUTE_UNUSED__attribute__((unused)), xmlSchemaValidCtxtPtr val ATTRIBUTE_UNUSED__attribute__((unused)), int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
738}
739
740#endif /* LIBXML_SCHEMAS_ENABLED */
741
742#define gen_nb_xmlHashDeallocator2 2
743static void
744test_xmlHashDeallocator(void *payload ATTRIBUTE_UNUSED__attribute__((unused)), xmlChar *name ATTRIBUTE_UNUSED__attribute__((unused))) {
745}
746
747static xmlHashDeallocator gen_xmlHashDeallocator(int no, int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
748 if (no == 0) return(test_xmlHashDeallocator);
749 return(NULL((void*)0));
750}
751static void des_xmlHashDeallocator(int no ATTRIBUTE_UNUSED__attribute__((unused)), xmlHashDeallocator val ATTRIBUTE_UNUSED__attribute__((unused)), int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
752}
753
754
755static void desret_int(int val ATTRIBUTE_UNUSED__attribute__((unused))) {
756}
757static void desret_xmlChar(xmlChar val ATTRIBUTE_UNUSED__attribute__((unused))) {
758}
759static void desret_long(long val ATTRIBUTE_UNUSED__attribute__((unused))) {
760}
761static void desret_unsigned_long(unsigned long val ATTRIBUTE_UNUSED__attribute__((unused))) {
762}
763static void desret_double(double val ATTRIBUTE_UNUSED__attribute__((unused))) {
764}
765static void desret_xmlCharEncoding(xmlCharEncoding val ATTRIBUTE_UNUSED__attribute__((unused))) {
766}
767#if 0
768static void desret_const_void_ptr(void *val ATTRIBUTE_UNUSED__attribute__((unused))) {
769}
770#endif
771static void desret_void_ptr(void *val ATTRIBUTE_UNUSED__attribute__((unused))) {
772}
773static void desret_const_char_ptr(const char *val ATTRIBUTE_UNUSED__attribute__((unused))) {
774}
775static void desret_const_xmlChar_ptr(const xmlChar *val ATTRIBUTE_UNUSED__attribute__((unused))) {
776}
777static void desret_xmlChar_ptr(xmlChar *val) {
778 if (val != NULL((void*)0))
779 xmlFree(val);
780}
781static void desret_xmlDocPtr(xmlDocPtr val) {
782 if (val != api_doc)
783 xmlFreeDoc(val);
784}
785static void desret_xmlDictPtr(xmlDictPtr val) {
786 xmlDictFree(val);
787}
788#ifdef LIBXML_OUTPUT_ENABLED
789static void desret_xmlOutputBufferPtr(xmlOutputBufferPtr val) {
790 xmlOutputBufferClose(val);
791}
792#endif
793#ifdef LIBXML_READER_ENABLED
794static void desret_xmlTextReaderPtr(xmlTextReaderPtr val) {
795 xmlFreeTextReader(val);
796}
797#endif
798static void desret_xmlNodePtr(xmlNodePtr val) {
799 if ((val != NULL((void*)0)) && (val != api_root) && (val != (xmlNodePtr) api_doc)) {
800 xmlUnlinkNode(val);
801 xmlFreeNode(val);
802 }
803}
804static void desret_xmlAttrPtr(xmlAttrPtr val) {
805 if (val != NULL((void*)0)) {
806 xmlUnlinkNode((xmlNodePtr) val);
807 xmlFreeNode((xmlNodePtr) val);
808 }
809}
810static void desret_xmlEntityPtr(xmlEntityPtr val) {
811 if (val != NULL((void*)0)) {
812 xmlUnlinkNode((xmlNodePtr) val);
813 xmlFreeNode((xmlNodePtr) val);
814 }
815}
816static void desret_xmlElementPtr(xmlElementPtr val) {
817 if (val != NULL((void*)0)) {
818 xmlUnlinkNode((xmlNodePtr) val);
819 }
820}
821static void desret_xmlAttributePtr(xmlAttributePtr val) {
822 if (val != NULL((void*)0)) {
823 xmlUnlinkNode((xmlNodePtr) val);
824 }
825}
826static void desret_xmlNsPtr(xmlNsPtr val ATTRIBUTE_UNUSED__attribute__((unused))) {
827}
828static void desret_xmlDtdPtr(xmlDtdPtr val) {
829 desret_xmlNodePtr((xmlNodePtr)val);
830}
831#ifdef LIBXML_XPATH_ENABLED
832static void desret_xmlXPathObjectPtr(xmlXPathObjectPtr val) {
833 xmlXPathFreeObject(val);
834}
835static void desret_xmlNodeSetPtr(xmlNodeSetPtr val) {
836 xmlXPathFreeNodeSet(val);
837}
838#endif
839static void desret_xmlParserCtxtPtr(xmlParserCtxtPtr val) {
840 xmlFreeParserCtxt(val);
841}
842static void desret_xmlParserInputBufferPtr(xmlParserInputBufferPtr val) {
843 xmlFreeParserInputBuffer(val);
844}
845static void desret_xmlParserInputPtr(xmlParserInputPtr val) {
846 xmlFreeInputStream(val);
847}
848#ifdef LIBXML_WRITER_ENABLED
849static void desret_xmlTextWriterPtr(xmlTextWriterPtr val) {
850 xmlFreeTextWriter(val);
851}
852#endif
853static void desret_xmlBufferPtr(xmlBufferPtr val) {
854 xmlBufferFree(val);
855}
856#ifdef LIBXML_SCHEMAS_ENABLED
857static void desret_xmlSchemaParserCtxtPtr(xmlSchemaParserCtxtPtr val) {
858 xmlSchemaFreeParserCtxt(val);
859}
860static void desret_xmlSchemaTypePtr(xmlSchemaTypePtr val ATTRIBUTE_UNUSED__attribute__((unused))) {
861}
862static void desret_xmlRelaxNGParserCtxtPtr(xmlRelaxNGParserCtxtPtr val) {
863 xmlRelaxNGFreeParserCtxt(val);
864}
865#endif
866#ifdef LIBXML_HTML_ENABLED
867static void desret_const_htmlEntityDesc_ptr(const htmlEntityDesc * val ATTRIBUTE_UNUSED__attribute__((unused))) {
868}
869#endif
870#ifdef LIBXML_HTTP_ENABLED
871static void desret_xmlNanoHTTPCtxtPtr(void *val) {
872 xmlNanoHTTPClose(val);
873}
874#endif
875#ifdef LIBXML_FTP_ENABLED
876static void desret_xmlNanoFTPCtxtPtr(void *val) {
877 xmlNanoFTPClose(val);
878}
879#endif
880/* cut and pasted from autogenerated to avoid troubles */
881#define gen_nb_const_xmlChar_ptr_ptr1 1
882static xmlChar ** gen_const_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED__attribute__((unused)), int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
883 return(NULL((void*)0));
884}
885static void des_const_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED__attribute__((unused)), const xmlChar ** val ATTRIBUTE_UNUSED__attribute__((unused)), int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
886}
887
888#define gen_nb_unsigned_char_ptr1 1
889static unsigned char * gen_unsigned_char_ptr(int no ATTRIBUTE_UNUSED__attribute__((unused)), int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
890 return(NULL((void*)0));
891}
892static void des_unsigned_char_ptr(int no ATTRIBUTE_UNUSED__attribute__((unused)), unsigned char * val ATTRIBUTE_UNUSED__attribute__((unused)), int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
893}
894
895#define gen_nb_const_unsigned_char_ptr1 1
896static unsigned char * gen_const_unsigned_char_ptr(int no ATTRIBUTE_UNUSED__attribute__((unused)), int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
897 return(NULL((void*)0));
898}
899static void des_const_unsigned_char_ptr(int no ATTRIBUTE_UNUSED__attribute__((unused)), const unsigned char * val ATTRIBUTE_UNUSED__attribute__((unused)), int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
900}
901
902#ifdef LIBXML_HTML_ENABLED
903#define gen_nb_const_htmlNodePtr1 1
904static htmlNodePtr gen_const_htmlNodePtr(int no ATTRIBUTE_UNUSED__attribute__((unused)), int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
905 return(NULL((void*)0));
906}
907static void des_const_htmlNodePtr(int no ATTRIBUTE_UNUSED__attribute__((unused)), const htmlNodePtr val ATTRIBUTE_UNUSED__attribute__((unused)), int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
908}
909#endif
910
911#ifdef LIBXML_HTML_ENABLED
912#define gen_nb_htmlDocPtr3 3
913static htmlDocPtr gen_htmlDocPtr(int no ATTRIBUTE_UNUSED__attribute__((unused)), int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
914 if (no == 0) return(htmlNewDoc(NULL((void*)0), NULL((void*)0)));
915 if (no == 1) return(htmlReadMemory("<html/>", 7, "test", NULL((void*)0), 0));
916 return(NULL((void*)0));
917}
918static void des_htmlDocPtr(int no ATTRIBUTE_UNUSED__attribute__((unused)), htmlDocPtr val ATTRIBUTE_UNUSED__attribute__((unused)), int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
919 if ((val != NULL((void*)0)) && (val != api_doc) && (val->doc != api_doc))
920 xmlFreeDoc(val);
921}
922static void desret_htmlDocPtr(htmlDocPtr val) {
923 if ((val != NULL((void*)0)) && (val != api_doc) && (val->doc != api_doc))
924 xmlFreeDoc(val);
925}
926#define gen_nb_htmlParserCtxtPtr3 3
927static htmlParserCtxtPtr gen_htmlParserCtxtPtr(int no ATTRIBUTE_UNUSED__attribute__((unused)), int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
928 if (no == 0) return(xmlNewParserCtxt());
929 if (no == 1) return(htmlCreateMemoryParserCtxt("<html/>", 7));
930 return(NULL((void*)0));
931}
932static void des_htmlParserCtxtPtr(int no ATTRIBUTE_UNUSED__attribute__((unused)), htmlParserCtxtPtr val ATTRIBUTE_UNUSED__attribute__((unused)), int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
933 if (val != NULL((void*)0))
934 htmlFreeParserCtxt(val);
935}
936static void desret_htmlParserCtxtPtr(htmlParserCtxtPtr val) {
937 if (val != NULL((void*)0))
938 htmlFreeParserCtxt(val);
939}
940#endif
941
942#ifdef LIBXML_XPATH_ENABLED
943#define gen_nb_xmlNodeSetPtr1 1
944static xmlNodeSetPtr gen_xmlNodeSetPtr(int no ATTRIBUTE_UNUSED__attribute__((unused)), int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
945 return(NULL((void*)0));
946}
947static void des_xmlNodeSetPtr(int no ATTRIBUTE_UNUSED__attribute__((unused)), xmlNodeSetPtr val ATTRIBUTE_UNUSED__attribute__((unused)), int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
948}
949#endif
950
951#ifdef LIBXML_DEBUG_ENABLED
952#ifdef LIBXML_XPATH_ENABLED
953#define gen_nb_xmlShellCtxtPtr1 1
954static xmlShellCtxtPtr gen_xmlShellCtxtPtr(int no ATTRIBUTE_UNUSED__attribute__((unused)), int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
955 return(NULL((void*)0));
956}
957static void des_xmlShellCtxtPtr(int no ATTRIBUTE_UNUSED__attribute__((unused)), xmlShellCtxtPtr val ATTRIBUTE_UNUSED__attribute__((unused)), int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
958}
959#endif
960#endif
961
962#ifdef LIBXML_PATTERN_ENABLED
963#define gen_nb_xmlPatternPtr1 1
964static xmlPatternPtr gen_xmlPatternPtr(int no ATTRIBUTE_UNUSED__attribute__((unused)), int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
965 return(NULL((void*)0));
966}
967static void des_xmlPatternPtr(int no ATTRIBUTE_UNUSED__attribute__((unused)), xmlPatternPtr val ATTRIBUTE_UNUSED__attribute__((unused)), int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
968}
969#endif
970
971#define gen_nb_xmlElementContentPtr1 1
972static xmlElementContentPtr gen_xmlElementContentPtr(int no ATTRIBUTE_UNUSED__attribute__((unused)), int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
973 return(NULL((void*)0));
974}
975static void des_xmlElementContentPtr(int no ATTRIBUTE_UNUSED__attribute__((unused)), xmlElementContentPtr val, int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
976 if (val != NULL((void*)0))
977 xmlFreeElementContent(val);
978}
979static void desret_xmlElementContentPtr(xmlElementContentPtr val) {
980 if (val != NULL((void*)0))
981 xmlFreeElementContent(val);
982}
983
984#define gen_nb_xmlParserNodeInfoSeqPtr1 1
985static xmlParserNodeInfoSeqPtr gen_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED__attribute__((unused)), int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
986 return(NULL((void*)0));
987}
988static void des_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED__attribute__((unused)), xmlParserNodeInfoSeqPtr val ATTRIBUTE_UNUSED__attribute__((unused)), int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
989}
990
991static void desret_const_xmlParserNodeInfo_ptr(const xmlParserNodeInfo *val ATTRIBUTE_UNUSED__attribute__((unused))) {
992}
993
994#define gen_nb_void_ptr_ptr1 1
995static void ** gen_void_ptr_ptr(int no ATTRIBUTE_UNUSED__attribute__((unused)), int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
996 return(NULL((void*)0));
997}
998static void des_void_ptr_ptr(int no ATTRIBUTE_UNUSED__attribute__((unused)), void ** val ATTRIBUTE_UNUSED__attribute__((unused)), int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
999}
1000
1001/************************************************************************
1002 * *
1003 * WARNING: end of the manually maintained part of the test code *
1004 * do not remove or alter the CUT HERE line *
1005 * *
1006 ************************************************************************/
1007
1008/* CUT HERE: everything below that line is generated */
1009#ifdef LIBXML_HTML_ENABLED
1010static void desret_htmlStatus(htmlStatus val ATTRIBUTE_UNUSED__attribute__((unused))) {
1011}
1012
1013#endif
1014
1015#define gen_nb_xmlAttributeDefault4 4
1016static xmlAttributeDefault gen_xmlAttributeDefault(int no, int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
1017 if (no == 1) return(XML_ATTRIBUTE_FIXED);
1018 if (no == 2) return(XML_ATTRIBUTE_IMPLIED);
1019 if (no == 3) return(XML_ATTRIBUTE_NONE);
1020 if (no == 4) return(XML_ATTRIBUTE_REQUIRED);
1021 return(0);
1022}
1023
1024static void des_xmlAttributeDefault(int no ATTRIBUTE_UNUSED__attribute__((unused)), xmlAttributeDefault val ATTRIBUTE_UNUSED__attribute__((unused)), int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
1025}
1026
1027#define gen_nb_xmlAttributeType4 4
1028static xmlAttributeType gen_xmlAttributeType(int no, int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
1029 if (no == 1) return(XML_ATTRIBUTE_CDATA);
1030 if (no == 2) return(XML_ATTRIBUTE_ENTITIES);
1031 if (no == 3) return(XML_ATTRIBUTE_ENTITY);
1032 if (no == 4) return(XML_ATTRIBUTE_ENUMERATION);
1033 return(0);
1034}
1035
1036static void des_xmlAttributeType(int no ATTRIBUTE_UNUSED__attribute__((unused)), xmlAttributeType val ATTRIBUTE_UNUSED__attribute__((unused)), int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
1037}
1038
1039#define gen_nb_xmlBufferAllocationScheme4 4
1040static xmlBufferAllocationScheme gen_xmlBufferAllocationScheme(int no, int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
1041 if (no == 1) return(XML_BUFFER_ALLOC_DOUBLEIT);
1042 if (no == 2) return(XML_BUFFER_ALLOC_EXACT);
1043 if (no == 3) return(XML_BUFFER_ALLOC_IMMUTABLE);
1044 if (no == 4) return(XML_BUFFER_ALLOC_IO);
1045 return(0);
1046}
1047
1048static void des_xmlBufferAllocationScheme(int no ATTRIBUTE_UNUSED__attribute__((unused)), xmlBufferAllocationScheme val ATTRIBUTE_UNUSED__attribute__((unused)), int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
1049}
1050
1051static void desret_xmlBufferAllocationScheme(xmlBufferAllocationScheme val ATTRIBUTE_UNUSED__attribute__((unused))) {
1052}
1053
1054#ifdef LIBXML_CATALOG_ENABLED
1055#define gen_nb_xmlCatalogAllow4 4
1056static xmlCatalogAllow gen_xmlCatalogAllow(int no, int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
1057 if (no == 1) return(XML_CATA_ALLOW_ALL);
1058 if (no == 2) return(XML_CATA_ALLOW_DOCUMENT);
1059 if (no == 3) return(XML_CATA_ALLOW_GLOBAL);
1060 if (no == 4) return(XML_CATA_ALLOW_NONE);
1061 return(0);
1062}
1063
1064static void des_xmlCatalogAllow(int no ATTRIBUTE_UNUSED__attribute__((unused)), xmlCatalogAllow val ATTRIBUTE_UNUSED__attribute__((unused)), int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
1065}
1066
1067static void desret_xmlCatalogAllow(xmlCatalogAllow val ATTRIBUTE_UNUSED__attribute__((unused))) {
1068}
1069
1070#endif
1071
1072#ifdef LIBXML_CATALOG_ENABLED
1073#define gen_nb_xmlCatalogPrefer3 3
1074static xmlCatalogPrefer gen_xmlCatalogPrefer(int no, int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
1075 if (no == 1) return(XML_CATA_PREFER_NONE);
1076 if (no == 2) return(XML_CATA_PREFER_PUBLIC);
1077 if (no == 3) return(XML_CATA_PREFER_SYSTEM);
1078 return(0);
1079}
1080
1081static void des_xmlCatalogPrefer(int no ATTRIBUTE_UNUSED__attribute__((unused)), xmlCatalogPrefer val ATTRIBUTE_UNUSED__attribute__((unused)), int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
1082}
1083
1084static void desret_xmlCatalogPrefer(xmlCatalogPrefer val ATTRIBUTE_UNUSED__attribute__((unused))) {
1085}
1086
1087#endif
1088
1089#define gen_nb_xmlElementContentType4 4
1090static xmlElementContentType gen_xmlElementContentType(int no, int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
1091 if (no == 1) return(XML_ELEMENT_CONTENT_ELEMENT);
1092 if (no == 2) return(XML_ELEMENT_CONTENT_OR);
1093 if (no == 3) return(XML_ELEMENT_CONTENT_PCDATA);
1094 if (no == 4) return(XML_ELEMENT_CONTENT_SEQ);
1095 return(0);
1096}
1097
1098static void des_xmlElementContentType(int no ATTRIBUTE_UNUSED__attribute__((unused)), xmlElementContentType val ATTRIBUTE_UNUSED__attribute__((unused)), int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
1099}
1100
1101#define gen_nb_xmlElementTypeVal4 4
1102static xmlElementTypeVal gen_xmlElementTypeVal(int no, int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
1103 if (no == 1) return(XML_ELEMENT_TYPE_ANY);
1104 if (no == 2) return(XML_ELEMENT_TYPE_ELEMENT);
1105 if (no == 3) return(XML_ELEMENT_TYPE_EMPTY);
1106 if (no == 4) return(XML_ELEMENT_TYPE_MIXED);
1107 return(0);
1108}
1109
1110static void des_xmlElementTypeVal(int no ATTRIBUTE_UNUSED__attribute__((unused)), xmlElementTypeVal val ATTRIBUTE_UNUSED__attribute__((unused)), int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
1111}
1112
1113#define gen_nb_xmlFeature4 4
1114static xmlFeature gen_xmlFeature(int no, int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
1115 if (no == 1) return(XML_WITH_AUTOMATA);
1116 if (no == 2) return(XML_WITH_C14N);
1117 if (no == 3) return(XML_WITH_CATALOG);
1118 if (no == 4) return(XML_WITH_DEBUG);
1119 return(0);
1120}
1121
1122static void des_xmlFeature(int no ATTRIBUTE_UNUSED__attribute__((unused)), xmlFeature val ATTRIBUTE_UNUSED__attribute__((unused)), int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
1123}
1124
1125static void desret_xmlParserErrors(xmlParserErrors val ATTRIBUTE_UNUSED__attribute__((unused))) {
1126}
1127
1128#ifdef LIBXML_SCHEMAS_ENABLED
1129#define gen_nb_xmlSchemaValType4 4
1130static xmlSchemaValType gen_xmlSchemaValType(int no, int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
1131 if (no == 1) return(XML_SCHEMAS_ANYSIMPLETYPE);
1132 if (no == 2) return(XML_SCHEMAS_ANYTYPE);
1133 if (no == 3) return(XML_SCHEMAS_ANYURI);
1134 if (no == 4) return(XML_SCHEMAS_BASE64BINARY);
1135 return(0);
1136}
1137
1138static void des_xmlSchemaValType(int no ATTRIBUTE_UNUSED__attribute__((unused)), xmlSchemaValType val ATTRIBUTE_UNUSED__attribute__((unused)), int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
1139}
1140
1141static void desret_xmlSchemaValType(xmlSchemaValType val ATTRIBUTE_UNUSED__attribute__((unused))) {
1142}
1143
1144#endif
1145
1146#ifdef LIBXML_SCHEMAS_ENABLED
1147#define gen_nb_xmlSchemaWhitespaceValueType4 4
1148static xmlSchemaWhitespaceValueType gen_xmlSchemaWhitespaceValueType(int no, int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
1149 if (no == 1) return(XML_SCHEMA_WHITESPACE_COLLAPSE);
1150 if (no == 2) return(XML_SCHEMA_WHITESPACE_PRESERVE);
1151 if (no == 3) return(XML_SCHEMA_WHITESPACE_REPLACE);
1152 if (no == 4) return(XML_SCHEMA_WHITESPACE_UNKNOWN);
1153 return(0);
1154}
1155
1156static void des_xmlSchemaWhitespaceValueType(int no ATTRIBUTE_UNUSED__attribute__((unused)), xmlSchemaWhitespaceValueType val ATTRIBUTE_UNUSED__attribute__((unused)), int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
1157}
1158
1159#endif
1160
1161#include <libxml/HTMLparser.h>
1162#include <libxml/HTMLtree.h>
1163#include <libxml/SAX2.h>
1164#include <libxml/c14n.h>
1165#include <libxml/catalog.h>
1166#include <libxml/chvalid.h>
1167#include <libxml/debugXML.h>
1168#include <libxml/dict.h>
1169#include <libxml/encoding.h>
1170#include <libxml/entities.h>
1171#include <libxml/hash.h>
1172#include <libxml/list.h>
1173#include <libxml/nanoftp.h>
1174#include <libxml/nanohttp.h>
1175#include <libxml/parser.h>
1176#include <libxml/parserInternals.h>
1177#include <libxml/pattern.h>
1178#include <libxml/relaxng.h>
1179#include <libxml/schemasInternals.h>
1180#include <libxml/schematron.h>
1181#include <libxml/tree.h>
1182#include <libxml/uri.h>
1183#include <libxml/valid.h>
1184#include <libxml/xinclude.h>
1185#include <libxml/xmlIO.h>
1186#include <libxml/xmlautomata.h>
1187#include <libxml/xmlerror.h>
1188#include <libxml/xmlmodule.h>
1189#include <libxml/xmlreader.h>
1190#include <libxml/xmlregexp.h>
1191#include <libxml/xmlsave.h>
1192#include <libxml/xmlschemas.h>
1193#include <libxml/xmlschemastypes.h>
1194#include <libxml/xmlstring.h>
1195#include <libxml/xmlunicode.h>
1196#include <libxml/xmlwriter.h>
1197#include <libxml/xpath.h>
1198#include <libxml/xpathInternals.h>
1199#include <libxml/xpointer.h>
1200static int test_HTMLparser(void);
1201static int test_HTMLtree(void);
1202static int test_SAX2(void);
1203static int test_c14n(void);
1204static int test_catalog(void);
1205static int test_chvalid(void);
1206static int test_debugXML(void);
1207static int test_dict(void);
1208static int test_encoding(void);
1209static int test_entities(void);
1210static int test_hash(void);
1211static int test_list(void);
1212static int test_nanoftp(void);
1213static int test_nanohttp(void);
1214static int test_parser(void);
1215static int test_parserInternals(void);
1216static int test_pattern(void);
1217static int test_relaxng(void);
1218static int test_schemasInternals(void);
1219static int test_schematron(void);
1220static int test_tree(void);
1221static int test_uri(void);
1222static int test_valid(void);
1223static int test_xinclude(void);
1224static int test_xmlIO(void);
1225static int test_xmlautomata(void);
1226static int test_xmlerror(void);
1227static int test_xmlmodule(void);
1228static int test_xmlreader(void);
1229static int test_xmlregexp(void);
1230static int test_xmlsave(void);
1231static int test_xmlschemas(void);
1232static int test_xmlschemastypes(void);
1233static int test_xmlstring(void);
1234static int test_xmlunicode(void);
1235static int test_xmlwriter(void);
1236static int test_xpath(void);
1237static int test_xpathInternals(void);
1238static int test_xpointer(void);
1239
1240/**
1241 * testlibxml2:
1242 *
1243 * Main entry point of the tester for the full libxml2 module,
1244 * it calls all the tester entry point for each module.
1245 *
1246 * Returns the number of error found
1247 */
1248static int
1249testlibxml2(void)
1250{
1251 int test_ret = 0;
1252
1253 test_ret += test_HTMLparser();
1254 test_ret += test_HTMLtree();
1255 test_ret += test_SAX2();
1256 test_ret += test_c14n();
1257 test_ret += test_catalog();
1258 test_ret += test_chvalid();
1259 test_ret += test_debugXML();
1260 test_ret += test_dict();
1261 test_ret += test_encoding();
1262 test_ret += test_entities();
1263 test_ret += test_hash();
1264 test_ret += test_list();
1265 test_ret += test_nanoftp();
1266 test_ret += test_nanohttp();
1267 test_ret += test_parser();
1268 test_ret += test_parserInternals();
1269 test_ret += test_pattern();
1270 test_ret += test_relaxng();
1271 test_ret += test_schemasInternals();
1272 test_ret += test_schematron();
1273 test_ret += test_tree();
1274 test_ret += test_uri();
1275 test_ret += test_valid();
1276 test_ret += test_xinclude();
1277 test_ret += test_xmlIO();
1278 test_ret += test_xmlautomata();
1279 test_ret += test_xmlerror();
1280 test_ret += test_xmlmodule();
1281 test_ret += test_xmlreader();
1282 test_ret += test_xmlregexp();
1283 test_ret += test_xmlsave();
1284 test_ret += test_xmlschemas();
1285 test_ret += test_xmlschemastypes();
1286 test_ret += test_xmlstring();
1287 test_ret += test_xmlunicode();
1288 test_ret += test_xmlwriter();
1289 test_ret += test_xpath();
1290 test_ret += test_xpathInternals();
1291 test_ret += test_xpointer();
1292
1293 printf("Total: %d functions, %d tests, %d errors\n",
1294 function_tests, call_tests, test_ret);
1295 return(test_ret);
1296}
1297
1298
1299static int
1300test_UTF8ToHtml(void) {
1301 int test_ret = 0;
1302
1303#if defined(LIBXML_HTML_ENABLED)
1304 int mem_base;
1305 int ret_val;
1306 unsigned char * out; /* a pointer to an array of bytes to store the result */
1307 int n_out;
1308 int * outlen; /* the length of @out */
1309 int n_outlen;
1310 unsigned char * in; /* a pointer to an array of UTF-8 chars */
1311 int n_in;
1312 int * inlen; /* the length of @in */
1313 int n_inlen;
1314
1315 for (n_out = 0;n_out < gen_nb_unsigned_char_ptr1;n_out++) {
1316 for (n_outlen = 0;n_outlen < gen_nb_int_ptr2;n_outlen++) {
1317 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr1;n_in++) {
1318 for (n_inlen = 0;n_inlen < gen_nb_int_ptr2;n_inlen++) {
1319 mem_base = xmlMemBlocks();
1320 out = gen_unsigned_char_ptr(n_out, 0);
1321 outlen = gen_int_ptr(n_outlen, 1);
1322 in = gen_const_unsigned_char_ptr(n_in, 2);
1323 inlen = gen_int_ptr(n_inlen, 3);
1324
1325 ret_val = UTF8ToHtml(out, outlen, (const unsigned char *)in, inlen);
1326 desret_int(ret_val);
1327 call_tests++;
1328 des_unsigned_char_ptr(n_out, out, 0);
1329 des_int_ptr(n_outlen, outlen, 1);
1330 des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 2);
1331 des_int_ptr(n_inlen, inlen, 3);
1332 xmlResetLastError();
1333 if (mem_base != xmlMemBlocks()) {
1334 printf("Leak of %d blocks found in UTF8ToHtml",
1335 xmlMemBlocks() - mem_base);
1336 test_ret++;
1337 printf(" %d", n_out);
1338 printf(" %d", n_outlen);
1339 printf(" %d", n_in);
1340 printf(" %d", n_inlen);
1341 printf("\n");
1342 }
1343 }
1344 }
1345 }
1346 }
1347 function_tests++;
1348#endif
1349
1350 return(test_ret);
1351}
1352
1353#ifdef LIBXML_HTML_ENABLED
1354
1355#define gen_nb_const_htmlElemDesc_ptr1 1
1356static htmlElemDesc * gen_const_htmlElemDesc_ptr(int no ATTRIBUTE_UNUSED__attribute__((unused)), int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
1357 return(NULL((void*)0));
1358}
1359static void des_const_htmlElemDesc_ptr(int no ATTRIBUTE_UNUSED__attribute__((unused)), const htmlElemDesc * val ATTRIBUTE_UNUSED__attribute__((unused)), int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
1360}
1361#endif
1362
1363
1364static int
1365test_htmlAttrAllowed(void) {
1366 int test_ret = 0;
1367
1368#if defined(LIBXML_HTML_ENABLED)
1369 int mem_base;
1370 htmlStatus ret_val;
1371 htmlElemDesc * elt; /* HTML element */
1372 int n_elt;
1373 xmlChar * attr; /* HTML attribute */
1374 int n_attr;
1375 int legacy; /* whether to allow deprecated attributes */
1376 int n_legacy;
1377
1378 for (n_elt = 0;n_elt < gen_nb_const_htmlElemDesc_ptr1;n_elt++) {
1379 for (n_attr = 0;n_attr < gen_nb_const_xmlChar_ptr5;n_attr++) {
1380 for (n_legacy = 0;n_legacy < gen_nb_int4;n_legacy++) {
1381 mem_base = xmlMemBlocks();
1382 elt = gen_const_htmlElemDesc_ptr(n_elt, 0);
1383 attr = gen_const_xmlChar_ptr(n_attr, 1);
1384 legacy = gen_int(n_legacy, 2);
1385
1386 ret_val = htmlAttrAllowed((const htmlElemDesc *)elt, (const xmlChar *)attr, legacy);
1387 desret_htmlStatus(ret_val);
1388 call_tests++;
1389 des_const_htmlElemDesc_ptr(n_elt, (const htmlElemDesc *)elt, 0);
1390 des_const_xmlChar_ptr(n_attr, (const xmlChar *)attr, 1);
1391 des_int(n_legacy, legacy, 2);
1392 xmlResetLastError();
1393 if (mem_base != xmlMemBlocks()) {
1394 printf("Leak of %d blocks found in htmlAttrAllowed",
1395 xmlMemBlocks() - mem_base);
1396 test_ret++;
1397 printf(" %d", n_elt);
1398 printf(" %d", n_attr);
1399 printf(" %d", n_legacy);
1400 printf("\n");
1401 }
1402 }
1403 }
1404 }
1405 function_tests++;
1406#endif
1407
1408 return(test_ret);
1409}
1410
1411#ifdef LIBXML_HTML_ENABLED
1412
1413#define gen_nb_htmlNodePtr1 1
1414static htmlNodePtr gen_htmlNodePtr(int no ATTRIBUTE_UNUSED__attribute__((unused)), int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
1415 return(NULL((void*)0));
1416}
1417static void des_htmlNodePtr(int no ATTRIBUTE_UNUSED__attribute__((unused)), htmlNodePtr val ATTRIBUTE_UNUSED__attribute__((unused)), int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
1418}
1419#endif
1420
1421
1422static int
1423test_htmlAutoCloseTag(void) {
1424 int test_ret = 0;
1425
1426#if defined(LIBXML_HTML_ENABLED)
1427 int mem_base;
1428 int ret_val;
1429 htmlDocPtr doc; /* the HTML document */
1430 int n_doc;
1431 xmlChar * name; /* The tag name */
1432 int n_name;
1433 htmlNodePtr elem; /* the HTML element */
1434 int n_elem;
1435
1436 for (n_doc = 0;n_doc < gen_nb_htmlDocPtr3;n_doc++) {
1437 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr5;n_name++) {
1438 for (n_elem = 0;n_elem < gen_nb_htmlNodePtr1;n_elem++) {
1439 mem_base = xmlMemBlocks();
1440 doc = gen_htmlDocPtr(n_doc, 0);
1441 name = gen_const_xmlChar_ptr(n_name, 1);
1442 elem = gen_htmlNodePtr(n_elem, 2);
1443
1444 ret_val = htmlAutoCloseTag(doc, (const xmlChar *)name, elem);
1445 desret_int(ret_val);
1446 call_tests++;
1447 des_htmlDocPtr(n_doc, doc, 0);
1448 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
1449 des_htmlNodePtr(n_elem, elem, 2);
1450 xmlResetLastError();
1451 if (mem_base != xmlMemBlocks()) {
1452 printf("Leak of %d blocks found in htmlAutoCloseTag",
1453 xmlMemBlocks() - mem_base);
1454 test_ret++;
1455 printf(" %d", n_doc);
1456 printf(" %d", n_name);
1457 printf(" %d", n_elem);
1458 printf("\n");
1459 }
1460 }
1461 }
1462 }
1463 function_tests++;
1464#endif
1465
1466 return(test_ret);
1467}
1468
1469
1470static int
1471test_htmlCreateMemoryParserCtxt(void) {
1472 int test_ret = 0;
1473
1474#if defined(LIBXML_HTML_ENABLED)
1475 int mem_base;
1476 htmlParserCtxtPtr ret_val;
1477 char * buffer; /* a pointer to a char array */
1478 int n_buffer;
1479 int size; /* the size of the array */
1480 int n_size;
1481
1482 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr4;n_buffer++) {
1483 for (n_size = 0;n_size < gen_nb_int4;n_size++) {
1484 mem_base = xmlMemBlocks();
1485 buffer = gen_const_char_ptr(n_buffer, 0);
1486 size = gen_int(n_size, 1);
1487
1488 ret_val = htmlCreateMemoryParserCtxt((const char *)buffer, size);
1489 desret_htmlParserCtxtPtr(ret_val);
1490 call_tests++;
1491 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
1492 des_int(n_size, size, 1);
1493 xmlResetLastError();
1494 if (mem_base != xmlMemBlocks()) {
1495 printf("Leak of %d blocks found in htmlCreateMemoryParserCtxt",
1496 xmlMemBlocks() - mem_base);
1497 test_ret++;
1498 printf(" %d", n_buffer);
1499 printf(" %d", n_size);
1500 printf("\n");
1501 }
1502 }
1503 }
1504 function_tests++;
1505#endif
1506
1507 return(test_ret);
1508}
1509
1510#ifdef LIBXML_HTML_ENABLED
1511
1512#define gen_nb_htmlSAXHandlerPtr1 1
1513static htmlSAXHandlerPtr gen_htmlSAXHandlerPtr(int no ATTRIBUTE_UNUSED__attribute__((unused)), int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
1514 return(NULL((void*)0));
1515}
1516static void des_htmlSAXHandlerPtr(int no ATTRIBUTE_UNUSED__attribute__((unused)), htmlSAXHandlerPtr val ATTRIBUTE_UNUSED__attribute__((unused)), int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
1517}
1518#endif
1519
1520
1521static int
1522test_htmlCreatePushParserCtxt(void) {
1523 int test_ret = 0;
1524
1525#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_PUSH_ENABLED)
1526 int mem_base;
1527 htmlParserCtxtPtr ret_val;
1528 htmlSAXHandlerPtr sax; /* a SAX handler */
1529 int n_sax;
1530 void * user_data; /* The user data returned on SAX callbacks */
1531 int n_user_data;
1532 char * chunk; /* a pointer to an array of chars */
1533 int n_chunk;
1534 int size; /* number of chars in the array */
1535 int n_size;
1536 const char * filename; /* an optional file name or URI */
1537 int n_filename;
1538 xmlCharEncoding enc; /* an optional encoding */
1539 int n_enc;
1540
1541 for (n_sax = 0;n_sax < gen_nb_htmlSAXHandlerPtr1;n_sax++) {
1542 for (n_user_data = 0;n_user_data < gen_nb_userdata3;n_user_data++) {
1543 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr4;n_chunk++) {
1544 for (n_size = 0;n_size < gen_nb_int4;n_size++) {
1545 for (n_filename = 0;n_filename < gen_nb_fileoutput6;n_filename++) {
1546 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding4;n_enc++) {
1547 mem_base = xmlMemBlocks();
1548 sax = gen_htmlSAXHandlerPtr(n_sax, 0);
1549 user_data = gen_userdata(n_user_data, 1);
1550 chunk = gen_const_char_ptr(n_chunk, 2);
1551 size = gen_int(n_size, 3);
1552 filename = gen_fileoutput(n_filename, 4);
1553 enc = gen_xmlCharEncoding(n_enc, 5);
1554
1555 ret_val = htmlCreatePushParserCtxt(sax, user_data, (const char *)chunk, size, filename, enc);
1556 desret_htmlParserCtxtPtr(ret_val);
1557 call_tests++;
1558 des_htmlSAXHandlerPtr(n_sax, sax, 0);
1559 des_userdata(n_user_data, user_data, 1);
1560 des_const_char_ptr(n_chunk, (const char *)chunk, 2);
1561 des_int(n_size, size, 3);
1562 des_fileoutput(n_filename, filename, 4);
1563 des_xmlCharEncoding(n_enc, enc, 5);
1564 xmlResetLastError();
1565 if (mem_base != xmlMemBlocks()) {
1566 printf("Leak of %d blocks found in htmlCreatePushParserCtxt",
1567 xmlMemBlocks() - mem_base);
1568 test_ret++;
1569 printf(" %d", n_sax);
1570 printf(" %d", n_user_data);
1571 printf(" %d", n_chunk);
1572 printf(" %d", n_size);
1573 printf(" %d", n_filename);
1574 printf(" %d", n_enc);
1575 printf("\n");
1576 }
1577 }
1578 }
1579 }
1580 }
1581 }
1582 }
1583 function_tests++;
1584#endif
1585
1586 return(test_ret);
1587}
1588
1589
1590static int
1591test_htmlCtxtReadDoc(void) {
1592 int test_ret = 0;
1593
1594#if defined(LIBXML_HTML_ENABLED)
1595 int mem_base;
1596 htmlDocPtr ret_val;
1597 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1598 int n_ctxt;
1599 xmlChar * cur; /* a pointer to a zero terminated string */
1600 int n_cur;
1601 const char * URL; /* the base URL to use for the document */
1602 int n_URL;
1603 char * encoding; /* the document encoding, or NULL */
1604 int n_encoding;
1605 int options; /* a combination of htmlParserOption(s) */
1606 int n_options;
1607
1608 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr3;n_ctxt++) {
1609 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr5;n_cur++) {
1610 for (n_URL = 0;n_URL < gen_nb_filepath8;n_URL++) {
1611 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr4;n_encoding++) {
1612 for (n_options = 0;n_options < gen_nb_int4;n_options++) {
1613 mem_base = xmlMemBlocks();
1614 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
1615 cur = gen_const_xmlChar_ptr(n_cur, 1);
1616 URL = gen_filepath(n_URL, 2);
1617 encoding = gen_const_char_ptr(n_encoding, 3);
1618 options = gen_int(n_options, 4);
1619
1620 ret_val = htmlCtxtReadDoc(ctxt, (const xmlChar *)cur, URL, (const char *)encoding, options);
1621 desret_htmlDocPtr(ret_val);
1622 call_tests++;
1623 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
1624 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 1);
1625 des_filepath(n_URL, URL, 2);
1626 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
1627 des_int(n_options, options, 4);
1628 xmlResetLastError();
1629 if (mem_base != xmlMemBlocks()) {
1630 printf("Leak of %d blocks found in htmlCtxtReadDoc",
1631 xmlMemBlocks() - mem_base);
1632 test_ret++;
1633 printf(" %d", n_ctxt);
1634 printf(" %d", n_cur);
1635 printf(" %d", n_URL);
1636 printf(" %d", n_encoding);
1637 printf(" %d", n_options);
1638 printf("\n");
1639 }
1640 }
1641 }
1642 }
1643 }
1644 }
1645 function_tests++;
1646#endif
1647
1648 return(test_ret);
1649}
1650
1651
1652static int
1653test_htmlCtxtReadFile(void) {
1654 int test_ret = 0;
1655
1656#if defined(LIBXML_HTML_ENABLED)
1657 htmlDocPtr ret_val;
1658 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1659 int n_ctxt;
1660 const char * filename; /* a file or URL */
1661 int n_filename;
1662 char * encoding; /* the document encoding, or NULL */
1663 int n_encoding;
1664 int options; /* a combination of htmlParserOption(s) */
1665 int n_options;
1666
1667 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr3;n_ctxt++) {
1668 for (n_filename = 0;n_filename < gen_nb_filepath8;n_filename++) {
1669 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr4;n_encoding++) {
1670 for (n_options = 0;n_options < gen_nb_int4;n_options++) {
1671 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
1672 filename = gen_filepath(n_filename, 1);
1673 encoding = gen_const_char_ptr(n_encoding, 2);
1674 options = gen_int(n_options, 3);
1675
1676 ret_val = htmlCtxtReadFile(ctxt, filename, (const char *)encoding, options);
1677 desret_htmlDocPtr(ret_val);
1678 call_tests++;
1679 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
1680 des_filepath(n_filename, filename, 1);
1681 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
1682 des_int(n_options, options, 3);
1683 xmlResetLastError();
1684 }
1685 }
1686 }
1687 }
1688 function_tests++;
1689#endif
1690
1691 return(test_ret);
1692}
1693
1694
1695static int
1696test_htmlCtxtReadMemory(void) {
1697 int test_ret = 0;
1698
1699#if defined(LIBXML_HTML_ENABLED)
1700 int mem_base;
1701 htmlDocPtr ret_val;
1702 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1703 int n_ctxt;
1704 char * buffer; /* a pointer to a char array */
1705 int n_buffer;
1706 int size; /* the size of the array */
1707 int n_size;
1708 const char * URL; /* the base URL to use for the document */
1709 int n_URL;
1710 char * encoding; /* the document encoding, or NULL */
1711 int n_encoding;
1712 int options; /* a combination of htmlParserOption(s) */
1713 int n_options;
1714
1715 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr3;n_ctxt++) {
1716 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr4;n_buffer++) {
1717 for (n_size = 0;n_size < gen_nb_int4;n_size++) {
1718 for (n_URL = 0;n_URL < gen_nb_filepath8;n_URL++) {
1719 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr4;n_encoding++) {
1720 for (n_options = 0;n_options < gen_nb_int4;n_options++) {
1721 mem_base = xmlMemBlocks();
1722 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
1723 buffer = gen_const_char_ptr(n_buffer, 1);
1724 size = gen_int(n_size, 2);
1725 URL = gen_filepath(n_URL, 3);
1726 encoding = gen_const_char_ptr(n_encoding, 4);
1727 options = gen_int(n_options, 5);
1728
1729 ret_val = htmlCtxtReadMemory(ctxt, (const char *)buffer, size, URL, (const char *)encoding, options);
1730 desret_htmlDocPtr(ret_val);
1731 call_tests++;
1732 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
1733 des_const_char_ptr(n_buffer, (const char *)buffer, 1);
1734 des_int(n_size, size, 2);
1735 des_filepath(n_URL, URL, 3);
1736 des_const_char_ptr(n_encoding, (const char *)encoding, 4);
1737 des_int(n_options, options, 5);
1738 xmlResetLastError();
1739 if (mem_base != xmlMemBlocks()) {
1740 printf("Leak of %d blocks found in htmlCtxtReadMemory",
1741 xmlMemBlocks() - mem_base);
1742 test_ret++;
1743 printf(" %d", n_ctxt);
1744 printf(" %d", n_buffer);
1745 printf(" %d", n_size);
1746 printf(" %d", n_URL);
1747 printf(" %d", n_encoding);
1748 printf(" %d", n_options);
1749 printf("\n");
1750 }
1751 }
1752 }
1753 }
1754 }
1755 }
1756 }
1757 function_tests++;
1758#endif
1759
1760 return(test_ret);
1761}
1762
1763
1764static int
1765test_htmlCtxtReset(void) {
1766 int test_ret = 0;
1767
1768#if defined(LIBXML_HTML_ENABLED)
1769 int mem_base;
1770 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1771 int n_ctxt;
1772
1773 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr3;n_ctxt++) {
1774 mem_base = xmlMemBlocks();
1775 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
1776
1777 htmlCtxtReset(ctxt);
1778 call_tests++;
1779 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
1780 xmlResetLastError();
1781 if (mem_base != xmlMemBlocks()) {
1782 printf("Leak of %d blocks found in htmlCtxtReset",
1783 xmlMemBlocks() - mem_base);
1784 test_ret++;
1785 printf(" %d", n_ctxt);
1786 printf("\n");
1787 }
1788 }
1789 function_tests++;
1790#endif
1791
1792 return(test_ret);
1793}
1794
1795
1796static int
1797test_htmlCtxtUseOptions(void) {
1798 int test_ret = 0;
1799
1800#if defined(LIBXML_HTML_ENABLED)
1801 int mem_base;
1802 int ret_val;
1803 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1804 int n_ctxt;
1805 int options; /* a combination of htmlParserOption(s) */
1806 int n_options;
1807
1808 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr3;n_ctxt++) {
1809 for (n_options = 0;n_options < gen_nb_int4;n_options++) {
1810 mem_base = xmlMemBlocks();
1811 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
1812 options = gen_int(n_options, 1);
1813
1814 ret_val = htmlCtxtUseOptions(ctxt, options);
1815 desret_int(ret_val);
1816 call_tests++;
1817 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
1818 des_int(n_options, options, 1);
1819 xmlResetLastError();
1820 if (mem_base != xmlMemBlocks()) {
1821 printf("Leak of %d blocks found in htmlCtxtUseOptions",
1822 xmlMemBlocks() - mem_base);
1823 test_ret++;
1824 printf(" %d", n_ctxt);
1825 printf(" %d", n_options);
1826 printf("\n");
1827 }
1828 }
1829 }
1830 function_tests++;
1831#endif
1832
1833 return(test_ret);
1834}
1835
1836
1837static int
1838test_htmlElementAllowedHere(void) {
1839 int test_ret = 0;
1840
1841#if defined(LIBXML_HTML_ENABLED)
1842 int mem_base;
1843 int ret_val;
1844 htmlElemDesc * parent; /* HTML parent element */
1845 int n_parent;
1846 xmlChar * elt; /* HTML element */
1847 int n_elt;
1848
1849 for (n_parent = 0;n_parent < gen_nb_const_htmlElemDesc_ptr1;n_parent++) {
1850 for (n_elt = 0;n_elt < gen_nb_const_xmlChar_ptr5;n_elt++) {
1851 mem_base = xmlMemBlocks();
1852 parent = gen_const_htmlElemDesc_ptr(n_parent, 0);
1853 elt = gen_const_xmlChar_ptr(n_elt, 1);
1854
1855 ret_val = htmlElementAllowedHere((const htmlElemDesc *)parent, (const xmlChar *)elt);
1856 desret_int(ret_val);
1857 call_tests++;
1858 des_const_htmlElemDesc_ptr(n_parent, (const htmlElemDesc *)parent, 0);
1859 des_const_xmlChar_ptr(n_elt, (const xmlChar *)elt, 1);
1860 xmlResetLastError();
1861 if (mem_base != xmlMemBlocks()) {
1862 printf("Leak of %d blocks found in htmlElementAllowedHere",
1863 xmlMemBlocks() - mem_base);
1864 test_ret++;
1865 printf(" %d", n_parent);
1866 printf(" %d", n_elt);
1867 printf("\n");
1868 }
1869 }
1870 }
1871 function_tests++;
1872#endif
1873
1874 return(test_ret);
1875}
1876
1877
1878static int
1879test_htmlElementStatusHere(void) {
1880 int test_ret = 0;
1881
1882#if defined(LIBXML_HTML_ENABLED)
1883 int mem_base;
1884 htmlStatus ret_val;
1885 htmlElemDesc * parent; /* HTML parent element */
1886 int n_parent;
1887 htmlElemDesc * elt; /* HTML element */
1888 int n_elt;
1889
1890 for (n_parent = 0;n_parent < gen_nb_const_htmlElemDesc_ptr1;n_parent++) {
1891 for (n_elt = 0;n_elt < gen_nb_const_htmlElemDesc_ptr1;n_elt++) {
1892 mem_base = xmlMemBlocks();
1893 parent = gen_const_htmlElemDesc_ptr(n_parent, 0);
1894 elt = gen_const_htmlElemDesc_ptr(n_elt, 1);
1895
1896 ret_val = htmlElementStatusHere((const htmlElemDesc *)parent, (const htmlElemDesc *)elt);
1897 desret_htmlStatus(ret_val);
1898 call_tests++;
1899 des_const_htmlElemDesc_ptr(n_parent, (const htmlElemDesc *)parent, 0);
1900 des_const_htmlElemDesc_ptr(n_elt, (const htmlElemDesc *)elt, 1);
1901 xmlResetLastError();
1902 if (mem_base != xmlMemBlocks()) {
1903 printf("Leak of %d blocks found in htmlElementStatusHere",
1904 xmlMemBlocks() - mem_base);
1905 test_ret++;
1906 printf(" %d", n_parent);
1907 printf(" %d", n_elt);
1908 printf("\n");
1909 }
1910 }
1911 }
1912 function_tests++;
1913#endif
1914
1915 return(test_ret);
1916}
1917
1918
1919static int
1920test_htmlEncodeEntities(void) {
1921 int test_ret = 0;
1922
1923#if defined(LIBXML_HTML_ENABLED)
1924 int mem_base;
1925 int ret_val;
1926 unsigned char * out; /* a pointer to an array of bytes to store the result */
1927 int n_out;
1928 int * outlen; /* the length of @out */
1929 int n_outlen;
1930 unsigned char * in; /* a pointer to an array of UTF-8 chars */
1931 int n_in;
1932 int * inlen; /* the length of @in */
1933 int n_inlen;
1934 int quoteChar; /* the quote character to escape (' or ") or zero. */
1935 int n_quoteChar;
1936
1937 for (n_out = 0;n_out < gen_nb_unsigned_char_ptr1;n_out++) {
1938 for (n_outlen = 0;n_outlen < gen_nb_int_ptr2;n_outlen++) {
1939 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr1;n_in++) {
1940 for (n_inlen = 0;n_inlen < gen_nb_int_ptr2;n_inlen++) {
1941 for (n_quoteChar = 0;n_quoteChar < gen_nb_int4;n_quoteChar++) {
1942 mem_base = xmlMemBlocks();
1943 out = gen_unsigned_char_ptr(n_out, 0);
1944 outlen = gen_int_ptr(n_outlen, 1);
1945 in = gen_const_unsigned_char_ptr(n_in, 2);
1946 inlen = gen_int_ptr(n_inlen, 3);
1947 quoteChar = gen_int(n_quoteChar, 4);
1948
1949 ret_val = htmlEncodeEntities(out, outlen, (const unsigned char *)in, inlen, quoteChar);
1950 desret_int(ret_val);
1951 call_tests++;
1952 des_unsigned_char_ptr(n_out, out, 0);
1953 des_int_ptr(n_outlen, outlen, 1);
1954 des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 2);
1955 des_int_ptr(n_inlen, inlen, 3);
1956 des_int(n_quoteChar, quoteChar, 4);
1957 xmlResetLastError();
1958 if (mem_base != xmlMemBlocks()) {
1959 printf("Leak of %d blocks found in htmlEncodeEntities",
1960 xmlMemBlocks() - mem_base);
1961 test_ret++;
1962 printf(" %d", n_out);
1963 printf(" %d", n_outlen);
1964 printf(" %d", n_in);
1965 printf(" %d", n_inlen);
1966 printf(" %d", n_quoteChar);
1967 printf("\n");
1968 }
1969 }
1970 }
1971 }
1972 }
1973 }
1974 function_tests++;
1975#endif
1976
1977 return(test_ret);
1978}
1979
1980
1981static int
1982test_htmlEntityLookup(void) {
1983 int test_ret = 0;
1984
1985#if defined(LIBXML_HTML_ENABLED)
1986 int mem_base;
1987 const htmlEntityDesc * ret_val;
1988 xmlChar * name; /* the entity name */
1989 int n_name;
1990
1991 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr5;n_name++) {
1992 mem_base = xmlMemBlocks();
1993 name = gen_const_xmlChar_ptr(n_name, 0);
1994
1995 ret_val = htmlEntityLookup((const xmlChar *)name);
1996 desret_const_htmlEntityDesc_ptr(ret_val);
1997 call_tests++;
1998 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
1999 xmlResetLastError();
2000 if (mem_base != xmlMemBlocks()) {
2001 printf("Leak of %d blocks found in htmlEntityLookup",
2002 xmlMemBlocks() - mem_base);
2003 test_ret++;
2004 printf(" %d", n_name);
2005 printf("\n");
2006 }
2007 }
2008 function_tests++;
2009#endif
2010
2011 return(test_ret);
2012}
2013
2014
2015static int
2016test_htmlEntityValueLookup(void) {
2017 int test_ret = 0;
2018
2019#if defined(LIBXML_HTML_ENABLED)
2020 int mem_base;
2021 const htmlEntityDesc * ret_val;
2022 unsigned int value; /* the entity's unicode value */
2023 int n_value;
2024
2025 for (n_value = 0;n_value < gen_nb_unsigned_int3;n_value++) {
2026 mem_base = xmlMemBlocks();
2027 value = gen_unsigned_int(n_value, 0);
2028
2029 ret_val = htmlEntityValueLookup(value);
2030 desret_const_htmlEntityDesc_ptr(ret_val);
2031 call_tests++;
2032 des_unsigned_int(n_value, value, 0);
2033 xmlResetLastError();
2034 if (mem_base != xmlMemBlocks()) {
2035 printf("Leak of %d blocks found in htmlEntityValueLookup",
2036 xmlMemBlocks() - mem_base);
2037 test_ret++;
2038 printf(" %d", n_value);
2039 printf("\n");
2040 }
2041 }
2042 function_tests++;
2043#endif
2044
2045 return(test_ret);
2046}
2047
2048
2049static int
2050test_htmlHandleOmittedElem(void) {
2051 int test_ret = 0;
2052
2053#if defined(LIBXML_HTML_ENABLED)
2054 int mem_base;
2055 int ret_val;
2056 int val; /* int 0 or 1 */
2057 int n_val;
2058
2059 for (n_val = 0;n_val < gen_nb_int4;n_val++) {
2060 mem_base = xmlMemBlocks();
2061 val = gen_int(n_val, 0);
2062
2063 ret_val = htmlHandleOmittedElem(val);
2064 desret_int(ret_val);
2065 call_tests++;
2066 des_int(n_val, val, 0);
2067 xmlResetLastError();
2068 if (mem_base != xmlMemBlocks()) {
2069 printf("Leak of %d blocks found in htmlHandleOmittedElem",
2070 xmlMemBlocks() - mem_base);
2071 test_ret++;
2072 printf(" %d", n_val);
2073 printf("\n");
2074 }
2075 }
2076 function_tests++;
2077#endif
2078
2079 return(test_ret);
2080}
2081
2082
2083static int
2084test_htmlIsAutoClosed(void) {
2085 int test_ret = 0;
2086
2087#if defined(LIBXML_HTML_ENABLED)
2088 int mem_base;
2089 int ret_val;
2090 htmlDocPtr doc; /* the HTML document */
2091 int n_doc;
2092 htmlNodePtr elem; /* the HTML element */
2093 int n_elem;
2094
2095 for (n_doc = 0;n_doc < gen_nb_htmlDocPtr3;n_doc++) {
2096 for (n_elem = 0;n_elem < gen_nb_htmlNodePtr1;n_elem++) {
2097 mem_base = xmlMemBlocks();
2098 doc = gen_htmlDocPtr(n_doc, 0);
2099 elem = gen_htmlNodePtr(n_elem, 1);
2100
2101 ret_val = htmlIsAutoClosed(doc, elem);
2102 desret_int(ret_val);
2103 call_tests++;
2104 des_htmlDocPtr(n_doc, doc, 0);
2105 des_htmlNodePtr(n_elem, elem, 1);
2106 xmlResetLastError();
2107 if (mem_base != xmlMemBlocks()) {
2108 printf("Leak of %d blocks found in htmlIsAutoClosed",
2109 xmlMemBlocks() - mem_base);
2110 test_ret++;
2111 printf(" %d", n_doc);
2112 printf(" %d", n_elem);
2113 printf("\n");
2114 }
2115 }
2116 }
2117 function_tests++;
2118#endif
2119
2120 return(test_ret);
2121}
2122
2123
2124static int
2125test_htmlIsScriptAttribute(void) {
2126 int test_ret = 0;
2127
2128#if defined(LIBXML_HTML_ENABLED)
2129 int mem_base;
2130 int ret_val;
2131 xmlChar * name; /* an attribute name */
2132 int n_name;
2133
2134 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr5;n_name++) {
2135 mem_base = xmlMemBlocks();
2136 name = gen_const_xmlChar_ptr(n_name, 0);
2137
2138 ret_val = htmlIsScriptAttribute((const xmlChar *)name);
2139 desret_int(ret_val);
2140 call_tests++;
2141 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
2142 xmlResetLastError();
2143 if (mem_base != xmlMemBlocks()) {
2144 printf("Leak of %d blocks found in htmlIsScriptAttribute",
2145 xmlMemBlocks() - mem_base);
2146 test_ret++;
2147 printf(" %d", n_name);
2148 printf("\n");
2149 }
2150 }
2151 function_tests++;
2152#endif
2153
2154 return(test_ret);
2155}
2156
2157
2158static int
2159test_htmlNewParserCtxt(void) {
2160 int test_ret = 0;
2161
2162#if defined(LIBXML_HTML_ENABLED)
2163 int mem_base;
2164 htmlParserCtxtPtr ret_val;
2165
2166 mem_base = xmlMemBlocks();
2167
2168 ret_val = htmlNewParserCtxt();
2169 desret_htmlParserCtxtPtr(ret_val);
2170 call_tests++;
2171 xmlResetLastError();
2172 if (mem_base != xmlMemBlocks()) {
2173 printf("Leak of %d blocks found in htmlNewParserCtxt",
2174 xmlMemBlocks() - mem_base);
2175 test_ret++;
2176 printf("\n");
2177 }
2178 function_tests++;
2179#endif
2180
2181 return(test_ret);
2182}
2183
2184
2185static int
2186test_htmlNodeStatus(void) {
2187 int test_ret = 0;
2188
2189#if defined(LIBXML_HTML_ENABLED)
2190 int mem_base;
2191 htmlStatus ret_val;
2192 htmlNodePtr node; /* an htmlNodePtr in a tree */
2193 int n_node;
2194 int legacy; /* whether to allow deprecated elements (YES is faster here for Element nodes) */
2195 int n_legacy;
2196
2197 for (n_node = 0;n_node < gen_nb_const_htmlNodePtr1;n_node++) {
2198 for (n_legacy = 0;n_legacy < gen_nb_int4;n_legacy++) {
2199 mem_base = xmlMemBlocks();
2200 node = gen_const_htmlNodePtr(n_node, 0);
2201 legacy = gen_int(n_legacy, 1);
2202
2203 ret_val = htmlNodeStatus((const htmlNodePtr)node, legacy);
2204 desret_htmlStatus(ret_val);
2205 call_tests++;
2206 des_const_htmlNodePtr(n_node, (const htmlNodePtr)node, 0);
2207 des_int(n_legacy, legacy, 1);
2208 xmlResetLastError();
2209 if (mem_base != xmlMemBlocks()) {
2210 printf("Leak of %d blocks found in htmlNodeStatus",
2211 xmlMemBlocks() - mem_base);
2212 test_ret++;
2213 printf(" %d", n_node);
2214 printf(" %d", n_legacy);
2215 printf("\n");
2216 }
2217 }
2218 }
2219 function_tests++;
2220#endif
2221
2222 return(test_ret);
2223}
2224
2225
2226static int
2227test_htmlParseCharRef(void) {
2228 int test_ret = 0;
2229
2230#if defined(LIBXML_HTML_ENABLED)
2231 int mem_base;
2232 int ret_val;
2233 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2234 int n_ctxt;
2235
2236 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr3;n_ctxt++) {
2237 mem_base = xmlMemBlocks();
2238 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
2239
2240 ret_val = htmlParseCharRef(ctxt);
2241 desret_int(ret_val);
2242 call_tests++;
2243 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
2244 xmlResetLastError();
2245 if (mem_base != xmlMemBlocks()) {
2246 printf("Leak of %d blocks found in htmlParseCharRef",
2247 xmlMemBlocks() - mem_base);
2248 test_ret++;
2249 printf(" %d", n_ctxt);
2250 printf("\n");
2251 }
2252 }
2253 function_tests++;
2254#endif
2255
2256 return(test_ret);
2257}
2258
2259
2260static int
2261test_htmlParseChunk(void) {
2262 int test_ret = 0;
2263
2264#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_PUSH_ENABLED)
2265 int mem_base;
2266 int ret_val;
2267 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2268 int n_ctxt;
2269 char * chunk; /* an char array */
2270 int n_chunk;
2271 int size; /* the size in byte of the chunk */
2272 int n_size;
2273 int terminate; /* last chunk indicator */
2274 int n_terminate;
2275
2276 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr3;n_ctxt++) {
2277 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr4;n_chunk++) {
2278 for (n_size = 0;n_size < gen_nb_int4;n_size++) {
2279 for (n_terminate = 0;n_terminate < gen_nb_int4;n_terminate++) {
2280 mem_base = xmlMemBlocks();
2281 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
2282 chunk = gen_const_char_ptr(n_chunk, 1);
2283 size = gen_int(n_size, 2);
2284 terminate = gen_int(n_terminate, 3);
2285
2286 ret_val = htmlParseChunk(ctxt, (const char *)chunk, size, terminate);
2287 if (ctxt != NULL((void*)0)) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL((void*)0);}
2288 desret_int(ret_val);
2289 call_tests++;
2290 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
2291 des_const_char_ptr(n_chunk, (const char *)chunk, 1);
2292 des_int(n_size, size, 2);
2293 des_int(n_terminate, terminate, 3);
2294 xmlResetLastError();
2295 if (mem_base != xmlMemBlocks()) {
2296 printf("Leak of %d blocks found in htmlParseChunk",
2297 xmlMemBlocks() - mem_base);
2298 test_ret++;
2299 printf(" %d", n_ctxt);
2300 printf(" %d", n_chunk);
2301 printf(" %d", n_size);
2302 printf(" %d", n_terminate);
2303 printf("\n");
2304 }
2305 }
2306 }
2307 }
2308 }
2309 function_tests++;
2310#endif
2311
2312 return(test_ret);
2313}
2314
2315
2316static int
2317test_htmlParseDoc(void) {
2318 int test_ret = 0;
2319
2320#if defined(LIBXML_HTML_ENABLED)
2321 int mem_base;
2322 htmlDocPtr ret_val;
2323 xmlChar * cur; /* a pointer to an array of xmlChar */
2324 int n_cur;
2325 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
2326 int n_encoding;
2327
2328 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr2;n_cur++) {
2329 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr4;n_encoding++) {
2330 mem_base = xmlMemBlocks();
2331 cur = gen_xmlChar_ptr(n_cur, 0);
2332 encoding = gen_const_char_ptr(n_encoding, 1);
2333
2334 ret_val = htmlParseDoc(cur, (const char *)encoding);
2335 desret_htmlDocPtr(ret_val);
2336 call_tests++;
2337 des_xmlChar_ptr(n_cur, cur, 0);
2338 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
2339 xmlResetLastError();
2340 if (mem_base != xmlMemBlocks()) {
2341 printf("Leak of %d blocks found in htmlParseDoc",
2342 xmlMemBlocks() - mem_base);
2343 test_ret++;
2344 printf(" %d", n_cur);
2345 printf(" %d", n_encoding);
2346 printf("\n");
2347 }
2348 }
2349 }
2350 function_tests++;
2351#endif
2352
2353 return(test_ret);
2354}
2355
2356
2357static int
2358test_htmlParseDocument(void) {
2359 int test_ret = 0;
2360
2361#if defined(LIBXML_HTML_ENABLED)
2362 int mem_base;
2363 int ret_val;
2364 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2365 int n_ctxt;
2366
2367 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr3;n_ctxt++) {
2368 mem_base = xmlMemBlocks();
2369 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
2370
2371 ret_val = htmlParseDocument(ctxt);
2372 if (ctxt != NULL((void*)0)) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL((void*)0);}
2373 desret_int(ret_val);
2374 call_tests++;
2375 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
2376 xmlResetLastError();
2377 if (mem_base != xmlMemBlocks()) {
2378 printf("Leak of %d blocks found in htmlParseDocument",
2379 xmlMemBlocks() - mem_base);
2380 test_ret++;
2381 printf(" %d", n_ctxt);
2382 printf("\n");
2383 }
2384 }
2385 function_tests++;
2386#endif
2387
2388 return(test_ret);
2389}
2390
2391
2392static int
2393test_htmlParseElement(void) {
2394 int test_ret = 0;
2395
2396#if defined(LIBXML_HTML_ENABLED)
2397 int mem_base;
2398 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2399 int n_ctxt;
2400
2401 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr3;n_ctxt++) {
2402 mem_base = xmlMemBlocks();
2403 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
2404
2405 htmlParseElement(ctxt);
2406 call_tests++;
2407 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
2408 xmlResetLastError();
2409 if (mem_base != xmlMemBlocks()) {
2410 printf("Leak of %d blocks found in htmlParseElement",
2411 xmlMemBlocks() - mem_base);
2412 test_ret++;
2413 printf(" %d", n_ctxt);
2414 printf("\n");
2415 }
2416 }
2417 function_tests++;
2418#endif
2419
2420 return(test_ret);
2421}
2422
2423
2424static int
2425test_htmlParseEntityRef(void) {
2426 int test_ret = 0;
2427
2428#if defined(LIBXML_HTML_ENABLED)
2429 int mem_base;
2430 const htmlEntityDesc * ret_val;
2431 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2432 int n_ctxt;
2433 xmlChar ** str; /* location to store the entity name */
2434 int n_str;
2435
2436 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr3;n_ctxt++) {
2437 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr_ptr1;n_str++) {
2438 mem_base = xmlMemBlocks();
2439 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
2440 str = gen_const_xmlChar_ptr_ptr(n_str, 1);
2441
2442 ret_val = htmlParseEntityRef(ctxt, (const xmlChar **)str);
2443 desret_const_htmlEntityDesc_ptr(ret_val);
2444 call_tests++;
2445 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
2446 des_const_xmlChar_ptr_ptr(n_str, (const xmlChar **)str, 1);
2447 xmlResetLastError();
2448 if (mem_base != xmlMemBlocks()) {
2449 printf("Leak of %d blocks found in htmlParseEntityRef",
2450 xmlMemBlocks() - mem_base);
2451 test_ret++;
2452 printf(" %d", n_ctxt);
2453 printf(" %d", n_str);
2454 printf("\n");
2455 }
2456 }
2457 }
2458 function_tests++;
2459#endif
2460
2461 return(test_ret);
2462}
2463
2464
2465static int
2466test_htmlParseFile(void) {
2467 int test_ret = 0;
2468
2469#if defined(LIBXML_HTML_ENABLED)
2470 htmlDocPtr ret_val;
2471 const char * filename; /* the filename */
2472 int n_filename;
2473 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
2474 int n_encoding;
2475
2476 for (n_filename = 0;n_filename < gen_nb_filepath8;n_filename++) {
2477 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr4;n_encoding++) {
2478 filename = gen_filepath(n_filename, 0);
2479 encoding = gen_const_char_ptr(n_encoding, 1);
2480
2481 ret_val = htmlParseFile(filename, (const char *)encoding);
2482 desret_htmlDocPtr(ret_val);
2483 call_tests++;
2484 des_filepath(n_filename, filename, 0);
2485 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
2486 xmlResetLastError();
2487 }
2488 }
2489 function_tests++;
2490#endif
2491
2492 return(test_ret);
2493}
2494
2495
2496static int
2497test_htmlReadDoc(void) {
2498 int test_ret = 0;
2499
2500#if defined(LIBXML_HTML_ENABLED)
2501 int mem_base;
2502 htmlDocPtr ret_val;
2503 xmlChar * cur; /* a pointer to a zero terminated string */
2504 int n_cur;
2505 const char * URL; /* the base URL to use for the document */
2506 int n_URL;
2507 char * encoding; /* the document encoding, or NULL */
2508 int n_encoding;
2509 int options; /* a combination of htmlParserOption(s) */
2510 int n_options;
2511
2512 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr5;n_cur++) {
2513 for (n_URL = 0;n_URL < gen_nb_filepath8;n_URL++) {
2514 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr4;n_encoding++) {
2515 for (n_options = 0;n_options < gen_nb_int4;n_options++) {
2516 mem_base = xmlMemBlocks();
2517 cur = gen_const_xmlChar_ptr(n_cur, 0);
2518 URL = gen_filepath(n_URL, 1);
2519 encoding = gen_const_char_ptr(n_encoding, 2);
2520 options = gen_int(n_options, 3);
2521
2522 ret_val = htmlReadDoc((const xmlChar *)cur, URL, (const char *)encoding, options);
2523 desret_htmlDocPtr(ret_val);
2524 call_tests++;
2525 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
2526 des_filepath(n_URL, URL, 1);
2527 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
2528 des_int(n_options, options, 3);
2529 xmlResetLastError();
2530 if (mem_base != xmlMemBlocks()) {
2531 printf("Leak of %d blocks found in htmlReadDoc",
2532 xmlMemBlocks() - mem_base);
2533 test_ret++;
2534 printf(" %d", n_cur);
2535 printf(" %d", n_URL);
2536 printf(" %d", n_encoding);
2537 printf(" %d", n_options);
2538 printf("\n");
2539 }
2540 }
2541 }
2542 }
2543 }
2544 function_tests++;
2545#endif
2546
2547 return(test_ret);
2548}
2549
2550
2551static int
2552test_htmlReadFile(void) {
2553 int test_ret = 0;
2554
2555#if defined(LIBXML_HTML_ENABLED)
2556 int mem_base;
2557 htmlDocPtr ret_val;
2558 const char * filename; /* a file or URL */
2559 int n_filename;
2560 char * encoding; /* the document encoding, or NULL */
2561 int n_encoding;
2562 int options; /* a combination of htmlParserOption(s) */
2563 int n_options;
2564
2565 for (n_filename = 0;n_filename < gen_nb_filepath8;n_filename++) {
2566 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr4;n_encoding++) {
2567 for (n_options = 0;n_options < gen_nb_int4;n_options++) {
2568 mem_base = xmlMemBlocks();
2569 filename = gen_filepath(n_filename, 0);
2570 encoding = gen_const_char_ptr(n_encoding, 1);
2571 options = gen_int(n_options, 2);
2572
2573 ret_val = htmlReadFile(filename, (const char *)encoding, options);
2574 desret_htmlDocPtr(ret_val);
2575 call_tests++;
2576 des_filepath(n_filename, filename, 0);
2577 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
2578 des_int(n_options, options, 2);
2579 xmlResetLastError();
2580 if (mem_base != xmlMemBlocks()) {
2581 printf("Leak of %d blocks found in htmlReadFile",
2582 xmlMemBlocks() - mem_base);
2583 test_ret++;
2584 printf(" %d", n_filename);
2585 printf(" %d", n_encoding);
2586 printf(" %d", n_options);
2587 printf("\n");
2588 }
2589 }
2590 }
2591 }
2592 function_tests++;
2593#endif
2594
2595 return(test_ret);
2596}
2597
2598
2599static int
2600test_htmlReadMemory(void) {
2601 int test_ret = 0;
2602
2603#if defined(LIBXML_HTML_ENABLED)
2604 int mem_base;
2605 htmlDocPtr ret_val;
2606 char * buffer; /* a pointer to a char array */
2607 int n_buffer;
2608 int size; /* the size of the array */
2609 int n_size;
2610 const char * URL; /* the base URL to use for the document */
2611 int n_URL;
2612 char * encoding; /* the document encoding, or NULL */
2613 int n_encoding;
2614 int options; /* a combination of htmlParserOption(s) */
2615 int n_options;
2616
2617 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr4;n_buffer++) {
2618 for (n_size = 0;n_size < gen_nb_int4;n_size++) {
2619 for (n_URL = 0;n_URL < gen_nb_filepath8;n_URL++) {
2620 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr4;n_encoding++) {
2621 for (n_options = 0;n_options < gen_nb_int4;n_options++) {
2622 mem_base = xmlMemBlocks();
2623 buffer = gen_const_char_ptr(n_buffer, 0);
2624 size = gen_int(n_size, 1);
2625 URL = gen_filepath(n_URL, 2);
2626 encoding = gen_const_char_ptr(n_encoding, 3);
2627 options = gen_int(n_options, 4);
2628
2629 ret_val = htmlReadMemory((const char *)buffer, size, URL, (const char *)encoding, options);
2630 desret_htmlDocPtr(ret_val);
2631 call_tests++;
2632 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
2633 des_int(n_size, size, 1);
2634 des_filepath(n_URL, URL, 2);
2635 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
2636 des_int(n_options, options, 4);
2637 xmlResetLastError();
2638 if (mem_base != xmlMemBlocks()) {
2639 printf("Leak of %d blocks found in htmlReadMemory",
2640 xmlMemBlocks() - mem_base);
2641 test_ret++;
2642 printf(" %d", n_buffer);
2643 printf(" %d", n_size);
2644 printf(" %d", n_URL);
2645 printf(" %d", n_encoding);
2646 printf(" %d", n_options);
2647 printf("\n");
2648 }
2649 }
2650 }
2651 }
2652 }
2653 }
2654 function_tests++;
2655#endif
2656
2657 return(test_ret);
2658}
2659
2660
2661static int
2662test_htmlSAXParseDoc(void) {
2663 int test_ret = 0;
2664
2665#if defined(LIBXML_HTML_ENABLED)
2666 int mem_base;
2667 htmlDocPtr ret_val;
2668 xmlChar * cur; /* a pointer to an array of xmlChar */
2669 int n_cur;
2670 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
2671 int n_encoding;
2672 htmlSAXHandlerPtr sax; /* the SAX handler block */
2673 int n_sax;
2674 void * userData; /* if using SAX, this pointer will be provided on callbacks. */
2675 int n_userData;
2676
2677 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr2;n_cur++) {
2678 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr4;n_encoding++) {
2679 for (n_sax = 0;n_sax < gen_nb_htmlSAXHandlerPtr1;n_sax++) {
2680 for (n_userData = 0;n_userData < gen_nb_userdata3;n_userData++) {
2681 mem_base = xmlMemBlocks();
2682 cur = gen_xmlChar_ptr(n_cur, 0);
2683 encoding = gen_const_char_ptr(n_encoding, 1);
2684 sax = gen_htmlSAXHandlerPtr(n_sax, 2);
2685 userData = gen_userdata(n_userData, 3);
2686
2687 ret_val = htmlSAXParseDoc(cur, (const char *)encoding, sax, userData);
2688 desret_htmlDocPtr(ret_val);
2689 call_tests++;
2690 des_xmlChar_ptr(n_cur, cur, 0);
2691 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
2692 des_htmlSAXHandlerPtr(n_sax, sax, 2);
2693 des_userdata(n_userData, userData, 3);
2694 xmlResetLastError();
2695 if (mem_base != xmlMemBlocks()) {
2696 printf("Leak of %d blocks found in htmlSAXParseDoc",
2697 xmlMemBlocks() - mem_base);
2698 test_ret++;
2699 printf(" %d", n_cur);
2700 printf(" %d", n_encoding);
2701 printf(" %d", n_sax);
2702 printf(" %d", n_userData);
2703 printf("\n");
2704 }
2705 }
2706 }
2707 }
2708 }
2709 function_tests++;
2710#endif
2711
2712 return(test_ret);
2713}
2714
2715
2716static int
2717test_htmlSAXParseFile(void) {
2718 int test_ret = 0;
2719
2720#if defined(LIBXML_HTML_ENABLED)
2721 int mem_base;
2722 htmlDocPtr ret_val;
2723 const char * filename; /* the filename */
2724 int n_filename;
2725 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
2726 int n_encoding;
2727 htmlSAXHandlerPtr sax; /* the SAX handler block */
2728 int n_sax;
2729 void * userData; /* if using SAX, this pointer will be provided on callbacks. */
2730 int n_userData;
2731
2732 for (n_filename = 0;n_filename < gen_nb_filepath8;n_filename++) {
2733 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr4;n_encoding++) {
2734 for (n_sax = 0;n_sax < gen_nb_htmlSAXHandlerPtr1;n_sax++) {
2735 for (n_userData = 0;n_userData < gen_nb_userdata3;n_userData++) {
2736 mem_base = xmlMemBlocks();
2737 filename = gen_filepath(n_filename, 0);
2738 encoding = gen_const_char_ptr(n_encoding, 1);
2739 sax = gen_htmlSAXHandlerPtr(n_sax, 2);
2740 userData = gen_userdata(n_userData, 3);
2741
2742 ret_val = htmlSAXParseFile(filename, (const char *)encoding, sax, userData);
2743 desret_htmlDocPtr(ret_val);
2744 call_tests++;
2745 des_filepath(n_filename, filename, 0);
2746 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
2747 des_htmlSAXHandlerPtr(n_sax, sax, 2);
2748 des_userdata(n_userData, userData, 3);
2749 xmlResetLastError();
2750 if (mem_base != xmlMemBlocks()) {
2751 printf("Leak of %d blocks found in htmlSAXParseFile",
2752 xmlMemBlocks() - mem_base);
2753 test_ret++;
2754 printf(" %d", n_filename);
2755 printf(" %d", n_encoding);
2756 printf(" %d", n_sax);
2757 printf(" %d", n_userData);
2758 printf("\n");
2759 }
2760 }
2761 }
2762 }
2763 }
2764 function_tests++;
2765#endif
2766
2767 return(test_ret);
2768}
2769
2770
2771static int
2772test_htmlTagLookup(void) {
2773 int test_ret = 0;
2774
2775
2776 /* missing type support */
2777 return(test_ret);
2778}
2779
2780static int
2781test_HTMLparser(void) {
2782 int test_ret = 0;
2783
2784 if (quiet == 0) printf("Testing HTMLparser : 32 of 38 functions ...\n");
2785 test_ret += test_UTF8ToHtml();
2786 test_ret += test_htmlAttrAllowed();
2787 test_ret += test_htmlAutoCloseTag();
2788 test_ret += test_htmlCreateMemoryParserCtxt();
2789 test_ret += test_htmlCreatePushParserCtxt();
2790 test_ret += test_htmlCtxtReadDoc();
2791 test_ret += test_htmlCtxtReadFile();
2792 test_ret += test_htmlCtxtReadMemory();
2793 test_ret += test_htmlCtxtReset();
2794 test_ret += test_htmlCtxtUseOptions();
2795 test_ret += test_htmlElementAllowedHere();
2796 test_ret += test_htmlElementStatusHere();
2797 test_ret += test_htmlEncodeEntities();
2798 test_ret += test_htmlEntityLookup();
2799 test_ret += test_htmlEntityValueLookup();
2800 test_ret += test_htmlHandleOmittedElem();
2801 test_ret += test_htmlIsAutoClosed();
2802 test_ret += test_htmlIsScriptAttribute();
2803 test_ret += test_htmlNewParserCtxt();
2804 test_ret += test_htmlNodeStatus();
2805 test_ret += test_htmlParseCharRef();
2806 test_ret += test_htmlParseChunk();
2807 test_ret += test_htmlParseDoc();
2808 test_ret += test_htmlParseDocument();
2809 test_ret += test_htmlParseElement();
2810 test_ret += test_htmlParseEntityRef();
2811 test_ret += test_htmlParseFile();
2812 test_ret += test_htmlReadDoc();
2813 test_ret += test_htmlReadFile();
2814 test_ret += test_htmlReadMemory();
2815 test_ret += test_htmlSAXParseDoc();
2816 test_ret += test_htmlSAXParseFile();
2817 test_ret += test_htmlTagLookup();
2818
2819 if (test_ret != 0)
2820 printf("Module HTMLparser: %d errors\n", test_ret);
2821 return(test_ret);
2822}
2823
2824static int
2825test_htmlDocContentDumpFormatOutput(void) {
2826 int test_ret = 0;
2827
2828#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
2829 int mem_base;
2830 xmlOutputBufferPtr buf; /* the HTML buffer output */
2831 int n_buf;
2832 xmlDocPtr cur; /* the document */
2833 int n_cur;
2834 char * encoding; /* the encoding string */
2835 int n_encoding;
2836 int format; /* should formatting spaces been added */
2837 int n_format;
2838
2839 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr2;n_buf++) {
2840 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr4;n_cur++) {
2841 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr4;n_encoding++) {
2842 for (n_format = 0;n_format < gen_nb_int4;n_format++) {
2843 mem_base = xmlMemBlocks();
2844 buf = gen_xmlOutputBufferPtr(n_buf, 0);
2845 cur = gen_xmlDocPtr(n_cur, 1);
2846 encoding = gen_const_char_ptr(n_encoding, 2);
2847 format = gen_int(n_format, 3);
2848
2849 htmlDocContentDumpFormatOutput(buf, cur, (const char *)encoding, format);
2850 call_tests++;
2851 des_xmlOutputBufferPtr(n_buf, buf, 0);
2852 des_xmlDocPtr(n_cur, cur, 1);
2853 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
2854 des_int(n_format, format, 3);
2855 xmlResetLastError();
2856 if (mem_base != xmlMemBlocks()) {
2857 printf("Leak of %d blocks found in htmlDocContentDumpFormatOutput",
2858 xmlMemBlocks() - mem_base);
2859 test_ret++;
2860 printf(" %d", n_buf);
2861 printf(" %d", n_cur);
2862 printf(" %d", n_encoding);
2863 printf(" %d", n_format);
2864 printf("\n");
2865 }
2866 }
2867 }
2868 }
2869 }
2870 function_tests++;
2871#endif
2872
2873 return(test_ret);
2874}
2875
2876
2877static int
2878test_htmlDocContentDumpOutput(void) {
2879 int test_ret = 0;
2880
2881#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
2882 int mem_base;
2883 xmlOutputBufferPtr buf; /* the HTML buffer output */
2884 int n_buf;
2885 xmlDocPtr cur; /* the document */
2886 int n_cur;
2887 char * encoding; /* the encoding string */
2888 int n_encoding;
2889
2890 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr2;n_buf++) {
2891 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr4;n_cur++) {
2892 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr4;n_encoding++) {
2893 mem_base = xmlMemBlocks();
2894 buf = gen_xmlOutputBufferPtr(n_buf, 0);
2895 cur = gen_xmlDocPtr(n_cur, 1);
2896 encoding = gen_const_char_ptr(n_encoding, 2);
2897
2898 htmlDocContentDumpOutput(buf, cur, (const char *)encoding);
2899 call_tests++;
2900 des_xmlOutputBufferPtr(n_buf, buf, 0);
2901 des_xmlDocPtr(n_cur, cur, 1);
2902 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
2903 xmlResetLastError();
2904 if (mem_base != xmlMemBlocks()) {
2905 printf("Leak of %d blocks found in htmlDocContentDumpOutput",
2906 xmlMemBlocks() - mem_base);
2907 test_ret++;
2908 printf(" %d", n_buf);
2909 printf(" %d", n_cur);
2910 printf(" %d", n_encoding);
2911 printf("\n");
2912 }
2913 }
2914 }
2915 }
2916 function_tests++;
2917#endif
2918
2919 return(test_ret);
2920}
2921
2922
2923static int
2924test_htmlDocDump(void) {
2925 int test_ret = 0;
2926
2927#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
2928 int mem_base;
2929 int ret_val;
2930 FILE * f; /* the FILE* */
2931 int n_f;
2932 xmlDocPtr cur; /* the document */
2933 int n_cur;
2934
2935 for (n_f = 0;n_f < gen_nb_FILE_ptr2;n_f++) {
2936 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr4;n_cur++) {
2937 mem_base = xmlMemBlocks();
2938 f = gen_FILE_ptr(n_f, 0);
2939 cur = gen_xmlDocPtr(n_cur, 1);
2940
2941 ret_val = htmlDocDump(f, cur);
2942 desret_int(ret_val);
2943 call_tests++;
2944 des_FILE_ptr(n_f, f, 0);
2945 des_xmlDocPtr(n_cur, cur, 1);
2946 xmlResetLastError();
2947 if (mem_base != xmlMemBlocks()) {
2948 printf("Leak of %d blocks found in htmlDocDump",
2949 xmlMemBlocks() - mem_base);
2950 test_ret++;
2951 printf(" %d", n_f);
2952 printf(" %d", n_cur);
2953 printf("\n");
2954 }
2955 }
2956 }
2957 function_tests++;
2958#endif
2959
2960 return(test_ret);
2961}
2962
2963
2964#define gen_nb_xmlChar_ptr_ptr1 1
2965static xmlChar ** gen_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED__attribute__((unused)), int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
2966 return(NULL((void*)0));
2967}
2968static void des_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED__attribute__((unused)), xmlChar ** val ATTRIBUTE_UNUSED__attribute__((unused)), int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
2969}
2970
2971static int
2972test_htmlDocDumpMemory(void) {
2973 int test_ret = 0;
2974
2975#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
2976 int mem_base;
2977 xmlDocPtr cur; /* the document */
2978 int n_cur;
2979 xmlChar ** mem; /* OUT: the memory pointer */
2980 int n_mem;
2981 int * size; /* OUT: the memory length */
2982 int n_size;
2983
2984 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr4;n_cur++) {
2985 for (n_mem = 0;n_mem < gen_nb_xmlChar_ptr_ptr1;n_mem++) {
2986 for (n_size = 0;n_size < gen_nb_int_ptr2;n_size++) {
2987 mem_base = xmlMemBlocks();
2988 cur = gen_xmlDocPtr(n_cur, 0);
2989 mem = gen_xmlChar_ptr_ptr(n_mem, 1);
2990 size = gen_int_ptr(n_size, 2);
2991
2992 htmlDocDumpMemory(cur, mem, size);
2993 call_tests++;
2994 des_xmlDocPtr(n_cur, cur, 0);
2995 des_xmlChar_ptr_ptr(n_mem, mem, 1);
2996 des_int_ptr(n_size, size, 2);
2997 xmlResetLastError();
2998 if (mem_base != xmlMemBlocks()) {
2999 printf("Leak of %d blocks found in htmlDocDumpMemory",
3000 xmlMemBlocks() - mem_base);
3001 test_ret++;
3002 printf(" %d", n_cur);
3003 printf(" %d", n_mem);
3004 printf(" %d", n_size);
3005 printf("\n");
3006 }
3007 }
3008 }
3009 }
3010 function_tests++;
3011#endif
3012
3013 return(test_ret);
3014}
3015
3016
3017static int
3018test_htmlDocDumpMemoryFormat(void) {
3019 int test_ret = 0;
3020
3021#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
3022 int mem_base;
3023 xmlDocPtr cur; /* the document */
3024 int n_cur;
3025 xmlChar ** mem; /* OUT: the memory pointer */
3026 int n_mem;
3027 int * size; /* OUT: the memory length */
3028 int n_size;
3029 int format; /* should formatting spaces been added */
3030 int n_format;
3031
3032 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr4;n_cur++) {
3033 for (n_mem = 0;n_mem < gen_nb_xmlChar_ptr_ptr1;n_mem++) {
3034 for (n_size = 0;n_size < gen_nb_int_ptr2;n_size++) {
3035 for (n_format = 0;n_format < gen_nb_int4;n_format++) {
3036 mem_base = xmlMemBlocks();
3037 cur = gen_xmlDocPtr(n_cur, 0);
3038 mem = gen_xmlChar_ptr_ptr(n_mem, 1);
3039 size = gen_int_ptr(n_size, 2);
3040 format = gen_int(n_format, 3);
3041
3042 htmlDocDumpMemoryFormat(cur, mem, size, format);
3043 call_tests++;
3044 des_xmlDocPtr(n_cur, cur, 0);
3045 des_xmlChar_ptr_ptr(n_mem, mem, 1);
3046 des_int_ptr(n_size, size, 2);
3047 des_int(n_format, format, 3);
3048 xmlResetLastError();
3049 if (mem_base != xmlMemBlocks()) {
3050 printf("Leak of %d blocks found in htmlDocDumpMemoryFormat",
3051 xmlMemBlocks() - mem_base);
3052 test_ret++;
3053 printf(" %d", n_cur);
3054 printf(" %d", n_mem);
3055 printf(" %d", n_size);
3056 printf(" %d", n_format);
3057 printf("\n");
3058 }
3059 }
3060 }
3061 }
3062 }
3063 function_tests++;
3064#endif
3065
3066 return(test_ret);
3067}
3068
3069
3070static int
3071test_htmlGetMetaEncoding(void) {
3072 int test_ret = 0;
3073
3074#if defined(LIBXML_HTML_ENABLED)
3075 int mem_base;
3076 const xmlChar * ret_val;
3077 htmlDocPtr doc; /* the document */
3078 int n_doc;
3079
3080 for (n_doc = 0;n_doc < gen_nb_htmlDocPtr3;n_doc++) {
3081 mem_base = xmlMemBlocks();
3082 doc = gen_htmlDocPtr(n_doc, 0);
3083
3084 ret_val = htmlGetMetaEncoding(doc);
3085 desret_const_xmlChar_ptr(ret_val);
3086 call_tests++;
3087 des_htmlDocPtr(n_doc, doc, 0);
3088 xmlResetLastError();
3089 if (mem_base != xmlMemBlocks()) {
3090 printf("Leak of %d blocks found in htmlGetMetaEncoding",
3091 xmlMemBlocks() - mem_base);
3092 test_ret++;
3093 printf(" %d", n_doc);
3094 printf("\n");
3095 }
3096 }
3097 function_tests++;
3098#endif
3099
3100 return(test_ret);
3101}
3102
3103
3104static int
3105test_htmlIsBooleanAttr(void) {
3106 int test_ret = 0;
3107
3108#if defined(LIBXML_HTML_ENABLED)
3109 int mem_base;
3110 int ret_val;
3111 xmlChar * name; /* the name of the attribute to check */
3112 int n_name;
3113
3114 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr5;n_name++) {
3115 mem_base = xmlMemBlocks();
3116 name = gen_const_xmlChar_ptr(n_name, 0);
3117
3118 ret_val = htmlIsBooleanAttr((const xmlChar *)name);
3119 desret_int(ret_val);
3120 call_tests++;
3121 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
3122 xmlResetLastError();
3123 if (mem_base != xmlMemBlocks()) {
3124 printf("Leak of %d blocks found in htmlIsBooleanAttr",
3125 xmlMemBlocks() - mem_base);
3126 test_ret++;
3127 printf(" %d", n_name);
3128 printf("\n");
3129 }
3130 }
3131 function_tests++;
3132#endif
3133
3134 return(test_ret);
3135}
3136
3137
3138static int
3139test_htmlNewDoc(void) {
3140 int test_ret = 0;
3141
3142#if defined(LIBXML_HTML_ENABLED)
3143 int mem_base;
3144 htmlDocPtr ret_val;
3145 xmlChar * URI; /* URI for the dtd, or NULL */
3146 int n_URI;
3147 xmlChar * ExternalID; /* the external ID of the DTD, or NULL */
3148 int n_ExternalID;
3149
3150 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr5;n_URI++) {
3151 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr5;n_ExternalID++) {
3152 mem_base = xmlMemBlocks();
3153 URI = gen_const_xmlChar_ptr(n_URI, 0);
3154 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 1);
3155
3156 ret_val = htmlNewDoc((const xmlChar *)URI, (const xmlChar *)ExternalID);
3157 desret_htmlDocPtr(ret_val);
3158 call_tests++;
3159 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0);
3160 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 1);
3161 xmlResetLastError();
3162 if (mem_base != xmlMemBlocks()) {
3163 printf("Leak of %d blocks found in htmlNewDoc",
3164 xmlMemBlocks() - mem_base);
3165 test_ret++;
3166 printf(" %d", n_URI);
3167 printf(" %d", n_ExternalID);
3168 printf("\n");
3169 }
3170 }
3171 }
3172 function_tests++;
3173#endif
3174
3175 return(test_ret);
3176}
3177
3178
3179static int
3180test_htmlNewDocNoDtD(void) {
3181 int test_ret = 0;
3182
3183#if defined(LIBXML_HTML_ENABLED)
3184 int mem_base;
3185 htmlDocPtr ret_val;
3186 xmlChar * URI; /* URI for the dtd, or NULL */
3187 int n_URI;
3188 xmlChar * ExternalID; /* the external ID of the DTD, or NULL */
3189 int n_ExternalID;
3190
3191 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr5;n_URI++) {
3192 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr5;n_ExternalID++) {
3193 mem_base = xmlMemBlocks();
3194 URI = gen_const_xmlChar_ptr(n_URI, 0);
3195 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 1);
3196
3197 ret_val = htmlNewDocNoDtD((const xmlChar *)URI, (const xmlChar *)ExternalID);
3198 desret_htmlDocPtr(ret_val);
3199 call_tests++;
3200 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0);
3201 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 1);
3202 xmlResetLastError();
3203 if (mem_base != xmlMemBlocks()) {
3204 printf("Leak of %d blocks found in htmlNewDocNoDtD",
3205 xmlMemBlocks() - mem_base);
3206 test_ret++;
3207 printf(" %d", n_URI);
3208 printf(" %d", n_ExternalID);
3209 printf("\n");
3210 }
3211 }
3212 }
3213 function_tests++;
3214#endif
3215
3216 return(test_ret);
3217}
3218
3219
3220static int
3221test_htmlNodeDump(void) {
3222 int test_ret = 0;
3223
3224#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
3225 int mem_base;
3226 int ret_val;
3227 xmlBufferPtr buf; /* the HTML buffer output */
3228 int n_buf;
3229 xmlDocPtr doc; /* the document */
3230 int n_doc;
3231 xmlNodePtr cur; /* the current node */
3232 int n_cur;
3233
3234 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr3;n_buf++) {
3235 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr4;n_doc++) {
3236 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr3;n_cur++) {
3237 mem_base = xmlMemBlocks();
3238 buf = gen_xmlBufferPtr(n_buf, 0);
3239 doc = gen_xmlDocPtr(n_doc, 1);
3240 cur = gen_xmlNodePtr(n_cur, 2);
3241
3242 ret_val = htmlNodeDump(buf, doc, cur);
3243 desret_int(ret_val);
3244 call_tests++;
3245 des_xmlBufferPtr(n_buf, buf, 0);
3246 des_xmlDocPtr(n_doc, doc, 1);
3247 des_xmlNodePtr(n_cur, cur, 2);
3248 xmlResetLastError();
3249 if (mem_base != xmlMemBlocks()) {
3250 printf("Leak of %d blocks found in htmlNodeDump",
3251 xmlMemBlocks() - mem_base);
3252 test_ret++;
3253 printf(" %d", n_buf);
3254 printf(" %d", n_doc);
3255 printf(" %d", n_cur);
3256 printf("\n");
3257 }
3258 }
3259 }
3260 }
3261 function_tests++;
3262#endif
3263
3264 return(test_ret);
3265}
3266
3267
3268static int
3269test_htmlNodeDumpFile(void) {
3270 int test_ret = 0;
3271
3272#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
3273 int mem_base;
3274 FILE * out; /* the FILE pointer */
3275 int n_out;
3276 xmlDocPtr doc; /* the document */
3277 int n_doc;
3278 xmlNodePtr cur; /* the current node */
3279 int n_cur;
3280
3281 for (n_out = 0;n_out < gen_nb_FILE_ptr2;n_out++) {
3282 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr4;n_doc++) {
3283 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr3;n_cur++) {
3284 mem_base = xmlMemBlocks();
3285 out = gen_FILE_ptr(n_out, 0);
3286 doc = gen_xmlDocPtr(n_doc, 1);
3287 cur = gen_xmlNodePtr(n_cur, 2);
3288
3289 htmlNodeDumpFile(out, doc, cur);
3290 call_tests++;
3291 des_FILE_ptr(n_out, out, 0);
3292 des_xmlDocPtr(n_doc, doc, 1);
3293 des_xmlNodePtr(n_cur, cur, 2);
3294 xmlResetLastError();
3295 if (mem_base != xmlMemBlocks()) {
3296 printf("Leak of %d blocks found in htmlNodeDumpFile",
3297 xmlMemBlocks() - mem_base);
3298 test_ret++;
3299 printf(" %d", n_out);
3300 printf(" %d", n_doc);
3301 printf(" %d", n_cur);
3302 printf("\n");
3303 }
3304 }
3305 }
3306 }
3307 function_tests++;
3308#endif
3309
3310 return(test_ret);
3311}
3312
3313
3314static int
3315test_htmlNodeDumpFileFormat(void) {
3316 int test_ret = 0;
3317
3318#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
3319 int mem_base;
3320 int ret_val;
3321 FILE * out; /* the FILE pointer */
3322 int n_out;
3323 xmlDocPtr doc; /* the document */
3324 int n_doc;
3325 xmlNodePtr cur; /* the current node */
3326 int n_cur;
3327 char * encoding; /* the document encoding */
3328 int n_encoding;
3329 int format; /* should formatting spaces been added */
3330 int n_format;
3331
3332 for (n_out = 0;n_out < gen_nb_FILE_ptr2;n_out++) {
3333 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr4;n_doc++) {
3334 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr3;n_cur++) {
3335 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr4;n_encoding++) {
3336 for (n_format = 0;n_format < gen_nb_int4;n_format++) {
3337 mem_base = xmlMemBlocks();
3338 out = gen_FILE_ptr(n_out, 0);
3339 doc = gen_xmlDocPtr(n_doc, 1);
3340 cur = gen_xmlNodePtr(n_cur, 2);
3341 encoding = gen_const_char_ptr(n_encoding, 3);
3342 format = gen_int(n_format, 4);
3343
3344 ret_val = htmlNodeDumpFileFormat(out, doc, cur, (const char *)encoding, format);
3345 desret_int(ret_val);
3346 call_tests++;
3347 des_FILE_ptr(n_out, out, 0);
3348 des_xmlDocPtr(n_doc, doc, 1);
3349 des_xmlNodePtr(n_cur, cur, 2);
3350 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
3351 des_int(n_format, format, 4);
3352 xmlResetLastError();
3353 if (mem_base != xmlMemBlocks()) {
3354 printf("Leak of %d blocks found in htmlNodeDumpFileFormat",
3355 xmlMemBlocks() - mem_base);
3356 test_ret++;
3357 printf(" %d", n_out);
3358 printf(" %d", n_doc);
3359 printf(" %d", n_cur);
3360 printf(" %d", n_encoding);
3361 printf(" %d", n_format);
3362 printf("\n");
3363 }
3364 }
3365 }
3366 }
3367 }
3368 }
3369 function_tests++;
3370#endif
3371
3372 return(test_ret);
3373}
3374
3375
3376static int
3377test_htmlNodeDumpFormatOutput(void) {
3378 int test_ret = 0;
3379
3380#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
3381 int mem_base;
3382 xmlOutputBufferPtr buf; /* the HTML buffer output */
3383 int n_buf;
3384 xmlDocPtr doc; /* the document */
3385 int n_doc;
3386 xmlNodePtr cur; /* the current node */
3387 int n_cur;
3388 char * encoding; /* the encoding string */
3389 int n_encoding;
3390 int format; /* should formatting spaces been added */
3391 int n_format;
3392
3393 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr2;n_buf++) {
3394 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr4;n_doc++) {
3395 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr3;n_cur++) {
3396 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr4;n_encoding++) {
3397 for (n_format = 0;n_format < gen_nb_int4;n_format++) {
3398 mem_base = xmlMemBlocks();
3399 buf = gen_xmlOutputBufferPtr(n_buf, 0);
3400 doc = gen_xmlDocPtr(n_doc, 1);
3401 cur = gen_xmlNodePtr(n_cur, 2);
3402 encoding = gen_const_char_ptr(n_encoding, 3);
3403 format = gen_int(n_format, 4);
3404
3405 htmlNodeDumpFormatOutput(buf, doc, cur, (const char *)encoding, format);
3406 call_tests++;
3407 des_xmlOutputBufferPtr(n_buf, buf, 0);
3408 des_xmlDocPtr(n_doc, doc, 1);
3409 des_xmlNodePtr(n_cur, cur, 2);
3410 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
3411 des_int(n_format, format, 4);
3412 xmlResetLastError();
3413 if (mem_base != xmlMemBlocks()) {
3414 printf("Leak of %d blocks found in htmlNodeDumpFormatOutput",
3415 xmlMemBlocks() - mem_base);
3416 test_ret++;
3417 printf(" %d", n_buf);
3418 printf(" %d", n_doc);
3419 printf(" %d", n_cur);
3420 printf(" %d", n_encoding);
3421 printf(" %d", n_format);
3422 printf("\n");
3423 }
3424 }
3425 }
3426 }
3427 }
3428 }
3429 function_tests++;
3430#endif
3431
3432 return(test_ret);
3433}
3434
3435
3436static int
3437test_htmlNodeDumpOutput(void) {
3438 int test_ret = 0;
3439
3440#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
3441 int mem_base;
3442 xmlOutputBufferPtr buf; /* the HTML buffer output */
3443 int n_buf;
3444 xmlDocPtr doc; /* the document */
3445 int n_doc;
3446 xmlNodePtr cur; /* the current node */
3447 int n_cur;
3448 char * encoding; /* the encoding string */
3449 int n_encoding;
3450
3451 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr2;n_buf++) {
3452 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr4;n_doc++) {
3453 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr3;n_cur++) {
3454 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr4;n_encoding++) {
3455 mem_base = xmlMemBlocks();
3456 buf = gen_xmlOutputBufferPtr(n_buf, 0);
3457 doc = gen_xmlDocPtr(n_doc, 1);
3458 cur = gen_xmlNodePtr(n_cur, 2);
3459 encoding = gen_const_char_ptr(n_encoding, 3);
3460
3461 htmlNodeDumpOutput(buf, doc, cur, (const char *)encoding);
3462 call_tests++;
3463 des_xmlOutputBufferPtr(n_buf, buf, 0);
3464 des_xmlDocPtr(n_doc, doc, 1);
3465 des_xmlNodePtr(n_cur, cur, 2);
3466 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
3467 xmlResetLastError();
3468 if (mem_base != xmlMemBlocks()) {
3469 printf("Leak of %d blocks found in htmlNodeDumpOutput",
3470 xmlMemBlocks() - mem_base);
3471 test_ret++;
3472 printf(" %d", n_buf);
3473 printf(" %d", n_doc);
3474 printf(" %d", n_cur);
3475 printf(" %d", n_encoding);
3476 printf("\n");
3477 }
3478 }
3479 }
3480 }
3481 }
3482 function_tests++;
3483#endif
3484
3485 return(test_ret);
3486}
3487
3488
3489static int
3490test_htmlSaveFile(void) {
3491 int test_ret = 0;
3492
3493#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
3494 int mem_base;
3495 int ret_val;
3496 const char * filename; /* the filename (or URL) */
3497 int n_filename;
3498 xmlDocPtr cur; /* the document */
3499 int n_cur;
3500
3501 for (n_filename = 0;n_filename < gen_nb_fileoutput6;n_filename++) {
3502 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr4;n_cur++) {
3503 mem_base = xmlMemBlocks();
3504 filename = gen_fileoutput(n_filename, 0);
3505 cur = gen_xmlDocPtr(n_cur, 1);
3506
3507 ret_val = htmlSaveFile(filename, cur);
3508 desret_int(ret_val);
3509 call_tests++;
3510 des_fileoutput(n_filename, filename, 0);
3511 des_xmlDocPtr(n_cur, cur, 1);
3512 xmlResetLastError();
3513 if (mem_base != xmlMemBlocks()) {
3514 printf("Leak of %d blocks found in htmlSaveFile",
3515 xmlMemBlocks() - mem_base);
3516 test_ret++;
3517 printf(" %d", n_filename);
3518 printf(" %d", n_cur);
3519 printf("\n");
3520 }
3521 }
3522 }
3523 function_tests++;
3524#endif
3525
3526 return(test_ret);
3527}
3528
3529
3530static int
3531test_htmlSaveFileEnc(void) {
3532 int test_ret = 0;
3533
3534#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
3535 int mem_base;
3536 int ret_val;
3537 const char * filename; /* the filename */
3538 int n_filename;
3539 xmlDocPtr cur; /* the document */
3540 int n_cur;
3541 char * encoding; /* the document encoding */
3542 int n_encoding;
3543
3544 for (n_filename = 0;n_filename < gen_nb_fileoutput6;n_filename++) {
3545 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr4;n_cur++) {
3546 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr4;n_encoding++) {
3547 mem_base = xmlMemBlocks();
3548 filename = gen_fileoutput(n_filename, 0);
3549 cur = gen_xmlDocPtr(n_cur, 1);
3550 encoding = gen_const_char_ptr(n_encoding, 2);
3551
3552 ret_val = htmlSaveFileEnc(filename, cur, (const char *)encoding);
3553 desret_int(ret_val);
3554 call_tests++;
3555 des_fileoutput(n_filename, filename, 0);
3556 des_xmlDocPtr(n_cur, cur, 1);
3557 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
3558 xmlResetLastError();
3559 if (mem_base != xmlMemBlocks()) {
3560 printf("Leak of %d blocks found in htmlSaveFileEnc",
3561 xmlMemBlocks() - mem_base);
3562 test_ret++;
3563 printf(" %d", n_filename);
3564 printf(" %d", n_cur);
3565 printf(" %d", n_encoding);
3566 printf("\n");
3567 }
3568 }
3569 }
3570 }
3571 function_tests++;
3572#endif
3573
3574 return(test_ret);
3575}
3576
3577
3578static int
3579test_htmlSaveFileFormat(void) {
3580 int test_ret = 0;
3581
3582#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
3583 int mem_base;
3584 int ret_val;
3585 const char * filename; /* the filename */
3586 int n_filename;
3587 xmlDocPtr cur; /* the document */
3588 int n_cur;
3589 char * encoding; /* the document encoding */
3590 int n_encoding;
3591 int format; /* should formatting spaces been added */
3592 int n_format;
3593
3594 for (n_filename = 0;n_filename < gen_nb_fileoutput6;n_filename++) {
3595 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr4;n_cur++) {
3596 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr4;n_encoding++) {
3597 for (n_format = 0;n_format < gen_nb_int4;n_format++) {
3598 mem_base = xmlMemBlocks();
3599 filename = gen_fileoutput(n_filename, 0);
3600 cur = gen_xmlDocPtr(n_cur, 1);
3601 encoding = gen_const_char_ptr(n_encoding, 2);
3602 format = gen_int(n_format, 3);
3603
3604 ret_val = htmlSaveFileFormat(filename, cur, (const char *)encoding, format);
3605 desret_int(ret_val);
3606 call_tests++;
3607 des_fileoutput(n_filename, filename, 0);
3608 des_xmlDocPtr(n_cur, cur, 1);
3609 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
3610 des_int(n_format, format, 3);
3611 xmlResetLastError();
3612 if (mem_base != xmlMemBlocks()) {
3613 printf("Leak of %d blocks found in htmlSaveFileFormat",
3614 xmlMemBlocks() - mem_base);
3615 test_ret++;
3616 printf(" %d", n_filename);
3617 printf(" %d", n_cur);
3618 printf(" %d", n_encoding);
3619 printf(" %d", n_format);
3620 printf("\n");
3621 }
3622 }
3623 }
3624 }
3625 }
3626 function_tests++;
3627#endif
3628
3629 return(test_ret);
3630}
3631
3632
3633static int
3634test_htmlSetMetaEncoding(void) {
3635 int test_ret = 0;
3636
3637#if defined(LIBXML_HTML_ENABLED)
3638 int mem_base;
3639 int ret_val;
3640 htmlDocPtr doc; /* the document */
3641 int n_doc;
3642 xmlChar * encoding; /* the encoding string */
3643 int n_encoding;
3644
3645 for (n_doc = 0;n_doc < gen_nb_htmlDocPtr3;n_doc++) {
3646 for (n_encoding = 0;n_encoding < gen_nb_const_xmlChar_ptr5;n_encoding++) {
3647 mem_base = xmlMemBlocks();
3648 doc = gen_htmlDocPtr(n_doc, 0);
3649 encoding = gen_const_xmlChar_ptr(n_encoding, 1);
3650
3651 ret_val = htmlSetMetaEncoding(doc, (const xmlChar *)encoding);
3652 desret_int(ret_val);
3653 call_tests++;
3654 des_htmlDocPtr(n_doc, doc, 0);
3655 des_const_xmlChar_ptr(n_encoding, (const xmlChar *)encoding, 1);
3656 xmlResetLastError();
3657 if (mem_base != xmlMemBlocks()) {
3658 printf("Leak of %d blocks found in htmlSetMetaEncoding",
3659 xmlMemBlocks() - mem_base);
3660 test_ret++;
3661 printf(" %d", n_doc);
3662 printf(" %d", n_encoding);
3663 printf("\n");
3664 }
3665 }
3666 }
3667 function_tests++;
3668#endif
3669
3670 return(test_ret);
3671}
3672
3673static int
3674test_HTMLtree(void) {
3675 int test_ret = 0;
3676
3677 if (quiet == 0) printf("Testing HTMLtree : 18 of 18 functions ...\n");
3678 test_ret += test_htmlDocContentDumpFormatOutput();
3679 test_ret += test_htmlDocContentDumpOutput();
3680 test_ret += test_htmlDocDump();
3681 test_ret += test_htmlDocDumpMemory();
3682 test_ret += test_htmlDocDumpMemoryFormat();
3683 test_ret += test_htmlGetMetaEncoding();
3684 test_ret += test_htmlIsBooleanAttr();
3685 test_ret += test_htmlNewDoc();
3686 test_ret += test_htmlNewDocNoDtD();
3687 test_ret += test_htmlNodeDump();
3688 test_ret += test_htmlNodeDumpFile();
3689 test_ret += test_htmlNodeDumpFileFormat();
3690 test_ret += test_htmlNodeDumpFormatOutput();
3691 test_ret += test_htmlNodeDumpOutput();
3692 test_ret += test_htmlSaveFile();
3693 test_ret += test_htmlSaveFileEnc();
3694 test_ret += test_htmlSaveFileFormat();
3695 test_ret += test_htmlSetMetaEncoding();
3696
3697 if (test_ret != 0)
3698 printf("Module HTMLtree: %d errors\n", test_ret);
3699 return(test_ret);
3700}
3701
3702static int
3703test_docbDefaultSAXHandlerInit(void) {
3704 int test_ret = 0;
3705
3706#if defined(LIBXML_DOCB_ENABLED)
3707#ifdef LIBXML_DOCB_ENABLED
3708 int mem_base;
3709
3710 mem_base = xmlMemBlocks();
3711
3712 docbDefaultSAXHandlerInit();
3713 call_tests++;
3714 xmlResetLastError();
3715 if (mem_base != xmlMemBlocks()) {
3716 printf("Leak of %d blocks found in docbDefaultSAXHandlerInit",
3717 xmlMemBlocks() - mem_base);
3718 test_ret++;
3719 printf("\n");
3720 }
3721 function_tests++;
3722#endif
3723#endif
3724
3725 return(test_ret);
3726}
3727
3728
3729static int
3730test_htmlDefaultSAXHandlerInit(void) {
3731 int test_ret = 0;
3732
3733#if defined(LIBXML_HTML_ENABLED)
3734#ifdef LIBXML_HTML_ENABLED
3735 int mem_base;
3736
3737 mem_base = xmlMemBlocks();
3738
3739 htmlDefaultSAXHandlerInit();
3740 call_tests++;
3741 xmlResetLastError();
3742 if (mem_base != xmlMemBlocks()) {
3743 printf("Leak of %d blocks found in htmlDefaultSAXHandlerInit",
3744 xmlMemBlocks() - mem_base);
3745 test_ret++;
3746 printf("\n");
3747 }
3748 function_tests++;
3749#endif
3750#endif
3751
3752 return(test_ret);
3753}
3754
3755
3756static int
3757test_xmlDefaultSAXHandlerInit(void) {
3758 int test_ret = 0;
3759
3760 int mem_base;
3761
3762 mem_base = xmlMemBlocks();
3763
3764 xmlDefaultSAXHandlerInit();
3765 call_tests++;
3766 xmlResetLastError();
3767 if (mem_base != xmlMemBlocks()) {
3768 printf("Leak of %d blocks found in xmlDefaultSAXHandlerInit",
3769 xmlMemBlocks() - mem_base);
3770 test_ret++;
3771 printf("\n");
3772 }
3773 function_tests++;
3774
3775 return(test_ret);
3776}
3777
3778
3779#define gen_nb_xmlEnumerationPtr1 1
3780static xmlEnumerationPtr gen_xmlEnumerationPtr(int no ATTRIBUTE_UNUSED__attribute__((unused)), int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
3781 return(NULL((void*)0));
3782}
3783static void des_xmlEnumerationPtr(int no ATTRIBUTE_UNUSED__attribute__((unused)), xmlEnumerationPtr val ATTRIBUTE_UNUSED__attribute__((unused)), int nr ATTRIBUTE_UNUSED__attribute__((unused))) {
3784}
3785
3786static int
3787test_xmlSAX2AttributeDecl(void) {
3788 int test_ret = 0;
3789
3790 int mem_base;
3791 void * ctx; /* the user data (XML parser context) */
3792 int n_ctx;
3793 xmlChar * elem; /* the name of the element */
3794 int n_elem;
3795 xmlChar * fullname; /* the attribute name */
3796 int n_fullname;
3797 int type; /* the attribute type */
3798 int n_type;
3799 int def; /* the type of default value */
3800 int n_def;
3801 xmlChar * defaultValue; /* the attribute default value */
3802 int n_defaultValue;
3803 xmlEnumerationPtr tree; /* the tree of enumerated value set */
3804 int n_tree;
3805
3806 for (n_ctx = 0;n_ctx < gen_nb_void_ptr2;n_ctx++) {
3807 for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr5;n_elem++) {
3808 for (n_fullname = 0;n_fullname < gen_nb_const_xmlChar_ptr5;n_fullname++) {
3809 for (n_type = 0;n_type < gen_nb_int4;n_type++) {
3810 for (n_def = 0;n_def < gen_nb_int4;n_def++) {
3811 for (n_defaultValue = 0;n_defaultValue < gen_nb_const_xmlChar_ptr5;n_defaultValue++) {
3812 for (n_tree = 0;n_tree < gen_nb_xmlEnumerationPtr1;n_tree++) {
3813 mem_base = xmlMemBlocks();
3814 ctx = gen_void_ptr(n_ctx, 0);
3815 elem = gen_const_xmlChar_ptr(n_elem, 1);
3816 fullname = gen_const_xmlChar_ptr(n_fullname, 2);
3817 type = gen_int(n_type, 3);
3818 def = gen_int(n_def, 4);
3819 defaultValue = gen_const_xmlChar_ptr(n_defaultValue, 5);
3820 tree = gen_xmlEnumerationPtr(n_tree, 6);
3821
3822 xmlSAX2AttributeDecl(ctx, (const xmlChar *)elem, (const xmlChar *)fullname, type, def, (const xmlChar *)defaultValue, tree);
3823 call_tests++;
3824 des_void_ptr(n_ctx, ctx, 0);
3825 des_const_xmlChar_ptr(n_elem, (const xmlChar *)elem, 1);
3826 des_const_xmlChar_ptr(n_fullname, (const xmlChar *)fullname, 2);
3827 des_int(n_type, type, 3);
3828 des_int(n_def, def, 4);
3829 des_const_xmlChar_ptr(n_defaultValue, (const xmlChar *)defaultValue, 5);
3830 des_xmlEnumerationPtr(n_tree, tree, 6);
3831 xmlResetLastError();
3832 if (mem_base != xmlMemBlocks()) {
3833 printf("Leak of %d blocks found in xmlSAX2AttributeDecl",
3834 xmlMemBlocks() - mem_base);
3835 test_ret++;
3836 printf(" %d", n_ctx);
3837 printf(" %d", n_elem);
3838 printf(" %d", n_fullname);
3839 printf(" %d", n_type);
3840 printf(" %d", n_def);
3841 printf(" %d", n_defaultValue);
3842 printf(" %d", n_tree);
3843 printf("\n");
3844 }
3845 }
3846 }
3847 }
3848 }
3849 }
3850 }
3851 }
3852 function_tests++;
3853
3854 return(test_ret);
3855}
3856
3857
3858static int
3859test_xmlSAX2CDataBlock(void) {
3860 int test_ret = 0;
3861
3862 int mem_base;
3863 void * ctx; /* the user data (XML parser context) */
3864 int n_ctx;
3865 xmlChar * value; /* The pcdata content */
3866 int n_value;
3867 int len; /* the block length */
3868 int n_len;
3869
3870 for (n_ctx = 0;n_ctx < gen_nb_void_ptr2;n_ctx++) {
3871 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr5;n_value++) {
3872 for (n_len = 0;n_len < gen_nb_int4;n_len++) {
3873 mem_base = xmlMemBlocks();
3874 ctx = gen_void_ptr(n_ctx, 0);
3875 value = gen_const_xmlChar_ptr(n_value, 1);
3876 len = gen_int(n_len, 2);
3877
3878