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 (at) veillard.com 9 */ 10 11 #include "libxml.h" 12 #include <stdio.h> 13 14 #include <stdlib.h> /* for putenv() */ 15 #include <string.h> 16 #include <libxml/xmlerror.h> 17 #include <libxml/relaxng.h> 18 19 20 static int testlibxml2(void); 21 static int test_module(const char *module); 22 23 static int generic_errors = 0; 24 static int call_tests = 0; 25 static int function_tests = 0; 26 27 static xmlChar chartab[1024]; 28 static int inttab[1024]; 29 static unsigned long longtab[1024]; 30 31 static xmlDocPtr api_doc = NULL; 32 static xmlDtdPtr api_dtd = NULL; 33 static xmlNodePtr api_root = NULL; 34 static xmlAttrPtr api_attr = NULL; 35 static xmlNsPtr api_ns = NULL; 36 37 static void 38 structured_errors(void *userData ATTRIBUTE_UNUSED, 39 xmlErrorPtr error ATTRIBUTE_UNUSED) { 40 generic_errors++; 41 } 42 43 static void 44 free_api_doc(void) { 45 xmlFreeDoc(api_doc); 46 api_doc = NULL; 47 api_dtd = NULL; 48 api_root = NULL; 49 api_attr = NULL; 50 api_ns = NULL; 51 } 52 53 static xmlDocPtr 54 get_api_doc(void) { 55 if (api_doc == NULL) { 56 api_doc = xmlReadMemory("<!DOCTYPE root [<!ELEMENT root EMPTY>]><root xmlns:h='http://example.com/' h:foo='bar'/>", 88, "root_test", NULL, 0); 57 api_root = NULL; 58 api_attr = NULL; 59 } 60 return(api_doc); 61 } 62 63 static xmlDtdPtr 64 get_api_dtd(void) { 65 if ((api_dtd == NULL) || (api_dtd->type != XML_DTD_NODE)) { 66 get_api_doc(); 67 if ((api_doc != NULL) && (api_doc->children != NULL) && 68 (api_doc->children->type == XML_DTD_NODE)) 69 api_dtd = (xmlDtdPtr) api_doc->children; 70 } 71 return(api_dtd); 72 } 73 74 static xmlNodePtr 75 get_api_root(void) { 76 if ((api_root == NULL) || (api_root->type != XML_ELEMENT_NODE)) { 77 get_api_doc(); 78 if ((api_doc != NULL) && (api_doc->children != NULL) && 79 (api_doc->children->next != NULL) && 80 (api_doc->children->next->type == XML_ELEMENT_NODE)) 81 api_root = api_doc->children->next; 82 } 83 return(api_root); 84 } 85 86 static xmlNsPtr 87 get_api_ns(void) { 88 get_api_root(); 89 if (api_root != NULL) 90 api_ns = api_root->nsDef; 91 return(api_ns); 92 } 93 94 static xmlAttrPtr 95 get_api_attr(void) { 96 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED) 97 static int nr = 0; 98 xmlChar name[20]; 99 #endif 100 101 if ((api_root == NULL) || (api_root->type != XML_ELEMENT_NODE)) { 102 get_api_root(); 103 } 104 if (api_root == NULL) 105 return(NULL); 106 if (api_root->properties != NULL) { 107 api_attr = api_root->properties; 108 return(api_root->properties); 109 } 110 api_attr = NULL; 111 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED) 112 snprintf((char *) name, 20, "foo%d", nr++); 113 api_attr = xmlSetProp(api_root, name, (const xmlChar *) "bar"); 114 #endif 115 return(api_attr); 116 } 117 118 static int quiet = 0; 119 120 int main(int argc, char **argv) { 121 int ret; 122 int blocks, mem; 123 124 #ifdef HAVE_PUTENV 125 /* access to the proxy can slow up regression tests a lot */ 126 putenv((char *) "http_proxy="); 127 #endif 128 129 memset(chartab, 0, sizeof(chartab)); 130 strncpy((char *) chartab, " chartab\n", 20); 131 memset(inttab, 0, sizeof(inttab)); 132 memset(longtab, 0, sizeof(longtab)); 133 134 xmlInitParser(); 135 #ifdef LIBXML_SCHEMAS_ENABLED 136 xmlRelaxNGInitTypes(); 137 #endif 138 139 LIBXML_TEST_VERSION 140 141 xmlSetStructuredErrorFunc(NULL, structured_errors); 142 143 if (argc >= 2) { 144 if (!strcmp(argv[1], "-q")) { 145 quiet = 1; 146 if (argc >= 3) 147 ret = test_module(argv[2]); 148 else 149 ret = testlibxml2(); 150 } else { 151 ret = test_module(argv[1]); 152 } 153 } else 154 ret = testlibxml2(); 155 156 xmlCleanupParser(); 157 blocks = xmlMemBlocks(); 158 mem = xmlMemUsed(); 159 if ((blocks != 0) || (mem != 0)) { 160 printf("testapi leaked %d bytes in %d blocks\n", mem, blocks); 161 } 162 xmlMemoryDump(); 163 164 return (ret != 0); 165 } 166 167 #include <libxml/HTMLparser.h> 168 #include <libxml/HTMLtree.h> 169 #include <libxml/catalog.h> 170 #include <libxml/chvalid.h> 171 #include <libxml/dict.h> 172 #include <libxml/encoding.h> 173 #include <libxml/entities.h> 174 #include <libxml/hash.h> 175 #include <libxml/list.h> 176 #include <libxml/nanoftp.h> 177 #include <libxml/nanohttp.h> 178 #include <libxml/parser.h> 179 #include <libxml/parserInternals.h> 180 #include <libxml/pattern.h> 181 #include <libxml/relaxng.h> 182 #include <libxml/schemasInternals.h> 183 #include <libxml/schematron.h> 184 #include <libxml/tree.h> 185 #include <libxml/uri.h> 186 #include <libxml/valid.h> 187 #include <libxml/xinclude.h> 188 #include <libxml/xmlIO.h> 189 #include <libxml/xmlerror.h> 190 #include <libxml/xmlreader.h> 191 #include <libxml/xmlsave.h> 192 #include <libxml/xmlschemas.h> 193 #include <libxml/xmlschemastypes.h> 194 #include <libxml/xmlstring.h> 195 #include <libxml/xmlwriter.h> 196 #include <libxml/xpath.h> 197 #include <libxml/xpointer.h> 198 #include <libxml/debugXML.h> 199 200 /* 201 We manually define xmlErrMemory because it's normal declaration 202 is "hidden" by #ifdef IN_LIBXML 203 */ 204 void xmlErrMemory(xmlParserCtxtPtr ctxt, const char *extra); 205 206 /* 207 We need some "remote" addresses, but want to avoid getting into 208 name resolution delays, so we use these 209 */ 210 #define REMOTE1GOOD "http://localhost/" 211 #define REMOTE1BAD "http:http://http" 212 #define REMOTE2GOOD "ftp://localhost/foo" 213 214 #define gen_nb_void_ptr 2 215 216 static void *gen_void_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 217 return(NULL); 218 } 219 static void des_void_ptr(int no ATTRIBUTE_UNUSED, void *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 220 } 221 222 #if 0 223 #define gen_nb_const_void_ptr 2 224 225 static const void *gen_const_void_ptr(int no, int nr ATTRIBUTE_UNUSED) { 226 if (no == 0) return((const void *) "immutable string"); 227 return(NULL); 228 } 229 static void des_const_void_ptr(int no ATTRIBUTE_UNUSED, const void *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 230 } 231 #endif 232 233 #define gen_nb_userdata 3 234 235 static void *gen_userdata(int no, int nr ATTRIBUTE_UNUSED) { 236 if (no == 0) return((void *) &call_tests); 237 if (no == 1) return((void *) -1); 238 return(NULL); 239 } 240 static void des_userdata(int no ATTRIBUTE_UNUSED, void *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 241 } 242 243 244 #define gen_nb_int 4 245 246 static int gen_int(int no, int nr ATTRIBUTE_UNUSED) { 247 if (no == 0) return(0); 248 if (no == 1) return(1); 249 if (no == 2) return(-1); 250 if (no == 3) return(122); 251 return(-1); 252 } 253 254 static void des_int(int no ATTRIBUTE_UNUSED, int val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 255 } 256 257 #define gen_nb_parseroptions 5 258 259 static int gen_parseroptions(int no, int nr ATTRIBUTE_UNUSED) { 260 if (no == 0) return(XML_PARSE_NOBLANKS | XML_PARSE_RECOVER); 261 if (no == 1) return(XML_PARSE_NOENT | XML_PARSE_DTDLOAD | XML_PARSE_DTDATTR | XML_PARSE_DTDVALID | XML_PARSE_NOCDATA); 262 if (no == 2) return(XML_PARSE_XINCLUDE | XML_PARSE_NOXINCNODE | XML_PARSE_NSCLEAN); 263 if (no == 3) return(XML_PARSE_XINCLUDE | XML_PARSE_NODICT); 264 return(XML_PARSE_SAX1); 265 } 266 267 static void des_parseroptions(int no ATTRIBUTE_UNUSED, int val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 268 } 269 270 #if 0 271 #define gen_nb_long 5 272 273 static long gen_long(int no, int nr ATTRIBUTE_UNUSED) { 274 if (no == 0) return(0); 275 if (no == 1) return(1); 276 if (no == 2) return(-1); 277 if (no == 3) return(122); 278 return(-1); 279 } 280 281 static void des_long(int no ATTRIBUTE_UNUSED, long val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 282 } 283 #endif 284 285 #define gen_nb_xmlChar 4 286 287 static xmlChar gen_xmlChar(int no, int nr ATTRIBUTE_UNUSED) { 288 if (no == 0) return('a'); 289 if (no == 1) return(' '); 290 if (no == 2) return((xmlChar) '\xf8'); 291 return(0); 292 } 293 294 static void des_xmlChar(int no ATTRIBUTE_UNUSED, xmlChar val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 295 } 296 297 #define gen_nb_unsigned_int 3 298 299 static unsigned int gen_unsigned_int(int no, int nr ATTRIBUTE_UNUSED) { 300 if (no == 0) return(0); 301 if (no == 1) return(1); 302 if (no == 2) return(122); 303 return((unsigned int) -1); 304 } 305 306 static void des_unsigned_int(int no ATTRIBUTE_UNUSED, unsigned int val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 307 } 308 309 #define gen_nb_unsigned_long 4 310 311 static unsigned long gen_unsigned_long(int no, int nr ATTRIBUTE_UNUSED) { 312 if (no == 0) return(0); 313 if (no == 1) return(1); 314 if (no == 2) return(122); 315 return((unsigned long) -1); 316 } 317 318 static void des_unsigned_long(int no ATTRIBUTE_UNUSED, unsigned long val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 319 } 320 321 #define gen_nb_double 4 322 323 static double gen_double(int no, int nr ATTRIBUTE_UNUSED) { 324 if (no == 0) return(0); 325 if (no == 1) return(-1.1); 326 #if defined(LIBXML_XPATH_ENABLED) 327 if (no == 2) return(xmlXPathNAN); 328 #endif 329 return(-1); 330 } 331 332 static void des_double(int no ATTRIBUTE_UNUSED, double val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 333 } 334 335 #define gen_nb_unsigned_long_ptr 2 336 337 static unsigned long *gen_unsigned_long_ptr(int no, int nr) { 338 if (no == 0) return(&longtab[nr]); 339 return(NULL); 340 } 341 342 static void des_unsigned_long_ptr(int no ATTRIBUTE_UNUSED, unsigned long *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 343 } 344 345 #define gen_nb_int_ptr 2 346 347 static int *gen_int_ptr(int no, int nr) { 348 if (no == 0) return(&inttab[nr]); 349 return(NULL); 350 } 351 352 static void des_int_ptr(int no ATTRIBUTE_UNUSED, int *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 353 } 354 355 #define gen_nb_const_char_ptr 4 356 357 static char *gen_const_char_ptr(int no, int nr ATTRIBUTE_UNUSED) { 358 if (no == 0) return((char *) "foo"); 359 if (no == 1) return((char *) "<foo/>"); 360 if (no == 2) return((char *) "test/ent2"); 361 return(NULL); 362 } 363 static void des_const_char_ptr(int no ATTRIBUTE_UNUSED, const char *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 364 } 365 366 #define gen_nb_xmlChar_ptr 2 367 368 static xmlChar *gen_xmlChar_ptr(int no, int nr ATTRIBUTE_UNUSED) { 369 if (no == 0) return(&chartab[0]); 370 return(NULL); 371 } 372 static void des_xmlChar_ptr(int no ATTRIBUTE_UNUSED, xmlChar *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 373 } 374 375 #define gen_nb_FILE_ptr 2 376 377 static FILE *gen_FILE_ptr(int no, int nr ATTRIBUTE_UNUSED) { 378 if (no == 0) return(fopen("test.out", "a+")); 379 return(NULL); 380 } 381 static void des_FILE_ptr(int no ATTRIBUTE_UNUSED, FILE *val, int nr ATTRIBUTE_UNUSED) { 382 if (val != NULL) fclose(val); 383 } 384 385 #define gen_nb_debug_FILE_ptr 2 386 static FILE *gen_debug_FILE_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 387 return(fopen("test.out", "a+")); 388 } 389 static void des_debug_FILE_ptr(int no ATTRIBUTE_UNUSED, FILE *val, int nr ATTRIBUTE_UNUSED) { 390 if (val != NULL) fclose(val); 391 } 392 393 #define gen_nb_const_xmlChar_ptr 5 394 395 static xmlChar *gen_const_xmlChar_ptr(int no, int nr ATTRIBUTE_UNUSED) { 396 if (no == 0) return((xmlChar *) "foo"); 397 if (no == 1) return((xmlChar *) "<foo/>"); 398 if (no == 2) return((xmlChar *) "n" "\xf8" "ne"); 399 if (no == 3) return((xmlChar *) " 2ab "); 400 return(NULL); 401 } 402 static void des_const_xmlChar_ptr(int no ATTRIBUTE_UNUSED, const xmlChar *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 403 } 404 405 #define gen_nb_filepath 8 406 407 static const char *gen_filepath(int no, int nr ATTRIBUTE_UNUSED) { 408 if (no == 0) return("missing.xml"); 409 if (no == 1) return("<foo/>"); 410 if (no == 2) return("test/ent2"); 411 if (no == 3) return("test/valid/REC-xml-19980210.xml"); 412 if (no == 4) return("test/valid/dtds/xhtml1-strict.dtd"); 413 if (no == 5) return(REMOTE1GOOD); 414 if (no == 6) return(REMOTE1BAD); 415 return(NULL); 416 } 417 static void des_filepath(int no ATTRIBUTE_UNUSED, const char *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 418 } 419 420 #define gen_nb_eaten_name 2 421 422 static xmlChar *gen_eaten_name(int no, int nr ATTRIBUTE_UNUSED) { 423 if (no == 0) return(xmlStrdup(BAD_CAST "eaten")); 424 return(NULL); 425 } 426 static void des_eaten_name(int no ATTRIBUTE_UNUSED, xmlChar *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 427 } 428 429 #define gen_nb_fileoutput 6 430 431 static const char *gen_fileoutput(int no, int nr ATTRIBUTE_UNUSED) { 432 if (no == 0) return("/missing.xml"); 433 if (no == 1) return("<foo/>"); 434 if (no == 2) return(REMOTE2GOOD); 435 if (no == 3) return(REMOTE1GOOD); 436 if (no == 4) return(REMOTE1BAD); 437 return(NULL); 438 } 439 static void des_fileoutput(int no ATTRIBUTE_UNUSED, const char *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 440 } 441 442 #define gen_nb_xmlParserCtxtPtr 3 443 static xmlParserCtxtPtr gen_xmlParserCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) { 444 if (no == 0) return(xmlNewParserCtxt()); 445 if (no == 1) return(xmlCreateMemoryParserCtxt("<doc/>", 6)); 446 return(NULL); 447 } 448 static void des_xmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, xmlParserCtxtPtr val, int nr ATTRIBUTE_UNUSED) { 449 if (val != NULL) 450 xmlFreeParserCtxt(val); 451 } 452 453 #define gen_nb_xmlSAXHandlerPtr 2 454 static xmlSAXHandlerPtr gen_xmlSAXHandlerPtr(int no, int nr ATTRIBUTE_UNUSED) { 455 #ifdef LIBXML_SAX1_ENABLED 456 if (no == 0) return((xmlSAXHandlerPtr) &xmlDefaultSAXHandler); 457 #endif 458 return(NULL); 459 } 460 static void des_xmlSAXHandlerPtr(int no ATTRIBUTE_UNUSED, xmlSAXHandlerPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 461 } 462 463 #define gen_nb_xmlValidCtxtPtr 2 464 static xmlValidCtxtPtr gen_xmlValidCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) { 465 #ifdef LIBXML_VALID_ENABLED 466 if (no == 0) return(xmlNewValidCtxt()); 467 #endif 468 return(NULL); 469 } 470 static void des_xmlValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlValidCtxtPtr val, int nr ATTRIBUTE_UNUSED) { 471 #ifdef LIBXML_VALID_ENABLED 472 if (val != NULL) 473 xmlFreeValidCtxt(val); 474 #endif 475 } 476 477 #define gen_nb_xmlParserInputBufferPtr 8 478 479 static xmlParserInputBufferPtr gen_xmlParserInputBufferPtr(int no, int nr ATTRIBUTE_UNUSED) { 480 if (no == 0) return(xmlParserInputBufferCreateFilename("missing.xml", XML_CHAR_ENCODING_NONE)); 481 if (no == 1) return(xmlParserInputBufferCreateFilename("<foo/>", XML_CHAR_ENCODING_NONE)); 482 if (no == 2) return(xmlParserInputBufferCreateFilename("test/ent2", XML_CHAR_ENCODING_NONE)); 483 if (no == 3) return(xmlParserInputBufferCreateFilename("test/valid/REC-xml-19980210.xml", XML_CHAR_ENCODING_NONE)); 484 if (no == 4) return(xmlParserInputBufferCreateFilename("test/valid/dtds/xhtml1-strict.dtd", XML_CHAR_ENCODING_NONE)); 485 if (no == 5) return(xmlParserInputBufferCreateFilename(REMOTE1GOOD, XML_CHAR_ENCODING_NONE)); 486 if (no == 6) return(xmlParserInputBufferCreateFilename(REMOTE1BAD, XML_CHAR_ENCODING_NONE)); 487 return(NULL); 488 } 489 static void des_xmlParserInputBufferPtr(int no ATTRIBUTE_UNUSED, xmlParserInputBufferPtr val, int nr ATTRIBUTE_UNUSED) { 490 xmlFreeParserInputBuffer(val); 491 } 492 493 #define gen_nb_xmlDocPtr 4 494 static xmlDocPtr gen_xmlDocPtr(int no, int nr ATTRIBUTE_UNUSED) { 495 if (no == 0) return(xmlNewDoc(BAD_CAST "1.0")); 496 if (no == 1) return(xmlReadMemory("<foo/>", 6, "test", NULL, 0)); 497 if (no == 2) return(xmlReadMemory("<!DOCTYPE foo []> <foo/>", 24, "test", NULL, 0)); 498 return(NULL); 499 } 500 static void des_xmlDocPtr(int no ATTRIBUTE_UNUSED, xmlDocPtr val, int nr ATTRIBUTE_UNUSED) { 501 if ((val != NULL) && (val != api_doc) && (val->doc != api_doc)) 502 xmlFreeDoc(val); 503 } 504 505 #define gen_nb_xmlAttrPtr 2 506 static xmlAttrPtr gen_xmlAttrPtr(int no, int nr ATTRIBUTE_UNUSED) { 507 if (no == 0) return(get_api_attr()); 508 return(NULL); 509 } 510 static void des_xmlAttrPtr(int no, xmlAttrPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 511 if (no == 0) free_api_doc(); 512 } 513 514 #define gen_nb_xmlDictPtr 2 515 static xmlDictPtr gen_xmlDictPtr(int no, int nr ATTRIBUTE_UNUSED) { 516 if (no == 0) return(xmlDictCreate()); 517 return(NULL); 518 } 519 static void des_xmlDictPtr(int no ATTRIBUTE_UNUSED, xmlDictPtr val, int nr ATTRIBUTE_UNUSED) { 520 if (val != NULL) 521 xmlDictFree(val); 522 } 523 524 #define gen_nb_xmlNodePtr 3 525 static xmlNodePtr gen_xmlNodePtr(int no, int nr ATTRIBUTE_UNUSED) { 526 if (no == 0) return(xmlNewPI(BAD_CAST "test", NULL)); 527 if (no == 1) return(get_api_root()); 528 return(NULL); 529 /* if (no == 2) return((xmlNodePtr) get_api_doc()); */ 530 } 531 static void des_xmlNodePtr(int no, xmlNodePtr val, int nr ATTRIBUTE_UNUSED) { 532 if (no == 1) { 533 free_api_doc(); 534 } else if (val != NULL) { 535 xmlUnlinkNode(val); 536 xmlFreeNode(val); 537 } 538 } 539 540 #define gen_nb_xmlDtdPtr 3 541 static xmlDtdPtr gen_xmlDtdPtr(int no, int nr ATTRIBUTE_UNUSED) { 542 if (no == 0) 543 return(xmlNewDtd(NULL, BAD_CAST "dtd", BAD_CAST"foo", BAD_CAST"bar")); 544 if (no == 1) return(get_api_dtd()); 545 return(NULL); 546 } 547 static void des_xmlDtdPtr(int no, xmlDtdPtr val, int nr ATTRIBUTE_UNUSED) { 548 if (no == 1) free_api_doc(); 549 else if (val != NULL) { 550 xmlUnlinkNode((xmlNodePtr) val); 551 xmlFreeNode((xmlNodePtr) val); 552 } 553 } 554 555 #define gen_nb_xmlNsPtr 2 556 static xmlNsPtr gen_xmlNsPtr(int no, int nr ATTRIBUTE_UNUSED) { 557 if (no == 0) return(get_api_ns()); 558 return(NULL); 559 } 560 static void des_xmlNsPtr(int no, xmlNsPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 561 if (no == 0) free_api_doc(); 562 } 563 564 #define gen_nb_xmlNodePtr_in 3 565 static xmlNodePtr gen_xmlNodePtr_in(int no, int nr ATTRIBUTE_UNUSED) { 566 if (no == 0) return(xmlNewPI(BAD_CAST "test", NULL)); 567 if (no == 0) return(xmlNewText(BAD_CAST "text")); 568 return(NULL); 569 } 570 static void des_xmlNodePtr_in(int no ATTRIBUTE_UNUSED, xmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 571 } 572 573 #ifdef LIBXML_WRITER_ENABLED 574 #define gen_nb_xmlTextWriterPtr 2 575 static xmlTextWriterPtr gen_xmlTextWriterPtr(int no, int nr ATTRIBUTE_UNUSED) { 576 if (no == 0) return(xmlNewTextWriterFilename("test.out", 0)); 577 return(NULL); 578 } 579 static void des_xmlTextWriterPtr(int no ATTRIBUTE_UNUSED, xmlTextWriterPtr val, int nr ATTRIBUTE_UNUSED) { 580 if (val != NULL) xmlFreeTextWriter(val); 581 } 582 #endif 583 584 #ifdef LIBXML_READER_ENABLED 585 #define gen_nb_xmlTextReaderPtr 4 586 static xmlTextReaderPtr gen_xmlTextReaderPtr(int no, int nr ATTRIBUTE_UNUSED) { 587 if (no == 0) return(xmlNewTextReaderFilename("test/ent2")); 588 if (no == 1) return(xmlNewTextReaderFilename("test/valid/REC-xml-19980210.xml")); 589 if (no == 2) return(xmlNewTextReaderFilename("test/valid/dtds/xhtml1-strict.dtd")); 590 return(NULL); 591 } 592 static void des_xmlTextReaderPtr(int no ATTRIBUTE_UNUSED, xmlTextReaderPtr val, int nr ATTRIBUTE_UNUSED) { 593 if (val != NULL) xmlFreeTextReader(val); 594 } 595 #endif 596 597 #define gen_nb_xmlBufferPtr 3 598 static const xmlChar *static_buf_content = (xmlChar *)"a static buffer"; 599 static xmlBufferPtr gen_xmlBufferPtr(int no, int nr ATTRIBUTE_UNUSED) { 600 if (no == 0) return(xmlBufferCreate()); 601 if (no == 1) return(xmlBufferCreateStatic((void *)static_buf_content, 13)); 602 return(NULL); 603 } 604 static void des_xmlBufferPtr(int no ATTRIBUTE_UNUSED, xmlBufferPtr val, int nr ATTRIBUTE_UNUSED) { 605 if (val != NULL) { 606 xmlBufferFree(val); 607 } 608 } 609 610 #define gen_nb_xmlListPtr 2 611 static xmlListPtr gen_xmlListPtr(int no, int nr ATTRIBUTE_UNUSED) { 612 if (no == 0) return(xmlListCreate(NULL, NULL)); 613 return(NULL); 614 } 615 static void des_xmlListPtr(int no ATTRIBUTE_UNUSED, xmlListPtr val, int nr ATTRIBUTE_UNUSED) { 616 if (val != NULL) { 617 xmlListDelete(val); 618 } 619 } 620 621 #define gen_nb_xmlHashTablePtr 2 622 static xmlHashTablePtr gen_xmlHashTablePtr(int no, int nr ATTRIBUTE_UNUSED) { 623 if (no == 0) return(xmlHashCreate(10)); 624 return(NULL); 625 } 626 static void des_xmlHashTablePtr(int no ATTRIBUTE_UNUSED, xmlHashTablePtr val, int nr ATTRIBUTE_UNUSED) { 627 if (val != NULL) { 628 xmlHashFree(val, NULL); 629 } 630 } 631 632 #include <libxml/xpathInternals.h> 633 634 #ifdef LIBXML_XPATH_ENABLED 635 #define gen_nb_xmlXPathObjectPtr 5 636 static xmlXPathObjectPtr gen_xmlXPathObjectPtr(int no, int nr ATTRIBUTE_UNUSED) { 637 if (no == 0) return(xmlXPathNewString(BAD_CAST "string object")); 638 if (no == 1) return(xmlXPathNewFloat(1.1)); 639 if (no == 2) return(xmlXPathNewBoolean(1)); 640 if (no == 3) return(xmlXPathNewNodeSet(NULL)); 641 return(NULL); 642 } 643 static void des_xmlXPathObjectPtr(int no ATTRIBUTE_UNUSED, xmlXPathObjectPtr val, int nr ATTRIBUTE_UNUSED) { 644 if (val != NULL) { 645 xmlXPathFreeObject(val); 646 } 647 } 648 #endif 649 650 #ifdef LIBXML_OUTPUT_ENABLED 651 #define gen_nb_xmlOutputBufferPtr 2 652 static xmlOutputBufferPtr gen_xmlOutputBufferPtr(int no, int nr ATTRIBUTE_UNUSED) { 653 if (no == 0) return(xmlOutputBufferCreateFilename("test.out", NULL, 0)); 654 return(NULL); 655 } 656 static void des_xmlOutputBufferPtr(int no ATTRIBUTE_UNUSED, xmlOutputBufferPtr val, int nr ATTRIBUTE_UNUSED) { 657 if (val != NULL) { 658 xmlOutputBufferClose(val); 659 } 660 } 661 #endif 662 663 #ifdef LIBXML_FTP_ENABLED 664 #define gen_nb_xmlNanoFTPCtxtPtr 4 665 static void *gen_xmlNanoFTPCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) { 666 if (no == 0) return(xmlNanoFTPNewCtxt(REMOTE2GOOD)); 667 if (no == 1) return(xmlNanoFTPNewCtxt(REMOTE1GOOD)); 668 if (no == 2) return(xmlNanoFTPNewCtxt("foo")); 669 return(NULL); 670 } 671 static void des_xmlNanoFTPCtxtPtr(int no ATTRIBUTE_UNUSED, void *val, int nr ATTRIBUTE_UNUSED) { 672 if (val != NULL) { 673 xmlNanoFTPFreeCtxt(val); 674 } 675 } 676 #endif 677 678 #ifdef LIBXML_HTTP_ENABLED 679 #define gen_nb_xmlNanoHTTPCtxtPtr 1 680 static void *gen_xmlNanoHTTPCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) { 681 if (no == 0) return(xmlNanoHTTPOpen(REMOTE1GOOD, NULL)); 682 if (no == 1) return(xmlNanoHTTPOpen(REMOTE2GOOD, NULL)); 683 if (no == 2) return(xmlNanoHTTPOpen(REMOTE1BAD, NULL)); 684 return(NULL); 685 } 686 static void des_xmlNanoHTTPCtxtPtr(int no ATTRIBUTE_UNUSED, void *val, int nr ATTRIBUTE_UNUSED) { 687 if (val != NULL) { 688 xmlNanoHTTPClose(val); 689 } 690 } 691 #endif 692 693 #define gen_nb_xmlCharEncoding 4 694 static xmlCharEncoding gen_xmlCharEncoding(int no, int nr ATTRIBUTE_UNUSED) { 695 if (no == 0) return(XML_CHAR_ENCODING_UTF8); 696 if (no == 1) return(XML_CHAR_ENCODING_NONE); 697 if (no == 2) return(XML_CHAR_ENCODING_8859_1); 698 return(XML_CHAR_ENCODING_ERROR); 699 } 700 static void des_xmlCharEncoding(int no ATTRIBUTE_UNUSED, xmlCharEncoding val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 701 } 702 703 #if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_EXPR_ENABLED) 704 705 #define gen_nb_xmlExpCtxtPtr 1 706 static xmlExpCtxtPtr gen_xmlExpCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 707 return(NULL); 708 } 709 static void des_xmlExpCtxtPtr(int no ATTRIBUTE_UNUSED, xmlExpCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 710 } 711 712 #define gen_nb_xmlExpNodePtr 1 713 static xmlExpNodePtr gen_xmlExpNodePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 714 return(NULL); 715 } 716 static void des_xmlExpNodePtr(int no ATTRIBUTE_UNUSED, xmlExpNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 717 } 718 719 #endif 720 721 #if defined(LIBXML_SCHEMAS_ENABLED) 722 #define gen_nb_xmlSchemaPtr 1 723 static xmlSchemaPtr gen_xmlSchemaPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 724 return(NULL); 725 } 726 static void des_xmlSchemaPtr(int no ATTRIBUTE_UNUSED, xmlSchemaPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 727 } 728 729 #define gen_nb_xmlSchemaValidCtxtPtr 1 730 static xmlSchemaValidCtxtPtr gen_xmlSchemaValidCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 731 return(NULL); 732 } 733 static void des_xmlSchemaValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSchemaValidCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 734 } 735 736 #endif /* LIBXML_SCHEMAS_ENABLED */ 737 738 #define gen_nb_xmlHashDeallocator 2 739 static void 740 test_xmlHashDeallocator(void *payload ATTRIBUTE_UNUSED, xmlChar *name ATTRIBUTE_UNUSED) { 741 } 742 743 static xmlHashDeallocator gen_xmlHashDeallocator(int no, int nr ATTRIBUTE_UNUSED) { 744 if (no == 0) return(test_xmlHashDeallocator); 745 return(NULL); 746 } 747 static void des_xmlHashDeallocator(int no ATTRIBUTE_UNUSED, xmlHashDeallocator val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 748 } 749 750 751 static void desret_int(int val ATTRIBUTE_UNUSED) { 752 } 753 static void desret_xmlChar(xmlChar val ATTRIBUTE_UNUSED) { 754 } 755 static void desret_long(long val ATTRIBUTE_UNUSED) { 756 } 757 static void desret_unsigned_long(unsigned long val ATTRIBUTE_UNUSED) { 758 } 759 static void desret_double(double val ATTRIBUTE_UNUSED) { 760 } 761 static void desret_xmlCharEncoding(xmlCharEncoding val ATTRIBUTE_UNUSED) { 762 } 763 #if 0 764 static void desret_const_void_ptr(void *val ATTRIBUTE_UNUSED) { 765 } 766 #endif 767 static void desret_void_ptr(void *val ATTRIBUTE_UNUSED) { 768 } 769 static void desret_const_char_ptr(const char *val ATTRIBUTE_UNUSED) { 770 } 771 static void desret_const_xmlChar_ptr(const xmlChar *val ATTRIBUTE_UNUSED) { 772 } 773 static void desret_xmlChar_ptr(xmlChar *val) { 774 if (val != NULL) 775 xmlFree(val); 776 } 777 static void desret_xmlDocPtr(xmlDocPtr val) { 778 if (val != api_doc) 779 xmlFreeDoc(val); 780 } 781 static void desret_xmlDictPtr(xmlDictPtr val) { 782 xmlDictFree(val); 783 } 784 #ifdef LIBXML_OUTPUT_ENABLED 785 static void desret_xmlOutputBufferPtr(xmlOutputBufferPtr val) { 786 xmlOutputBufferClose(val); 787 } 788 #endif 789 #ifdef LIBXML_READER_ENABLED 790 static void desret_xmlTextReaderPtr(xmlTextReaderPtr val) { 791 xmlFreeTextReader(val); 792 } 793 #endif 794 static void desret_xmlNodePtr(xmlNodePtr val) { 795 if ((val != NULL) && (val != api_root) && (val != (xmlNodePtr) api_doc)) { 796 xmlUnlinkNode(val); 797 xmlFreeNode(val); 798 } 799 } 800 static void desret_xmlAttrPtr(xmlAttrPtr val) { 801 if (val != NULL) { 802 xmlUnlinkNode((xmlNodePtr) val); 803 xmlFreeNode((xmlNodePtr) val); 804 } 805 } 806 static void desret_xmlEntityPtr(xmlEntityPtr val) { 807 if (val != NULL) { 808 xmlUnlinkNode((xmlNodePtr) val); 809 xmlFreeNode((xmlNodePtr) val); 810 } 811 } 812 static void desret_xmlElementPtr(xmlElementPtr val) { 813 if (val != NULL) { 814 xmlUnlinkNode((xmlNodePtr) val); 815 } 816 } 817 static void desret_xmlAttributePtr(xmlAttributePtr val) { 818 if (val != NULL) { 819 xmlUnlinkNode((xmlNodePtr) val); 820 } 821 } 822 static void desret_xmlNsPtr(xmlNsPtr val ATTRIBUTE_UNUSED) { 823 } 824 static void desret_xmlDtdPtr(xmlDtdPtr val) { 825 desret_xmlNodePtr((xmlNodePtr)val); 826 } 827 #ifdef LIBXML_XPATH_ENABLED 828 static void desret_xmlXPathObjectPtr(xmlXPathObjectPtr val) { 829 xmlXPathFreeObject(val); 830 } 831 static void desret_xmlNodeSetPtr(xmlNodeSetPtr val) { 832 xmlXPathFreeNodeSet(val); 833 } 834 #endif 835 static void desret_xmlParserCtxtPtr(xmlParserCtxtPtr val) { 836 xmlFreeParserCtxt(val); 837 } 838 static void desret_xmlParserInputBufferPtr(xmlParserInputBufferPtr val) { 839 xmlFreeParserInputBuffer(val); 840 } 841 static void desret_xmlParserInputPtr(xmlParserInputPtr val) { 842 xmlFreeInputStream(val); 843 } 844 #ifdef LIBXML_WRITER_ENABLED 845 static void desret_xmlTextWriterPtr(xmlTextWriterPtr val) { 846 xmlFreeTextWriter(val); 847 } 848 #endif 849 static void desret_xmlBufferPtr(xmlBufferPtr val) { 850 xmlBufferFree(val); 851 } 852 #ifdef LIBXML_SCHEMAS_ENABLED 853 static void desret_xmlSchemaParserCtxtPtr(xmlSchemaParserCtxtPtr val) { 854 xmlSchemaFreeParserCtxt(val); 855 } 856 static void desret_xmlSchemaTypePtr(xmlSchemaTypePtr val ATTRIBUTE_UNUSED) { 857 } 858 static void desret_xmlRelaxNGParserCtxtPtr(xmlRelaxNGParserCtxtPtr val) { 859 xmlRelaxNGFreeParserCtxt(val); 860 } 861 #endif 862 #ifdef LIBXML_HTML_ENABLED 863 static void desret_const_htmlEntityDesc_ptr(const htmlEntityDesc * val ATTRIBUTE_UNUSED) { 864 } 865 #endif 866 #ifdef LIBXML_HTTP_ENABLED 867 static void desret_xmlNanoHTTPCtxtPtr(void *val) { 868 xmlNanoHTTPClose(val); 869 } 870 #endif 871 #ifdef LIBXML_FTP_ENABLED 872 static void desret_xmlNanoFTPCtxtPtr(void *val) { 873 xmlNanoFTPClose(val); 874 } 875 #endif 876 /* cut and pasted from autogenerated to avoid troubles */ 877 #define gen_nb_const_xmlChar_ptr_ptr 1 878 static xmlChar ** gen_const_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 879 return(NULL); 880 } 881 static void des_const_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, const xmlChar ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 882 } 883 884 #define gen_nb_unsigned_char_ptr 1 885 static unsigned char * gen_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 886 return(NULL); 887 } 888 static void des_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, unsigned char * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 889 } 890 891 #define gen_nb_const_unsigned_char_ptr 1 892 static unsigned char * gen_const_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 893 return(NULL); 894 } 895 static void des_const_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, const unsigned char * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 896 } 897 898 #ifdef LIBXML_HTML_ENABLED 899 #define gen_nb_const_htmlNodePtr 1 900 static htmlNodePtr gen_const_htmlNodePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 901 return(NULL); 902 } 903 static void des_const_htmlNodePtr(int no ATTRIBUTE_UNUSED, const htmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 904 } 905 #endif 906 907 #ifdef LIBXML_HTML_ENABLED 908 #define gen_nb_htmlDocPtr 3 909 static htmlDocPtr gen_htmlDocPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 910 if (no == 0) return(htmlNewDoc(NULL, NULL)); 911 if (no == 1) return(htmlReadMemory("<html/>", 7, "test", NULL, 0)); 912 return(NULL); 913 } 914 static void des_htmlDocPtr(int no ATTRIBUTE_UNUSED, htmlDocPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 915 if ((val != NULL) && (val != api_doc) && (val->doc != api_doc)) 916 xmlFreeDoc(val); 917 } 918 static void desret_htmlDocPtr(htmlDocPtr val) { 919 if ((val != NULL) && (val != api_doc) && (val->doc != api_doc)) 920 xmlFreeDoc(val); 921 } 922 #define gen_nb_htmlParserCtxtPtr 3 923 static htmlParserCtxtPtr gen_htmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 924 if (no == 0) return(xmlNewParserCtxt()); 925 if (no == 1) return(htmlCreateMemoryParserCtxt("<html/>", 7)); 926 return(NULL); 927 } 928 static void des_htmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, htmlParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 929 if (val != NULL) 930 htmlFreeParserCtxt(val); 931 } 932 static void desret_htmlParserCtxtPtr(htmlParserCtxtPtr val) { 933 if (val != NULL) 934 htmlFreeParserCtxt(val); 935 } 936 #endif 937 938 #ifdef LIBXML_XPATH_ENABLED 939 #define gen_nb_xmlNodeSetPtr 1 940 static xmlNodeSetPtr gen_xmlNodeSetPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 941 return(NULL); 942 } 943 static void des_xmlNodeSetPtr(int no ATTRIBUTE_UNUSED, xmlNodeSetPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 944 } 945 #endif 946 947 #ifdef LIBXML_DEBUG_ENABLED 948 #ifdef LIBXML_XPATH_ENABLED 949 #define gen_nb_xmlShellCtxtPtr 1 950 static xmlShellCtxtPtr gen_xmlShellCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 951 return(NULL); 952 } 953 static void des_xmlShellCtxtPtr(int no ATTRIBUTE_UNUSED, xmlShellCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 954 } 955 #endif 956 #endif 957 958 #ifdef LIBXML_PATTERN_ENABLED 959 #define gen_nb_xmlPatternPtr 1 960 static xmlPatternPtr gen_xmlPatternPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 961 return(NULL); 962 } 963 static void des_xmlPatternPtr(int no ATTRIBUTE_UNUSED, xmlPatternPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 964 } 965 #endif 966 967 #define gen_nb_xmlElementContentPtr 1 968 static xmlElementContentPtr gen_xmlElementContentPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 969 return(NULL); 970 } 971 static void des_xmlElementContentPtr(int no ATTRIBUTE_UNUSED, xmlElementContentPtr val, int nr ATTRIBUTE_UNUSED) { 972 if (val != NULL) 973 xmlFreeElementContent(val); 974 } 975 static void desret_xmlElementContentPtr(xmlElementContentPtr val) { 976 if (val != NULL) 977 xmlFreeElementContent(val); 978 } 979 980 #define gen_nb_xmlParserNodeInfoSeqPtr 1 981 static xmlParserNodeInfoSeqPtr gen_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 982 return(NULL); 983 } 984 static void des_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, xmlParserNodeInfoSeqPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 985 } 986 987 static void desret_const_xmlParserNodeInfo_ptr(const xmlParserNodeInfo *val ATTRIBUTE_UNUSED) { 988 } 989 990 #define gen_nb_void_ptr_ptr 1 991 static void ** gen_void_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 992 return(NULL); 993 } 994 static void des_void_ptr_ptr(int no ATTRIBUTE_UNUSED, void ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 995 } 996 997 /************************************************************************ 998 * * 999 * WARNING: end of the manually maintained part of the test code * 1000 * do not remove or alter the CUT HERE line * 1001 * * 1002 ************************************************************************/ 1003 1004 /* CUT HERE: everything below that line is generated */ 1005 #ifdef LIBXML_HTML_ENABLED 1006 static void desret_htmlStatus(htmlStatus val ATTRIBUTE_UNUSED) { 1007 } 1008 1009 #endif 1010 1011 #define gen_nb_xmlAttributeDefault 4 1012 static xmlAttributeDefault gen_xmlAttributeDefault(int no, int nr ATTRIBUTE_UNUSED) { 1013 if (no == 1) return(XML_ATTRIBUTE_FIXED); 1014 if (no == 2) return(XML_ATTRIBUTE_IMPLIED); 1015 if (no == 3) return(XML_ATTRIBUTE_NONE); 1016 if (no == 4) return(XML_ATTRIBUTE_REQUIRED); 1017 return(0); 1018 } 1019 1020 static void des_xmlAttributeDefault(int no ATTRIBUTE_UNUSED, xmlAttributeDefault val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 1021 } 1022 1023 #define gen_nb_xmlAttributeType 4 1024 static xmlAttributeType gen_xmlAttributeType(int no, int nr ATTRIBUTE_UNUSED) { 1025 if (no == 1) return(XML_ATTRIBUTE_CDATA); 1026 if (no == 2) return(XML_ATTRIBUTE_ENTITIES); 1027 if (no == 3) return(XML_ATTRIBUTE_ENTITY); 1028 if (no == 4) return(XML_ATTRIBUTE_ENUMERATION); 1029 return(0); 1030 } 1031 1032 static void des_xmlAttributeType(int no ATTRIBUTE_UNUSED, xmlAttributeType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 1033 } 1034 1035 #define gen_nb_xmlBufferAllocationScheme 4 1036 static xmlBufferAllocationScheme gen_xmlBufferAllocationScheme(int no, int nr ATTRIBUTE_UNUSED) { 1037 if (no == 1) return(XML_BUFFER_ALLOC_BOUNDED); 1038 if (no == 2) return(XML_BUFFER_ALLOC_DOUBLEIT); 1039 if (no == 3) return(XML_BUFFER_ALLOC_EXACT); 1040 if (no == 4) return(XML_BUFFER_ALLOC_HYBRID); 1041 return(0); 1042 } 1043 1044 static void des_xmlBufferAllocationScheme(int no ATTRIBUTE_UNUSED, xmlBufferAllocationScheme val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 1045 } 1046 1047 static void desret_xmlBufferAllocationScheme(xmlBufferAllocationScheme val ATTRIBUTE_UNUSED) { 1048 } 1049 1050 #ifdef LIBXML_CATALOG_ENABLED 1051 #define gen_nb_xmlCatalogAllow 4 1052 static xmlCatalogAllow gen_xmlCatalogAllow(int no, int nr ATTRIBUTE_UNUSED) { 1053 if (no == 1) return(XML_CATA_ALLOW_ALL); 1054 if (no == 2) return(XML_CATA_ALLOW_DOCUMENT); 1055 if (no == 3) return(XML_CATA_ALLOW_GLOBAL); 1056 if (no == 4) return(XML_CATA_ALLOW_NONE); 1057 return(0); 1058 } 1059 1060 static void des_xmlCatalogAllow(int no ATTRIBUTE_UNUSED, xmlCatalogAllow val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 1061 } 1062 1063 static void desret_xmlCatalogAllow(xmlCatalogAllow val ATTRIBUTE_UNUSED) { 1064 } 1065 1066 #endif 1067 1068 #ifdef LIBXML_CATALOG_ENABLED 1069 #define gen_nb_xmlCatalogPrefer 3 1070 static xmlCatalogPrefer gen_xmlCatalogPrefer(int no, int nr ATTRIBUTE_UNUSED) { 1071 if (no == 1) return(XML_CATA_PREFER_NONE); 1072 if (no == 2) return(XML_CATA_PREFER_PUBLIC); 1073 if (no == 3) return(XML_CATA_PREFER_SYSTEM); 1074 return(0); 1075 } 1076 1077 static void des_xmlCatalogPrefer(int no ATTRIBUTE_UNUSED, xmlCatalogPrefer val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 1078 } 1079 1080 static void desret_xmlCatalogPrefer(xmlCatalogPrefer val ATTRIBUTE_UNUSED) { 1081 } 1082 1083 #endif 1084 1085 #define gen_nb_xmlElementContentType 4 1086 static xmlElementContentType gen_xmlElementContentType(int no, int nr ATTRIBUTE_UNUSED) { 1087 if (no == 1) return(XML_ELEMENT_CONTENT_ELEMENT); 1088 if (no == 2) return(XML_ELEMENT_CONTENT_OR); 1089 if (no == 3) return(XML_ELEMENT_CONTENT_PCDATA); 1090 if (no == 4) return(XML_ELEMENT_CONTENT_SEQ); 1091 return(0); 1092 } 1093 1094 static void des_xmlElementContentType(int no ATTRIBUTE_UNUSED, xmlElementContentType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 1095 } 1096 1097 #define gen_nb_xmlElementTypeVal 4 1098 static xmlElementTypeVal gen_xmlElementTypeVal(int no, int nr ATTRIBUTE_UNUSED) { 1099 if (no == 1) return(XML_ELEMENT_TYPE_ANY); 1100 if (no == 2) return(XML_ELEMENT_TYPE_ELEMENT); 1101 if (no == 3) return(XML_ELEMENT_TYPE_EMPTY); 1102 if (no == 4) return(XML_ELEMENT_TYPE_MIXED); 1103 return(0); 1104 } 1105 1106 static void des_xmlElementTypeVal(int no ATTRIBUTE_UNUSED, xmlElementTypeVal val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 1107 } 1108 1109 #define gen_nb_xmlFeature 4 1110 static xmlFeature gen_xmlFeature(int no, int nr ATTRIBUTE_UNUSED) { 1111 if (no == 1) return(XML_WITH_AUTOMATA); 1112 if (no == 2) return(XML_WITH_C14N); 1113 if (no == 3) return(XML_WITH_CATALOG); 1114 if (no == 4) return(XML_WITH_DEBUG); 1115 return(0); 1116 } 1117 1118 static void des_xmlFeature(int no ATTRIBUTE_UNUSED, xmlFeature val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 1119 } 1120 1121 static void desret_xmlParserErrors(xmlParserErrors val ATTRIBUTE_UNUSED) { 1122 } 1123 1124 #ifdef LIBXML_SCHEMAS_ENABLED 1125 #define gen_nb_xmlSchemaValType 4 1126 static xmlSchemaValType gen_xmlSchemaValType(int no, int nr ATTRIBUTE_UNUSED) { 1127 if (no == 1) return(XML_SCHEMAS_ANYSIMPLETYPE); 1128 if (no == 2) return(XML_SCHEMAS_ANYTYPE); 1129 if (no == 3) return(XML_SCHEMAS_ANYURI); 1130 if (no == 4) return(XML_SCHEMAS_BASE64BINARY); 1131 return(0); 1132 } 1133 1134 static void des_xmlSchemaValType(int no ATTRIBUTE_UNUSED, xmlSchemaValType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 1135 } 1136 1137 static void desret_xmlSchemaValType(xmlSchemaValType val ATTRIBUTE_UNUSED) { 1138 } 1139 1140 #endif 1141 1142 #ifdef LIBXML_SCHEMAS_ENABLED 1143 #define gen_nb_xmlSchemaWhitespaceValueType 4 1144 static xmlSchemaWhitespaceValueType gen_xmlSchemaWhitespaceValueType(int no, int nr ATTRIBUTE_UNUSED) { 1145 if (no == 1) return(XML_SCHEMA_WHITESPACE_COLLAPSE); 1146 if (no == 2) return(XML_SCHEMA_WHITESPACE_PRESERVE); 1147 if (no == 3) return(XML_SCHEMA_WHITESPACE_REPLACE); 1148 if (no == 4) return(XML_SCHEMA_WHITESPACE_UNKNOWN); 1149 return(0); 1150 } 1151 1152 static void des_xmlSchemaWhitespaceValueType(int no ATTRIBUTE_UNUSED, xmlSchemaWhitespaceValueType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 1153 } 1154 1155 #endif 1156 1157 #include <libxml/HTMLparser.h> 1158 #include <libxml/HTMLtree.h> 1159 #include <libxml/SAX2.h> 1160 #include <libxml/c14n.h> 1161 #include <libxml/catalog.h> 1162 #include <libxml/chvalid.h> 1163 #include <libxml/debugXML.h> 1164 #include <libxml/dict.h> 1165 #include <libxml/encoding.h> 1166 #include <libxml/entities.h> 1167 #include <libxml/hash.h> 1168 #include <libxml/list.h> 1169 #include <libxml/nanoftp.h> 1170 #include <libxml/nanohttp.h> 1171 #include <libxml/parser.h> 1172 #include <libxml/parserInternals.h> 1173 #include <libxml/pattern.h> 1174 #include <libxml/relaxng.h> 1175 #include <libxml/schemasInternals.h> 1176 #include <libxml/schematron.h> 1177 #include <libxml/tree.h> 1178 #include <libxml/uri.h> 1179 #include <libxml/valid.h> 1180 #include <libxml/xinclude.h> 1181 #include <libxml/xmlIO.h> 1182 #include <libxml/xmlautomata.h> 1183 #include <libxml/xmlerror.h> 1184 #include <libxml/xmlmodule.h> 1185 #include <libxml/xmlreader.h> 1186 #include <libxml/xmlregexp.h> 1187 #include <libxml/xmlsave.h> 1188 #include <libxml/xmlschemas.h> 1189 #include <libxml/xmlschemastypes.h> 1190 #include <libxml/xmlstring.h> 1191 #include <libxml/xmlunicode.h> 1192 #include <libxml/xmlwriter.h> 1193 #include <libxml/xpath.h> 1194 #include <libxml/xpathInternals.h> 1195 #include <libxml/xpointer.h> 1196 static int test_HTMLparser(void); 1197 static int test_HTMLtree(void); 1198 static int test_SAX2(void); 1199 static int test_c14n(void); 1200 static int test_catalog(void); 1201 static int test_chvalid(void); 1202 static int test_debugXML(void); 1203 static int test_dict(void); 1204 static int test_encoding(void); 1205 static int test_entities(void); 1206 static int test_hash(void); 1207 static int test_list(void); 1208 static int test_nanoftp(void); 1209 static int test_nanohttp(void); 1210 static int test_parser(void); 1211 static int test_parserInternals(void); 1212 static int test_pattern(void); 1213 static int test_relaxng(void); 1214 static int test_schemasInternals(void); 1215 static int test_schematron(void); 1216 static int test_tree(void); 1217 static int test_uri(void); 1218 static int test_valid(void); 1219 static int test_xinclude(void); 1220 static int test_xmlIO(void); 1221 static int test_xmlautomata(void); 1222 static int test_xmlerror(void); 1223 static int test_xmlmodule(void); 1224 static int test_xmlreader(void); 1225 static int test_xmlregexp(void); 1226 static int test_xmlsave(void); 1227 static int test_xmlschemas(void); 1228 static int test_xmlschemastypes(void); 1229 static int test_xmlstring(void); 1230 static int test_xmlunicode(void); 1231 static int test_xmlwriter(void); 1232 static int test_xpath(void); 1233 static int test_xpathInternals(void); 1234 static int test_xpointer(void); 1235 1236 /** 1237 * testlibxml2: 1238 * 1239 * Main entry point of the tester for the full libxml2 module, 1240 * it calls all the tester entry point for each module. 1241 * 1242 * Returns the number of error found 1243 */ 1244 static int 1245 testlibxml2(void) 1246 { 1247 int test_ret = 0; 1248 1249 test_ret += test_HTMLparser(); 1250 test_ret += test_HTMLtree(); 1251 test_ret += test_SAX2(); 1252 test_ret += test_c14n(); 1253 test_ret += test_catalog(); 1254 test_ret += test_chvalid(); 1255 test_ret += test_debugXML(); 1256 test_ret += test_dict(); 1257 test_ret += test_encoding(); 1258 test_ret += test_entities(); 1259 test_ret += test_hash(); 1260 test_ret += test_list(); 1261 test_ret += test_nanoftp(); 1262 test_ret += test_nanohttp(); 1263 test_ret += test_parser(); 1264 test_ret += test_parserInternals(); 1265 test_ret += test_pattern(); 1266 test_ret += test_relaxng(); 1267 test_ret += test_schemasInternals(); 1268 test_ret += test_schematron(); 1269 test_ret += test_tree(); 1270 test_ret += test_uri(); 1271 test_ret += test_valid(); 1272 test_ret += test_xinclude(); 1273 test_ret += test_xmlIO(); 1274 test_ret += test_xmlautomata(); 1275 test_ret += test_xmlerror(); 1276 test_ret += test_xmlmodule(); 1277 test_ret += test_xmlreader(); 1278 test_ret += test_xmlregexp(); 1279 test_ret += test_xmlsave(); 1280 test_ret += test_xmlschemas(); 1281 test_ret += test_xmlschemastypes(); 1282 test_ret += test_xmlstring(); 1283 test_ret += test_xmlunicode(); 1284 test_ret += test_xmlwriter(); 1285 test_ret += test_xpath(); 1286 test_ret += test_xpathInternals(); 1287 test_ret += test_xpointer(); 1288 1289 printf("Total: %d functions, %d tests, %d errors\n", 1290 function_tests, call_tests, test_ret); 1291 return(test_ret); 1292 } 1293 1294 1295 static int 1296 test_UTF8ToHtml(void) { 1297 int test_ret = 0; 1298 1299 #if defined(LIBXML_HTML_ENABLED) 1300 int mem_base; 1301 int ret_val; 1302 unsigned char * out; /* a pointer to an array of bytes to store the result */ 1303 int n_out; 1304 int * outlen; /* the length of @out */ 1305 int n_outlen; 1306 unsigned char * in; /* a pointer to an array of UTF-8 chars */ 1307 int n_in; 1308 int * inlen; /* the length of @in */ 1309 int n_inlen; 1310 1311 for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) { 1312 for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) { 1313 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) { 1314 for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) { 1315 mem_base = xmlMemBlocks(); 1316 out = gen_unsigned_char_ptr(n_out, 0); 1317 outlen = gen_int_ptr(n_outlen, 1); 1318 in = gen_const_unsigned_char_ptr(n_in, 2); 1319 inlen = gen_int_ptr(n_inlen, 3); 1320 1321 ret_val = UTF8ToHtml(out, outlen, (const unsigned char *)in, inlen); 1322 desret_int(ret_val); 1323 call_tests++; 1324 des_unsigned_char_ptr(n_out, out, 0); 1325 des_int_ptr(n_outlen, outlen, 1); 1326 des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 2); 1327 des_int_ptr(n_inlen, inlen, 3); 1328 xmlResetLastError(); 1329 if (mem_base != xmlMemBlocks()) { 1330 printf("Leak of %d blocks found in UTF8ToHtml", 1331 xmlMemBlocks() - mem_base); 1332 test_ret++; 1333 printf(" %d", n_out); 1334 printf(" %d", n_outlen); 1335 printf(" %d", n_in); 1336 printf(" %d", n_inlen); 1337 printf("\n"); 1338 } 1339 } 1340 } 1341 } 1342 } 1343 function_tests++; 1344 #endif 1345 1346 return(test_ret); 1347 } 1348 1349 #ifdef LIBXML_HTML_ENABLED 1350 1351 #define gen_nb_const_htmlElemDesc_ptr 1 1352 static htmlElemDesc * gen_const_htmlElemDesc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 1353 return(NULL); 1354 } 1355 static void des_const_htmlElemDesc_ptr(int no ATTRIBUTE_UNUSED, const htmlElemDesc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 1356 } 1357 #endif 1358 1359 1360 static int 1361 test_htmlAttrAllowed(void) { 1362 int test_ret = 0; 1363 1364 #if defined(LIBXML_HTML_ENABLED) 1365 int mem_base; 1366 htmlStatus ret_val; 1367 htmlElemDesc * elt; /* HTML element */ 1368 int n_elt; 1369 xmlChar * attr; /* HTML attribute */ 1370 int n_attr; 1371 int legacy; /* whether to allow deprecated attributes */ 1372 int n_legacy; 1373 1374 for (n_elt = 0;n_elt < gen_nb_const_htmlElemDesc_ptr;n_elt++) { 1375 for (n_attr = 0;n_attr < gen_nb_const_xmlChar_ptr;n_attr++) { 1376 for (n_legacy = 0;n_legacy < gen_nb_int;n_legacy++) { 1377 mem_base = xmlMemBlocks(); 1378 elt = gen_const_htmlElemDesc_ptr(n_elt, 0); 1379 attr = gen_const_xmlChar_ptr(n_attr, 1); 1380 legacy = gen_int(n_legacy, 2); 1381 1382 ret_val = htmlAttrAllowed((const htmlElemDesc *)elt, (const xmlChar *)attr, legacy); 1383 desret_htmlStatus(ret_val); 1384 call_tests++; 1385 des_const_htmlElemDesc_ptr(n_elt, (const htmlElemDesc *)elt, 0); 1386 des_const_xmlChar_ptr(n_attr, (const xmlChar *)attr, 1); 1387 des_int(n_legacy, legacy, 2); 1388 xmlResetLastError(); 1389 if (mem_base != xmlMemBlocks()) { 1390 printf("Leak of %d blocks found in htmlAttrAllowed", 1391 xmlMemBlocks() - mem_base); 1392 test_ret++; 1393 printf(" %d", n_elt); 1394 printf(" %d", n_attr); 1395 printf(" %d", n_legacy); 1396 printf("\n"); 1397 } 1398 } 1399 } 1400 } 1401 function_tests++; 1402 #endif 1403 1404 return(test_ret); 1405 } 1406 1407 #ifdef LIBXML_HTML_ENABLED 1408 1409 #define gen_nb_htmlNodePtr 1 1410 static htmlNodePtr gen_htmlNodePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 1411 return(NULL); 1412 } 1413 static void des_htmlNodePtr(int no ATTRIBUTE_UNUSED, htmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 1414 } 1415 #endif 1416 1417 1418 static int 1419 test_htmlAutoCloseTag(void) { 1420 int test_ret = 0; 1421 1422 #if defined(LIBXML_HTML_ENABLED) 1423 int mem_base; 1424 int ret_val; 1425 htmlDocPtr doc; /* the HTML document */ 1426 int n_doc; 1427 xmlChar * name; /* The tag name */ 1428 int n_name; 1429 htmlNodePtr elem; /* the HTML element */ 1430 int n_elem; 1431 1432 for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) { 1433 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { 1434 for (n_elem = 0;n_elem < gen_nb_htmlNodePtr;n_elem++) { 1435 mem_base = xmlMemBlocks(); 1436 doc = gen_htmlDocPtr(n_doc, 0); 1437 name = gen_const_xmlChar_ptr(n_name, 1); 1438 elem = gen_htmlNodePtr(n_elem, 2); 1439 1440 ret_val = htmlAutoCloseTag(doc, (const xmlChar *)name, elem); 1441 desret_int(ret_val); 1442 call_tests++; 1443 des_htmlDocPtr(n_doc, doc, 0); 1444 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); 1445 des_htmlNodePtr(n_elem, elem, 2); 1446 xmlResetLastError(); 1447 if (mem_base != xmlMemBlocks()) { 1448 printf("Leak of %d blocks found in htmlAutoCloseTag", 1449 xmlMemBlocks() - mem_base); 1450 test_ret++; 1451 printf(" %d", n_doc); 1452 printf(" %d", n_name); 1453 printf(" %d", n_elem); 1454 printf("\n"); 1455 } 1456 } 1457 } 1458 } 1459 function_tests++; 1460 #endif 1461 1462 return(test_ret); 1463 } 1464 1465 1466 static int 1467 test_htmlCreateMemoryParserCtxt(void) { 1468 int test_ret = 0; 1469 1470 #if defined(LIBXML_HTML_ENABLED) 1471 int mem_base; 1472 htmlParserCtxtPtr ret_val; 1473 char * buffer; /* a pointer to a char array */ 1474 int n_buffer; 1475 int size; /* the size of the array */ 1476 int n_size; 1477 1478 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) { 1479 for (n_size = 0;n_size < gen_nb_int;n_size++) { 1480 mem_base = xmlMemBlocks(); 1481 buffer = gen_const_char_ptr(n_buffer, 0); 1482 size = gen_int(n_size, 1); 1483 1484 ret_val = htmlCreateMemoryParserCtxt((const char *)buffer, size); 1485 desret_htmlParserCtxtPtr(ret_val); 1486 call_tests++; 1487 des_const_char_ptr(n_buffer, (const char *)buffer, 0); 1488 des_int(n_size, size, 1); 1489 xmlResetLastError(); 1490 if (mem_base != xmlMemBlocks()) { 1491 printf("Leak of %d blocks found in htmlCreateMemoryParserCtxt", 1492 xmlMemBlocks() - mem_base); 1493 test_ret++; 1494 printf(" %d", n_buffer); 1495 printf(" %d", n_size); 1496 printf("\n"); 1497 } 1498 } 1499 } 1500 function_tests++; 1501 #endif 1502 1503 return(test_ret); 1504 } 1505 1506 #ifdef LIBXML_HTML_ENABLED 1507 1508 #define gen_nb_htmlSAXHandlerPtr 1 1509 static htmlSAXHandlerPtr gen_htmlSAXHandlerPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 1510 return(NULL); 1511 } 1512 static void des_htmlSAXHandlerPtr(int no ATTRIBUTE_UNUSED, htmlSAXHandlerPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 1513 } 1514 #endif 1515 1516 1517 static int 1518 test_htmlCreatePushParserCtxt(void) { 1519 int test_ret = 0; 1520 1521 #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_PUSH_ENABLED) 1522 int mem_base; 1523 htmlParserCtxtPtr ret_val; 1524 htmlSAXHandlerPtr sax; /* a SAX handler */ 1525 int n_sax; 1526 void * user_data; /* The user data returned on SAX callbacks */ 1527 int n_user_data; 1528 char * chunk; /* a pointer to an array of chars */ 1529 int n_chunk; 1530 int size; /* number of chars in the array */ 1531 int n_size; 1532 const char * filename; /* an optional file name or URI */ 1533 int n_filename; 1534 xmlCharEncoding enc; /* an optional encoding */ 1535 int n_enc; 1536 1537 for (n_sax = 0;n_sax < gen_nb_htmlSAXHandlerPtr;n_sax++) { 1538 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) { 1539 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) { 1540 for (n_size = 0;n_size < gen_nb_int;n_size++) { 1541 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) { 1542 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) { 1543 mem_base = xmlMemBlocks(); 1544 sax = gen_htmlSAXHandlerPtr(n_sax, 0); 1545 user_data = gen_userdata(n_user_data, 1); 1546 chunk = gen_const_char_ptr(n_chunk, 2); 1547 size = gen_int(n_size, 3); 1548 filename = gen_fileoutput(n_filename, 4); 1549 enc = gen_xmlCharEncoding(n_enc, 5); 1550 1551 ret_val = htmlCreatePushParserCtxt(sax, user_data, (const char *)chunk, size, filename, enc); 1552 desret_htmlParserCtxtPtr(ret_val); 1553 call_tests++; 1554 des_htmlSAXHandlerPtr(n_sax, sax, 0); 1555 des_userdata(n_user_data, user_data, 1); 1556 des_const_char_ptr(n_chunk, (const char *)chunk, 2); 1557 des_int(n_size, size, 3); 1558 des_fileoutput(n_filename, filename, 4); 1559 des_xmlCharEncoding(n_enc, enc, 5); 1560 xmlResetLastError(); 1561 if (mem_base != xmlMemBlocks()) { 1562 printf("Leak of %d blocks found in htmlCreatePushParserCtxt", 1563 xmlMemBlocks() - mem_base); 1564 test_ret++; 1565 printf(" %d", n_sax); 1566 printf(" %d", n_user_data); 1567 printf(" %d", n_chunk); 1568 printf(" %d", n_size); 1569 printf(" %d", n_filename); 1570 printf(" %d", n_enc); 1571 printf("\n"); 1572 } 1573 } 1574 } 1575 } 1576 } 1577 } 1578 } 1579 function_tests++; 1580 #endif 1581 1582 return(test_ret); 1583 } 1584 1585 1586 static int 1587 test_htmlCtxtReadDoc(void) { 1588 int test_ret = 0; 1589 1590 #if defined(LIBXML_HTML_ENABLED) 1591 int mem_base; 1592 htmlDocPtr ret_val; 1593 htmlParserCtxtPtr ctxt; /* an HTML parser context */ 1594 int n_ctxt; 1595 xmlChar * cur; /* a pointer to a zero terminated string */ 1596 int n_cur; 1597 const char * URL; /* the base URL to use for the document */ 1598 int n_URL; 1599 char * encoding; /* the document encoding, or NULL */ 1600 int n_encoding; 1601 int options; /* a combination of htmlParserOption(s) */ 1602 int n_options; 1603 1604 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) { 1605 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) { 1606 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) { 1607 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { 1608 for (n_options = 0;n_options < gen_nb_int;n_options++) { 1609 mem_base = xmlMemBlocks(); 1610 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0); 1611 cur = gen_const_xmlChar_ptr(n_cur, 1); 1612 URL = gen_filepath(n_URL, 2); 1613 encoding = gen_const_char_ptr(n_encoding, 3); 1614 options = gen_int(n_options, 4); 1615 1616 ret_val = htmlCtxtReadDoc(ctxt, (const xmlChar *)cur, URL, (const char *)encoding, options); 1617 desret_htmlDocPtr(ret_val); 1618 call_tests++; 1619 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0); 1620 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 1); 1621 des_filepath(n_URL, URL, 2); 1622 des_const_char_ptr(n_encoding, (const char *)encoding, 3); 1623 des_int(n_options, options, 4); 1624 xmlResetLastError(); 1625 if (mem_base != xmlMemBlocks()) { 1626 printf("Leak of %d blocks found in htmlCtxtReadDoc", 1627 xmlMemBlocks() - mem_base); 1628 test_ret++; 1629 printf(" %d", n_ctxt); 1630 printf(" %d", n_cur); 1631 printf(" %d", n_URL); 1632 printf(" %d", n_encoding); 1633 printf(" %d", n_options); 1634 printf("\n"); 1635 } 1636 } 1637 } 1638 } 1639 } 1640 } 1641 function_tests++; 1642 #endif 1643 1644 return(test_ret); 1645 } 1646 1647 1648 static int 1649 test_htmlCtxtReadFile(void) { 1650 int test_ret = 0; 1651 1652 #if defined(LIBXML_HTML_ENABLED) 1653 htmlDocPtr ret_val; 1654 htmlParserCtxtPtr ctxt; /* an HTML parser context */ 1655 int n_ctxt; 1656 const char * filename; /* a file or URL */ 1657 int n_filename; 1658 char * encoding; /* the document encoding, or NULL */ 1659 int n_encoding; 1660 int options; /* a combination of htmlParserOption(s) */ 1661 int n_options; 1662 1663 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) { 1664 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { 1665 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { 1666 for (n_options = 0;n_options < gen_nb_int;n_options++) { 1667 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0); 1668 filename = gen_filepath(n_filename, 1); 1669 encoding = gen_const_char_ptr(n_encoding, 2); 1670 options = gen_int(n_options, 3); 1671 1672 ret_val = htmlCtxtReadFile(ctxt, filename, (const char *)encoding, options); 1673 desret_htmlDocPtr(ret_val); 1674 call_tests++; 1675 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0); 1676 des_filepath(n_filename, filename, 1); 1677 des_const_char_ptr(n_encoding, (const char *)encoding, 2); 1678 des_int(n_options, options, 3); 1679 xmlResetLastError(); 1680 } 1681 } 1682 } 1683 } 1684 function_tests++; 1685 #endif 1686 1687 return(test_ret); 1688 } 1689 1690 1691 static int 1692 test_htmlCtxtReadMemory(void) { 1693 int test_ret = 0; 1694 1695 #if defined(LIBXML_HTML_ENABLED) 1696 int mem_base; 1697 htmlDocPtr ret_val; 1698 htmlParserCtxtPtr ctxt; /* an HTML parser context */ 1699 int n_ctxt; 1700 char * buffer; /* a pointer to a char array */ 1701 int n_buffer; 1702 int size; /* the size of the array */ 1703 int n_size; 1704 const char * URL; /* the base URL to use for the document */ 1705 int n_URL; 1706 char * encoding; /* the document encoding, or NULL */ 1707 int n_encoding; 1708 int options; /* a combination of htmlParserOption(s) */ 1709 int n_options; 1710 1711 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) { 1712 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) { 1713 for (n_size = 0;n_size < gen_nb_int;n_size++) { 1714 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) { 1715 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { 1716 for (n_options = 0;n_options < gen_nb_int;n_options++) { 1717 mem_base = xmlMemBlocks(); 1718 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0); 1719 buffer = gen_const_char_ptr(n_buffer, 1); 1720 size = gen_int(n_size, 2); 1721 URL = gen_filepath(n_URL, 3); 1722 encoding = gen_const_char_ptr(n_encoding, 4); 1723 options = gen_int(n_options, 5); 1724 1725 ret_val = htmlCtxtReadMemory(ctxt, (const char *)buffer, size, URL, (const char *)encoding, options); 1726 desret_htmlDocPtr(ret_val); 1727 call_tests++; 1728 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0); 1729 des_const_char_ptr(n_buffer, (const char *)buffer, 1); 1730 des_int(n_size, size, 2); 1731 des_filepath(n_URL, URL, 3); 1732 des_const_char_ptr(n_encoding, (const char *)encoding, 4); 1733 des_int(n_options, options, 5); 1734 xmlResetLastError(); 1735 if (mem_base != xmlMemBlocks()) { 1736 printf("Leak of %d blocks found in htmlCtxtReadMemory", 1737 xmlMemBlocks() - mem_base); 1738 test_ret++; 1739 printf(" %d", n_ctxt); 1740 printf(" %d", n_buffer); 1741 printf(" %d", n_size); 1742 printf(" %d", n_URL); 1743 printf(" %d", n_encoding); 1744 printf(" %d", n_options); 1745 printf("\n"); 1746 } 1747 } 1748 } 1749 } 1750 } 1751 } 1752 } 1753 function_tests++; 1754 #endif 1755 1756 return(test_ret); 1757 } 1758 1759 1760 static int 1761 test_htmlCtxtReset(void) { 1762 int test_ret = 0; 1763 1764 #if defined(LIBXML_HTML_ENABLED) 1765 int mem_base; 1766 htmlParserCtxtPtr ctxt; /* an HTML parser context */ 1767 int n_ctxt; 1768 1769 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) { 1770 mem_base = xmlMemBlocks(); 1771 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0); 1772 1773 htmlCtxtReset(ctxt); 1774 call_tests++; 1775 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0); 1776 xmlResetLastError(); 1777 if (mem_base != xmlMemBlocks()) { 1778 printf("Leak of %d blocks found in htmlCtxtReset", 1779 xmlMemBlocks() - mem_base); 1780 test_ret++; 1781 printf(" %d", n_ctxt); 1782 printf("\n"); 1783 } 1784 } 1785 function_tests++; 1786 #endif 1787 1788 return(test_ret); 1789 } 1790 1791 1792 static int 1793 test_htmlCtxtUseOptions(void) { 1794 int test_ret = 0; 1795 1796 #if defined(LIBXML_HTML_ENABLED) 1797 int mem_base; 1798 int ret_val; 1799 htmlParserCtxtPtr ctxt; /* an HTML parser context */ 1800 int n_ctxt; 1801 int options; /* a combination of htmlParserOption(s) */ 1802 int n_options; 1803 1804 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) { 1805 for (n_options = 0;n_options < gen_nb_int;n_options++) { 1806 mem_base = xmlMemBlocks(); 1807 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0); 1808 options = gen_int(n_options, 1); 1809 1810 ret_val = htmlCtxtUseOptions(ctxt, options); 1811 desret_int(ret_val); 1812 call_tests++; 1813 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0); 1814 des_int(n_options, options, 1); 1815 xmlResetLastError(); 1816 if (mem_base != xmlMemBlocks()) { 1817 printf("Leak of %d blocks found in htmlCtxtUseOptions", 1818 xmlMemBlocks() - mem_base); 1819 test_ret++; 1820 printf(" %d", n_ctxt); 1821 printf(" %d", n_options); 1822 printf("\n"); 1823 } 1824 } 1825 } 1826 function_tests++; 1827 #endif 1828 1829 return(test_ret); 1830 } 1831 1832 1833 static int 1834 test_htmlElementAllowedHere(void) { 1835 int test_ret = 0; 1836 1837 #if defined(LIBXML_HTML_ENABLED) 1838 int mem_base; 1839 int ret_val; 1840 htmlElemDesc * parent; /* HTML parent element */ 1841 int n_parent; 1842 xmlChar * elt; /* HTML element */ 1843 int n_elt; 1844 1845 for (n_parent = 0;n_parent < gen_nb_const_htmlElemDesc_ptr;n_parent++) { 1846 for (n_elt = 0;n_elt < gen_nb_const_xmlChar_ptr;n_elt++) { 1847 mem_base = xmlMemBlocks(); 1848 parent = gen_const_htmlElemDesc_ptr(n_parent, 0); 1849 elt = gen_const_xmlChar_ptr(n_elt, 1); 1850 1851 ret_val = htmlElementAllowedHere((const htmlElemDesc *)parent, (const xmlChar *)elt); 1852 desret_int(ret_val); 1853 call_tests++; 1854 des_const_htmlElemDesc_ptr(n_parent, (const htmlElemDesc *)parent, 0); 1855 des_const_xmlChar_ptr(n_elt, (const xmlChar *)elt, 1); 1856 xmlResetLastError(); 1857 if (mem_base != xmlMemBlocks()) { 1858 printf("Leak of %d blocks found in htmlElementAllowedHere", 1859 xmlMemBlocks() - mem_base); 1860 test_ret++; 1861 printf(" %d", n_parent); 1862 printf(" %d", n_elt); 1863 printf("\n"); 1864 } 1865 } 1866 } 1867 function_tests++; 1868 #endif 1869 1870 return(test_ret); 1871 } 1872 1873 1874 static int 1875 test_htmlElementStatusHere(void) { 1876 int test_ret = 0; 1877 1878 #if defined(LIBXML_HTML_ENABLED) 1879 int mem_base; 1880 htmlStatus ret_val; 1881 htmlElemDesc * parent; /* HTML parent element */ 1882 int n_parent; 1883 htmlElemDesc * elt; /* HTML element */ 1884 int n_elt; 1885 1886 for (n_parent = 0;n_parent < gen_nb_const_htmlElemDesc_ptr;n_parent++) { 1887 for (n_elt = 0;n_elt < gen_nb_const_htmlElemDesc_ptr;n_elt++) { 1888 mem_base = xmlMemBlocks(); 1889 parent = gen_const_htmlElemDesc_ptr(n_parent, 0); 1890 elt = gen_const_htmlElemDesc_ptr(n_elt, 1); 1891 1892 ret_val = htmlElementStatusHere((const htmlElemDesc *)parent, (const htmlElemDesc *)elt); 1893 desret_htmlStatus(ret_val); 1894 call_tests++; 1895 des_const_htmlElemDesc_ptr(n_parent, (const htmlElemDesc *)parent, 0); 1896 des_const_htmlElemDesc_ptr(n_elt, (const htmlElemDesc *)elt, 1); 1897 xmlResetLastError(); 1898 if (mem_base != xmlMemBlocks()) { 1899 printf("Leak of %d blocks found in htmlElementStatusHere", 1900 xmlMemBlocks() - mem_base); 1901 test_ret++; 1902 printf(" %d", n_parent); 1903 printf(" %d", n_elt); 1904 printf("\n"); 1905 } 1906 } 1907 } 1908 function_tests++; 1909 #endif 1910 1911 return(test_ret); 1912 } 1913 1914 1915 static int 1916 test_htmlEncodeEntities(void) { 1917 int test_ret = 0; 1918 1919 #if defined(LIBXML_HTML_ENABLED) 1920 int mem_base; 1921 int ret_val; 1922 unsigned char * out; /* a pointer to an array of bytes to store the result */ 1923 int n_out; 1924 int * outlen; /* the length of @out */ 1925 int n_outlen; 1926 unsigned char * in; /* a pointer to an array of UTF-8 chars */ 1927 int n_in; 1928 int * inlen; /* the length of @in */ 1929 int n_inlen; 1930 int quoteChar; /* the quote character to escape (' or ") or zero. */ 1931 int n_quoteChar; 1932 1933 for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) { 1934 for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) { 1935 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) { 1936 for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) { 1937 for (n_quoteChar = 0;n_quoteChar < gen_nb_int;n_quoteChar++) { 1938 mem_base = xmlMemBlocks(); 1939 out = gen_unsigned_char_ptr(n_out, 0); 1940 outlen = gen_int_ptr(n_outlen, 1); 1941 in = gen_const_unsigned_char_ptr(n_in, 2); 1942 inlen = gen_int_ptr(n_inlen, 3); 1943 quoteChar = gen_int(n_quoteChar, 4); 1944 1945 ret_val = htmlEncodeEntities(out, outlen, (const unsigned char *)in, inlen, quoteChar); 1946 desret_int(ret_val); 1947 call_tests++; 1948 des_unsigned_char_ptr(n_out, out, 0); 1949 des_int_ptr(n_outlen, outlen, 1); 1950 des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 2); 1951 des_int_ptr(n_inlen, inlen, 3); 1952 des_int(n_quoteChar, quoteChar, 4); 1953 xmlResetLastError(); 1954 if (mem_base != xmlMemBlocks()) { 1955 printf("Leak of %d blocks found in htmlEncodeEntities", 1956 xmlMemBlocks() - mem_base); 1957 test_ret++; 1958 printf(" %d", n_out); 1959 printf(" %d", n_outlen); 1960 printf(" %d", n_in); 1961 printf(" %d", n_inlen); 1962 printf(" %d", n_quoteChar); 1963 printf("\n"); 1964 } 1965 } 1966 } 1967 } 1968 } 1969 } 1970 function_tests++; 1971 #endif 1972 1973 return(test_ret); 1974 } 1975 1976 1977 static int 1978 test_htmlEntityLookup(void) { 1979 int test_ret = 0; 1980 1981 #if defined(LIBXML_HTML_ENABLED) 1982 int mem_base; 1983 const htmlEntityDesc * ret_val; 1984 xmlChar * name; /* the entity name */ 1985 int n_name; 1986 1987 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { 1988 mem_base = xmlMemBlocks(); 1989 name = gen_const_xmlChar_ptr(n_name, 0); 1990 1991 ret_val = htmlEntityLookup((const xmlChar *)name); 1992 desret_const_htmlEntityDesc_ptr(ret_val); 1993 call_tests++; 1994 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0); 1995 xmlResetLastError(); 1996 if (mem_base != xmlMemBlocks()) { 1997 printf("Leak of %d blocks found in htmlEntityLookup", 1998 xmlMemBlocks() - mem_base); 1999 test_ret++; 2000 printf(" %d", n_name); 2001 printf("\n"); 2002 } 2003 } 2004 function_tests++; 2005 #endif 2006 2007 return(test_ret); 2008 } 2009 2010 2011 static int 2012 test_htmlEntityValueLookup(void) { 2013 int test_ret = 0; 2014 2015 #if defined(LIBXML_HTML_ENABLED) 2016 int mem_base; 2017 const htmlEntityDesc * ret_val; 2018 unsigned int value; /* the entity's unicode value */ 2019 int n_value; 2020 2021 for (n_value = 0;n_value < gen_nb_unsigned_int;n_value++) { 2022 mem_base = xmlMemBlocks(); 2023 value = gen_unsigned_int(n_value, 0); 2024 2025 ret_val = htmlEntityValueLookup(value); 2026 desret_const_htmlEntityDesc_ptr(ret_val); 2027 call_tests++; 2028 des_unsigned_int(n_value, value, 0); 2029 xmlResetLastError(); 2030 if (mem_base != xmlMemBlocks()) { 2031 printf("Leak of %d blocks found in htmlEntityValueLookup", 2032 xmlMemBlocks() - mem_base); 2033 test_ret++; 2034 printf(" %d", n_value); 2035 printf("\n"); 2036 } 2037 } 2038 function_tests++; 2039 #endif 2040 2041 return(test_ret); 2042 } 2043 2044 2045 static int 2046 test_htmlHandleOmittedElem(void) { 2047 int test_ret = 0; 2048 2049 #if defined(LIBXML_HTML_ENABLED) 2050 int mem_base; 2051 int ret_val; 2052 int val; /* int 0 or 1 */ 2053 int n_val; 2054 2055 for (n_val = 0;n_val < gen_nb_int;n_val++) { 2056 mem_base = xmlMemBlocks(); 2057 val = gen_int(n_val, 0); 2058 2059 ret_val = htmlHandleOmittedElem(val); 2060 desret_int(ret_val); 2061 call_tests++; 2062 des_int(n_val, val, 0); 2063 xmlResetLastError(); 2064 if (mem_base != xmlMemBlocks()) { 2065 printf("Leak of %d blocks found in htmlHandleOmittedElem", 2066 xmlMemBlocks() - mem_base); 2067 test_ret++; 2068 printf(" %d", n_val); 2069 printf("\n"); 2070 } 2071 } 2072 function_tests++; 2073 #endif 2074 2075 return(test_ret); 2076 } 2077 2078 2079 static int 2080 test_htmlIsAutoClosed(void) { 2081 int test_ret = 0; 2082 2083 #if defined(LIBXML_HTML_ENABLED) 2084 int mem_base; 2085 int ret_val; 2086 htmlDocPtr doc; /* the HTML document */ 2087 int n_doc; 2088 htmlNodePtr elem; /* the HTML element */ 2089 int n_elem; 2090 2091 for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) { 2092 for (n_elem = 0;n_elem < gen_nb_htmlNodePtr;n_elem++) { 2093 mem_base = xmlMemBlocks(); 2094 doc = gen_htmlDocPtr(n_doc, 0); 2095 elem = gen_htmlNodePtr(n_elem, 1); 2096 2097 ret_val = htmlIsAutoClosed(doc, elem); 2098 desret_int(ret_val); 2099 call_tests++; 2100 des_htmlDocPtr(n_doc, doc, 0); 2101 des_htmlNodePtr(n_elem, elem, 1); 2102 xmlResetLastError(); 2103 if (mem_base != xmlMemBlocks()) { 2104 printf("Leak of %d blocks found in htmlIsAutoClosed", 2105 xmlMemBlocks() - mem_base); 2106 test_ret++; 2107 printf(" %d", n_doc); 2108 printf(" %d", n_elem); 2109 printf("\n"); 2110 } 2111 } 2112 } 2113 function_tests++; 2114 #endif 2115 2116 return(test_ret); 2117 } 2118 2119 2120 static int 2121 test_htmlIsScriptAttribute(void) { 2122 int test_ret = 0; 2123 2124 #if defined(LIBXML_HTML_ENABLED) 2125 int mem_base; 2126 int ret_val; 2127 xmlChar * name; /* an attribute name */ 2128 int n_name; 2129 2130 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { 2131 mem_base = xmlMemBlocks(); 2132 name = gen_const_xmlChar_ptr(n_name, 0); 2133 2134 ret_val = htmlIsScriptAttribute((const xmlChar *)name); 2135 desret_int(ret_val); 2136 call_tests++; 2137 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0); 2138 xmlResetLastError(); 2139 if (mem_base != xmlMemBlocks()) { 2140 printf("Leak of %d blocks found in htmlIsScriptAttribute", 2141 xmlMemBlocks() - mem_base); 2142 test_ret++; 2143 printf(" %d", n_name); 2144 printf("\n"); 2145 } 2146 } 2147 function_tests++; 2148 #endif 2149 2150 return(test_ret); 2151 } 2152 2153 2154 static int 2155 test_htmlNewParserCtxt(void) { 2156 int test_ret = 0; 2157 2158 #if defined(LIBXML_HTML_ENABLED) 2159 int mem_base; 2160 htmlParserCtxtPtr ret_val; 2161 2162 mem_base = xmlMemBlocks(); 2163 2164 ret_val = htmlNewParserCtxt(); 2165 desret_htmlParserCtxtPtr(ret_val); 2166 call_tests++; 2167 xmlResetLastError(); 2168 if (mem_base != xmlMemBlocks()) { 2169 printf("Leak of %d blocks found in htmlNewParserCtxt", 2170 xmlMemBlocks() - mem_base); 2171 test_ret++; 2172 printf("\n"); 2173 } 2174 function_tests++; 2175 #endif 2176 2177 return(test_ret); 2178 } 2179 2180 2181 static int 2182 test_htmlNodeStatus(void) { 2183 int test_ret = 0; 2184 2185 #if defined(LIBXML_HTML_ENABLED) 2186 int mem_base; 2187 htmlStatus ret_val; 2188 htmlNodePtr node; /* an htmlNodePtr in a tree */ 2189 int n_node; 2190 int legacy; /* whether to allow deprecated elements (YES is faster here for Element nodes) */ 2191 int n_legacy; 2192 2193 for (n_node = 0;n_node < gen_nb_const_htmlNodePtr;n_node++) { 2194 for (n_legacy = 0;n_legacy < gen_nb_int;n_legacy++) { 2195 mem_base = xmlMemBlocks(); 2196 node = gen_const_htmlNodePtr(n_node, 0); 2197 legacy = gen_int(n_legacy, 1); 2198 2199 ret_val = htmlNodeStatus((const htmlNodePtr)node, legacy); 2200 desret_htmlStatus(ret_val); 2201 call_tests++; 2202 des_const_htmlNodePtr(n_node, (const htmlNodePtr)node, 0); 2203 des_int(n_legacy, legacy, 1); 2204 xmlResetLastError(); 2205 if (mem_base != xmlMemBlocks()) { 2206 printf("Leak of %d blocks found in htmlNodeStatus", 2207 xmlMemBlocks() - mem_base); 2208 test_ret++; 2209 printf(" %d", n_node); 2210 printf(" %d", n_legacy); 2211 printf("\n"); 2212 } 2213 } 2214 } 2215 function_tests++; 2216 #endif 2217 2218 return(test_ret); 2219 } 2220 2221 2222 static int 2223 test_htmlParseCharRef(void) { 2224 int test_ret = 0; 2225 2226 #if defined(LIBXML_HTML_ENABLED) 2227 int mem_base; 2228 int ret_val; 2229 htmlParserCtxtPtr ctxt; /* an HTML parser context */ 2230 int n_ctxt; 2231 2232 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) { 2233 mem_base = xmlMemBlocks(); 2234 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0); 2235 2236 ret_val = htmlParseCharRef(ctxt); 2237 desret_int(ret_val); 2238 call_tests++; 2239 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0); 2240 xmlResetLastError(); 2241 if (mem_base != xmlMemBlocks()) { 2242 printf("Leak of %d blocks found in htmlParseCharRef", 2243 xmlMemBlocks() - mem_base); 2244 test_ret++; 2245 printf(" %d", n_ctxt); 2246 printf("\n"); 2247 } 2248 } 2249 function_tests++; 2250 #endif 2251 2252 return(test_ret); 2253 } 2254 2255 2256 static int 2257 test_htmlParseChunk(void) { 2258 int test_ret = 0; 2259 2260 #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_PUSH_ENABLED) 2261 int mem_base; 2262 int ret_val; 2263 htmlParserCtxtPtr ctxt; /* an HTML parser context */ 2264 int n_ctxt; 2265 char * chunk; /* an char array */ 2266 int n_chunk; 2267 int size; /* the size in byte of the chunk */ 2268 int n_size; 2269 int terminate; /* last chunk indicator */ 2270 int n_terminate; 2271 2272 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) { 2273 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) { 2274 for (n_size = 0;n_size < gen_nb_int;n_size++) { 2275 for (n_terminate = 0;n_terminate < gen_nb_int;n_terminate++) { 2276 mem_base = xmlMemBlocks(); 2277 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0); 2278 chunk = gen_const_char_ptr(n_chunk, 1); 2279 size = gen_int(n_size, 2); 2280 terminate = gen_int(n_terminate, 3); 2281 2282 ret_val = htmlParseChunk(ctxt, (const char *)chunk, size, terminate); 2283 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;} 2284 desret_int(ret_val); 2285 call_tests++; 2286 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0); 2287 des_const_char_ptr(n_chunk, (const char *)chunk, 1); 2288 des_int(n_size, size, 2); 2289 des_int(n_terminate, terminate, 3); 2290 xmlResetLastError(); 2291 if (mem_base != xmlMemBlocks()) { 2292 printf("Leak of %d blocks found in htmlParseChunk", 2293 xmlMemBlocks() - mem_base); 2294 test_ret++; 2295 printf(" %d", n_ctxt); 2296 printf(" %d", n_chunk); 2297 printf(" %d", n_size); 2298 printf(" %d", n_terminate); 2299 printf("\n"); 2300 } 2301 } 2302 } 2303 } 2304 } 2305 function_tests++; 2306 #endif 2307 2308 return(test_ret); 2309 } 2310 2311 2312 static int 2313 test_htmlParseDoc(void) { 2314 int test_ret = 0; 2315 2316 #if defined(LIBXML_HTML_ENABLED) 2317 int mem_base; 2318 htmlDocPtr ret_val; 2319 xmlChar * cur; /* a pointer to an array of xmlChar */ 2320 int n_cur; 2321 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */ 2322 int n_encoding; 2323 2324 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) { 2325 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { 2326 mem_base = xmlMemBlocks(); 2327 cur = gen_xmlChar_ptr(n_cur, 0); 2328 encoding = gen_const_char_ptr(n_encoding, 1); 2329 2330 ret_val = htmlParseDoc(cur, (const char *)encoding); 2331 desret_htmlDocPtr(ret_val); 2332 call_tests++; 2333 des_xmlChar_ptr(n_cur, cur, 0); 2334 des_const_char_ptr(n_encoding, (const char *)encoding, 1); 2335 xmlResetLastError(); 2336 if (mem_base != xmlMemBlocks()) { 2337 printf("Leak of %d blocks found in htmlParseDoc", 2338 xmlMemBlocks() - mem_base); 2339 test_ret++; 2340 printf(" %d", n_cur); 2341 printf(" %d", n_encoding); 2342 printf("\n"); 2343 } 2344 } 2345 } 2346 function_tests++; 2347 #endif 2348 2349 return(test_ret); 2350 } 2351 2352 2353 static int 2354 test_htmlParseDocument(void) { 2355 int test_ret = 0; 2356 2357 #if defined(LIBXML_HTML_ENABLED) 2358 int mem_base; 2359 int ret_val; 2360 htmlParserCtxtPtr ctxt; /* an HTML parser context */ 2361 int n_ctxt; 2362 2363 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) { 2364 mem_base = xmlMemBlocks(); 2365 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0); 2366 2367 ret_val = htmlParseDocument(ctxt); 2368 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;} 2369 desret_int(ret_val); 2370 call_tests++; 2371 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0); 2372 xmlResetLastError(); 2373 if (mem_base != xmlMemBlocks()) { 2374 printf("Leak of %d blocks found in htmlParseDocument", 2375 xmlMemBlocks() - mem_base); 2376 test_ret++; 2377 printf(" %d", n_ctxt); 2378 printf("\n"); 2379 } 2380 } 2381 function_tests++; 2382 #endif 2383 2384 return(test_ret); 2385 } 2386 2387 2388 static int 2389 test_htmlParseElement(void) { 2390 int test_ret = 0; 2391 2392 #if defined(LIBXML_HTML_ENABLED) 2393 int mem_base; 2394 htmlParserCtxtPtr ctxt; /* an HTML parser context */ 2395 int n_ctxt; 2396 2397 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) { 2398 mem_base = xmlMemBlocks(); 2399 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0); 2400 2401 htmlParseElement(ctxt); 2402 call_tests++; 2403 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0); 2404 xmlResetLastError(); 2405 if (mem_base != xmlMemBlocks()) { 2406 printf("Leak of %d blocks found in htmlParseElement", 2407 xmlMemBlocks() - mem_base); 2408 test_ret++; 2409 printf(" %d", n_ctxt); 2410 printf("\n"); 2411 } 2412 } 2413 function_tests++; 2414 #endif 2415 2416 return(test_ret); 2417 } 2418 2419 2420 static int 2421 test_htmlParseEntityRef(void) { 2422 int test_ret = 0; 2423 2424 #if defined(LIBXML_HTML_ENABLED) 2425 int mem_base; 2426 const htmlEntityDesc * ret_val; 2427 htmlParserCtxtPtr ctxt; /* an HTML parser context */ 2428 int n_ctxt; 2429 xmlChar ** str; /* location to store the entity name */ 2430 int n_str; 2431 2432 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) { 2433 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr_ptr;n_str++) { 2434 mem_base = xmlMemBlocks(); 2435 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0); 2436 str = gen_const_xmlChar_ptr_ptr(n_str, 1); 2437 2438 ret_val = htmlParseEntityRef(ctxt, (const xmlChar **)str); 2439 desret_const_htmlEntityDesc_ptr(ret_val); 2440 call_tests++; 2441 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0); 2442 des_const_xmlChar_ptr_ptr(n_str, (const xmlChar **)str, 1); 2443 xmlResetLastError(); 2444 if (mem_base != xmlMemBlocks()) { 2445 printf("Leak of %d blocks found in htmlParseEntityRef", 2446 xmlMemBlocks() - mem_base); 2447 test_ret++; 2448 printf(" %d", n_ctxt); 2449 printf(" %d", n_str); 2450 printf("\n"); 2451 } 2452 } 2453 } 2454 function_tests++; 2455 #endif 2456 2457 return(test_ret); 2458 } 2459 2460 2461 static int 2462 test_htmlParseFile(void) { 2463 int test_ret = 0; 2464 2465 #if defined(LIBXML_HTML_ENABLED) 2466 htmlDocPtr ret_val; 2467 const char * filename; /* the filename */ 2468 int n_filename; 2469 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */ 2470 int n_encoding; 2471 2472 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { 2473 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { 2474 filename = gen_filepath(n_filename, 0); 2475 encoding = gen_const_char_ptr(n_encoding, 1); 2476 2477 ret_val = htmlParseFile(filename, (const char *)encoding); 2478 desret_htmlDocPtr(ret_val); 2479 call_tests++; 2480 des_filepath(n_filename, filename, 0); 2481 des_const_char_ptr(n_encoding, (const char *)encoding, 1); 2482 xmlResetLastError(); 2483 } 2484 } 2485 function_tests++; 2486 #endif 2487 2488 return(test_ret); 2489 } 2490 2491 2492 static int 2493 test_htmlReadDoc(void) { 2494 int test_ret = 0; 2495 2496 #if defined(LIBXML_HTML_ENABLED) 2497 int mem_base; 2498 htmlDocPtr ret_val; 2499 xmlChar * cur; /* a pointer to a zero terminated string */ 2500 int n_cur; 2501 const char * URL; /* the base URL to use for the document */ 2502 int n_URL; 2503 char * encoding; /* the document encoding, or NULL */ 2504 int n_encoding; 2505 int options; /* a combination of htmlParserOption(s) */ 2506 int n_options; 2507 2508 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) { 2509 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) { 2510 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { 2511 for (n_options = 0;n_options < gen_nb_int;n_options++) { 2512 mem_base = xmlMemBlocks(); 2513 cur = gen_const_xmlChar_ptr(n_cur, 0); 2514 URL = gen_filepath(n_URL, 1); 2515 encoding = gen_const_char_ptr(n_encoding, 2); 2516 options = gen_int(n_options, 3); 2517 2518 ret_val = htmlReadDoc((const xmlChar *)cur, URL, (const char *)encoding, options); 2519 desret_htmlDocPtr(ret_val); 2520 call_tests++; 2521 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0); 2522 des_filepath(n_URL, URL, 1); 2523 des_const_char_ptr(n_encoding, (const char *)encoding, 2); 2524 des_int(n_options, options, 3); 2525 xmlResetLastError(); 2526 if (mem_base != xmlMemBlocks()) { 2527 printf("Leak of %d blocks found in htmlReadDoc", 2528 xmlMemBlocks() - mem_base); 2529 test_ret++; 2530 printf(" %d", n_cur); 2531 printf(" %d", n_URL); 2532 printf(" %d", n_encoding); 2533 printf(" %d", n_options); 2534 printf("\n"); 2535 } 2536 } 2537 } 2538 } 2539 } 2540 function_tests++; 2541 #endif 2542 2543 return(test_ret); 2544 } 2545 2546 2547 static int 2548 test_htmlReadFile(void) { 2549 int test_ret = 0; 2550 2551 #if defined(LIBXML_HTML_ENABLED) 2552 int mem_base; 2553 htmlDocPtr ret_val; 2554 const char * filename; /* a file or URL */ 2555 int n_filename; 2556 char * encoding; /* the document encoding, or NULL */ 2557 int n_encoding; 2558 int options; /* a combination of htmlParserOption(s) */ 2559 int n_options; 2560 2561 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { 2562 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { 2563 for (n_options = 0;n_options < gen_nb_int;n_options++) { 2564 mem_base = xmlMemBlocks(); 2565 filename = gen_filepath(n_filename, 0); 2566 encoding = gen_const_char_ptr(n_encoding, 1); 2567 options = gen_int(n_options, 2); 2568 2569 ret_val = htmlReadFile(filename, (const char *)encoding, options); 2570 desret_htmlDocPtr(ret_val); 2571 call_tests++; 2572 des_filepath(n_filename, filename, 0); 2573 des_const_char_ptr(n_encoding, (const char *)encoding, 1); 2574 des_int(n_options, options, 2); 2575 xmlResetLastError(); 2576 if (mem_base != xmlMemBlocks()) { 2577 printf("Leak of %d blocks found in htmlReadFile", 2578 xmlMemBlocks() - mem_base); 2579 test_ret++; 2580 printf(" %d", n_filename); 2581 printf(" %d", n_encoding); 2582 printf(" %d", n_options); 2583 printf("\n"); 2584 } 2585 } 2586 } 2587 } 2588 function_tests++; 2589 #endif 2590 2591 return(test_ret); 2592 } 2593 2594 2595 static int 2596 test_htmlReadMemory(void) { 2597 int test_ret = 0; 2598 2599 #if defined(LIBXML_HTML_ENABLED) 2600 int mem_base; 2601 htmlDocPtr ret_val; 2602 char * buffer; /* a pointer to a char array */ 2603 int n_buffer; 2604 int size; /* the size of the array */ 2605 int n_size; 2606 const char * URL; /* the base URL to use for the document */ 2607 int n_URL; 2608 char * encoding; /* the document encoding, or NULL */ 2609 int n_encoding; 2610 int options; /* a combination of htmlParserOption(s) */ 2611 int n_options; 2612 2613 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) { 2614 for (n_size = 0;n_size < gen_nb_int;n_size++) { 2615 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) { 2616 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { 2617 for (n_options = 0;n_options < gen_nb_int;n_options++) { 2618 mem_base = xmlMemBlocks(); 2619 buffer = gen_const_char_ptr(n_buffer, 0); 2620 size = gen_int(n_size, 1); 2621 URL = gen_filepath(n_URL, 2); 2622 encoding = gen_const_char_ptr(n_encoding, 3); 2623 options = gen_int(n_options, 4); 2624 2625 ret_val = htmlReadMemory((const char *)buffer, size, URL, (const char *)encoding, options); 2626 desret_htmlDocPtr(ret_val); 2627 call_tests++; 2628 des_const_char_ptr(n_buffer, (const char *)buffer, 0); 2629 des_int(n_size, size, 1); 2630 des_filepath(n_URL, URL, 2); 2631 des_const_char_ptr(n_encoding, (const char *)encoding, 3); 2632 des_int(n_options, options, 4); 2633 xmlResetLastError(); 2634 if (mem_base != xmlMemBlocks()) { 2635 printf("Leak of %d blocks found in htmlReadMemory", 2636 xmlMemBlocks() - mem_base); 2637 test_ret++; 2638 printf(" %d", n_buffer); 2639 printf(" %d", n_size); 2640 printf(" %d", n_URL); 2641 printf(" %d", n_encoding); 2642 printf(" %d", n_options); 2643 printf("\n"); 2644 } 2645 } 2646 } 2647 } 2648 } 2649 } 2650 function_tests++; 2651 #endif 2652 2653 return(test_ret); 2654 } 2655 2656 2657 static int 2658 test_htmlSAXParseDoc(void) { 2659 int test_ret = 0; 2660 2661 #if defined(LIBXML_HTML_ENABLED) 2662 int mem_base; 2663 htmlDocPtr ret_val; 2664 xmlChar * cur; /* a pointer to an array of xmlChar */ 2665 int n_cur; 2666 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */ 2667 int n_encoding; 2668 htmlSAXHandlerPtr sax; /* the SAX handler block */ 2669 int n_sax; 2670 void * userData; /* if using SAX, this pointer will be provided on callbacks. */ 2671 int n_userData; 2672 2673 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) { 2674 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { 2675 for (n_sax = 0;n_sax < gen_nb_htmlSAXHandlerPtr;n_sax++) { 2676 for (n_userData = 0;n_userData < gen_nb_userdata;n_userData++) { 2677 mem_base = xmlMemBlocks(); 2678 cur = gen_xmlChar_ptr(n_cur, 0); 2679 encoding = gen_const_char_ptr(n_encoding, 1); 2680 sax = gen_htmlSAXHandlerPtr(n_sax, 2); 2681 userData = gen_userdata(n_userData, 3); 2682 2683 ret_val = htmlSAXParseDoc(cur, (const char *)encoding, sax, userData); 2684 desret_htmlDocPtr(ret_val); 2685 call_tests++; 2686 des_xmlChar_ptr(n_cur, cur, 0); 2687 des_const_char_ptr(n_encoding, (const char *)encoding, 1); 2688 des_htmlSAXHandlerPtr(n_sax, sax, 2); 2689 des_userdata(n_userData, userData, 3); 2690 xmlResetLastError(); 2691 if (mem_base != xmlMemBlocks()) { 2692 printf("Leak of %d blocks found in htmlSAXParseDoc", 2693 xmlMemBlocks() - mem_base); 2694 test_ret++; 2695 printf(" %d", n_cur); 2696 printf(" %d", n_encoding); 2697 printf(" %d", n_sax); 2698 printf(" %d", n_userData); 2699 printf("\n"); 2700 } 2701 } 2702 } 2703 } 2704 } 2705 function_tests++; 2706 #endif 2707 2708 return(test_ret); 2709 } 2710 2711 2712 static int 2713 test_htmlSAXParseFile(void) { 2714 int test_ret = 0; 2715 2716 #if defined(LIBXML_HTML_ENABLED) 2717 int mem_base; 2718 htmlDocPtr ret_val; 2719 const char * filename; /* the filename */ 2720 int n_filename; 2721 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */ 2722 int n_encoding; 2723 htmlSAXHandlerPtr sax; /* the SAX handler block */ 2724 int n_sax; 2725 void * userData; /* if using SAX, this pointer will be provided on callbacks. */ 2726 int n_userData; 2727 2728 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { 2729 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { 2730 for (n_sax = 0;n_sax < gen_nb_htmlSAXHandlerPtr;n_sax++) { 2731 for (n_userData = 0;n_userData < gen_nb_userdata;n_userData++) { 2732 mem_base = xmlMemBlocks(); 2733 filename = gen_filepath(n_filename, 0); 2734 encoding = gen_const_char_ptr(n_encoding, 1); 2735 sax = gen_htmlSAXHandlerPtr(n_sax, 2); 2736 userData = gen_userdata(n_userData, 3); 2737 2738 ret_val = htmlSAXParseFile(filename, (const char *)encoding, sax, userData); 2739 desret_htmlDocPtr(ret_val); 2740 call_tests++; 2741 des_filepath(n_filename, filename, 0); 2742 des_const_char_ptr(n_encoding, (const char *)encoding, 1); 2743 des_htmlSAXHandlerPtr(n_sax, sax, 2); 2744 des_userdata(n_userData, userData, 3); 2745 xmlResetLastError(); 2746 if (mem_base != xmlMemBlocks()) { 2747 printf("Leak of %d blocks found in htmlSAXParseFile", 2748 xmlMemBlocks() - mem_base); 2749 test_ret++; 2750 printf(" %d", n_filename); 2751 printf(" %d", n_encoding); 2752 printf(" %d", n_sax); 2753 printf(" %d", n_userData); 2754 printf("\n"); 2755 } 2756 } 2757 } 2758 } 2759 } 2760 function_tests++; 2761 #endif 2762 2763 return(test_ret); 2764 } 2765 2766 2767 static int 2768 test_htmlTagLookup(void) { 2769 int test_ret = 0; 2770 2771 2772 /* missing type support */ 2773 return(test_ret); 2774 } 2775 2776 static int 2777 test_HTMLparser(void) { 2778 int test_ret = 0; 2779 2780 if (quiet == 0) printf("Testing HTMLparser : 32 of 38 functions ...\n"); 2781 test_ret += test_UTF8ToHtml(); 2782 test_ret += test_htmlAttrAllowed(); 2783 test_ret += test_htmlAutoCloseTag(); 2784 test_ret += test_htmlCreateMemoryParserCtxt(); 2785 test_ret += test_htmlCreatePushParserCtxt(); 2786 test_ret += test_htmlCtxtReadDoc(); 2787 test_ret += test_htmlCtxtReadFile(); 2788 test_ret += test_htmlCtxtReadMemory(); 2789 test_ret += test_htmlCtxtReset(); 2790 test_ret += test_htmlCtxtUseOptions(); 2791 test_ret += test_htmlElementAllowedHere(); 2792 test_ret += test_htmlElementStatusHere(); 2793 test_ret += test_htmlEncodeEntities(); 2794 test_ret += test_htmlEntityLookup(); 2795 test_ret += test_htmlEntityValueLookup(); 2796 test_ret += test_htmlHandleOmittedElem(); 2797 test_ret += test_htmlIsAutoClosed(); 2798 test_ret += test_htmlIsScriptAttribute(); 2799 test_ret += test_htmlNewParserCtxt(); 2800 test_ret += test_htmlNodeStatus(); 2801 test_ret += test_htmlParseCharRef(); 2802 test_ret += test_htmlParseChunk(); 2803 test_ret += test_htmlParseDoc(); 2804 test_ret += test_htmlParseDocument(); 2805 test_ret += test_htmlParseElement(); 2806 test_ret += test_htmlParseEntityRef(); 2807 test_ret += test_htmlParseFile(); 2808 test_ret += test_htmlReadDoc(); 2809 test_ret += test_htmlReadFile(); 2810 test_ret += test_htmlReadMemory(); 2811 test_ret += test_htmlSAXParseDoc(); 2812 test_ret += test_htmlSAXParseFile(); 2813 test_ret += test_htmlTagLookup(); 2814 2815 if (test_ret != 0) 2816 printf("Module HTMLparser: %d errors\n", test_ret); 2817 return(test_ret); 2818 } 2819 2820 static int 2821 test_htmlDocContentDumpFormatOutput(void) { 2822 int test_ret = 0; 2823 2824 #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) 2825 int mem_base; 2826 xmlOutputBufferPtr buf; /* the HTML buffer output */ 2827 int n_buf; 2828 xmlDocPtr cur; /* the document */ 2829 int n_cur; 2830 char * encoding; /* the encoding string */ 2831 int n_encoding; 2832 int format; /* should formatting spaces been added */ 2833 int n_format; 2834 2835 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) { 2836 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) { 2837 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { 2838 for (n_format = 0;n_format < gen_nb_int;n_format++) { 2839 mem_base = xmlMemBlocks(); 2840 buf = gen_xmlOutputBufferPtr(n_buf, 0); 2841 cur = gen_xmlDocPtr(n_cur, 1); 2842 encoding = gen_const_char_ptr(n_encoding, 2); 2843 format = gen_int(n_format, 3); 2844 2845 htmlDocContentDumpFormatOutput(buf, cur, (const char *)encoding, format); 2846 call_tests++; 2847 des_xmlOutputBufferPtr(n_buf, buf, 0); 2848 des_xmlDocPtr(n_cur, cur, 1); 2849 des_const_char_ptr(n_encoding, (const char *)encoding, 2); 2850 des_int(n_format, format, 3); 2851 xmlResetLastError(); 2852 if (mem_base != xmlMemBlocks()) { 2853 printf("Leak of %d blocks found in htmlDocContentDumpFormatOutput", 2854 xmlMemBlocks() - mem_base); 2855 test_ret++; 2856 printf(" %d", n_buf); 2857 printf(" %d", n_cur); 2858 printf(" %d", n_encoding); 2859 printf(" %d", n_format); 2860 printf("\n"); 2861 } 2862 } 2863 } 2864 } 2865 } 2866 function_tests++; 2867 #endif 2868 2869 return(test_ret); 2870 } 2871 2872 2873 static int 2874 test_htmlDocContentDumpOutput(void) { 2875 int test_ret = 0; 2876 2877 #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) 2878 int mem_base; 2879 xmlOutputBufferPtr buf; /* the HTML buffer output */ 2880 int n_buf; 2881 xmlDocPtr cur; /* the document */ 2882 int n_cur; 2883 char * encoding; /* the encoding string */ 2884 int n_encoding; 2885 2886 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) { 2887 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) { 2888 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { 2889 mem_base = xmlMemBlocks(); 2890 buf = gen_xmlOutputBufferPtr(n_buf, 0); 2891 cur = gen_xmlDocPtr(n_cur, 1); 2892 encoding = gen_const_char_ptr(n_encoding, 2); 2893 2894 htmlDocContentDumpOutput(buf, cur, (const char *)encoding); 2895 call_tests++; 2896 des_xmlOutputBufferPtr(n_buf, buf, 0); 2897 des_xmlDocPtr(n_cur, cur, 1); 2898 des_const_char_ptr(n_encoding, (const char *)encoding, 2); 2899 xmlResetLastError(); 2900 if (mem_base != xmlMemBlocks()) { 2901 printf("Leak of %d blocks found in htmlDocContentDumpOutput", 2902 xmlMemBlocks() - mem_base); 2903 test_ret++; 2904 printf(" %d", n_buf); 2905 printf(" %d", n_cur); 2906 printf(" %d", n_encoding); 2907 printf("\n"); 2908 } 2909 } 2910 } 2911 } 2912 function_tests++; 2913 #endif 2914 2915 return(test_ret); 2916 } 2917 2918 2919 static int 2920 test_htmlDocDump(void) { 2921 int test_ret = 0; 2922 2923 #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) 2924 int mem_base; 2925 int ret_val; 2926 FILE * f; /* the FILE* */ 2927 int n_f; 2928 xmlDocPtr cur; /* the document */ 2929 int n_cur; 2930 2931 for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) { 2932 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) { 2933 mem_base = xmlMemBlocks(); 2934 f = gen_FILE_ptr(n_f, 0); 2935 cur = gen_xmlDocPtr(n_cur, 1); 2936 2937 ret_val = htmlDocDump(f, cur); 2938 desret_int(ret_val); 2939 call_tests++; 2940 des_FILE_ptr(n_f, f, 0); 2941 des_xmlDocPtr(n_cur, cur, 1); 2942 xmlResetLastError(); 2943 if (mem_base != xmlMemBlocks()) { 2944 printf("Leak of %d blocks found in htmlDocDump", 2945 xmlMemBlocks() - mem_base); 2946 test_ret++; 2947 printf(" %d", n_f); 2948 printf(" %d", n_cur); 2949 printf("\n"); 2950 } 2951 } 2952 } 2953 function_tests++; 2954 #endif 2955 2956 return(test_ret); 2957 } 2958 2959 2960 #define gen_nb_xmlChar_ptr_ptr 1 2961 static xmlChar ** gen_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 2962 return(NULL); 2963 } 2964 static void des_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, xmlChar ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 2965 } 2966 2967 static int 2968 test_htmlDocDumpMemory(void) { 2969 int test_ret = 0; 2970 2971 #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) 2972 int mem_base; 2973 xmlDocPtr cur; /* the document */ 2974 int n_cur; 2975 xmlChar ** mem; /* OUT: the memory pointer */ 2976 int n_mem; 2977 int * size; /* OUT: the memory length */ 2978 int n_size; 2979 2980 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) { 2981 for (n_mem = 0;n_mem < gen_nb_xmlChar_ptr_ptr;n_mem++) { 2982 for (n_size = 0;n_size < gen_nb_int_ptr;n_size++) { 2983 mem_base = xmlMemBlocks(); 2984 cur = gen_xmlDocPtr(n_cur, 0); 2985 mem = gen_xmlChar_ptr_ptr(n_mem, 1); 2986 size = gen_int_ptr(n_size, 2); 2987 2988 htmlDocDumpMemory(cur, mem, size); 2989 call_tests++; 2990 des_xmlDocPtr(n_cur, cur, 0); 2991 des_xmlChar_ptr_ptr(n_mem, mem, 1); 2992 des_int_ptr(n_size, size, 2); 2993 xmlResetLastError(); 2994 if (mem_base != xmlMemBlocks()) { 2995 printf("Leak of %d blocks found in htmlDocDumpMemory", 2996 xmlMemBlocks() - mem_base); 2997 test_ret++; 2998 printf(" %d", n_cur); 2999 printf(" %d", n_mem); 3000 printf(" %d", n_size); 3001 printf("\n"); 3002 } 3003 } 3004 } 3005 } 3006 function_tests++; 3007 #endif 3008 3009 return(test_ret); 3010 } 3011 3012 3013 static int 3014 test_htmlDocDumpMemoryFormat(void) { 3015 int test_ret = 0; 3016 3017 #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) 3018 int mem_base; 3019 xmlDocPtr cur; /* the document */ 3020 int n_cur; 3021 xmlChar ** mem; /* OUT: the memory pointer */ 3022 int n_mem; 3023 int * size; /* OUT: the memory length */ 3024 int n_size; 3025 int format; /* should formatting spaces been added */ 3026 int n_format; 3027 3028 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) { 3029 for (n_mem = 0;n_mem < gen_nb_xmlChar_ptr_ptr;n_mem++) { 3030 for (n_size = 0;n_size < gen_nb_int_ptr;n_size++) { 3031 for (n_format = 0;n_format < gen_nb_int;n_format++) { 3032 mem_base = xmlMemBlocks(); 3033 cur = gen_xmlDocPtr(n_cur, 0); 3034 mem = gen_xmlChar_ptr_ptr(n_mem, 1); 3035 size = gen_int_ptr(n_size, 2); 3036 format = gen_int(n_format, 3); 3037 3038 htmlDocDumpMemoryFormat(cur, mem, size, format); 3039 call_tests++; 3040 des_xmlDocPtr(n_cur, cur, 0); 3041 des_xmlChar_ptr_ptr(n_mem, mem, 1); 3042 des_int_ptr(n_size, size, 2); 3043 des_int(n_format, format, 3); 3044 xmlResetLastError(); 3045 if (mem_base != xmlMemBlocks()) { 3046 printf("Leak of %d blocks found in htmlDocDumpMemoryFormat", 3047 xmlMemBlocks() - mem_base); 3048 test_ret++; 3049 printf(" %d", n_cur); 3050 printf(" %d", n_mem); 3051 printf(" %d", n_size); 3052 printf(" %d", n_format); 3053 printf("\n"); 3054 } 3055 } 3056 } 3057 } 3058 } 3059 function_tests++; 3060 #endif 3061 3062 return(test_ret); 3063 } 3064 3065 3066 static int 3067 test_htmlGetMetaEncoding(void) { 3068 int test_ret = 0; 3069 3070 #if defined(LIBXML_HTML_ENABLED) 3071 int mem_base; 3072 const xmlChar * ret_val; 3073 htmlDocPtr doc; /* the document */ 3074 int n_doc; 3075 3076 for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) { 3077 mem_base = xmlMemBlocks(); 3078 doc = gen_htmlDocPtr(n_doc, 0); 3079 3080 ret_val = htmlGetMetaEncoding(doc); 3081 desret_const_xmlChar_ptr(ret_val); 3082 call_tests++; 3083 des_htmlDocPtr(n_doc, doc, 0); 3084 xmlResetLastError(); 3085 if (mem_base != xmlMemBlocks()) { 3086 printf("Leak of %d blocks found in htmlGetMetaEncoding", 3087 xmlMemBlocks() - mem_base); 3088 test_ret++; 3089 printf(" %d", n_doc); 3090 printf("\n"); 3091 } 3092 } 3093 function_tests++; 3094 #endif 3095 3096 return(test_ret); 3097 } 3098 3099 3100 static int 3101 test_htmlIsBooleanAttr(void) { 3102 int test_ret = 0; 3103 3104 #if defined(LIBXML_HTML_ENABLED) 3105 int mem_base; 3106 int ret_val; 3107 xmlChar * name; /* the name of the attribute to check */ 3108 int n_name; 3109 3110 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { 3111 mem_base = xmlMemBlocks(); 3112 name = gen_const_xmlChar_ptr(n_name, 0); 3113 3114 ret_val = htmlIsBooleanAttr((const xmlChar *)name); 3115 desret_int(ret_val); 3116 call_tests++; 3117 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0); 3118 xmlResetLastError(); 3119 if (mem_base != xmlMemBlocks()) { 3120 printf("Leak of %d blocks found in htmlIsBooleanAttr", 3121 xmlMemBlocks() - mem_base); 3122 test_ret++; 3123 printf(" %d", n_name); 3124 printf("\n"); 3125 } 3126 } 3127 function_tests++; 3128 #endif 3129 3130 return(test_ret); 3131 } 3132 3133 3134 static int 3135 test_htmlNewDoc(void) { 3136 int test_ret = 0; 3137 3138 #if defined(LIBXML_HTML_ENABLED) 3139 int mem_base; 3140 htmlDocPtr ret_val; 3141 xmlChar * URI; /* URI for the dtd, or NULL */ 3142 int n_URI; 3143 xmlChar * ExternalID; /* the external ID of the DTD, or NULL */ 3144 int n_ExternalID; 3145 3146 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) { 3147 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) { 3148 mem_base = xmlMemBlocks(); 3149 URI = gen_const_xmlChar_ptr(n_URI, 0); 3150 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 1); 3151 3152 ret_val = htmlNewDoc((const xmlChar *)URI, (const xmlChar *)ExternalID); 3153 desret_htmlDocPtr(ret_val); 3154 call_tests++; 3155 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0); 3156 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 1); 3157 xmlResetLastError(); 3158 if (mem_base != xmlMemBlocks()) { 3159 printf("Leak of %d blocks found in htmlNewDoc", 3160 xmlMemBlocks() - mem_base); 3161 test_ret++; 3162 printf(" %d", n_URI); 3163 printf(" %d", n_ExternalID); 3164 printf("\n"); 3165 } 3166 } 3167 } 3168 function_tests++; 3169 #endif 3170 3171 return(test_ret); 3172 } 3173 3174 3175 static int 3176 test_htmlNewDocNoDtD(void) { 3177 int test_ret = 0; 3178 3179 #if defined(LIBXML_HTML_ENABLED) 3180 int mem_base; 3181 htmlDocPtr ret_val; 3182 xmlChar * URI; /* URI for the dtd, or NULL */ 3183 int n_URI; 3184 xmlChar * ExternalID; /* the external ID of the DTD, or NULL */ 3185 int n_ExternalID; 3186 3187 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) { 3188 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) { 3189 mem_base = xmlMemBlocks(); 3190 URI = gen_const_xmlChar_ptr(n_URI, 0); 3191 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 1); 3192 3193 ret_val = htmlNewDocNoDtD((const xmlChar *)URI, (const xmlChar *)ExternalID); 3194 desret_htmlDocPtr(ret_val); 3195 call_tests++; 3196 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0); 3197 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 1); 3198 xmlResetLastError(); 3199 if (mem_base != xmlMemBlocks()) { 3200 printf("Leak of %d blocks found in htmlNewDocNoDtD", 3201 xmlMemBlocks() - mem_base); 3202 test_ret++; 3203 printf(" %d", n_URI); 3204 printf(" %d", n_ExternalID); 3205 printf("\n"); 3206 } 3207 } 3208 } 3209 function_tests++; 3210 #endif 3211 3212 return(test_ret); 3213 } 3214 3215 3216 static int 3217 test_htmlNodeDump(void) { 3218 int test_ret = 0; 3219 3220 #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) 3221 int mem_base; 3222 int ret_val; 3223 xmlBufferPtr buf; /* the HTML buffer output */ 3224 int n_buf; 3225 xmlDocPtr doc; /* the document */ 3226 int n_doc; 3227 xmlNodePtr cur; /* the current node */ 3228 int n_cur; 3229 3230 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) { 3231 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { 3232 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { 3233 mem_base = xmlMemBlocks(); 3234 buf = gen_xmlBufferPtr(n_buf, 0); 3235 doc = gen_xmlDocPtr(n_doc, 1); 3236 cur = gen_xmlNodePtr(n_cur, 2); 3237 3238 ret_val = htmlNodeDump(buf, doc, cur); 3239 desret_int(ret_val); 3240 call_tests++; 3241 des_xmlBufferPtr(n_buf, buf, 0); 3242 des_xmlDocPtr(n_doc, doc, 1); 3243 des_xmlNodePtr(n_cur, cur, 2); 3244 xmlResetLastError(); 3245 if (mem_base != xmlMemBlocks()) { 3246 printf("Leak of %d blocks found in htmlNodeDump", 3247 xmlMemBlocks() - mem_base); 3248 test_ret++; 3249 printf(" %d", n_buf); 3250 printf(" %d", n_doc); 3251 printf(" %d", n_cur); 3252 printf("\n"); 3253 } 3254 } 3255 } 3256 } 3257 function_tests++; 3258 #endif 3259 3260 return(test_ret); 3261 } 3262 3263 3264 static int 3265 test_htmlNodeDumpFile(void) { 3266 int test_ret = 0; 3267 3268 #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) 3269 int mem_base; 3270 FILE * out; /* the FILE pointer */ 3271 int n_out; 3272 xmlDocPtr doc; /* the document */ 3273 int n_doc; 3274 xmlNodePtr cur; /* the current node */ 3275 int n_cur; 3276 3277 for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) { 3278 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { 3279 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { 3280 mem_base = xmlMemBlocks(); 3281 out = gen_FILE_ptr(n_out, 0); 3282 doc = gen_xmlDocPtr(n_doc, 1); 3283 cur = gen_xmlNodePtr(n_cur, 2); 3284 3285 htmlNodeDumpFile(out, doc, cur); 3286 call_tests++; 3287 des_FILE_ptr(n_out, out, 0); 3288 des_xmlDocPtr(n_doc, doc, 1); 3289 des_xmlNodePtr(n_cur, cur, 2); 3290 xmlResetLastError(); 3291 if (mem_base != xmlMemBlocks()) { 3292 printf("Leak of %d blocks found in htmlNodeDumpFile", 3293 xmlMemBlocks() - mem_base); 3294 test_ret++; 3295 printf(" %d", n_out); 3296 printf(" %d", n_doc); 3297 printf(" %d", n_cur); 3298 printf("\n"); 3299 } 3300 } 3301 } 3302 } 3303 function_tests++; 3304 #endif 3305 3306 return(test_ret); 3307 } 3308 3309 3310 static int 3311 test_htmlNodeDumpFileFormat(void) { 3312 int test_ret = 0; 3313 3314 #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) 3315 int mem_base; 3316 int ret_val; 3317 FILE * out; /* the FILE pointer */ 3318 int n_out; 3319 xmlDocPtr doc; /* the document */ 3320 int n_doc; 3321 xmlNodePtr cur; /* the current node */ 3322 int n_cur; 3323 char * encoding; /* the document encoding */ 3324 int n_encoding; 3325 int format; /* should formatting spaces been added */ 3326 int n_format; 3327 3328 for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) { 3329 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { 3330 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { 3331 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { 3332 for (n_format = 0;n_format < gen_nb_int;n_format++) { 3333 mem_base = xmlMemBlocks(); 3334 out = gen_FILE_ptr(n_out, 0); 3335 doc = gen_xmlDocPtr(n_doc, 1); 3336 cur = gen_xmlNodePtr(n_cur, 2); 3337 encoding = gen_const_char_ptr(n_encoding, 3); 3338 format = gen_int(n_format, 4); 3339 3340 ret_val = htmlNodeDumpFileFormat(out, doc, cur, (const char *)encoding, format); 3341 desret_int(ret_val); 3342 call_tests++; 3343 des_FILE_ptr(n_out, out, 0); 3344 des_xmlDocPtr(n_doc, doc, 1); 3345 des_xmlNodePtr(n_cur, cur, 2); 3346 des_const_char_ptr(n_encoding, (const char *)encoding, 3); 3347 des_int(n_format, format, 4); 3348 xmlResetLastError(); 3349 if (mem_base != xmlMemBlocks()) { 3350 printf("Leak of %d blocks found in htmlNodeDumpFileFormat", 3351 xmlMemBlocks() - mem_base); 3352 test_ret++; 3353 printf(" %d", n_out); 3354 printf(" %d", n_doc); 3355 printf(" %d", n_cur); 3356 printf(" %d", n_encoding); 3357 printf(" %d", n_format); 3358 printf("\n"); 3359 } 3360 } 3361 } 3362 } 3363 } 3364 } 3365 function_tests++; 3366 #endif 3367 3368 return(test_ret); 3369 } 3370 3371 3372 static int 3373 test_htmlNodeDumpFormatOutput(void) { 3374 int test_ret = 0; 3375 3376 #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) 3377 int mem_base; 3378 xmlOutputBufferPtr buf; /* the HTML buffer output */ 3379 int n_buf; 3380 xmlDocPtr doc; /* the document */ 3381 int n_doc; 3382 xmlNodePtr cur; /* the current node */ 3383 int n_cur; 3384 char * encoding; /* the encoding string */ 3385 int n_encoding; 3386 int format; /* should formatting spaces been added */ 3387 int n_format; 3388 3389 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) { 3390 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { 3391 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { 3392 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { 3393 for (n_format = 0;n_format < gen_nb_int;n_format++) { 3394 mem_base = xmlMemBlocks(); 3395 buf = gen_xmlOutputBufferPtr(n_buf, 0); 3396 doc = gen_xmlDocPtr(n_doc, 1); 3397 cur = gen_xmlNodePtr(n_cur, 2); 3398 encoding = gen_const_char_ptr(n_encoding, 3); 3399 format = gen_int(n_format, 4); 3400 3401 htmlNodeDumpFormatOutput(buf, doc, cur, (const char *)encoding, format); 3402 call_tests++; 3403 des_xmlOutputBufferPtr(n_buf, buf, 0); 3404 des_xmlDocPtr(n_doc, doc, 1); 3405 des_xmlNodePtr(n_cur, cur, 2); 3406 des_const_char_ptr(n_encoding, (const char *)encoding, 3); 3407 des_int(n_format, format, 4); 3408 xmlResetLastError(); 3409 if (mem_base != xmlMemBlocks()) { 3410 printf("Leak of %d blocks found in htmlNodeDumpFormatOutput", 3411 xmlMemBlocks() - mem_base); 3412 test_ret++; 3413 printf(" %d", n_buf); 3414 printf(" %d", n_doc); 3415 printf(" %d", n_cur); 3416 printf(" %d", n_encoding); 3417 printf(" %d", n_format); 3418 printf("\n"); 3419 } 3420 } 3421 } 3422 } 3423 } 3424 } 3425 function_tests++; 3426 #endif 3427 3428 return(test_ret); 3429 } 3430 3431 3432 static int 3433 test_htmlNodeDumpOutput(void) { 3434 int test_ret = 0; 3435 3436 #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) 3437 int mem_base; 3438 xmlOutputBufferPtr buf; /* the HTML buffer output */ 3439 int n_buf; 3440 xmlDocPtr doc; /* the document */ 3441 int n_doc; 3442 xmlNodePtr cur; /* the current node */ 3443 int n_cur; 3444 char * encoding; /* the encoding string */ 3445 int n_encoding; 3446 3447 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) { 3448 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { 3449 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { 3450 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { 3451 mem_base = xmlMemBlocks(); 3452 buf = gen_xmlOutputBufferPtr(n_buf, 0); 3453 doc = gen_xmlDocPtr(n_doc, 1); 3454 cur = gen_xmlNodePtr(n_cur, 2); 3455 encoding = gen_const_char_ptr(n_encoding, 3); 3456 3457 htmlNodeDumpOutput(buf, doc, cur, (const char *)encoding); 3458 call_tests++; 3459 des_xmlOutputBufferPtr(n_buf, buf, 0); 3460 des_xmlDocPtr(n_doc, doc, 1); 3461 des_xmlNodePtr(n_cur, cur, 2); 3462 des_const_char_ptr(n_encoding, (const char *)encoding, 3); 3463 xmlResetLastError(); 3464 if (mem_base != xmlMemBlocks()) { 3465 printf("Leak of %d blocks found in htmlNodeDumpOutput", 3466 xmlMemBlocks() - mem_base); 3467 test_ret++; 3468 printf(" %d", n_buf); 3469 printf(" %d", n_doc); 3470 printf(" %d", n_cur); 3471 printf(" %d", n_encoding); 3472 printf("\n"); 3473 } 3474 } 3475 } 3476 } 3477 } 3478 function_tests++; 3479 #endif 3480 3481 return(test_ret); 3482 } 3483 3484 3485 static int 3486 test_htmlSaveFile(void) { 3487 int test_ret = 0; 3488 3489 #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) 3490 int mem_base; 3491 int ret_val; 3492 const char * filename; /* the filename (or URL) */ 3493 int n_filename; 3494 xmlDocPtr cur; /* the document */ 3495 int n_cur; 3496 3497 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) { 3498 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) { 3499 mem_base = xmlMemBlocks(); 3500 filename = gen_fileoutput(n_filename, 0); 3501 cur = gen_xmlDocPtr(n_cur, 1); 3502 3503 ret_val = htmlSaveFile(filename, cur); 3504 desret_int(ret_val); 3505 call_tests++; 3506 des_fileoutput(n_filename, filename, 0); 3507 des_xmlDocPtr(n_cur, cur, 1); 3508 xmlResetLastError(); 3509 if (mem_base != xmlMemBlocks()) { 3510 printf("Leak of %d blocks found in htmlSaveFile", 3511 xmlMemBlocks() - mem_base); 3512 test_ret++; 3513 printf(" %d", n_filename); 3514 printf(" %d", n_cur); 3515 printf("\n"); 3516 } 3517 } 3518 } 3519 function_tests++; 3520 #endif 3521 3522 return(test_ret); 3523 } 3524 3525 3526 static int 3527 test_htmlSaveFileEnc(void) { 3528 int test_ret = 0; 3529 3530 #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) 3531 int mem_base; 3532 int ret_val; 3533 const char * filename; /* the filename */ 3534 int n_filename; 3535 xmlDocPtr cur; /* the document */ 3536 int n_cur; 3537 char * encoding; /* the document encoding */ 3538 int n_encoding; 3539 3540 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) { 3541 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) { 3542 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { 3543 mem_base = xmlMemBlocks(); 3544 filename = gen_fileoutput(n_filename, 0); 3545 cur = gen_xmlDocPtr(n_cur, 1); 3546 encoding = gen_const_char_ptr(n_encoding, 2); 3547 3548 ret_val = htmlSaveFileEnc(filename, cur, (const char *)encoding); 3549 desret_int(ret_val); 3550 call_tests++; 3551 des_fileoutput(n_filename, filename, 0); 3552 des_xmlDocPtr(n_cur, cur, 1); 3553 des_const_char_ptr(n_encoding, (const char *)encoding, 2); 3554 xmlResetLastError(); 3555 if (mem_base != xmlMemBlocks()) { 3556 printf("Leak of %d blocks found in htmlSaveFileEnc", 3557 xmlMemBlocks() - mem_base); 3558 test_ret++; 3559 printf(" %d", n_filename); 3560 printf(" %d", n_cur); 3561 printf(" %d", n_encoding); 3562 printf("\n"); 3563 } 3564 } 3565 } 3566 } 3567 function_tests++; 3568 #endif 3569 3570 return(test_ret); 3571 } 3572 3573 3574 static int 3575 test_htmlSaveFileFormat(void) { 3576 int test_ret = 0; 3577 3578 #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) 3579 int mem_base; 3580 int ret_val; 3581 const char * filename; /* the filename */ 3582 int n_filename; 3583 xmlDocPtr cur; /* the document */ 3584 int n_cur; 3585 char * encoding; /* the document encoding */ 3586 int n_encoding; 3587 int format; /* should formatting spaces been added */ 3588 int n_format; 3589 3590 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) { 3591 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) { 3592 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { 3593 for (n_format = 0;n_format < gen_nb_int;n_format++) { 3594 mem_base = xmlMemBlocks(); 3595 filename = gen_fileoutput(n_filename, 0); 3596 cur = gen_xmlDocPtr(n_cur, 1); 3597 encoding = gen_const_char_ptr(n_encoding, 2); 3598 format = gen_int(n_format, 3); 3599 3600 ret_val = htmlSaveFileFormat(filename, cur, (const char *)encoding, format); 3601 desret_int(ret_val); 3602 call_tests++; 3603 des_fileoutput(n_filename, filename, 0); 3604 des_xmlDocPtr(n_cur, cur, 1); 3605 des_const_char_ptr(n_encoding, (const char *)encoding, 2); 3606 des_int(n_format, format, 3); 3607 xmlResetLastError(); 3608 if (mem_base != xmlMemBlocks()) { 3609 printf("Leak of %d blocks found in htmlSaveFileFormat", 3610 xmlMemBlocks() - mem_base); 3611 test_ret++; 3612 printf(" %d", n_filename); 3613 printf(" %d", n_cur); 3614 printf(" %d", n_encoding); 3615 printf(" %d", n_format); 3616 printf("\n"); 3617 } 3618 } 3619 } 3620 } 3621 } 3622 function_tests++; 3623 #endif 3624 3625 return(test_ret); 3626 } 3627 3628 3629 static int 3630 test_htmlSetMetaEncoding(void) { 3631 int test_ret = 0; 3632 3633 #if defined(LIBXML_HTML_ENABLED) 3634 int mem_base; 3635 int ret_val; 3636 htmlDocPtr doc; /* the document */ 3637 int n_doc; 3638 xmlChar * encoding; /* the encoding string */ 3639 int n_encoding; 3640 3641 for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) { 3642 for (n_encoding = 0;n_encoding < gen_nb_const_xmlChar_ptr;n_encoding++) { 3643 mem_base = xmlMemBlocks(); 3644 doc = gen_htmlDocPtr(n_doc, 0); 3645 encoding = gen_const_xmlChar_ptr(n_encoding, 1); 3646 3647 ret_val = htmlSetMetaEncoding(doc, (const xmlChar *)encoding); 3648 desret_int(ret_val); 3649 call_tests++; 3650 des_htmlDocPtr(n_doc, doc, 0); 3651 des_const_xmlChar_ptr(n_encoding, (const xmlChar *)encoding, 1); 3652 xmlResetLastError(); 3653 if (mem_base != xmlMemBlocks()) { 3654 printf("Leak of %d blocks found in htmlSetMetaEncoding", 3655 xmlMemBlocks() - mem_base); 3656 test_ret++; 3657 printf(" %d", n_doc); 3658 printf(" %d", n_encoding); 3659 printf("\n"); 3660 } 3661 } 3662 } 3663 function_tests++; 3664 #endif 3665 3666 return(test_ret); 3667 } 3668 3669 static int 3670 test_HTMLtree(void) { 3671 int test_ret = 0; 3672 3673 if (quiet == 0) printf("Testing HTMLtree : 18 of 18 functions ...\n"); 3674 test_ret += test_htmlDocContentDumpFormatOutput(); 3675 test_ret += test_htmlDocContentDumpOutput(); 3676 test_ret += test_htmlDocDump(); 3677 test_ret += test_htmlDocDumpMemory(); 3678 test_ret += test_htmlDocDumpMemoryFormat(); 3679 test_ret += test_htmlGetMetaEncoding(); 3680 test_ret += test_htmlIsBooleanAttr(); 3681 test_ret += test_htmlNewDoc(); 3682 test_ret += test_htmlNewDocNoDtD(); 3683 test_ret += test_htmlNodeDump(); 3684 test_ret += test_htmlNodeDumpFile(); 3685 test_ret += test_htmlNodeDumpFileFormat(); 3686 test_ret += test_htmlNodeDumpFormatOutput(); 3687 test_ret += test_htmlNodeDumpOutput(); 3688 test_ret += test_htmlSaveFile(); 3689 test_ret += test_htmlSaveFileEnc(); 3690 test_ret += test_htmlSaveFileFormat(); 3691 test_ret += test_htmlSetMetaEncoding(); 3692 3693 if (test_ret != 0) 3694 printf("Module HTMLtree: %d errors\n", test_ret); 3695 return(test_ret); 3696 } 3697 3698 static int 3699 test_docbDefaultSAXHandlerInit(void) { 3700 int test_ret = 0; 3701 3702 #if defined(LIBXML_DOCB_ENABLED) 3703 #ifdef LIBXML_DOCB_ENABLED 3704 int mem_base; 3705 3706 mem_base = xmlMemBlocks(); 3707 3708 docbDefaultSAXHandlerInit(); 3709 call_tests++; 3710 xmlResetLastError(); 3711 if (mem_base != xmlMemBlocks()) { 3712 printf("Leak of %d blocks found in docbDefaultSAXHandlerInit", 3713 xmlMemBlocks() - mem_base); 3714 test_ret++; 3715 printf("\n"); 3716 } 3717 function_tests++; 3718 #endif 3719 #endif 3720 3721 return(test_ret); 3722 } 3723 3724 3725 static int 3726 test_htmlDefaultSAXHandlerInit(void) { 3727 int test_ret = 0; 3728 3729 #if defined(LIBXML_HTML_ENABLED) 3730 #ifdef LIBXML_HTML_ENABLED 3731 int mem_base; 3732 3733 mem_base = xmlMemBlocks(); 3734 3735 htmlDefaultSAXHandlerInit(); 3736 call_tests++; 3737 xmlResetLastError(); 3738 if (mem_base != xmlMemBlocks()) { 3739 printf("Leak of %d blocks found in htmlDefaultSAXHandlerInit", 3740 xmlMemBlocks() - mem_base); 3741 test_ret++; 3742 printf("\n"); 3743 } 3744 function_tests++; 3745 #endif 3746 #endif 3747 3748 return(test_ret); 3749 } 3750 3751 3752 static int 3753 test_xmlDefaultSAXHandlerInit(void) { 3754 int test_ret = 0; 3755 3756 int mem_base; 3757 3758 mem_base = xmlMemBlocks(); 3759 3760 xmlDefaultSAXHandlerInit(); 3761 call_tests++; 3762 xmlResetLastError(); 3763 if (mem_base != xmlMemBlocks()) { 3764 printf("Leak of %d blocks found in xmlDefaultSAXHandlerInit", 3765 xmlMemBlocks() - mem_base); 3766 test_ret++; 3767 printf("\n"); 3768 } 3769 function_tests++; 3770 3771 return(test_ret); 3772 } 3773 3774 3775 #define gen_nb_xmlEnumerationPtr 1 3776 static xmlEnumerationPtr gen_xmlEnumerationPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 3777 return(NULL); 3778 } 3779 static void des_xmlEnumerationPtr(int no ATTRIBUTE_UNUSED, xmlEnumerationPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 3780 } 3781 3782 static int 3783 test_xmlSAX2AttributeDecl(void) { 3784 int test_ret = 0; 3785 3786 int mem_base; 3787 void * ctx; /* the user data (XML parser context) */ 3788 int n_ctx; 3789 xmlChar * elem; /* the name of the element */ 3790 int n_elem; 3791 xmlChar * fullname; /* the attribute name */ 3792 int n_fullname; 3793 int type; /* the attribute type */ 3794 int n_type; 3795 int def; /* the type of default value */ 3796 int n_def; 3797 xmlChar * defaultValue; /* the attribute default value */ 3798 int n_defaultValue; 3799 xmlEnumerationPtr tree; /* the tree of enumerated value set */ 3800 int n_tree; 3801 3802 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { 3803 for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) { 3804 for (n_fullname = 0;n_fullname < gen_nb_const_xmlChar_ptr;n_fullname++) { 3805 for (n_type = 0;n_type < gen_nb_int;n_type++) { 3806 for (n_def = 0;n_def < gen_nb_int;n_def++) { 3807 for (n_defaultValue = 0;n_defaultValue < gen_nb_const_xmlChar_ptr;n_defaultValue++) { 3808 for (n_tree = 0;n_tree < gen_nb_xmlEnumerationPtr;n_tree++) { 3809 mem_base = xmlMemBlocks(); 3810 ctx = gen_void_ptr(n_ctx, 0); 3811 elem = gen_const_xmlChar_ptr(n_elem, 1); 3812 fullname = gen_const_xmlChar_ptr(n_fullname, 2); 3813 type = gen_int(n_type, 3); 3814 def = gen_int(n_def, 4); 3815 defaultValue = gen_const_xmlChar_ptr(n_defaultValue, 5); 3816 tree = gen_xmlEnumerationPtr(n_tree, 6); 3817 3818 xmlSAX2AttributeDecl(ctx, (const xmlChar *)elem, (const xmlChar *)fullname, type, def, (const xmlChar *)defaultValue, tree); 3819 call_tests++; 3820 des_void_ptr(n_ctx, ctx, 0); 3821 des_const_xmlChar_ptr(n_elem, (const xmlChar *)elem, 1); 3822 des_const_xmlChar_ptr(n_fullname, (const xmlChar *)fullname, 2); 3823 des_int(n_type, type, 3); 3824 des_int(n_def, def, 4); 3825 des_const_xmlChar_ptr(n_defaultValue, (const xmlChar *)defaultValue, 5); 3826 des_xmlEnumerationPtr(n_tree, tree, 6); 3827 xmlResetLastError(); 3828 if (mem_base != xmlMemBlocks()) { 3829 printf("Leak of %d blocks found in xmlSAX2AttributeDecl", 3830 xmlMemBlocks() - mem_base); 3831 test_ret++; 3832 printf(" %d", n_ctx); 3833 printf(" %d", n_elem); 3834 printf(" %d", n_fullname); 3835 printf(" %d", n_type); 3836 printf(" %d", n_def); 3837 printf(" %d", n_defaultValue); 3838 printf(" %d", n_tree); 3839 printf("\n"); 3840 } 3841 } 3842 } 3843 } 3844 } 3845 } 3846 } 3847 } 3848 function_tests++; 3849 3850 return(test_ret); 3851 } 3852 3853 3854 static int 3855 test_xmlSAX2CDataBlock(void) { 3856 int test_ret = 0; 3857 3858 int mem_base; 3859 void * ctx; /* the user data (XML parser context) */ 3860 int n_ctx; 3861 xmlChar * value; /* The pcdata content */ 3862 int n_value; 3863 int len; /* the block length */ 3864 int n_len; 3865 3866 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { 3867 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { 3868 for (n_len = 0;n_len < gen_nb_int;n_len++) { 3869 mem_base = xmlMemBlocks(); 3870 ctx = gen_void_ptr(n_ctx, 0); 3871 value = gen_const_xmlChar_ptr(n_value, 1); 3872 len = gen_int(n_len, 2); 3873 3874 xmlSAX2CDataBlock(ctx, (const xmlChar *)value, len); 3875 call_tests++; 3876 des_void_ptr(n_ctx, ctx, 0); 3877 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1); 3878 des_int(n_len, len, 2); 3879 xmlResetLastError(); 3880 if (mem_base != xmlMemBlocks()) { 3881 printf("Leak of %d blocks found in xmlSAX2CDataBlock", 3882 xmlMemBlocks() - mem_base); 3883 test_ret++; 3884 printf(" %d", n_ctx); 3885 printf(" %d", n_value); 3886 printf(" %d", n_len); 3887 printf("\n"); 3888 } 3889 } 3890 } 3891 } 3892 function_tests++; 3893 3894 return(test_ret); 3895 } 3896 3897 3898 static int 3899 test_xmlSAX2Characters(void) { 3900 int test_ret = 0; 3901 3902 int mem_base; 3903 void * ctx; /* the user data (XML parser context) */ 3904 int n_ctx; 3905 xmlChar * ch; /* a xmlChar string */ 3906 int n_ch; 3907 int len; /* the number of xmlChar */ 3908 int n_len; 3909 3910 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { 3911 for (n_ch = 0;n_ch < gen_nb_const_xmlChar_ptr;n_ch++) { 3912 for (n_len = 0;n_len < gen_nb_int;n_len++) { 3913 mem_base = xmlMemBlocks(); 3914 ctx = gen_void_ptr(n_ctx, 0); 3915 ch = gen_const_xmlChar_ptr(n_ch, 1); 3916 len = gen_int(n_len, 2); 3917 3918 xmlSAX2Characters(ctx, (const xmlChar *)ch, len); 3919 call_tests++; 3920 des_void_ptr(n_ctx, ctx, 0); 3921 des_const_xmlChar_ptr(n_ch, (const xmlChar *)ch, 1); 3922 des_int(n_len, len, 2); 3923 xmlResetLastError(); 3924 if (mem_base != xmlMemBlocks()) { 3925 printf("Leak of %d blocks found in xmlSAX2Characters", 3926 xmlMemBlocks() - mem_base); 3927 test_ret++; 3928 printf(" %d", n_ctx); 3929 printf(" %d", n_ch); 3930 printf(" %d", n_len); 3931 printf("\n"); 3932 } 3933 } 3934 } 3935 } 3936 function_tests++; 3937 3938 return(test_ret); 3939 } 3940 3941 3942 static int 3943 test_xmlSAX2Comment(void) { 3944 int test_ret = 0; 3945 3946 int mem_base; 3947 void * ctx; /* the user data (XML parser context) */ 3948 int n_ctx; 3949 xmlChar * value; /* the xmlSAX2Comment content */ 3950 int n_value; 3951 3952 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { 3953 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { 3954 mem_base = xmlMemBlocks(); 3955 ctx = gen_void_ptr(n_ctx, 0); 3956 value = gen_const_xmlChar_ptr(n_value, 1); 3957 3958 xmlSAX2Comment(ctx, (const xmlChar *)value); 3959 call_tests++; 3960 des_void_ptr(n_ctx, ctx, 0); 3961 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1); 3962 xmlResetLastError(); 3963 if (mem_base != xmlMemBlocks()) { 3964 printf("Leak of %d blocks found in xmlSAX2Comment", 3965 xmlMemBlocks() - mem_base); 3966 test_ret++; 3967 printf(" %d", n_ctx); 3968 printf(" %d", n_value); 3969 printf("\n"); 3970 } 3971 } 3972 } 3973 function_tests++; 3974 3975 return(test_ret); 3976 } 3977 3978 3979 static int 3980 test_xmlSAX2ElementDecl(void) { 3981 int test_ret = 0; 3982 3983 int mem_base; 3984 void * ctx; /* the user data (XML parser context) */ 3985 int n_ctx; 3986 xmlChar * name; /* the element name */ 3987 int n_name; 3988 int type; /* the element type */ 3989 int n_type; 3990 xmlElementContentPtr content; /* the element value tree */ 3991 int n_content; 3992 3993 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { 3994 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { 3995 for (n_type = 0;n_type < gen_nb_int;n_type++) { 3996 for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) { 3997 mem_base = xmlMemBlocks(); 3998 ctx = gen_void_ptr(n_ctx, 0); 3999 name = gen_const_xmlChar_ptr(n_name, 1); 4000 type = gen_int(n_type, 2); 4001 content = gen_xmlElementContentPtr(n_content, 3); 4002 4003 xmlSAX2ElementDecl(ctx, (const xmlChar *)name, type, content); 4004 call_tests++; 4005 des_void_ptr(n_ctx, ctx, 0); 4006 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); 4007 des_int(n_type, type, 2); 4008 des_xmlElementContentPtr(n_content, content, 3); 4009 xmlResetLastError(); 4010 if (mem_base != xmlMemBlocks()) { 4011 printf("Leak of %d blocks found in xmlSAX2ElementDecl", 4012 xmlMemBlocks() - mem_base); 4013 test_ret++; 4014 printf(" %d", n_ctx); 4015 printf(" %d", n_name); 4016 printf(" %d", n_type); 4017 printf(" %d", n_content); 4018 printf("\n"); 4019 } 4020 } 4021 } 4022 } 4023 } 4024 function_tests++; 4025 4026 return(test_ret); 4027 } 4028 4029 4030 static int 4031 test_xmlSAX2EndDocument(void) { 4032 int test_ret = 0; 4033 4034 int mem_base; 4035 void * ctx; /* the user data (XML parser context) */ 4036 int n_ctx; 4037 4038 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { 4039 mem_base = xmlMemBlocks(); 4040 ctx = gen_void_ptr(n_ctx, 0); 4041 4042 xmlSAX2EndDocument(ctx); 4043 call_tests++; 4044 des_void_ptr(n_ctx, ctx, 0); 4045 xmlResetLastError(); 4046 if (mem_base != xmlMemBlocks()) { 4047 printf("Leak of %d blocks found in xmlSAX2EndDocument", 4048 xmlMemBlocks() - mem_base); 4049 test_ret++; 4050 printf(" %d", n_ctx); 4051 printf("\n"); 4052 } 4053 } 4054 function_tests++; 4055 4056 return(test_ret); 4057 } 4058 4059 4060 static int 4061 test_xmlSAX2EndElement(void) { 4062 int test_ret = 0; 4063 4064 #if defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_DOCB_ENABLED) || defined(LIBXML_LEGACY_ENABLED) 4065 #ifdef LIBXML_SAX1_ENABLED 4066 int mem_base; 4067 void * ctx; /* the user data (XML parser context) */ 4068 int n_ctx; 4069 xmlChar * name; /* The element name */ 4070 int n_name; 4071 4072 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { 4073 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { 4074 mem_base = xmlMemBlocks(); 4075 ctx = gen_void_ptr(n_ctx, 0); 4076 name = gen_const_xmlChar_ptr(n_name, 1); 4077 4078 xmlSAX2EndElement(ctx, (const xmlChar *)name); 4079 call_tests++; 4080 des_void_ptr(n_ctx, ctx, 0); 4081 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); 4082 xmlResetLastError(); 4083 if (mem_base != xmlMemBlocks()) { 4084 printf("Leak of %d blocks found in xmlSAX2EndElement", 4085 xmlMemBlocks() - mem_base); 4086 test_ret++; 4087 printf(" %d", n_ctx); 4088 printf(" %d", n_name); 4089 printf("\n"); 4090 } 4091 } 4092 } 4093 function_tests++; 4094 #endif 4095 #endif 4096 4097 return(test_ret); 4098 } 4099 4100 4101 static int 4102 test_xmlSAX2EndElementNs(void) { 4103 int test_ret = 0; 4104 4105 int mem_base; 4106 void * ctx; /* the user data (XML parser context) */ 4107 int n_ctx; 4108 xmlChar * localname; /* the local name of the element */ 4109 int n_localname; 4110 xmlChar * prefix; /* the element namespace prefix if available */ 4111 int n_prefix; 4112 xmlChar * URI; /* the element namespace name if available */ 4113 int n_URI; 4114 4115 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { 4116 for (n_localname = 0;n_localname < gen_nb_const_xmlChar_ptr;n_localname++) { 4117 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) { 4118 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) { 4119 mem_base = xmlMemBlocks(); 4120 ctx = gen_void_ptr(n_ctx, 0); 4121 localname = gen_const_xmlChar_ptr(n_localname, 1); 4122 prefix = gen_const_xmlChar_ptr(n_prefix, 2); 4123 URI = gen_const_xmlChar_ptr(n_URI, 3); 4124 4125 xmlSAX2EndElementNs(ctx, (const xmlChar *)localname, (const xmlChar *)prefix, (const xmlChar *)URI); 4126 call_tests++; 4127 des_void_ptr(n_ctx, ctx, 0); 4128 des_const_xmlChar_ptr(n_localname, (const xmlChar *)localname, 1); 4129 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 2); 4130 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 3); 4131 xmlResetLastError(); 4132 if (mem_base != xmlMemBlocks()) { 4133 printf("Leak of %d blocks found in xmlSAX2EndElementNs", 4134 xmlMemBlocks() - mem_base); 4135 test_ret++; 4136 printf(" %d", n_ctx); 4137 printf(" %d", n_localname); 4138 printf(" %d", n_prefix); 4139 printf(" %d", n_URI); 4140 printf("\n"); 4141 } 4142 } 4143 } 4144 } 4145 } 4146 function_tests++; 4147 4148 return(test_ret); 4149 } 4150 4151 4152 static int 4153 test_xmlSAX2EntityDecl(void) { 4154 int test_ret = 0; 4155 4156 int mem_base; 4157 void * ctx; /* the user data (XML parser context) */ 4158 int n_ctx; 4159 xmlChar * name; /* the entity name */ 4160 int n_name; 4161 int type; /* the entity type */ 4162 int n_type; 4163 xmlChar * publicId; /* The public ID of the entity */ 4164 int n_publicId; 4165 xmlChar * systemId; /* The system ID of the entity */ 4166 int n_systemId; 4167 xmlChar * content; /* the entity value (without processing). */ 4168 int n_content; 4169 4170 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { 4171 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { 4172 for (n_type = 0;n_type < gen_nb_int;n_type++) { 4173 for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) { 4174 for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) { 4175 for (n_content = 0;n_content < gen_nb_xmlChar_ptr;n_content++) { 4176 mem_base = xmlMemBlocks(); 4177 ctx = gen_void_ptr(n_ctx, 0); 4178 name = gen_const_xmlChar_ptr(n_name, 1); 4179 type = gen_int(n_type, 2); 4180 publicId = gen_const_xmlChar_ptr(n_publicId, 3); 4181 systemId = gen_const_xmlChar_ptr(n_systemId, 4); 4182 content = gen_xmlChar_ptr(n_content, 5); 4183 4184 xmlSAX2EntityDecl(ctx, (const xmlChar *)name, type, (const xmlChar *)publicId, (const xmlChar *)systemId, content); 4185 call_tests++; 4186 des_void_ptr(n_ctx, ctx, 0); 4187 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); 4188 des_int(n_type, type, 2); 4189 des_const_xmlChar_ptr(n_publicId, (const xmlChar *)publicId, 3); 4190 des_const_xmlChar_ptr(n_systemId, (const xmlChar *)systemId, 4); 4191 des_xmlChar_ptr(n_content, content, 5); 4192 xmlResetLastError(); 4193 if (mem_base != xmlMemBlocks()) { 4194 printf("Leak of %d blocks found in xmlSAX2EntityDecl", 4195 xmlMemBlocks() - mem_base); 4196 test_ret++; 4197 printf(" %d", n_ctx); 4198 printf(" %d", n_name); 4199 printf(" %d", n_type); 4200 printf(" %d", n_publicId); 4201 printf(" %d", n_systemId); 4202 printf(" %d", n_content); 4203 printf("\n"); 4204 } 4205 } 4206 } 4207 } 4208 } 4209 } 4210 } 4211 function_tests++; 4212 4213 return(test_ret); 4214 } 4215 4216 4217 static int 4218 test_xmlSAX2ExternalSubset(void) { 4219 int test_ret = 0; 4220 4221 int mem_base; 4222 void * ctx; /* the user data (XML parser context) */ 4223 int n_ctx; 4224 xmlChar * name; /* the root element name */ 4225 int n_name; 4226 xmlChar * ExternalID; /* the external ID */ 4227 int n_ExternalID; 4228 xmlChar * SystemID; /* the SYSTEM ID (e.g. filename or URL) */ 4229 int n_SystemID; 4230 4231 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { 4232 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { 4233 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) { 4234 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) { 4235 mem_base = xmlMemBlocks(); 4236 ctx = gen_void_ptr(n_ctx, 0); 4237 name = gen_const_xmlChar_ptr(n_name, 1); 4238 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2); 4239 SystemID = gen_const_xmlChar_ptr(n_SystemID, 3); 4240 4241 xmlSAX2ExternalSubset(ctx, (const xmlChar *)name, (const xmlChar *)ExternalID, (const xmlChar *)SystemID); 4242 call_tests++; 4243 des_void_ptr(n_ctx, ctx, 0); 4244 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); 4245 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 2); 4246 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 3); 4247 xmlResetLastError(); 4248 if (mem_base != xmlMemBlocks()) { 4249 printf("Leak of %d blocks found in xmlSAX2ExternalSubset", 4250 xmlMemBlocks() - mem_base); 4251 test_ret++; 4252 printf(" %d", n_ctx); 4253 printf(" %d", n_name); 4254 printf(" %d", n_ExternalID); 4255 printf(" %d", n_SystemID); 4256 printf("\n"); 4257 } 4258 } 4259 } 4260 } 4261 } 4262 function_tests++; 4263 4264 return(test_ret); 4265 } 4266 4267 4268 static int 4269 test_xmlSAX2GetColumnNumber(void) { 4270 int test_ret = 0; 4271 4272 int mem_base; 4273 int ret_val; 4274 void * ctx; /* the user data (XML parser context) */ 4275 int n_ctx; 4276 4277 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { 4278 mem_base = xmlMemBlocks(); 4279 ctx = gen_void_ptr(n_ctx, 0); 4280 4281 ret_val = xmlSAX2GetColumnNumber(ctx); 4282 desret_int(ret_val); 4283 call_tests++; 4284 des_void_ptr(n_ctx, ctx, 0); 4285 xmlResetLastError(); 4286 if (mem_base != xmlMemBlocks()) { 4287 printf("Leak of %d blocks found in xmlSAX2GetColumnNumber", 4288 xmlMemBlocks() - mem_base); 4289 test_ret++; 4290 printf(" %d", n_ctx); 4291 printf("\n"); 4292 } 4293 } 4294 function_tests++; 4295 4296 return(test_ret); 4297 } 4298 4299 4300 static int 4301 test_xmlSAX2GetEntity(void) { 4302 int test_ret = 0; 4303 4304 int mem_base; 4305 xmlEntityPtr ret_val; 4306 void * ctx; /* the user data (XML parser context) */ 4307 int n_ctx; 4308 xmlChar * name; /* The entity name */ 4309 int n_name; 4310 4311 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { 4312 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { 4313 mem_base = xmlMemBlocks(); 4314 ctx = gen_void_ptr(n_ctx, 0); 4315 name = gen_const_xmlChar_ptr(n_name, 1); 4316 4317 ret_val = xmlSAX2GetEntity(ctx, (const xmlChar *)name); 4318 desret_xmlEntityPtr(ret_val); 4319 call_tests++; 4320 des_void_ptr(n_ctx, ctx, 0); 4321 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); 4322 xmlResetLastError(); 4323 if (mem_base != xmlMemBlocks()) { 4324 printf("Leak of %d blocks found in xmlSAX2GetEntity", 4325 xmlMemBlocks() - mem_base); 4326 test_ret++; 4327 printf(" %d", n_ctx); 4328 printf(" %d", n_name); 4329 printf("\n"); 4330 } 4331 } 4332 } 4333 function_tests++; 4334 4335 return(test_ret); 4336 } 4337 4338 4339 static int 4340 test_xmlSAX2GetLineNumber(void) { 4341 int test_ret = 0; 4342 4343 int mem_base; 4344 int ret_val; 4345 void * ctx; /* the user data (XML parser context) */ 4346 int n_ctx; 4347 4348 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { 4349 mem_base = xmlMemBlocks(); 4350 ctx = gen_void_ptr(n_ctx, 0); 4351 4352 ret_val = xmlSAX2GetLineNumber(ctx); 4353 desret_int(ret_val); 4354 call_tests++; 4355 des_void_ptr(n_ctx, ctx, 0); 4356 xmlResetLastError(); 4357 if (mem_base != xmlMemBlocks()) { 4358 printf("Leak of %d blocks found in xmlSAX2GetLineNumber", 4359 xmlMemBlocks() - mem_base); 4360 test_ret++; 4361 printf(" %d", n_ctx); 4362 printf("\n"); 4363 } 4364 } 4365 function_tests++; 4366 4367 return(test_ret); 4368 } 4369 4370 4371 static int 4372 test_xmlSAX2GetParameterEntity(void) { 4373 int test_ret = 0; 4374 4375 int mem_base; 4376 xmlEntityPtr ret_val; 4377 void * ctx; /* the user data (XML parser context) */ 4378 int n_ctx; 4379 xmlChar * name; /* The entity name */ 4380 int n_name; 4381 4382 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { 4383 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { 4384 mem_base = xmlMemBlocks(); 4385 ctx = gen_void_ptr(n_ctx, 0); 4386 name = gen_const_xmlChar_ptr(n_name, 1); 4387 4388 ret_val = xmlSAX2GetParameterEntity(ctx, (const xmlChar *)name); 4389 desret_xmlEntityPtr(ret_val); 4390 call_tests++; 4391 des_void_ptr(n_ctx, ctx, 0); 4392 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); 4393 xmlResetLastError(); 4394 if (mem_base != xmlMemBlocks()) { 4395 printf("Leak of %d blocks found in xmlSAX2GetParameterEntity", 4396 xmlMemBlocks() - mem_base); 4397 test_ret++; 4398 printf(" %d", n_ctx); 4399 printf(" %d", n_name); 4400 printf("\n"); 4401 } 4402 } 4403 } 4404 function_tests++; 4405 4406 return(test_ret); 4407 } 4408 4409 4410 static int 4411 test_xmlSAX2GetPublicId(void) { 4412 int test_ret = 0; 4413 4414 int mem_base; 4415 const xmlChar * ret_val; 4416 void * ctx; /* the user data (XML parser context) */ 4417 int n_ctx; 4418 4419 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { 4420 mem_base = xmlMemBlocks(); 4421 ctx = gen_void_ptr(n_ctx, 0); 4422 4423 ret_val = xmlSAX2GetPublicId(ctx); 4424 desret_const_xmlChar_ptr(ret_val); 4425 call_tests++; 4426 des_void_ptr(n_ctx, ctx, 0); 4427 xmlResetLastError(); 4428 if (mem_base != xmlMemBlocks()) { 4429 printf("Leak of %d blocks found in xmlSAX2GetPublicId", 4430 xmlMemBlocks() - mem_base); 4431 test_ret++; 4432 printf(" %d", n_ctx); 4433 printf("\n"); 4434 } 4435 } 4436 function_tests++; 4437 4438 return(test_ret); 4439 } 4440 4441 4442 static int 4443 test_xmlSAX2GetSystemId(void) { 4444 int test_ret = 0; 4445 4446 int mem_base; 4447 const xmlChar * ret_val; 4448 void * ctx; /* the user data (XML parser context) */ 4449 int n_ctx; 4450 4451 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { 4452 mem_base = xmlMemBlocks(); 4453 ctx = gen_void_ptr(n_ctx, 0); 4454 4455 ret_val = xmlSAX2GetSystemId(ctx); 4456 desret_const_xmlChar_ptr(ret_val); 4457 call_tests++; 4458 des_void_ptr(n_ctx, ctx, 0); 4459 xmlResetLastError(); 4460 if (mem_base != xmlMemBlocks()) { 4461 printf("Leak of %d blocks found in xmlSAX2GetSystemId", 4462 xmlMemBlocks() - mem_base); 4463 test_ret++; 4464 printf(" %d", n_ctx); 4465 printf("\n"); 4466 } 4467 } 4468 function_tests++; 4469 4470 return(test_ret); 4471 } 4472 4473 4474 static int 4475 test_xmlSAX2HasExternalSubset(void) { 4476 int test_ret = 0; 4477 4478 int mem_base; 4479 int ret_val; 4480 void * ctx; /* the user data (XML parser context) */ 4481 int n_ctx; 4482 4483 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { 4484 mem_base = xmlMemBlocks(); 4485 ctx = gen_void_ptr(n_ctx, 0); 4486 4487 ret_val = xmlSAX2HasExternalSubset(ctx); 4488 desret_int(ret_val); 4489 call_tests++; 4490 des_void_ptr(n_ctx, ctx, 0); 4491 xmlResetLastError(); 4492 if (mem_base != xmlMemBlocks()) { 4493 printf("Leak of %d blocks found in xmlSAX2HasExternalSubset", 4494 xmlMemBlocks() - mem_base); 4495 test_ret++; 4496 printf(" %d", n_ctx); 4497 printf("\n"); 4498 } 4499 } 4500 function_tests++; 4501 4502 return(test_ret); 4503 } 4504 4505 4506 static int 4507 test_xmlSAX2HasInternalSubset(void) { 4508 int test_ret = 0; 4509 4510 int mem_base; 4511 int ret_val; 4512 void * ctx; /* the user data (XML parser context) */ 4513 int n_ctx; 4514 4515 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { 4516 mem_base = xmlMemBlocks(); 4517 ctx = gen_void_ptr(n_ctx, 0); 4518 4519 ret_val = xmlSAX2HasInternalSubset(ctx); 4520 desret_int(ret_val); 4521 call_tests++; 4522 des_void_ptr(n_ctx, ctx, 0); 4523 xmlResetLastError(); 4524 if (mem_base != xmlMemBlocks()) { 4525 printf("Leak of %d blocks found in xmlSAX2HasInternalSubset", 4526 xmlMemBlocks() - mem_base); 4527 test_ret++; 4528 printf(" %d", n_ctx); 4529 printf("\n"); 4530 } 4531 } 4532 function_tests++; 4533 4534 return(test_ret); 4535 } 4536 4537 4538 static int 4539 test_xmlSAX2IgnorableWhitespace(void) { 4540 int test_ret = 0; 4541 4542 int mem_base; 4543 void * ctx; /* the user data (XML parser context) */ 4544 int n_ctx; 4545 xmlChar * ch; /* a xmlChar string */ 4546 int n_ch; 4547 int len; /* the number of xmlChar */ 4548 int n_len; 4549 4550 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { 4551 for (n_ch = 0;n_ch < gen_nb_const_xmlChar_ptr;n_ch++) { 4552 for (n_len = 0;n_len < gen_nb_int;n_len++) { 4553 mem_base = xmlMemBlocks(); 4554 ctx = gen_void_ptr(n_ctx, 0); 4555 ch = gen_const_xmlChar_ptr(n_ch, 1); 4556 len = gen_int(n_len, 2); 4557 4558 xmlSAX2IgnorableWhitespace(ctx, (const xmlChar *)ch, len); 4559 call_tests++; 4560 des_void_ptr(n_ctx, ctx, 0); 4561 des_const_xmlChar_ptr(n_ch, (const xmlChar *)ch, 1); 4562 des_int(n_len, len, 2); 4563 xmlResetLastError(); 4564 if (mem_base != xmlMemBlocks()) { 4565 printf("Leak of %d blocks found in xmlSAX2IgnorableWhitespace", 4566 xmlMemBlocks() - mem_base); 4567 test_ret++; 4568 printf(" %d", n_ctx); 4569 printf(" %d", n_ch); 4570 printf(" %d", n_len); 4571 printf("\n"); 4572 } 4573 } 4574 } 4575 } 4576 function_tests++; 4577 4578 return(test_ret); 4579 } 4580 4581 4582 #define gen_nb_xmlSAXHandler_ptr 1 4583 static xmlSAXHandler * gen_xmlSAXHandler_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 4584 return(NULL); 4585 } 4586 static void des_xmlSAXHandler_ptr(int no ATTRIBUTE_UNUSED, xmlSAXHandler * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 4587 } 4588 4589 static int 4590 test_xmlSAX2InitDefaultSAXHandler(void) { 4591 int test_ret = 0; 4592 4593 int mem_base; 4594 xmlSAXHandler * hdlr; /* the SAX handler */ 4595 int n_hdlr; 4596 int warning; /* flag if non-zero sets the handler warning procedure */ 4597 int n_warning; 4598 4599 for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) { 4600 for (n_warning = 0;n_warning < gen_nb_int;n_warning++) { 4601 mem_base = xmlMemBlocks(); 4602 hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0); 4603 warning = gen_int(n_warning, 1); 4604 4605 xmlSAX2InitDefaultSAXHandler(hdlr, warning); 4606 call_tests++; 4607 des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0); 4608 des_int(n_warning, warning, 1); 4609 xmlResetLastError(); 4610 if (mem_base != xmlMemBlocks()) { 4611 printf("Leak of %d blocks found in xmlSAX2InitDefaultSAXHandler", 4612 xmlMemBlocks() - mem_base); 4613 test_ret++; 4614 printf(" %d", n_hdlr); 4615 printf(" %d", n_warning); 4616 printf("\n"); 4617 } 4618 } 4619 } 4620 function_tests++; 4621 4622 return(test_ret); 4623 } 4624 4625 4626 static int 4627 test_xmlSAX2InitDocbDefaultSAXHandler(void) { 4628 int test_ret = 0; 4629 4630 #if defined(LIBXML_DOCB_ENABLED) 4631 int mem_base; 4632 xmlSAXHandler * hdlr; /* the SAX handler */ 4633 int n_hdlr; 4634 4635 for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) { 4636 mem_base = xmlMemBlocks(); 4637 hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0); 4638 4639 xmlSAX2InitDocbDefaultSAXHandler(hdlr); 4640 call_tests++; 4641 des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0); 4642 xmlResetLastError(); 4643 if (mem_base != xmlMemBlocks()) { 4644 printf("Leak of %d blocks found in xmlSAX2InitDocbDefaultSAXHandler", 4645 xmlMemBlocks() - mem_base); 4646 test_ret++; 4647 printf(" %d", n_hdlr); 4648 printf("\n"); 4649 } 4650 } 4651 function_tests++; 4652 #endif 4653 4654 return(test_ret); 4655 } 4656 4657 4658 static int 4659 test_xmlSAX2InitHtmlDefaultSAXHandler(void) { 4660 int test_ret = 0; 4661 4662 #if defined(LIBXML_HTML_ENABLED) 4663 int mem_base; 4664 xmlSAXHandler * hdlr; /* the SAX handler */ 4665 int n_hdlr; 4666 4667 for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) { 4668 mem_base = xmlMemBlocks(); 4669 hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0); 4670 4671 xmlSAX2InitHtmlDefaultSAXHandler(hdlr); 4672 call_tests++; 4673 des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0); 4674 xmlResetLastError(); 4675 if (mem_base != xmlMemBlocks()) { 4676 printf("Leak of %d blocks found in xmlSAX2InitHtmlDefaultSAXHandler", 4677 xmlMemBlocks() - mem_base); 4678 test_ret++; 4679 printf(" %d", n_hdlr); 4680 printf("\n"); 4681 } 4682 } 4683 function_tests++; 4684 #endif 4685 4686 return(test_ret); 4687 } 4688 4689 4690 static int 4691 test_xmlSAX2InternalSubset(void) { 4692 int test_ret = 0; 4693 4694 int mem_base; 4695 void * ctx; /* the user data (XML parser context) */ 4696 int n_ctx; 4697 xmlChar * name; /* the root element name */ 4698 int n_name; 4699 xmlChar * ExternalID; /* the external ID */ 4700 int n_ExternalID; 4701 xmlChar * SystemID; /* the SYSTEM ID (e.g. filename or URL) */ 4702 int n_SystemID; 4703 4704 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { 4705 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { 4706 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) { 4707 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) { 4708 mem_base = xmlMemBlocks(); 4709 ctx = gen_void_ptr(n_ctx, 0); 4710 name = gen_const_xmlChar_ptr(n_name, 1); 4711 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2); 4712 SystemID = gen_const_xmlChar_ptr(n_SystemID, 3); 4713 4714 xmlSAX2InternalSubset(ctx, (const xmlChar *)name, (const xmlChar *)ExternalID, (const xmlChar *)SystemID); 4715 call_tests++; 4716 des_void_ptr(n_ctx, ctx, 0); 4717 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); 4718 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 2); 4719 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 3); 4720 xmlResetLastError(); 4721 if (mem_base != xmlMemBlocks()) { 4722 printf("Leak of %d blocks found in xmlSAX2InternalSubset", 4723 xmlMemBlocks() - mem_base); 4724 test_ret++; 4725 printf(" %d", n_ctx); 4726 printf(" %d", n_name); 4727 printf(" %d", n_ExternalID); 4728 printf(" %d", n_SystemID); 4729 printf("\n"); 4730 } 4731 } 4732 } 4733 } 4734 } 4735 function_tests++; 4736 4737 return(test_ret); 4738 } 4739 4740 4741 static int 4742 test_xmlSAX2IsStandalone(void) { 4743 int test_ret = 0; 4744 4745 int mem_base; 4746 int ret_val; 4747 void * ctx; /* the user data (XML parser context) */ 4748 int n_ctx; 4749 4750 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { 4751 mem_base = xmlMemBlocks(); 4752 ctx = gen_void_ptr(n_ctx, 0); 4753 4754 ret_val = xmlSAX2IsStandalone(ctx); 4755 desret_int(ret_val); 4756 call_tests++; 4757 des_void_ptr(n_ctx, ctx, 0); 4758 xmlResetLastError(); 4759 if (mem_base != xmlMemBlocks()) { 4760 printf("Leak of %d blocks found in xmlSAX2IsStandalone", 4761 xmlMemBlocks() - mem_base); 4762 test_ret++; 4763 printf(" %d", n_ctx); 4764 printf("\n"); 4765 } 4766 } 4767 function_tests++; 4768 4769 return(test_ret); 4770 } 4771 4772 4773 static int 4774 test_xmlSAX2NotationDecl(void) { 4775 int test_ret = 0; 4776 4777 int mem_base; 4778 void * ctx; /* the user data (XML parser context) */ 4779 int n_ctx; 4780 xmlChar * name; /* The name of the notation */ 4781 int n_name; 4782 xmlChar * publicId; /* The public ID of the entity */ 4783 int n_publicId; 4784 xmlChar * systemId; /* The system ID of the entity */ 4785 int n_systemId; 4786 4787 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { 4788 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { 4789 for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) { 4790 for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) { 4791 mem_base = xmlMemBlocks(); 4792 ctx = gen_void_ptr(n_ctx, 0); 4793 name = gen_const_xmlChar_ptr(n_name, 1); 4794 publicId = gen_const_xmlChar_ptr(n_publicId, 2); 4795 systemId = gen_const_xmlChar_ptr(n_systemId, 3); 4796 4797 xmlSAX2NotationDecl(ctx, (const xmlChar *)name, (const xmlChar *)publicId, (const xmlChar *)systemId); 4798 call_tests++; 4799 des_void_ptr(n_ctx, ctx, 0); 4800 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); 4801 des_const_xmlChar_ptr(n_publicId, (const xmlChar *)publicId, 2); 4802 des_const_xmlChar_ptr(n_systemId, (const xmlChar *)systemId, 3); 4803 xmlResetLastError(); 4804 if (mem_base != xmlMemBlocks()) { 4805 printf("Leak of %d blocks found in xmlSAX2NotationDecl", 4806 xmlMemBlocks() - mem_base); 4807 test_ret++; 4808 printf(" %d", n_ctx); 4809 printf(" %d", n_name); 4810 printf(" %d", n_publicId); 4811 printf(" %d", n_systemId); 4812 printf("\n"); 4813 } 4814 } 4815 } 4816 } 4817 } 4818 function_tests++; 4819 4820 return(test_ret); 4821 } 4822 4823 4824 static int 4825 test_xmlSAX2ProcessingInstruction(void) { 4826 int test_ret = 0; 4827 4828 int mem_base; 4829 void * ctx; /* the user data (XML parser context) */ 4830 int n_ctx; 4831 xmlChar * target; /* the target name */ 4832 int n_target; 4833 xmlChar * data; /* the PI data's */ 4834 int n_data; 4835 4836 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { 4837 for (n_target = 0;n_target < gen_nb_const_xmlChar_ptr;n_target++) { 4838 for (n_data = 0;n_data < gen_nb_const_xmlChar_ptr;n_data++) { 4839 mem_base = xmlMemBlocks(); 4840 ctx = gen_void_ptr(n_ctx, 0); 4841 target = gen_const_xmlChar_ptr(n_target, 1); 4842 data = gen_const_xmlChar_ptr(n_data, 2); 4843 4844 xmlSAX2ProcessingInstruction(ctx, (const xmlChar *)target, (const xmlChar *)data); 4845 call_tests++; 4846 des_void_ptr(n_ctx, ctx, 0); 4847 des_const_xmlChar_ptr(n_target, (const xmlChar *)target, 1); 4848 des_const_xmlChar_ptr(n_data, (const xmlChar *)data, 2); 4849 xmlResetLastError(); 4850 if (mem_base != xmlMemBlocks()) { 4851 printf("Leak of %d blocks found in xmlSAX2ProcessingInstruction", 4852 xmlMemBlocks() - mem_base); 4853 test_ret++; 4854 printf(" %d", n_ctx); 4855 printf(" %d", n_target); 4856 printf(" %d", n_data); 4857 printf("\n"); 4858 } 4859 } 4860 } 4861 } 4862 function_tests++; 4863 4864 return(test_ret); 4865 } 4866 4867 4868 static int 4869 test_xmlSAX2Reference(void) { 4870 int test_ret = 0; 4871 4872 int mem_base; 4873 void * ctx; /* the user data (XML parser context) */ 4874 int n_ctx; 4875 xmlChar * name; /* The entity name */ 4876 int n_name; 4877 4878 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { 4879 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { 4880 mem_base = xmlMemBlocks(); 4881 ctx = gen_void_ptr(n_ctx, 0); 4882 name = gen_const_xmlChar_ptr(n_name, 1); 4883 4884 xmlSAX2Reference(ctx, (const xmlChar *)name); 4885 call_tests++; 4886 des_void_ptr(n_ctx, ctx, 0); 4887 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); 4888 xmlResetLastError(); 4889 if (mem_base != xmlMemBlocks()) { 4890 printf("Leak of %d blocks found in xmlSAX2Reference", 4891 xmlMemBlocks() - mem_base); 4892 test_ret++; 4893 printf(" %d", n_ctx); 4894 printf(" %d", n_name); 4895 printf("\n"); 4896 } 4897 } 4898 } 4899 function_tests++; 4900 4901 return(test_ret); 4902 } 4903 4904 4905 static int 4906 test_xmlSAX2ResolveEntity(void) { 4907 int test_ret = 0; 4908 4909 int mem_base; 4910 xmlParserInputPtr ret_val; 4911 void * ctx; /* the user data (XML parser context) */ 4912 int n_ctx; 4913 xmlChar * publicId; /* The public ID of the entity */ 4914 int n_publicId; 4915 xmlChar * systemId; /* The system ID of the entity */ 4916 int n_systemId; 4917 4918 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { 4919 for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) { 4920 for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) { 4921 mem_base = xmlMemBlocks(); 4922 ctx = gen_void_ptr(n_ctx, 0); 4923 publicId = gen_const_xmlChar_ptr(n_publicId, 1); 4924 systemId = gen_const_xmlChar_ptr(n_systemId, 2); 4925 4926 ret_val = xmlSAX2ResolveEntity(ctx, (const xmlChar *)publicId, (const xmlChar *)systemId); 4927 desret_xmlParserInputPtr(ret_val); 4928 call_tests++; 4929 des_void_ptr(n_ctx, ctx, 0); 4930 des_const_xmlChar_ptr(n_publicId, (const xmlChar *)publicId, 1); 4931 des_const_xmlChar_ptr(n_systemId, (const xmlChar *)systemId, 2); 4932 xmlResetLastError(); 4933 if (mem_base != xmlMemBlocks()) { 4934 printf("Leak of %d blocks found in xmlSAX2ResolveEntity", 4935 xmlMemBlocks() - mem_base); 4936 test_ret++; 4937 printf(" %d", n_ctx); 4938 printf(" %d", n_publicId); 4939 printf(" %d", n_systemId); 4940 printf("\n"); 4941 } 4942 } 4943 } 4944 } 4945 function_tests++; 4946 4947 return(test_ret); 4948 } 4949 4950 4951 #define gen_nb_xmlSAXLocatorPtr 1 4952 static xmlSAXLocatorPtr gen_xmlSAXLocatorPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 4953 return(NULL); 4954 } 4955 static void des_xmlSAXLocatorPtr(int no ATTRIBUTE_UNUSED, xmlSAXLocatorPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 4956 } 4957 4958 static int 4959 test_xmlSAX2SetDocumentLocator(void) { 4960 int test_ret = 0; 4961 4962 int mem_base; 4963 void * ctx; /* the user data (XML parser context) */ 4964 int n_ctx; 4965 xmlSAXLocatorPtr loc; /* A SAX Locator */ 4966 int n_loc; 4967 4968 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { 4969 for (n_loc = 0;n_loc < gen_nb_xmlSAXLocatorPtr;n_loc++) { 4970 mem_base = xmlMemBlocks(); 4971 ctx = gen_void_ptr(n_ctx, 0); 4972 loc = gen_xmlSAXLocatorPtr(n_loc, 1); 4973 4974 xmlSAX2SetDocumentLocator(ctx, loc); 4975 call_tests++; 4976 des_void_ptr(n_ctx, ctx, 0); 4977 des_xmlSAXLocatorPtr(n_loc, loc, 1); 4978 xmlResetLastError(); 4979 if (mem_base != xmlMemBlocks()) { 4980 printf("Leak of %d blocks found in xmlSAX2SetDocumentLocator", 4981 xmlMemBlocks() - mem_base); 4982 test_ret++; 4983 printf(" %d", n_ctx); 4984 printf(" %d", n_loc); 4985 printf("\n"); 4986 } 4987 } 4988 } 4989 function_tests++; 4990 4991 return(test_ret); 4992 } 4993 4994 4995 static int 4996 test_xmlSAX2StartDocument(void) { 4997 int test_ret = 0; 4998 4999 int mem_base; 5000 void * ctx; /* the user data (XML parser context) */ 5001 int n_ctx; 5002 5003 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { 5004 mem_base = xmlMemBlocks(); 5005 ctx = gen_void_ptr(n_ctx, 0); 5006 5007 xmlSAX2StartDocument(ctx); 5008 call_tests++; 5009 des_void_ptr(n_ctx, ctx, 0); 5010 xmlResetLastError(); 5011 if (mem_base != xmlMemBlocks()) { 5012 printf("Leak of %d blocks found in xmlSAX2StartDocument", 5013 xmlMemBlocks() - mem_base); 5014 test_ret++; 5015 printf(" %d", n_ctx); 5016 printf("\n"); 5017 } 5018 } 5019 function_tests++; 5020 5021 return(test_ret); 5022 } 5023 5024 5025 static int 5026 test_xmlSAX2StartElement(void) { 5027 int test_ret = 0; 5028 5029 #if defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_DOCB_ENABLED) || defined(LIBXML_LEGACY_ENABLED) 5030 #ifdef LIBXML_SAX1_ENABLED 5031 int mem_base; 5032 void * ctx; /* the user data (XML parser context) */ 5033 int n_ctx; 5034 xmlChar * fullname; /* The element name, including namespace prefix */ 5035 int n_fullname; 5036 xmlChar ** atts; /* An array of name/value attributes pairs, NULL terminated */ 5037 int n_atts; 5038 5039 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { 5040 for (n_fullname = 0;n_fullname < gen_nb_const_xmlChar_ptr;n_fullname++) { 5041 for (n_atts = 0;n_atts < gen_nb_const_xmlChar_ptr_ptr;n_atts++) { 5042 mem_base = xmlMemBlocks(); 5043 ctx = gen_void_ptr(n_ctx, 0); 5044 fullname = gen_const_xmlChar_ptr(n_fullname, 1); 5045 atts = gen_const_xmlChar_ptr_ptr(n_atts, 2); 5046 5047 xmlSAX2StartElement(ctx, (const xmlChar *)fullname, (const xmlChar **)atts); 5048 call_tests++; 5049 des_void_ptr(n_ctx, ctx, 0); 5050 des_const_xmlChar_ptr(n_fullname, (const xmlChar *)fullname, 1); 5051 des_const_xmlChar_ptr_ptr(n_atts, (const xmlChar **)atts, 2); 5052 xmlResetLastError(); 5053 if (mem_base != xmlMemBlocks()) { 5054 printf("Leak of %d blocks found in xmlSAX2StartElement", 5055 xmlMemBlocks() - mem_base); 5056 test_ret++; 5057 printf(" %d", n_ctx); 5058 printf(" %d", n_fullname); 5059 printf(" %d", n_atts); 5060 printf("\n"); 5061 } 5062 } 5063 } 5064 } 5065 function_tests++; 5066 #endif 5067 #endif 5068 5069 return(test_ret); 5070 } 5071 5072 5073 static int 5074 test_xmlSAX2StartElementNs(void) { 5075 int test_ret = 0; 5076 5077 int mem_base; 5078 void * ctx; /* the user data (XML parser context) */ 5079 int n_ctx; 5080 xmlChar * localname; /* the local name of the element */ 5081 int n_localname; 5082 xmlChar * prefix; /* the element namespace prefix if available */ 5083 int n_prefix; 5084 xmlChar * URI; /* the element namespace name if available */ 5085 int n_URI; 5086 int nb_namespaces; /* number of namespace definitions on that node */ 5087 int n_nb_namespaces; 5088 xmlChar ** namespaces; /* pointer to the array of prefix/URI pairs namespace definitions */ 5089 int n_namespaces; 5090 int nb_attributes; /* the number of attributes on that node */ 5091 int n_nb_attributes; 5092 int nb_defaulted; /* the number of defaulted attributes. */ 5093 int n_nb_defaulted; 5094 xmlChar ** attributes; /* pointer to the array of (localname/prefix/URI/value/end) attribute values. */ 5095 int n_attributes; 5096 5097 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { 5098 for (n_localname = 0;n_localname < gen_nb_const_xmlChar_ptr;n_localname++) { 5099 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) { 5100 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) { 5101 for (n_nb_namespaces = 0;n_nb_namespaces < gen_nb_int;n_nb_namespaces++) { 5102 for (n_namespaces = 0;n_namespaces < gen_nb_const_xmlChar_ptr_ptr;n_namespaces++) { 5103 for (n_nb_attributes = 0;n_nb_attributes < gen_nb_int;n_nb_attributes++) { 5104 for (n_nb_defaulted = 0;n_nb_defaulted < gen_nb_int;n_nb_defaulted++) { 5105 for (n_attributes = 0;n_attributes < gen_nb_const_xmlChar_ptr_ptr;n_attributes++) { 5106 mem_base = xmlMemBlocks(); 5107 ctx = gen_void_ptr(n_ctx, 0); 5108 localname = gen_const_xmlChar_ptr(n_localname, 1); 5109 prefix = gen_const_xmlChar_ptr(n_prefix, 2); 5110 URI = gen_const_xmlChar_ptr(n_URI, 3); 5111 nb_namespaces = gen_int(n_nb_namespaces, 4); 5112 namespaces = gen_const_xmlChar_ptr_ptr(n_namespaces, 5); 5113 nb_attributes = gen_int(n_nb_attributes, 6); 5114 nb_defaulted = gen_int(n_nb_defaulted, 7); 5115 attributes = gen_const_xmlChar_ptr_ptr(n_attributes, 8); 5116 5117 xmlSAX2StartElementNs(ctx, (const xmlChar *)localname, (const xmlChar *)prefix, (const xmlChar *)URI, nb_namespaces, (const xmlChar **)namespaces, nb_attributes, nb_defaulted, (const xmlChar **)attributes); 5118 call_tests++; 5119 des_void_ptr(n_ctx, ctx, 0); 5120 des_const_xmlChar_ptr(n_localname, (const xmlChar *)localname, 1); 5121 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 2); 5122 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 3); 5123 des_int(n_nb_namespaces, nb_namespaces, 4); 5124 des_const_xmlChar_ptr_ptr(n_namespaces, (const xmlChar **)namespaces, 5); 5125 des_int(n_nb_attributes, nb_attributes, 6); 5126 des_int(n_nb_defaulted, nb_defaulted, 7); 5127 des_const_xmlChar_ptr_ptr(n_attributes, (const xmlChar **)attributes, 8); 5128 xmlResetLastError(); 5129 if (mem_base != xmlMemBlocks()) { 5130 printf("Leak of %d blocks found in xmlSAX2StartElementNs", 5131 xmlMemBlocks() - mem_base); 5132 test_ret++; 5133 printf(" %d", n_ctx); 5134 printf(" %d", n_localname); 5135 printf(" %d", n_prefix); 5136 printf(" %d", n_URI); 5137 printf(" %d", n_nb_namespaces); 5138 printf(" %d", n_namespaces); 5139 printf(" %d", n_nb_attributes); 5140 printf(" %d", n_nb_defaulted); 5141 printf(" %d", n_attributes); 5142 printf("\n"); 5143 } 5144 } 5145 } 5146 } 5147 } 5148 } 5149 } 5150 } 5151 } 5152 } 5153 function_tests++; 5154 5155 return(test_ret); 5156 } 5157 5158 5159 static int 5160 test_xmlSAX2UnparsedEntityDecl(void) { 5161 int test_ret = 0; 5162 5163 int mem_base; 5164 void * ctx; /* the user data (XML parser context) */ 5165 int n_ctx; 5166 xmlChar * name; /* The name of the entity */ 5167 int n_name; 5168 xmlChar * publicId; /* The public ID of the entity */ 5169 int n_publicId; 5170 xmlChar * systemId; /* The system ID of the entity */ 5171 int n_systemId; 5172 xmlChar * notationName; /* the name of the notation */ 5173 int n_notationName; 5174 5175 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { 5176 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { 5177 for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) { 5178 for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) { 5179 for (n_notationName = 0;n_notationName < gen_nb_const_xmlChar_ptr;n_notationName++) { 5180 mem_base = xmlMemBlocks(); 5181 ctx = gen_void_ptr(n_ctx, 0); 5182 name = gen_const_xmlChar_ptr(n_name, 1); 5183 publicId = gen_const_xmlChar_ptr(n_publicId, 2); 5184 systemId = gen_const_xmlChar_ptr(n_systemId, 3); 5185 notationName = gen_const_xmlChar_ptr(n_notationName, 4); 5186 5187 xmlSAX2UnparsedEntityDecl(ctx, (const xmlChar *)name, (const xmlChar *)publicId, (const xmlChar *)systemId, (const xmlChar *)notationName); 5188 call_tests++; 5189 des_void_ptr(n_ctx, ctx, 0); 5190 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); 5191 des_const_xmlChar_ptr(n_publicId, (const xmlChar *)publicId, 2); 5192 des_const_xmlChar_ptr(n_systemId, (const xmlChar *)systemId, 3); 5193 des_const_xmlChar_ptr(n_notationName, (const xmlChar *)notationName, 4); 5194 xmlResetLastError(); 5195 if (mem_base != xmlMemBlocks()) { 5196 printf("Leak of %d blocks found in xmlSAX2UnparsedEntityDecl", 5197 xmlMemBlocks() - mem_base); 5198 test_ret++; 5199 printf(" %d", n_ctx); 5200 printf(" %d", n_name); 5201 printf(" %d", n_publicId); 5202 printf(" %d", n_systemId); 5203 printf(" %d", n_notationName); 5204 printf("\n"); 5205 } 5206 } 5207 } 5208 } 5209 } 5210 } 5211 function_tests++; 5212 5213 return(test_ret); 5214 } 5215 5216 5217 static int 5218 test_xmlSAXDefaultVersion(void) { 5219 int test_ret = 0; 5220 5221 #if defined(LIBXML_SAX1_ENABLED) 5222 #ifdef LIBXML_SAX1_ENABLED 5223 int mem_base; 5224 int ret_val; 5225 int version; /* the version, 1 or 2 */ 5226 int n_version; 5227 5228 for (n_version = 0;n_version < gen_nb_int;n_version++) { 5229 mem_base = xmlMemBlocks(); 5230 version = gen_int(n_version, 0); 5231 5232 ret_val = xmlSAXDefaultVersion(version); 5233 desret_int(ret_val); 5234 call_tests++; 5235 des_int(n_version, version, 0); 5236 xmlResetLastError(); 5237 if (mem_base != xmlMemBlocks()) { 5238 printf("Leak of %d blocks found in xmlSAXDefaultVersion", 5239 xmlMemBlocks() - mem_base); 5240 test_ret++; 5241 printf(" %d", n_version); 5242 printf("\n"); 5243 } 5244 } 5245 function_tests++; 5246 #endif 5247 #endif 5248 5249 return(test_ret); 5250 } 5251 5252 5253 static int 5254 test_xmlSAXVersion(void) { 5255 int test_ret = 0; 5256 5257 int mem_base; 5258 int ret_val; 5259 xmlSAXHandler * hdlr; /* the SAX handler */ 5260 int n_hdlr; 5261 int version; /* the version, 1 or 2 */ 5262 int n_version; 5263 5264 for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) { 5265 for (n_version = 0;n_version < gen_nb_int;n_version++) { 5266 mem_base = xmlMemBlocks(); 5267 hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0); 5268 version = gen_int(n_version, 1); 5269 5270 ret_val = xmlSAXVersion(hdlr, version); 5271 desret_int(ret_val); 5272 call_tests++; 5273 des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0); 5274 des_int(n_version, version, 1); 5275 xmlResetLastError(); 5276 if (mem_base != xmlMemBlocks()) { 5277 printf("Leak of %d blocks found in xmlSAXVersion", 5278 xmlMemBlocks() - mem_base); 5279 test_ret++; 5280 printf(" %d", n_hdlr); 5281 printf(" %d", n_version); 5282 printf("\n"); 5283 } 5284 } 5285 } 5286 function_tests++; 5287 5288 return(test_ret); 5289 } 5290 5291 static int 5292 test_SAX2(void) { 5293 int test_ret = 0; 5294 5295 if (quiet == 0) printf("Testing SAX2 : 38 of 38 functions ...\n"); 5296 test_ret += test_docbDefaultSAXHandlerInit(); 5297 test_ret += test_htmlDefaultSAXHandlerInit(); 5298 test_ret += test_xmlDefaultSAXHandlerInit(); 5299 test_ret += test_xmlSAX2AttributeDecl(); 5300 test_ret += test_xmlSAX2CDataBlock(); 5301 test_ret += test_xmlSAX2Characters(); 5302 test_ret += test_xmlSAX2Comment(); 5303 test_ret += test_xmlSAX2ElementDecl(); 5304 test_ret += test_xmlSAX2EndDocument(); 5305 test_ret += test_xmlSAX2EndElement(); 5306 test_ret += test_xmlSAX2EndElementNs(); 5307 test_ret += test_xmlSAX2EntityDecl(); 5308 test_ret += test_xmlSAX2ExternalSubset(); 5309 test_ret += test_xmlSAX2GetColumnNumber(); 5310 test_ret += test_xmlSAX2GetEntity(); 5311 test_ret += test_xmlSAX2GetLineNumber(); 5312 test_ret += test_xmlSAX2GetParameterEntity(); 5313 test_ret += test_xmlSAX2GetPublicId(); 5314 test_ret += test_xmlSAX2GetSystemId(); 5315 test_ret += test_xmlSAX2HasExternalSubset(); 5316 test_ret += test_xmlSAX2HasInternalSubset(); 5317 test_ret += test_xmlSAX2IgnorableWhitespace(); 5318 test_ret += test_xmlSAX2InitDefaultSAXHandler(); 5319 test_ret += test_xmlSAX2InitDocbDefaultSAXHandler(); 5320 test_ret += test_xmlSAX2InitHtmlDefaultSAXHandler(); 5321 test_ret += test_xmlSAX2InternalSubset(); 5322 test_ret += test_xmlSAX2IsStandalone(); 5323 test_ret += test_xmlSAX2NotationDecl(); 5324 test_ret += test_xmlSAX2ProcessingInstruction(); 5325 test_ret += test_xmlSAX2Reference(); 5326 test_ret += test_xmlSAX2ResolveEntity(); 5327 test_ret += test_xmlSAX2SetDocumentLocator(); 5328 test_ret += test_xmlSAX2StartDocument(); 5329 test_ret += test_xmlSAX2StartElement(); 5330 test_ret += test_xmlSAX2StartElementNs(); 5331 test_ret += test_xmlSAX2UnparsedEntityDecl(); 5332 test_ret += test_xmlSAXDefaultVersion(); 5333 test_ret += test_xmlSAXVersion(); 5334 5335 if (test_ret != 0) 5336 printf("Module SAX2: %d errors\n", test_ret); 5337 return(test_ret); 5338 } 5339 5340 static int 5341 test_xmlC14NDocDumpMemory(void) { 5342 int test_ret = 0; 5343 5344 #if defined(LIBXML_C14N_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) 5345 int mem_base; 5346 int ret_val; 5347 xmlDocPtr doc; /* the XML document for canonization */ 5348 int n_doc; 5349 xmlNodeSetPtr nodes; /* the nodes set to be included in the canonized image or NULL if all document nodes should be included */ 5350 int n_nodes; 5351 int mode; /* the c14n mode (see @xmlC14NMode) */ 5352 int n_mode; 5353 xmlChar ** inclusive_ns_prefixes; /* the list of inclusive namespace prefixes ended with a NULL or NULL if there is no inclusive namespaces (only for exclusive canonicalization, ignored otherwise) */ 5354 int n_inclusive_ns_prefixes; 5355 int with_comments; /* include comments in the result (!=0) or not (==0) */ 5356 int n_with_comments; 5357 xmlChar ** doc_txt_ptr; /* the memory pointer for allocated canonical XML text; the caller of this functions is responsible for calling xmlFree() to free allocated memory */ 5358 int n_doc_txt_ptr; 5359 5360 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { 5361 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) { 5362 for (n_mode = 0;n_mode < gen_nb_int;n_mode++) { 5363 for (n_inclusive_ns_prefixes = 0;n_inclusive_ns_prefixes < gen_nb_xmlChar_ptr_ptr;n_inclusive_ns_prefixes++) { 5364 for (n_with_comments = 0;n_with_comments < gen_nb_int;n_with_comments++) { 5365 for (n_doc_txt_ptr = 0;n_doc_txt_ptr < gen_nb_xmlChar_ptr_ptr;n_doc_txt_ptr++) { 5366 mem_base = xmlMemBlocks(); 5367 doc = gen_xmlDocPtr(n_doc, 0); 5368 nodes = gen_xmlNodeSetPtr(n_nodes, 1); 5369 mode = gen_int(n_mode, 2); 5370 inclusive_ns_prefixes = gen_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, 3); 5371 with_comments = gen_int(n_with_comments, 4); 5372 doc_txt_ptr = gen_xmlChar_ptr_ptr(n_doc_txt_ptr, 5); 5373 5374 ret_val = xmlC14NDocDumpMemory(doc, nodes, mode, inclusive_ns_prefixes, with_comments, doc_txt_ptr); 5375 desret_int(ret_val); 5376 call_tests++; 5377 des_xmlDocPtr(n_doc, doc, 0); 5378 des_xmlNodeSetPtr(n_nodes, nodes, 1); 5379 des_int(n_mode, mode, 2); 5380 des_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, inclusive_ns_prefixes, 3); 5381 des_int(n_with_comments, with_comments, 4); 5382 des_xmlChar_ptr_ptr(n_doc_txt_ptr, doc_txt_ptr, 5); 5383 xmlResetLastError(); 5384 if (mem_base != xmlMemBlocks()) { 5385 printf("Leak of %d blocks found in xmlC14NDocDumpMemory", 5386 xmlMemBlocks() - mem_base); 5387 test_ret++; 5388 printf(" %d", n_doc); 5389 printf(" %d", n_nodes); 5390 printf(" %d", n_mode); 5391 printf(" %d", n_inclusive_ns_prefixes); 5392 printf(" %d", n_with_comments); 5393 printf(" %d", n_doc_txt_ptr); 5394 printf("\n"); 5395 } 5396 } 5397 } 5398 } 5399 } 5400 } 5401 } 5402 function_tests++; 5403 #endif 5404 5405 return(test_ret); 5406 } 5407 5408 5409 static int 5410 test_xmlC14NDocSave(void) { 5411 int test_ret = 0; 5412 5413 #if defined(LIBXML_C14N_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) 5414 int mem_base; 5415 int ret_val; 5416 xmlDocPtr doc; /* the XML document for canonization */ 5417 int n_doc; 5418 xmlNodeSetPtr nodes; /* the nodes set to be included in the canonized image or NULL if all document nodes should be included */ 5419 int n_nodes; 5420 int mode; /* the c14n mode (see @xmlC14NMode) */ 5421 int n_mode; 5422 xmlChar ** inclusive_ns_prefixes; /* the list of inclusive namespace prefixes ended with a NULL or NULL if there is no inclusive namespaces (only for exclusive canonicalization, ignored otherwise) */ 5423 int n_inclusive_ns_prefixes; 5424 int with_comments; /* include comments in the result (!=0) or not (==0) */ 5425 int n_with_comments; 5426 const char * filename; /* the filename to store canonical XML image */ 5427 int n_filename; 5428 int compression; /* the compression level (zlib requred): -1 - libxml default, 0 - uncompressed, >0 - compression level */ 5429 int n_compression; 5430 5431 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { 5432 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) { 5433 for (n_mode = 0;n_mode < gen_nb_int;n_mode++) { 5434 for (n_inclusive_ns_prefixes = 0;n_inclusive_ns_prefixes < gen_nb_xmlChar_ptr_ptr;n_inclusive_ns_prefixes++) { 5435 for (n_with_comments = 0;n_with_comments < gen_nb_int;n_with_comments++) { 5436 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) { 5437 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) { 5438 mem_base = xmlMemBlocks(); 5439 doc = gen_xmlDocPtr(n_doc, 0); 5440 nodes = gen_xmlNodeSetPtr(n_nodes, 1); 5441 mode = gen_int(n_mode, 2); 5442 inclusive_ns_prefixes = gen_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, 3); 5443 with_comments = gen_int(n_with_comments, 4); 5444 filename = gen_fileoutput(n_filename, 5); 5445 compression = gen_int(n_compression, 6); 5446 5447 ret_val = xmlC14NDocSave(doc, nodes, mode, inclusive_ns_prefixes, with_comments, filename, compression); 5448 desret_int(ret_val); 5449 call_tests++; 5450 des_xmlDocPtr(n_doc, doc, 0); 5451 des_xmlNodeSetPtr(n_nodes, nodes, 1); 5452 des_int(n_mode, mode, 2); 5453 des_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, inclusive_ns_prefixes, 3); 5454 des_int(n_with_comments, with_comments, 4); 5455 des_fileoutput(n_filename, filename, 5); 5456 des_int(n_compression, compression, 6); 5457 xmlResetLastError(); 5458 if (mem_base != xmlMemBlocks()) { 5459 printf("Leak of %d blocks found in xmlC14NDocSave", 5460 xmlMemBlocks() - mem_base); 5461 test_ret++; 5462 printf(" %d", n_doc); 5463 printf(" %d", n_nodes); 5464 printf(" %d", n_mode); 5465 printf(" %d", n_inclusive_ns_prefixes); 5466 printf(" %d", n_with_comments); 5467 printf(" %d", n_filename); 5468 printf(" %d", n_compression); 5469 printf("\n"); 5470 } 5471 } 5472 } 5473 } 5474 } 5475 } 5476 } 5477 } 5478 function_tests++; 5479 #endif 5480 5481 return(test_ret); 5482 } 5483 5484 5485 static int 5486 test_xmlC14NDocSaveTo(void) { 5487 int test_ret = 0; 5488 5489 #if defined(LIBXML_C14N_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) 5490 int mem_base; 5491 int ret_val; 5492 xmlDocPtr doc; /* the XML document for canonization */ 5493 int n_doc; 5494 xmlNodeSetPtr nodes; /* the nodes set to be included in the canonized image or NULL if all document nodes should be included */ 5495 int n_nodes; 5496 int mode; /* the c14n mode (see @xmlC14NMode) */ 5497 int n_mode; 5498 xmlChar ** inclusive_ns_prefixes; /* the list of inclusive namespace prefixes ended with a NULL or NULL if there is no inclusive namespaces (only for exclusive canonicalization, ignored otherwise) */ 5499 int n_inclusive_ns_prefixes; 5500 int with_comments; /* include comments in the result (!=0) or not (==0) */ 5501 int n_with_comments; 5502 xmlOutputBufferPtr buf; /* the output buffer to store canonical XML; this buffer MUST have encoder==NULL because C14N requires UTF-8 output */ 5503 int n_buf; 5504 5505 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { 5506 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) { 5507 for (n_mode = 0;n_mode < gen_nb_int;n_mode++) { 5508 for (n_inclusive_ns_prefixes = 0;n_inclusive_ns_prefixes < gen_nb_xmlChar_ptr_ptr;n_inclusive_ns_prefixes++) { 5509 for (n_with_comments = 0;n_with_comments < gen_nb_int;n_with_comments++) { 5510 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) { 5511 mem_base = xmlMemBlocks(); 5512 doc = gen_xmlDocPtr(n_doc, 0); 5513 nodes = gen_xmlNodeSetPtr(n_nodes, 1); 5514 mode = gen_int(n_mode, 2); 5515 inclusive_ns_prefixes = gen_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, 3); 5516 with_comments = gen_int(n_with_comments, 4); 5517 buf = gen_xmlOutputBufferPtr(n_buf, 5); 5518 5519 ret_val = xmlC14NDocSaveTo(doc, nodes, mode, inclusive_ns_prefixes, with_comments, buf); 5520 desret_int(ret_val); 5521 call_tests++; 5522 des_xmlDocPtr(n_doc, doc, 0); 5523 des_xmlNodeSetPtr(n_nodes, nodes, 1); 5524 des_int(n_mode, mode, 2); 5525 des_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, inclusive_ns_prefixes, 3); 5526 des_int(n_with_comments, with_comments, 4); 5527 des_xmlOutputBufferPtr(n_buf, buf, 5); 5528 xmlResetLastError(); 5529 if (mem_base != xmlMemBlocks()) { 5530 printf("Leak of %d blocks found in xmlC14NDocSaveTo", 5531 xmlMemBlocks() - mem_base); 5532 test_ret++; 5533 printf(" %d", n_doc); 5534 printf(" %d", n_nodes); 5535 printf(" %d", n_mode); 5536 printf(" %d", n_inclusive_ns_prefixes); 5537 printf(" %d", n_with_comments); 5538 printf(" %d", n_buf); 5539 printf("\n"); 5540 } 5541 } 5542 } 5543 } 5544 } 5545 } 5546 } 5547 function_tests++; 5548 #endif 5549 5550 return(test_ret); 5551 } 5552 5553 5554 static int 5555 test_xmlC14NExecute(void) { 5556 int test_ret = 0; 5557 5558 5559 /* missing type support */ 5560 return(test_ret); 5561 } 5562 5563 static int 5564 test_c14n(void) { 5565 int test_ret = 0; 5566 5567 if (quiet == 0) printf("Testing c14n : 3 of 4 functions ...\n"); 5568 test_ret += test_xmlC14NDocDumpMemory(); 5569 test_ret += test_xmlC14NDocSave(); 5570 test_ret += test_xmlC14NDocSaveTo(); 5571 test_ret += test_xmlC14NExecute(); 5572 5573 if (test_ret != 0) 5574 printf("Module c14n: %d errors\n", test_ret); 5575 return(test_ret); 5576 } 5577 #ifdef LIBXML_CATALOG_ENABLED 5578 5579 #define gen_nb_xmlCatalogPtr 1 5580 static xmlCatalogPtr gen_xmlCatalogPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 5581 return(NULL); 5582 } 5583 static void des_xmlCatalogPtr(int no ATTRIBUTE_UNUSED, xmlCatalogPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 5584 } 5585 #endif 5586 5587 5588 static int 5589 test_xmlACatalogAdd(void) { 5590 int test_ret = 0; 5591 5592 #if defined(LIBXML_CATALOG_ENABLED) 5593 int mem_base; 5594 int ret_val; 5595 xmlCatalogPtr catal; /* a Catalog */ 5596 int n_catal; 5597 xmlChar * type; /* the type of record to add to the catalog */ 5598 int n_type; 5599 xmlChar * orig; /* the system, public or prefix to match */ 5600 int n_orig; 5601 xmlChar * replace; /* the replacement value for the match */ 5602 int n_replace; 5603 5604 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) { 5605 for (n_type = 0;n_type < gen_nb_const_xmlChar_ptr;n_type++) { 5606 for (n_orig = 0;n_orig < gen_nb_const_xmlChar_ptr;n_orig++) { 5607 for (n_replace = 0;n_replace < gen_nb_const_xmlChar_ptr;n_replace++) { 5608 mem_base = xmlMemBlocks(); 5609 catal = gen_xmlCatalogPtr(n_catal, 0); 5610 type = gen_const_xmlChar_ptr(n_type, 1); 5611 orig = gen_const_xmlChar_ptr(n_orig, 2); 5612 replace = gen_const_xmlChar_ptr(n_replace, 3); 5613 5614 ret_val = xmlACatalogAdd(catal, (const xmlChar *)type, (const xmlChar *)orig, (const xmlChar *)replace); 5615 desret_int(ret_val); 5616 call_tests++; 5617 des_xmlCatalogPtr(n_catal, catal, 0); 5618 des_const_xmlChar_ptr(n_type, (const xmlChar *)type, 1); 5619 des_const_xmlChar_ptr(n_orig, (const xmlChar *)orig, 2); 5620 des_const_xmlChar_ptr(n_replace, (const xmlChar *)replace, 3); 5621 xmlResetLastError(); 5622 if (mem_base != xmlMemBlocks()) { 5623 printf("Leak of %d blocks found in xmlACatalogAdd", 5624 xmlMemBlocks() - mem_base); 5625 test_ret++; 5626 printf(" %d", n_catal); 5627 printf(" %d", n_type); 5628 printf(" %d", n_orig); 5629 printf(" %d", n_replace); 5630 printf("\n"); 5631 } 5632 } 5633 } 5634 } 5635 } 5636 function_tests++; 5637 #endif 5638 5639 return(test_ret); 5640 } 5641 5642 5643 static int 5644 test_xmlACatalogDump(void) { 5645 int test_ret = 0; 5646 5647 #if defined(LIBXML_CATALOG_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) 5648 int mem_base; 5649 xmlCatalogPtr catal; /* a Catalog */ 5650 int n_catal; 5651 FILE * out; /* the file. */ 5652 int n_out; 5653 5654 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) { 5655 for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) { 5656 mem_base = xmlMemBlocks(); 5657 catal = gen_xmlCatalogPtr(n_catal, 0); 5658 out = gen_FILE_ptr(n_out, 1); 5659 5660 xmlACatalogDump(catal, out); 5661 call_tests++; 5662 des_xmlCatalogPtr(n_catal, catal, 0); 5663 des_FILE_ptr(n_out, out, 1); 5664 xmlResetLastError(); 5665 if (mem_base != xmlMemBlocks()) { 5666 printf("Leak of %d blocks found in xmlACatalogDump", 5667 xmlMemBlocks() - mem_base); 5668 test_ret++; 5669 printf(" %d", n_catal); 5670 printf(" %d", n_out); 5671 printf("\n"); 5672 } 5673 } 5674 } 5675 function_tests++; 5676 #endif 5677 5678 return(test_ret); 5679 } 5680 5681 5682 static int 5683 test_xmlACatalogRemove(void) { 5684 int test_ret = 0; 5685 5686 #if defined(LIBXML_CATALOG_ENABLED) 5687 int mem_base; 5688 int ret_val; 5689 xmlCatalogPtr catal; /* a Catalog */ 5690 int n_catal; 5691 xmlChar * value; /* the value to remove */ 5692 int n_value; 5693 5694 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) { 5695 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { 5696 mem_base = xmlMemBlocks(); 5697 catal = gen_xmlCatalogPtr(n_catal, 0); 5698 value = gen_const_xmlChar_ptr(n_value, 1); 5699 5700 ret_val = xmlACatalogRemove(catal, (const xmlChar *)value); 5701 desret_int(ret_val); 5702 call_tests++; 5703 des_xmlCatalogPtr(n_catal, catal, 0); 5704 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1); 5705 xmlResetLastError(); 5706 if (mem_base != xmlMemBlocks()) { 5707 printf("Leak of %d blocks found in xmlACatalogRemove", 5708 xmlMemBlocks() - mem_base); 5709 test_ret++; 5710 printf(" %d", n_catal); 5711 printf(" %d", n_value); 5712 printf("\n"); 5713 } 5714 } 5715 } 5716 function_tests++; 5717 #endif 5718 5719 return(test_ret); 5720 } 5721 5722 5723 static int 5724 test_xmlACatalogResolve(void) { 5725 int test_ret = 0; 5726 5727 #if defined(LIBXML_CATALOG_ENABLED) 5728 int mem_base; 5729 xmlChar * ret_val; 5730 xmlCatalogPtr catal; /* a Catalog */ 5731 int n_catal; 5732 xmlChar * pubID; /* the public ID string */ 5733 int n_pubID; 5734 xmlChar * sysID; /* the system ID string */ 5735 int n_sysID; 5736 5737 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) { 5738 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) { 5739 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) { 5740 mem_base = xmlMemBlocks(); 5741 catal = gen_xmlCatalogPtr(n_catal, 0); 5742 pubID = gen_const_xmlChar_ptr(n_pubID, 1); 5743 sysID = gen_const_xmlChar_ptr(n_sysID, 2); 5744 5745 ret_val = xmlACatalogResolve(catal, (const xmlChar *)pubID, (const xmlChar *)sysID); 5746 desret_xmlChar_ptr(ret_val); 5747 call_tests++; 5748 des_xmlCatalogPtr(n_catal, catal, 0); 5749 des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 1); 5750 des_const_xmlChar_ptr(n_sysID, (const xmlChar *)sysID, 2); 5751 xmlResetLastError(); 5752 if (mem_base != xmlMemBlocks()) { 5753 printf("Leak of %d blocks found in xmlACatalogResolve", 5754 xmlMemBlocks() - mem_base); 5755 test_ret++; 5756 printf(" %d", n_catal); 5757 printf(" %d", n_pubID); 5758 printf(" %d", n_sysID); 5759 printf("\n"); 5760 } 5761 } 5762 } 5763 } 5764 function_tests++; 5765 #endif 5766 5767 return(test_ret); 5768 } 5769 5770 5771 static int 5772 test_xmlACatalogResolvePublic(void) { 5773 int test_ret = 0; 5774 5775 #if defined(LIBXML_CATALOG_ENABLED) 5776 int mem_base; 5777 xmlChar * ret_val; 5778 xmlCatalogPtr catal; /* a Catalog */ 5779 int n_catal; 5780 xmlChar * pubID; /* the public ID string */ 5781 int n_pubID; 5782 5783 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) { 5784 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) { 5785 mem_base = xmlMemBlocks(); 5786 catal = gen_xmlCatalogPtr(n_catal, 0); 5787 pubID = gen_const_xmlChar_ptr(n_pubID, 1); 5788 5789 ret_val = xmlACatalogResolvePublic(catal, (const xmlChar *)pubID); 5790 desret_xmlChar_ptr(ret_val); 5791 call_tests++; 5792 des_xmlCatalogPtr(n_catal, catal, 0); 5793 des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 1); 5794 xmlResetLastError(); 5795 if (mem_base != xmlMemBlocks()) { 5796 printf("Leak of %d blocks found in xmlACatalogResolvePublic", 5797 xmlMemBlocks() - mem_base); 5798 test_ret++; 5799 printf(" %d", n_catal); 5800 printf(" %d", n_pubID); 5801 printf("\n"); 5802 } 5803 } 5804 } 5805 function_tests++; 5806 #endif 5807 5808 return(test_ret); 5809 } 5810 5811 5812 static int 5813 test_xmlACatalogResolveSystem(void) { 5814 int test_ret = 0; 5815 5816 #if defined(LIBXML_CATALOG_ENABLED) 5817 int mem_base; 5818 xmlChar * ret_val; 5819 xmlCatalogPtr catal; /* a Catalog */ 5820 int n_catal; 5821 xmlChar * sysID; /* the system ID string */ 5822 int n_sysID; 5823 5824 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) { 5825 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) { 5826 mem_base = xmlMemBlocks(); 5827 catal = gen_xmlCatalogPtr(n_catal, 0); 5828 sysID = gen_const_xmlChar_ptr(n_sysID, 1); 5829 5830 ret_val = xmlACatalogResolveSystem(catal, (const xmlChar *)sysID); 5831 desret_xmlChar_ptr(ret_val); 5832 call_tests++; 5833 des_xmlCatalogPtr(n_catal, catal, 0); 5834 des_const_xmlChar_ptr(n_sysID, (const xmlChar *)sysID, 1); 5835 xmlResetLastError(); 5836 if (mem_base != xmlMemBlocks()) { 5837 printf("Leak of %d blocks found in xmlACatalogResolveSystem", 5838 xmlMemBlocks() - mem_base); 5839 test_ret++; 5840 printf(" %d", n_catal); 5841 printf(" %d", n_sysID); 5842 printf("\n"); 5843 } 5844 } 5845 } 5846 function_tests++; 5847 #endif 5848 5849 return(test_ret); 5850 } 5851 5852 5853 static int 5854 test_xmlACatalogResolveURI(void) { 5855 int test_ret = 0; 5856 5857 #if defined(LIBXML_CATALOG_ENABLED) 5858 int mem_base; 5859 xmlChar * ret_val; 5860 xmlCatalogPtr catal; /* a Catalog */ 5861 int n_catal; 5862 xmlChar * URI; /* the URI */ 5863 int n_URI; 5864 5865 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) { 5866 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) { 5867 mem_base = xmlMemBlocks(); 5868 catal = gen_xmlCatalogPtr(n_catal, 0); 5869 URI = gen_const_xmlChar_ptr(n_URI, 1); 5870 5871 ret_val = xmlACatalogResolveURI(catal, (const xmlChar *)URI); 5872 desret_xmlChar_ptr(ret_val); 5873 call_tests++; 5874 des_xmlCatalogPtr(n_catal, catal, 0); 5875 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 1); 5876 xmlResetLastError(); 5877 if (mem_base != xmlMemBlocks()) { 5878 printf("Leak of %d blocks found in xmlACatalogResolveURI", 5879 xmlMemBlocks() - mem_base); 5880 test_ret++; 5881 printf(" %d", n_catal); 5882 printf(" %d", n_URI); 5883 printf("\n"); 5884 } 5885 } 5886 } 5887 function_tests++; 5888 #endif 5889 5890 return(test_ret); 5891 } 5892 5893 5894 static int 5895 test_xmlCatalogAdd(void) { 5896 int test_ret = 0; 5897 5898 #if defined(LIBXML_CATALOG_ENABLED) 5899 int mem_base; 5900 int ret_val; 5901 xmlChar * type; /* the type of record to add to the catalog */ 5902 int n_type; 5903 xmlChar * orig; /* the system, public or prefix to match */ 5904 int n_orig; 5905 xmlChar * replace; /* the replacement value for the match */ 5906 int n_replace; 5907 5908 for (n_type = 0;n_type < gen_nb_const_xmlChar_ptr;n_type++) { 5909 for (n_orig = 0;n_orig < gen_nb_const_xmlChar_ptr;n_orig++) { 5910 for (n_replace = 0;n_replace < gen_nb_const_xmlChar_ptr;n_replace++) { 5911 mem_base = xmlMemBlocks(); 5912 type = gen_const_xmlChar_ptr(n_type, 0); 5913 orig = gen_const_xmlChar_ptr(n_orig, 1); 5914 replace = gen_const_xmlChar_ptr(n_replace, 2); 5915 5916 ret_val = xmlCatalogAdd((const xmlChar *)type, (const xmlChar *)orig, (const xmlChar *)replace); 5917 desret_int(ret_val); 5918 call_tests++; 5919 des_const_xmlChar_ptr(n_type, (const xmlChar *)type, 0); 5920 des_const_xmlChar_ptr(n_orig, (const xmlChar *)orig, 1); 5921 des_const_xmlChar_ptr(n_replace, (const xmlChar *)replace, 2); 5922 xmlResetLastError(); 5923 if (mem_base != xmlMemBlocks()) { 5924 printf("Leak of %d blocks found in xmlCatalogAdd", 5925 xmlMemBlocks() - mem_base); 5926 test_ret++; 5927 printf(" %d", n_type); 5928 printf(" %d", n_orig); 5929 printf(" %d", n_replace); 5930 printf("\n"); 5931 } 5932 } 5933 } 5934 } 5935 function_tests++; 5936 #endif 5937 5938 return(test_ret); 5939 } 5940 5941 5942 static int 5943 test_xmlCatalogCleanup(void) { 5944 int test_ret = 0; 5945 5946 #if defined(LIBXML_CATALOG_ENABLED) 5947 5948 5949 xmlCatalogCleanup(); 5950 call_tests++; 5951 xmlResetLastError(); 5952 function_tests++; 5953 #endif 5954 5955 return(test_ret); 5956 } 5957 5958 5959 static int 5960 test_xmlCatalogConvert(void) { 5961 int test_ret = 0; 5962 5963 #if defined(LIBXML_CATALOG_ENABLED) 5964 int ret_val; 5965 5966 5967 ret_val = xmlCatalogConvert(); 5968 desret_int(ret_val); 5969 call_tests++; 5970 xmlResetLastError(); 5971 function_tests++; 5972 #endif 5973 5974 return(test_ret); 5975 } 5976 5977 5978 static int 5979 test_xmlCatalogDump(void) { 5980 int test_ret = 0; 5981 5982 #if defined(LIBXML_CATALOG_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) 5983 int mem_base; 5984 FILE * out; /* the file. */ 5985 int n_out; 5986 5987 for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) { 5988 mem_base = xmlMemBlocks(); 5989 out = gen_FILE_ptr(n_out, 0); 5990 5991 xmlCatalogDump(out); 5992 call_tests++; 5993 des_FILE_ptr(n_out, out, 0); 5994 xmlResetLastError(); 5995 if (mem_base != xmlMemBlocks()) { 5996 printf("Leak of %d blocks found in xmlCatalogDump", 5997 xmlMemBlocks() - mem_base); 5998 test_ret++; 5999 printf(" %d", n_out); 6000 printf("\n"); 6001 } 6002 } 6003 function_tests++; 6004 #endif 6005 6006 return(test_ret); 6007 } 6008 6009 6010 static int 6011 test_xmlCatalogGetDefaults(void) { 6012 int test_ret = 0; 6013 6014 #if defined(LIBXML_CATALOG_ENABLED) 6015 int mem_base; 6016 xmlCatalogAllow ret_val; 6017 6018 mem_base = xmlMemBlocks(); 6019 6020 ret_val = xmlCatalogGetDefaults(); 6021 desret_xmlCatalogAllow(ret_val); 6022 call_tests++; 6023 xmlResetLastError(); 6024 if (mem_base != xmlMemBlocks()) { 6025 printf("Leak of %d blocks found in xmlCatalogGetDefaults", 6026 xmlMemBlocks() - mem_base); 6027 test_ret++; 6028 printf("\n"); 6029 } 6030 function_tests++; 6031 #endif 6032 6033 return(test_ret); 6034 } 6035 6036 6037 static int 6038 test_xmlCatalogIsEmpty(void) { 6039 int test_ret = 0; 6040 6041 #if defined(LIBXML_CATALOG_ENABLED) 6042 int mem_base; 6043 int ret_val; 6044 xmlCatalogPtr catal; /* should this create an SGML catalog */ 6045 int n_catal; 6046 6047 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) { 6048 mem_base = xmlMemBlocks(); 6049 catal = gen_xmlCatalogPtr(n_catal, 0); 6050 6051 ret_val = xmlCatalogIsEmpty(catal); 6052 desret_int(ret_val); 6053 call_tests++; 6054 des_xmlCatalogPtr(n_catal, catal, 0); 6055 xmlResetLastError(); 6056 if (mem_base != xmlMemBlocks()) { 6057 printf("Leak of %d blocks found in xmlCatalogIsEmpty", 6058 xmlMemBlocks() - mem_base); 6059 test_ret++; 6060 printf(" %d", n_catal); 6061 printf("\n"); 6062 } 6063 } 6064 function_tests++; 6065 #endif 6066 6067 return(test_ret); 6068 } 6069 6070 6071 static int 6072 test_xmlCatalogLocalResolve(void) { 6073 int test_ret = 0; 6074 6075 #if defined(LIBXML_CATALOG_ENABLED) 6076 int mem_base; 6077 xmlChar * ret_val; 6078 void * catalogs; /* a document's list of catalogs */ 6079 int n_catalogs; 6080 xmlChar * pubID; /* the public ID string */ 6081 int n_pubID; 6082 xmlChar * sysID; /* the system ID string */ 6083 int n_sysID; 6084 6085 for (n_catalogs = 0;n_catalogs < gen_nb_void_ptr;n_catalogs++) { 6086 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) { 6087 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) { 6088 mem_base = xmlMemBlocks(); 6089 catalogs = gen_void_ptr(n_catalogs, 0); 6090 pubID = gen_const_xmlChar_ptr(n_pubID, 1); 6091 sysID = gen_const_xmlChar_ptr(n_sysID, 2); 6092 6093 ret_val = xmlCatalogLocalResolve(catalogs, (const xmlChar *)pubID, (const xmlChar *)sysID); 6094 desret_xmlChar_ptr(ret_val); 6095 call_tests++; 6096 des_void_ptr(n_catalogs, catalogs, 0); 6097 des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 1); 6098 des_const_xmlChar_ptr(n_sysID, (const xmlChar *)sysID, 2); 6099 xmlResetLastError(); 6100 if (mem_base != xmlMemBlocks()) { 6101 printf("Leak of %d blocks found in xmlCatalogLocalResolve", 6102 xmlMemBlocks() - mem_base); 6103 test_ret++; 6104 printf(" %d", n_catalogs); 6105 printf(" %d", n_pubID); 6106 printf(" %d", n_sysID); 6107 printf("\n"); 6108 } 6109 } 6110 } 6111 } 6112 function_tests++; 6113 #endif 6114 6115 return(test_ret); 6116 } 6117 6118 6119 static int 6120 test_xmlCatalogLocalResolveURI(void) { 6121 int test_ret = 0; 6122 6123 #if defined(LIBXML_CATALOG_ENABLED) 6124 int mem_base; 6125 xmlChar * ret_val; 6126 void * catalogs; /* a document's list of catalogs */ 6127 int n_catalogs; 6128 xmlChar * URI; /* the URI */ 6129 int n_URI; 6130 6131 for (n_catalogs = 0;n_catalogs < gen_nb_void_ptr;n_catalogs++) { 6132 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) { 6133 mem_base = xmlMemBlocks(); 6134 catalogs = gen_void_ptr(n_catalogs, 0); 6135 URI = gen_const_xmlChar_ptr(n_URI, 1); 6136 6137 ret_val = xmlCatalogLocalResolveURI(catalogs, (const xmlChar *)URI); 6138 desret_xmlChar_ptr(ret_val); 6139 call_tests++; 6140 des_void_ptr(n_catalogs, catalogs, 0); 6141 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 1); 6142 xmlResetLastError(); 6143 if (mem_base != xmlMemBlocks()) { 6144 printf("Leak of %d blocks found in xmlCatalogLocalResolveURI", 6145 xmlMemBlocks() - mem_base); 6146 test_ret++; 6147 printf(" %d", n_catalogs); 6148 printf(" %d", n_URI); 6149 printf("\n"); 6150 } 6151 } 6152 } 6153 function_tests++; 6154 #endif 6155 6156 return(test_ret); 6157 } 6158 6159 6160 static int 6161 test_xmlCatalogRemove(void) { 6162 int test_ret = 0; 6163 6164 #if defined(LIBXML_CATALOG_ENABLED) 6165 int ret_val; 6166 xmlChar * value; /* the value to remove */ 6167 int n_value; 6168 6169 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { 6170 value = gen_const_xmlChar_ptr(n_value, 0); 6171 6172 ret_val = xmlCatalogRemove((const xmlChar *)value); 6173 desret_int(ret_val); 6174 call_tests++; 6175 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0); 6176 xmlResetLastError(); 6177 } 6178 function_tests++; 6179 #endif 6180 6181 return(test_ret); 6182 } 6183 6184 6185 static int 6186 test_xmlCatalogResolve(void) { 6187 int test_ret = 0; 6188 6189 #if defined(LIBXML_CATALOG_ENABLED) 6190 xmlChar * ret_val; 6191 xmlChar * pubID; /* the public ID string */ 6192 int n_pubID; 6193 xmlChar * sysID; /* the system ID string */ 6194 int n_sysID; 6195 6196 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) { 6197 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) { 6198 pubID = gen_const_xmlChar_ptr(n_pubID, 0); 6199 sysID = gen_const_xmlChar_ptr(n_sysID, 1); 6200 6201 ret_val = xmlCatalogResolve((const xmlChar *)pubID, (const xmlChar *)sysID); 6202 desret_xmlChar_ptr(ret_val); 6203 call_tests++; 6204 des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 0); 6205 des_const_xmlChar_ptr(n_sysID, (const xmlChar *)sysID, 1); 6206 xmlResetLastError(); 6207 } 6208 } 6209 function_tests++; 6210 #endif 6211 6212 return(test_ret); 6213 } 6214 6215 6216 static int 6217 test_xmlCatalogResolvePublic(void) { 6218 int test_ret = 0; 6219 6220 #if defined(LIBXML_CATALOG_ENABLED) 6221 int mem_base; 6222 xmlChar * ret_val; 6223 xmlChar * pubID; /* the public ID string */ 6224 int n_pubID; 6225 6226 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) { 6227 mem_base = xmlMemBlocks(); 6228 pubID = gen_const_xmlChar_ptr(n_pubID, 0); 6229 6230 ret_val = xmlCatalogResolvePublic((const xmlChar *)pubID); 6231 desret_xmlChar_ptr(ret_val); 6232 call_tests++; 6233 des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 0); 6234 xmlResetLastError(); 6235 if (mem_base != xmlMemBlocks()) { 6236 printf("Leak of %d blocks found in xmlCatalogResolvePublic", 6237 xmlMemBlocks() - mem_base); 6238 test_ret++; 6239 printf(" %d", n_pubID); 6240 printf("\n"); 6241 } 6242 } 6243 function_tests++; 6244 #endif 6245 6246 return(test_ret); 6247 } 6248 6249 6250 static int 6251 test_xmlCatalogResolveSystem(void) { 6252 int test_ret = 0; 6253 6254 #if defined(LIBXML_CATALOG_ENABLED) 6255 int mem_base; 6256 xmlChar * ret_val; 6257 xmlChar * sysID; /* the system ID string */ 6258 int n_sysID; 6259 6260 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) { 6261 mem_base = xmlMemBlocks(); 6262 sysID = gen_const_xmlChar_ptr(n_sysID, 0); 6263 6264 ret_val = xmlCatalogResolveSystem((const xmlChar *)sysID); 6265 desret_xmlChar_ptr(ret_val); 6266 call_tests++; 6267 des_const_xmlChar_ptr(n_sysID, (const xmlChar *)sysID, 0); 6268 xmlResetLastError(); 6269 if (mem_base != xmlMemBlocks()) { 6270 printf("Leak of %d blocks found in xmlCatalogResolveSystem", 6271 xmlMemBlocks() - mem_base); 6272 test_ret++; 6273 printf(" %d", n_sysID); 6274 printf("\n"); 6275 } 6276 } 6277 function_tests++; 6278 #endif 6279 6280 return(test_ret); 6281 } 6282 6283 6284 static int 6285 test_xmlCatalogResolveURI(void) { 6286 int test_ret = 0; 6287 6288 #if defined(LIBXML_CATALOG_ENABLED) 6289 int mem_base; 6290 xmlChar * ret_val; 6291 xmlChar * URI; /* the URI */ 6292 int n_URI; 6293 6294 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) { 6295 mem_base = xmlMemBlocks(); 6296 URI = gen_const_xmlChar_ptr(n_URI, 0); 6297 6298 ret_val = xmlCatalogResolveURI((const xmlChar *)URI); 6299 desret_xmlChar_ptr(ret_val); 6300 call_tests++; 6301 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0); 6302 xmlResetLastError(); 6303 if (mem_base != xmlMemBlocks()) { 6304 printf("Leak of %d blocks found in xmlCatalogResolveURI", 6305 xmlMemBlocks() - mem_base); 6306 test_ret++; 6307 printf(" %d", n_URI); 6308 printf("\n"); 6309 } 6310 } 6311 function_tests++; 6312 #endif 6313 6314 return(test_ret); 6315 } 6316 6317 6318 static int 6319 test_xmlCatalogSetDefaultPrefer(void) { 6320 int test_ret = 0; 6321 6322 #if defined(LIBXML_CATALOG_ENABLED) 6323 int mem_base; 6324 xmlCatalogPrefer ret_val; 6325 xmlCatalogPrefer prefer; /* the default preference for delegation */ 6326 int n_prefer; 6327 6328 for (n_prefer = 0;n_prefer < gen_nb_xmlCatalogPrefer;n_prefer++) { 6329 mem_base = xmlMemBlocks(); 6330 prefer = gen_xmlCatalogPrefer(n_prefer, 0); 6331 6332 ret_val = xmlCatalogSetDefaultPrefer(prefer); 6333 desret_xmlCatalogPrefer(ret_val); 6334 call_tests++; 6335 des_xmlCatalogPrefer(n_prefer, prefer, 0); 6336 xmlResetLastError(); 6337 if (mem_base != xmlMemBlocks()) { 6338 printf("Leak of %d blocks found in xmlCatalogSetDefaultPrefer", 6339 xmlMemBlocks() - mem_base); 6340 test_ret++; 6341 printf(" %d", n_prefer); 6342 printf("\n"); 6343 } 6344 } 6345 function_tests++; 6346 #endif 6347 6348 return(test_ret); 6349 } 6350 6351 6352 static int 6353 test_xmlCatalogSetDefaults(void) { 6354 int test_ret = 0; 6355 6356 #if defined(LIBXML_CATALOG_ENABLED) 6357 int mem_base; 6358 xmlCatalogAllow allow; /* what catalogs should be accepted */ 6359 int n_allow; 6360 6361 for (n_allow = 0;n_allow < gen_nb_xmlCatalogAllow;n_allow++) { 6362 mem_base = xmlMemBlocks(); 6363 allow = gen_xmlCatalogAllow(n_allow, 0); 6364 6365 xmlCatalogSetDefaults(allow); 6366 call_tests++; 6367 des_xmlCatalogAllow(n_allow, allow, 0); 6368 xmlResetLastError(); 6369 if (mem_base != xmlMemBlocks()) { 6370 printf("Leak of %d blocks found in xmlCatalogSetDefaults", 6371 xmlMemBlocks() - mem_base); 6372 test_ret++; 6373 printf(" %d", n_allow); 6374 printf("\n"); 6375 } 6376 } 6377 function_tests++; 6378 #endif 6379 6380 return(test_ret); 6381 } 6382 6383 6384 static int 6385 test_xmlConvertSGMLCatalog(void) { 6386 int test_ret = 0; 6387 6388 #if defined(LIBXML_CATALOG_ENABLED) 6389 int mem_base; 6390 int ret_val; 6391 xmlCatalogPtr catal; /* the catalog */ 6392 int n_catal; 6393 6394 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) { 6395 mem_base = xmlMemBlocks(); 6396 catal = gen_xmlCatalogPtr(n_catal, 0); 6397 6398 ret_val = xmlConvertSGMLCatalog(catal); 6399 desret_int(ret_val); 6400 call_tests++; 6401 des_xmlCatalogPtr(n_catal, catal, 0); 6402 xmlResetLastError(); 6403 if (mem_base != xmlMemBlocks()) { 6404 printf("Leak of %d blocks found in xmlConvertSGMLCatalog", 6405 xmlMemBlocks() - mem_base); 6406 test_ret++; 6407 printf(" %d", n_catal); 6408 printf("\n"); 6409 } 6410 } 6411 function_tests++; 6412 #endif 6413 6414 return(test_ret); 6415 } 6416 6417 6418 static int 6419 test_xmlInitializeCatalog(void) { 6420 int test_ret = 0; 6421 6422 #if defined(LIBXML_CATALOG_ENABLED) 6423 int mem_base; 6424 6425 mem_base = xmlMemBlocks(); 6426 6427 xmlInitializeCatalog(); 6428 call_tests++; 6429 xmlResetLastError(); 6430 if (mem_base != xmlMemBlocks()) { 6431 printf("Leak of %d blocks found in xmlInitializeCatalog", 6432 xmlMemBlocks() - mem_base); 6433 test_ret++; 6434 printf("\n"); 6435 } 6436 function_tests++; 6437 #endif 6438 6439 return(test_ret); 6440 } 6441 6442 6443 static int 6444 test_xmlLoadACatalog(void) { 6445 int test_ret = 0; 6446 6447 6448 /* missing type support */ 6449 return(test_ret); 6450 } 6451 6452 6453 static int 6454 test_xmlLoadCatalog(void) { 6455 int test_ret = 0; 6456 6457 #if defined(LIBXML_CATALOG_ENABLED) 6458 int ret_val; 6459 const char * filename; /* a file path */ 6460 int n_filename; 6461 6462 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { 6463 filename = gen_filepath(n_filename, 0); 6464 6465 ret_val = xmlLoadCatalog(filename); 6466 desret_int(ret_val); 6467 call_tests++; 6468 des_filepath(n_filename, filename, 0); 6469 xmlResetLastError(); 6470 } 6471 function_tests++; 6472 #endif 6473 6474 return(test_ret); 6475 } 6476 6477 6478 static int 6479 test_xmlLoadCatalogs(void) { 6480 int test_ret = 0; 6481 6482 #if defined(LIBXML_CATALOG_ENABLED) 6483 char * pathss; /* a list of directories separated by a colon or a space. */ 6484 int n_pathss; 6485 6486 for (n_pathss = 0;n_pathss < gen_nb_const_char_ptr;n_pathss++) { 6487 pathss = gen_const_char_ptr(n_pathss, 0); 6488 6489 xmlLoadCatalogs((const char *)pathss); 6490 call_tests++; 6491 des_const_char_ptr(n_pathss, (const char *)pathss, 0); 6492 xmlResetLastError(); 6493 } 6494 function_tests++; 6495 #endif 6496 6497 return(test_ret); 6498 } 6499 6500 6501 static int 6502 test_xmlLoadSGMLSuperCatalog(void) { 6503 int test_ret = 0; 6504 6505 6506 /* missing type support */ 6507 return(test_ret); 6508 } 6509 6510 6511 static int 6512 test_xmlNewCatalog(void) { 6513 int test_ret = 0; 6514 6515 6516 /* missing type support */ 6517 return(test_ret); 6518 } 6519 6520 6521 static int 6522 test_xmlParseCatalogFile(void) { 6523 int test_ret = 0; 6524 6525 #if defined(LIBXML_CATALOG_ENABLED) 6526 int mem_base; 6527 xmlDocPtr ret_val; 6528 const char * filename; /* the filename */ 6529 int n_filename; 6530 6531 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { 6532 mem_base = xmlMemBlocks(); 6533 filename = gen_filepath(n_filename, 0); 6534 6535 ret_val = xmlParseCatalogFile(filename); 6536 desret_xmlDocPtr(ret_val); 6537 call_tests++; 6538 des_filepath(n_filename, filename, 0); 6539 xmlResetLastError(); 6540 if (mem_base != xmlMemBlocks()) { 6541 printf("Leak of %d blocks found in xmlParseCatalogFile", 6542 xmlMemBlocks() - mem_base); 6543 test_ret++; 6544 printf(" %d", n_filename); 6545 printf("\n"); 6546 } 6547 } 6548 function_tests++; 6549 #endif 6550 6551 return(test_ret); 6552 } 6553 6554 static int 6555 test_catalog(void) { 6556 int test_ret = 0; 6557 6558 if (quiet == 0) printf("Testing catalog : 27 of 36 functions ...\n"); 6559 test_ret += test_xmlACatalogAdd(); 6560 test_ret += test_xmlACatalogDump(); 6561 test_ret += test_xmlACatalogRemove(); 6562 test_ret += test_xmlACatalogResolve(); 6563 test_ret += test_xmlACatalogResolvePublic(); 6564 test_ret += test_xmlACatalogResolveSystem(); 6565 test_ret += test_xmlACatalogResolveURI(); 6566 test_ret += test_xmlCatalogAdd(); 6567 test_ret += test_xmlCatalogCleanup(); 6568 test_ret += test_xmlCatalogConvert(); 6569 test_ret += test_xmlCatalogDump(); 6570 test_ret += test_xmlCatalogGetDefaults(); 6571 test_ret += test_xmlCatalogIsEmpty(); 6572 test_ret += test_xmlCatalogLocalResolve(); 6573 test_ret += test_xmlCatalogLocalResolveURI(); 6574 test_ret += test_xmlCatalogRemove(); 6575 test_ret += test_xmlCatalogResolve(); 6576 test_ret += test_xmlCatalogResolvePublic(); 6577 test_ret += test_xmlCatalogResolveSystem(); 6578 test_ret += test_xmlCatalogResolveURI(); 6579 test_ret += test_xmlCatalogSetDefaultPrefer(); 6580 test_ret += test_xmlCatalogSetDefaults(); 6581 test_ret += test_xmlConvertSGMLCatalog(); 6582 test_ret += test_xmlInitializeCatalog(); 6583 test_ret += test_xmlLoadACatalog(); 6584 test_ret += test_xmlLoadCatalog(); 6585 test_ret += test_xmlLoadCatalogs(); 6586 test_ret += test_xmlLoadSGMLSuperCatalog(); 6587 test_ret += test_xmlNewCatalog(); 6588 test_ret += test_xmlParseCatalogFile(); 6589 6590 if (test_ret != 0) 6591 printf("Module catalog: %d errors\n", test_ret); 6592 return(test_ret); 6593 } 6594 6595 #define gen_nb_const_xmlChRangeGroup_ptr 1 6596 static xmlChRangeGroup * gen_const_xmlChRangeGroup_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 6597 return(NULL); 6598 } 6599 static void des_const_xmlChRangeGroup_ptr(int no ATTRIBUTE_UNUSED, const xmlChRangeGroup * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 6600 } 6601 6602 static int 6603 test_xmlCharInRange(void) { 6604 int test_ret = 0; 6605 6606 int mem_base; 6607 int ret_val; 6608 unsigned int val; /* character to be validated */ 6609 int n_val; 6610 xmlChRangeGroup * rptr; /* pointer to range to be used to validate */ 6611 int n_rptr; 6612 6613 for (n_val = 0;n_val < gen_nb_unsigned_int;n_val++) { 6614 for (n_rptr = 0;n_rptr < gen_nb_const_xmlChRangeGroup_ptr;n_rptr++) { 6615 mem_base = xmlMemBlocks(); 6616 val = gen_unsigned_int(n_val, 0); 6617 rptr = gen_const_xmlChRangeGroup_ptr(n_rptr, 1); 6618 6619 ret_val = xmlCharInRange(val, (const xmlChRangeGroup *)rptr); 6620 desret_int(ret_val); 6621 call_tests++; 6622 des_unsigned_int(n_val, val, 0); 6623 des_const_xmlChRangeGroup_ptr(n_rptr, (const xmlChRangeGroup *)rptr, 1); 6624 xmlResetLastError(); 6625 if (mem_base != xmlMemBlocks()) { 6626 printf("Leak of %d blocks found in xmlCharInRange", 6627 xmlMemBlocks() - mem_base); 6628 test_ret++; 6629 printf(" %d", n_val); 6630 printf(" %d", n_rptr); 6631 printf("\n"); 6632 } 6633 } 6634 } 6635 function_tests++; 6636 6637 return(test_ret); 6638 } 6639 6640 6641 static int 6642 test_xmlIsBaseChar(void) { 6643 int test_ret = 0; 6644 6645 int mem_base; 6646 int ret_val; 6647 unsigned int ch; /* character to validate */ 6648 int n_ch; 6649 6650 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) { 6651 mem_base = xmlMemBlocks(); 6652 ch = gen_unsigned_int(n_ch, 0); 6653 6654 ret_val = xmlIsBaseChar(ch); 6655 desret_int(ret_val); 6656 call_tests++; 6657 des_unsigned_int(n_ch, ch, 0); 6658 xmlResetLastError(); 6659 if (mem_base != xmlMemBlocks()) { 6660 printf("Leak of %d blocks found in xmlIsBaseChar", 6661 xmlMemBlocks() - mem_base); 6662 test_ret++; 6663 printf(" %d", n_ch); 6664 printf("\n"); 6665 } 6666 } 6667 function_tests++; 6668 6669 return(test_ret); 6670 } 6671 6672 6673 static int 6674 test_xmlIsBlank(void) { 6675 int test_ret = 0; 6676 6677 int mem_base; 6678 int ret_val; 6679 unsigned int ch; /* character to validate */ 6680 int n_ch; 6681 6682 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) { 6683 mem_base = xmlMemBlocks(); 6684 ch = gen_unsigned_int(n_ch, 0); 6685 6686 ret_val = xmlIsBlank(ch); 6687 desret_int(ret_val); 6688 call_tests++; 6689 des_unsigned_int(n_ch, ch, 0); 6690 xmlResetLastError(); 6691 if (mem_base != xmlMemBlocks()) { 6692 printf("Leak of %d blocks found in xmlIsBlank", 6693 xmlMemBlocks() - mem_base); 6694 test_ret++; 6695 printf(" %d", n_ch); 6696 printf("\n"); 6697 } 6698 } 6699 function_tests++; 6700 6701 return(test_ret); 6702 } 6703 6704 6705 static int 6706 test_xmlIsChar(void) { 6707 int test_ret = 0; 6708 6709 int mem_base; 6710 int ret_val; 6711 unsigned int ch; /* character to validate */ 6712 int n_ch; 6713 6714 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) { 6715 mem_base = xmlMemBlocks(); 6716 ch = gen_unsigned_int(n_ch, 0); 6717 6718 ret_val = xmlIsChar(ch); 6719 desret_int(ret_val); 6720 call_tests++; 6721 des_unsigned_int(n_ch, ch, 0); 6722 xmlResetLastError(); 6723 if (mem_base != xmlMemBlocks()) { 6724 printf("Leak of %d blocks found in xmlIsChar", 6725 xmlMemBlocks() - mem_base); 6726 test_ret++; 6727 printf(" %d", n_ch); 6728 printf("\n"); 6729 } 6730 } 6731 function_tests++; 6732 6733 return(test_ret); 6734 } 6735 6736 6737 static int 6738 test_xmlIsCombining(void) { 6739 int test_ret = 0; 6740 6741 int mem_base; 6742 int ret_val; 6743 unsigned int ch; /* character to validate */ 6744 int n_ch; 6745 6746 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) { 6747 mem_base = xmlMemBlocks(); 6748 ch = gen_unsigned_int(n_ch, 0); 6749 6750 ret_val = xmlIsCombining(ch); 6751 desret_int(ret_val); 6752 call_tests++; 6753 des_unsigned_int(n_ch, ch, 0); 6754 xmlResetLastError(); 6755 if (mem_base != xmlMemBlocks()) { 6756 printf("Leak of %d blocks found in xmlIsCombining", 6757 xmlMemBlocks() - mem_base); 6758 test_ret++; 6759 printf(" %d", n_ch); 6760 printf("\n"); 6761 } 6762 } 6763 function_tests++; 6764 6765 return(test_ret); 6766 } 6767 6768 6769 static int 6770 test_xmlIsDigit(void) { 6771 int test_ret = 0; 6772 6773 int mem_base; 6774 int ret_val; 6775 unsigned int ch; /* character to validate */ 6776 int n_ch; 6777 6778 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) { 6779 mem_base = xmlMemBlocks(); 6780 ch = gen_unsigned_int(n_ch, 0); 6781 6782 ret_val = xmlIsDigit(ch); 6783 desret_int(ret_val); 6784 call_tests++; 6785 des_unsigned_int(n_ch, ch, 0); 6786 xmlResetLastError(); 6787 if (mem_base != xmlMemBlocks()) { 6788 printf("Leak of %d blocks found in xmlIsDigit", 6789 xmlMemBlocks() - mem_base); 6790 test_ret++; 6791 printf(" %d", n_ch); 6792 printf("\n"); 6793 } 6794 } 6795 function_tests++; 6796 6797 return(test_ret); 6798 } 6799 6800 6801 static int 6802 test_xmlIsExtender(void) { 6803 int test_ret = 0; 6804 6805 int mem_base; 6806 int ret_val; 6807 unsigned int ch; /* character to validate */ 6808 int n_ch; 6809 6810 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) { 6811 mem_base = xmlMemBlocks(); 6812 ch = gen_unsigned_int(n_ch, 0); 6813 6814 ret_val = xmlIsExtender(ch); 6815 desret_int(ret_val); 6816 call_tests++; 6817 des_unsigned_int(n_ch, ch, 0); 6818 xmlResetLastError(); 6819 if (mem_base != xmlMemBlocks()) { 6820 printf("Leak of %d blocks found in xmlIsExtender", 6821 xmlMemBlocks() - mem_base); 6822 test_ret++; 6823 printf(" %d", n_ch); 6824 printf("\n"); 6825 } 6826 } 6827 function_tests++; 6828 6829 return(test_ret); 6830 } 6831 6832 6833 static int 6834 test_xmlIsIdeographic(void) { 6835 int test_ret = 0; 6836 6837 int mem_base; 6838 int ret_val; 6839 unsigned int ch; /* character to validate */ 6840 int n_ch; 6841 6842 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) { 6843 mem_base = xmlMemBlocks(); 6844 ch = gen_unsigned_int(n_ch, 0); 6845 6846 ret_val = xmlIsIdeographic(ch); 6847 desret_int(ret_val); 6848 call_tests++; 6849 des_unsigned_int(n_ch, ch, 0); 6850 xmlResetLastError(); 6851 if (mem_base != xmlMemBlocks()) { 6852 printf("Leak of %d blocks found in xmlIsIdeographic", 6853 xmlMemBlocks() - mem_base); 6854 test_ret++; 6855 printf(" %d", n_ch); 6856 printf("\n"); 6857 } 6858 } 6859 function_tests++; 6860 6861 return(test_ret); 6862 } 6863 6864 6865 static int 6866 test_xmlIsPubidChar(void) { 6867 int test_ret = 0; 6868 6869 int mem_base; 6870 int ret_val; 6871 unsigned int ch; /* character to validate */ 6872 int n_ch; 6873 6874 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) { 6875 mem_base = xmlMemBlocks(); 6876 ch = gen_unsigned_int(n_ch, 0); 6877 6878 ret_val = xmlIsPubidChar(ch); 6879 desret_int(ret_val); 6880 call_tests++; 6881 des_unsigned_int(n_ch, ch, 0); 6882 xmlResetLastError(); 6883 if (mem_base != xmlMemBlocks()) { 6884 printf("Leak of %d blocks found in xmlIsPubidChar", 6885 xmlMemBlocks() - mem_base); 6886 test_ret++; 6887 printf(" %d", n_ch); 6888 printf("\n"); 6889 } 6890 } 6891 function_tests++; 6892 6893 return(test_ret); 6894 } 6895 6896 static int 6897 test_chvalid(void) { 6898 int test_ret = 0; 6899 6900 if (quiet == 0) printf("Testing chvalid : 9 of 9 functions ...\n"); 6901 test_ret += test_xmlCharInRange(); 6902 test_ret += test_xmlIsBaseChar(); 6903 test_ret += test_xmlIsBlank(); 6904 test_ret += test_xmlIsChar(); 6905 test_ret += test_xmlIsCombining(); 6906 test_ret += test_xmlIsDigit(); 6907 test_ret += test_xmlIsExtender(); 6908 test_ret += test_xmlIsIdeographic(); 6909 test_ret += test_xmlIsPubidChar(); 6910 6911 if (test_ret != 0) 6912 printf("Module chvalid: %d errors\n", test_ret); 6913 return(test_ret); 6914 } 6915 6916 static int 6917 test_xmlBoolToText(void) { 6918 int test_ret = 0; 6919 6920 #if defined(LIBXML_DEBUG_ENABLED) 6921 int mem_base; 6922 const char * ret_val; 6923 int boolval; /* a bool to turn into text */ 6924 int n_boolval; 6925 6926 for (n_boolval = 0;n_boolval < gen_nb_int;n_boolval++) { 6927 mem_base = xmlMemBlocks(); 6928 boolval = gen_int(n_boolval, 0); 6929 6930 ret_val = xmlBoolToText(boolval); 6931 desret_const_char_ptr(ret_val); 6932 call_tests++; 6933 des_int(n_boolval, boolval, 0); 6934 xmlResetLastError(); 6935 if (mem_base != xmlMemBlocks()) { 6936 printf("Leak of %d blocks found in xmlBoolToText", 6937 xmlMemBlocks() - mem_base); 6938 test_ret++; 6939 printf(" %d", n_boolval); 6940 printf("\n"); 6941 } 6942 } 6943 function_tests++; 6944 #endif 6945 6946 return(test_ret); 6947 } 6948 6949 6950 static int 6951 test_xmlDebugCheckDocument(void) { 6952 int test_ret = 0; 6953 6954 #if defined(LIBXML_DEBUG_ENABLED) 6955 int mem_base; 6956 int ret_val; 6957 FILE * output; /* the FILE * for the output */ 6958 int n_output; 6959 xmlDocPtr doc; /* the document */ 6960 int n_doc; 6961 6962 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) { 6963 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { 6964 mem_base = xmlMemBlocks(); 6965 output = gen_debug_FILE_ptr(n_output, 0); 6966 doc = gen_xmlDocPtr(n_doc, 1); 6967 6968 ret_val = xmlDebugCheckDocument(output, doc); 6969 desret_int(ret_val); 6970 call_tests++; 6971 des_debug_FILE_ptr(n_output, output, 0); 6972 des_xmlDocPtr(n_doc, doc, 1); 6973 xmlResetLastError(); 6974 if (mem_base != xmlMemBlocks()) { 6975 printf("Leak of %d blocks found in xmlDebugCheckDocument", 6976 xmlMemBlocks() - mem_base); 6977 test_ret++; 6978 printf(" %d", n_output); 6979 printf(" %d", n_doc); 6980 printf("\n"); 6981 } 6982 } 6983 } 6984 function_tests++; 6985 #endif 6986 6987 return(test_ret); 6988 } 6989 6990 6991 static int 6992 test_xmlDebugDumpAttr(void) { 6993 int test_ret = 0; 6994 6995 #if defined(LIBXML_DEBUG_ENABLED) 6996 int mem_base; 6997 FILE * output; /* the FILE * for the output */ 6998 int n_output; 6999 xmlAttrPtr attr; /* the attribute */ 7000 int n_attr; 7001 int depth; /* the indentation level. */ 7002 int n_depth; 7003 7004 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) { 7005 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) { 7006 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) { 7007 mem_base = xmlMemBlocks(); 7008 output = gen_debug_FILE_ptr(n_output, 0); 7009 attr = gen_xmlAttrPtr(n_attr, 1); 7010 depth = gen_int(n_depth, 2); 7011 7012 xmlDebugDumpAttr(output, attr, depth); 7013 call_tests++; 7014 des_debug_FILE_ptr(n_output, output, 0); 7015 des_xmlAttrPtr(n_attr, attr, 1); 7016 des_int(n_depth, depth, 2); 7017 xmlResetLastError(); 7018 if (mem_base != xmlMemBlocks()) { 7019 printf("Leak of %d blocks found in xmlDebugDumpAttr", 7020 xmlMemBlocks() - mem_base); 7021 test_ret++; 7022 printf(" %d", n_output); 7023 printf(" %d", n_attr); 7024 printf(" %d", n_depth); 7025 printf("\n"); 7026 } 7027 } 7028 } 7029 } 7030 function_tests++; 7031 #endif 7032 7033 return(test_ret); 7034 } 7035 7036 7037 static int 7038 test_xmlDebugDumpAttrList(void) { 7039 int test_ret = 0; 7040 7041 #if defined(LIBXML_DEBUG_ENABLED) 7042 int mem_base; 7043 FILE * output; /* the FILE * for the output */ 7044 int n_output; 7045 xmlAttrPtr attr; /* the attribute list */ 7046 int n_attr; 7047 int depth; /* the indentation level. */ 7048 int n_depth; 7049 7050 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) { 7051 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) { 7052 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) { 7053 mem_base = xmlMemBlocks(); 7054 output = gen_debug_FILE_ptr(n_output, 0); 7055 attr = gen_xmlAttrPtr(n_attr, 1); 7056 depth = gen_int(n_depth, 2); 7057 7058 xmlDebugDumpAttrList(output, attr, depth); 7059 call_tests++; 7060 des_debug_FILE_ptr(n_output, output, 0); 7061 des_xmlAttrPtr(n_attr, attr, 1); 7062 des_int(n_depth, depth, 2); 7063 xmlResetLastError(); 7064 if (mem_base != xmlMemBlocks()) { 7065 printf("Leak of %d blocks found in xmlDebugDumpAttrList", 7066 xmlMemBlocks() - mem_base); 7067 test_ret++; 7068 printf(" %d", n_output); 7069 printf(" %d", n_attr); 7070 printf(" %d", n_depth); 7071 printf("\n"); 7072 } 7073 } 7074 } 7075 } 7076 function_tests++; 7077 #endif 7078 7079 return(test_ret); 7080 } 7081 7082 7083 static int 7084 test_xmlDebugDumpDTD(void) { 7085 int test_ret = 0; 7086 7087 #if defined(LIBXML_DEBUG_ENABLED) 7088 int mem_base; 7089 FILE * output; /* the FILE * for the output */ 7090 int n_output; 7091 xmlDtdPtr dtd; /* the DTD */ 7092 int n_dtd; 7093 7094 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) { 7095 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) { 7096 mem_base = xmlMemBlocks(); 7097 output = gen_debug_FILE_ptr(n_output, 0); 7098 dtd = gen_xmlDtdPtr(n_dtd, 1); 7099 7100 xmlDebugDumpDTD(output, dtd); 7101 call_tests++; 7102 des_debug_FILE_ptr(n_output, output, 0); 7103 des_xmlDtdPtr(n_dtd, dtd, 1); 7104 xmlResetLastError(); 7105 if (mem_base != xmlMemBlocks()) { 7106 printf("Leak of %d blocks found in xmlDebugDumpDTD", 7107 xmlMemBlocks() - mem_base); 7108 test_ret++; 7109 printf(" %d", n_output); 7110 printf(" %d", n_dtd); 7111 printf("\n"); 7112 } 7113 } 7114 } 7115 function_tests++; 7116 #endif 7117 7118 return(test_ret); 7119 } 7120 7121 7122 static int 7123 test_xmlDebugDumpDocument(void) { 7124 int test_ret = 0; 7125 7126 #if defined(LIBXML_DEBUG_ENABLED) 7127 int mem_base; 7128 FILE * output; /* the FILE * for the output */ 7129 int n_output; 7130 xmlDocPtr doc; /* the document */ 7131 int n_doc; 7132 7133 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) { 7134 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { 7135 mem_base = xmlMemBlocks(); 7136 output = gen_debug_FILE_ptr(n_output, 0); 7137 doc = gen_xmlDocPtr(n_doc, 1); 7138 7139 xmlDebugDumpDocument(output, doc); 7140 call_tests++; 7141 des_debug_FILE_ptr(n_output, output, 0); 7142 des_xmlDocPtr(n_doc, doc, 1); 7143 xmlResetLastError(); 7144 if (mem_base != xmlMemBlocks()) { 7145 printf("Leak of %d blocks found in xmlDebugDumpDocument", 7146 xmlMemBlocks() - mem_base); 7147 test_ret++; 7148 printf(" %d", n_output); 7149 printf(" %d", n_doc); 7150 printf("\n"); 7151 } 7152 } 7153 } 7154 function_tests++; 7155 #endif 7156 7157 return(test_ret); 7158 } 7159 7160 7161 static int 7162 test_xmlDebugDumpDocumentHead(void) { 7163 int test_ret = 0; 7164 7165 #if defined(LIBXML_DEBUG_ENABLED) 7166 int mem_base; 7167 FILE * output; /* the FILE * for the output */ 7168 int n_output; 7169 xmlDocPtr doc; /* the document */ 7170 int n_doc; 7171 7172 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) { 7173 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { 7174 mem_base = xmlMemBlocks(); 7175 output = gen_debug_FILE_ptr(n_output, 0); 7176 doc = gen_xmlDocPtr(n_doc, 1); 7177 7178 xmlDebugDumpDocumentHead(output, doc); 7179 call_tests++; 7180 des_debug_FILE_ptr(n_output, output, 0); 7181 des_xmlDocPtr(n_doc, doc, 1); 7182 xmlResetLastError(); 7183 if (mem_base != xmlMemBlocks()) { 7184 printf("Leak of %d blocks found in xmlDebugDumpDocumentHead", 7185 xmlMemBlocks() - mem_base); 7186 test_ret++; 7187 printf(" %d", n_output); 7188 printf(" %d", n_doc); 7189 printf("\n"); 7190 } 7191 } 7192 } 7193 function_tests++; 7194 #endif 7195 7196 return(test_ret); 7197 } 7198 7199 7200 static int 7201 test_xmlDebugDumpEntities(void) { 7202 int test_ret = 0; 7203 7204 #if defined(LIBXML_DEBUG_ENABLED) 7205 int mem_base; 7206 FILE * output; /* the FILE * for the output */ 7207 int n_output; 7208 xmlDocPtr doc; /* the document */ 7209 int n_doc; 7210 7211 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) { 7212 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { 7213 mem_base = xmlMemBlocks(); 7214 output = gen_debug_FILE_ptr(n_output, 0); 7215 doc = gen_xmlDocPtr(n_doc, 1); 7216 7217 xmlDebugDumpEntities(output, doc); 7218 call_tests++; 7219 des_debug_FILE_ptr(n_output, output, 0); 7220 des_xmlDocPtr(n_doc, doc, 1); 7221 xmlResetLastError(); 7222 if (mem_base != xmlMemBlocks()) { 7223 printf("Leak of %d blocks found in xmlDebugDumpEntities", 7224 xmlMemBlocks() - mem_base); 7225 test_ret++; 7226 printf(" %d", n_output); 7227 printf(" %d", n_doc); 7228 printf("\n"); 7229 } 7230 } 7231 } 7232 function_tests++; 7233 #endif 7234 7235 return(test_ret); 7236 } 7237 7238 7239 static int 7240 test_xmlDebugDumpNode(void) { 7241 int test_ret = 0; 7242 7243 #if defined(LIBXML_DEBUG_ENABLED) 7244 int mem_base; 7245 FILE * output; /* the FILE * for the output */ 7246 int n_output; 7247 xmlNodePtr node; /* the node */ 7248 int n_node; 7249 int depth; /* the indentation level. */ 7250 int n_depth; 7251 7252 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) { 7253 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { 7254 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) { 7255 mem_base = xmlMemBlocks(); 7256 output = gen_debug_FILE_ptr(n_output, 0); 7257 node = gen_xmlNodePtr(n_node, 1); 7258 depth = gen_int(n_depth, 2); 7259 7260 xmlDebugDumpNode(output, node, depth); 7261 call_tests++; 7262 des_debug_FILE_ptr(n_output, output, 0); 7263 des_xmlNodePtr(n_node, node, 1); 7264 des_int(n_depth, depth, 2); 7265 xmlResetLastError(); 7266 if (mem_base != xmlMemBlocks()) { 7267 printf("Leak of %d blocks found in xmlDebugDumpNode", 7268 xmlMemBlocks() - mem_base); 7269 test_ret++; 7270 printf(" %d", n_output); 7271 printf(" %d", n_node); 7272 printf(" %d", n_depth); 7273 printf("\n"); 7274 } 7275 } 7276 } 7277 } 7278 function_tests++; 7279 #endif 7280 7281 return(test_ret); 7282 } 7283 7284 7285 static int 7286 test_xmlDebugDumpNodeList(void) { 7287 int test_ret = 0; 7288 7289 #if defined(LIBXML_DEBUG_ENABLED) 7290 int mem_base; 7291 FILE * output; /* the FILE * for the output */ 7292 int n_output; 7293 xmlNodePtr node; /* the node list */ 7294 int n_node; 7295 int depth; /* the indentation level. */ 7296 int n_depth; 7297 7298 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) { 7299 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { 7300 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) { 7301 mem_base = xmlMemBlocks(); 7302 output = gen_debug_FILE_ptr(n_output, 0); 7303 node = gen_xmlNodePtr(n_node, 1); 7304 depth = gen_int(n_depth, 2); 7305 7306 xmlDebugDumpNodeList(output, node, depth); 7307 call_tests++; 7308 des_debug_FILE_ptr(n_output, output, 0); 7309 des_xmlNodePtr(n_node, node, 1); 7310 des_int(n_depth, depth, 2); 7311 xmlResetLastError(); 7312 if (mem_base != xmlMemBlocks()) { 7313 printf("Leak of %d blocks found in xmlDebugDumpNodeList", 7314 xmlMemBlocks() - mem_base); 7315 test_ret++; 7316 printf(" %d", n_output); 7317 printf(" %d", n_node); 7318 printf(" %d", n_depth); 7319 printf("\n"); 7320 } 7321 } 7322 } 7323 } 7324 function_tests++; 7325 #endif 7326 7327 return(test_ret); 7328 } 7329 7330 7331 static int 7332 test_xmlDebugDumpOneNode(void) { 7333 int test_ret = 0; 7334 7335 #if defined(LIBXML_DEBUG_ENABLED) 7336 int mem_base; 7337 FILE * output; /* the FILE * for the output */ 7338 int n_output; 7339 xmlNodePtr node; /* the node */ 7340 int n_node; 7341 int depth; /* the indentation level. */ 7342 int n_depth; 7343 7344 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) { 7345 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { 7346 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) { 7347 mem_base = xmlMemBlocks(); 7348 output = gen_debug_FILE_ptr(n_output, 0); 7349 node = gen_xmlNodePtr(n_node, 1); 7350 depth = gen_int(n_depth, 2); 7351 7352 xmlDebugDumpOneNode(output, node, depth); 7353 call_tests++; 7354 des_debug_FILE_ptr(n_output, output, 0); 7355 des_xmlNodePtr(n_node, node, 1); 7356 des_int(n_depth, depth, 2); 7357 xmlResetLastError(); 7358 if (mem_base != xmlMemBlocks()) { 7359 printf("Leak of %d blocks found in xmlDebugDumpOneNode", 7360 xmlMemBlocks() - mem_base); 7361 test_ret++; 7362 printf(" %d", n_output); 7363 printf(" %d", n_node); 7364 printf(" %d", n_depth); 7365 printf("\n"); 7366 } 7367 } 7368 } 7369 } 7370 function_tests++; 7371 #endif 7372 7373 return(test_ret); 7374 } 7375 7376 7377 static int 7378 test_xmlDebugDumpString(void) { 7379 int test_ret = 0; 7380 7381 #if defined(LIBXML_DEBUG_ENABLED) 7382 int mem_base; 7383 FILE * output; /* the FILE * for the output */ 7384 int n_output; 7385 xmlChar * str; /* the string */ 7386 int n_str; 7387 7388 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) { 7389 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) { 7390 mem_base = xmlMemBlocks(); 7391 output = gen_debug_FILE_ptr(n_output, 0); 7392 str = gen_const_xmlChar_ptr(n_str, 1); 7393 7394 xmlDebugDumpString(output, (const xmlChar *)str); 7395 call_tests++; 7396 des_debug_FILE_ptr(n_output, output, 0); 7397 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1); 7398 xmlResetLastError(); 7399 if (mem_base != xmlMemBlocks()) { 7400 printf("Leak of %d blocks found in xmlDebugDumpString", 7401 xmlMemBlocks() - mem_base); 7402 test_ret++; 7403 printf(" %d", n_output); 7404 printf(" %d", n_str); 7405 printf("\n"); 7406 } 7407 } 7408 } 7409 function_tests++; 7410 #endif 7411 7412 return(test_ret); 7413 } 7414 7415 7416 static int 7417 test_xmlLsCountNode(void) { 7418 int test_ret = 0; 7419 7420 #if defined(LIBXML_DEBUG_ENABLED) 7421 int mem_base; 7422 int ret_val; 7423 xmlNodePtr node; /* the node to count */ 7424 int n_node; 7425 7426 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { 7427 mem_base = xmlMemBlocks(); 7428 node = gen_xmlNodePtr(n_node, 0); 7429 7430 ret_val = xmlLsCountNode(node); 7431 desret_int(ret_val); 7432 call_tests++; 7433 des_xmlNodePtr(n_node, node, 0); 7434 xmlResetLastError(); 7435 if (mem_base != xmlMemBlocks()) { 7436 printf("Leak of %d blocks found in xmlLsCountNode", 7437 xmlMemBlocks() - mem_base); 7438 test_ret++; 7439 printf(" %d", n_node); 7440 printf("\n"); 7441 } 7442 } 7443 function_tests++; 7444 #endif 7445 7446 return(test_ret); 7447 } 7448 7449 7450 static int 7451 test_xmlLsOneNode(void) { 7452 int test_ret = 0; 7453 7454 #if defined(LIBXML_DEBUG_ENABLED) 7455 int mem_base; 7456 FILE * output; /* the FILE * for the output */ 7457 int n_output; 7458 xmlNodePtr node; /* the node to dump */ 7459 int n_node; 7460 7461 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) { 7462 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { 7463 mem_base = xmlMemBlocks(); 7464 output = gen_debug_FILE_ptr(n_output, 0); 7465 node = gen_xmlNodePtr(n_node, 1); 7466 7467 xmlLsOneNode(output, node); 7468 call_tests++; 7469 des_debug_FILE_ptr(n_output, output, 0); 7470 des_xmlNodePtr(n_node, node, 1); 7471 xmlResetLastError(); 7472 if (mem_base != xmlMemBlocks()) { 7473 printf("Leak of %d blocks found in xmlLsOneNode", 7474 xmlMemBlocks() - mem_base); 7475 test_ret++; 7476 printf(" %d", n_output); 7477 printf(" %d", n_node); 7478 printf("\n"); 7479 } 7480 } 7481 } 7482 function_tests++; 7483 #endif 7484 7485 return(test_ret); 7486 } 7487 7488 7489 #define gen_nb_char_ptr 1 7490 static char * gen_char_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 7491 return(NULL); 7492 } 7493 static void des_char_ptr(int no ATTRIBUTE_UNUSED, char * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 7494 } 7495 7496 static int 7497 test_xmlShell(void) { 7498 int test_ret = 0; 7499 7500 7501 /* missing type support */ 7502 return(test_ret); 7503 } 7504 7505 7506 static int 7507 test_xmlShellBase(void) { 7508 int test_ret = 0; 7509 7510 #if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) 7511 int mem_base; 7512 int ret_val; 7513 xmlShellCtxtPtr ctxt; /* the shell context */ 7514 int n_ctxt; 7515 char * arg; /* unused */ 7516 int