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