1 /* 2 * testapi.c: libxml2 API tester program. 3 * 4 * Automatically generated by gentest.py from libxml2-api.xml 5 * 6 * See Copyright for the status of this software. 7 * 8 * daniel (at) veillard.com 9 */ 10 11 #include "libxml.h" 12 #include <stdio.h> 13 14 #include <stdlib.h> /* for putenv() */ 15 #include <string.h> 16 #include <libxml/xmlerror.h> 17 #include <libxml/relaxng.h> 18 19 20 static int testlibxml2(void); 21 static int test_module(const char *module); 22 23 static int generic_errors = 0; 24 static int call_tests = 0; 25 static int function_tests = 0; 26 27 static xmlChar chartab[1024]; 28 static int inttab[1024]; 29 static unsigned long longtab[1024]; 30 31 static xmlDocPtr api_doc = NULL; 32 static xmlDtdPtr api_dtd = NULL; 33 static xmlNodePtr api_root = NULL; 34 static xmlAttrPtr api_attr = NULL; 35 static xmlNsPtr api_ns = NULL; 36 37 static void 38 structured_errors(void *userData ATTRIBUTE_UNUSED, 39 xmlErrorPtr error ATTRIBUTE_UNUSED) { 40 generic_errors++; 41 } 42 43 static void 44 free_api_doc(void) { 45 xmlFreeDoc(api_doc); 46 api_doc = NULL; 47 api_dtd = NULL; 48 api_root = NULL; 49 api_attr = NULL; 50 api_ns = NULL; 51 } 52 53 static xmlDocPtr 54 get_api_doc(void) { 55 if (api_doc == NULL) { 56 api_doc = xmlReadMemory("<!DOCTYPE root [<!ELEMENT root EMPTY>]><root xmlns:h='http://example.com/' h:foo='bar'/>", 88, "root_test", NULL, 0); 57 api_root = NULL; 58 api_attr = NULL; 59 } 60 return(api_doc); 61 } 62 63 static xmlDtdPtr 64 get_api_dtd(void) { 65 if ((api_dtd == NULL) || (api_dtd->type != XML_DTD_NODE)) { 66 get_api_doc(); 67 if ((api_doc != NULL) && (api_doc->children != NULL) && 68 (api_doc->children->type == XML_DTD_NODE)) 69 api_dtd = (xmlDtdPtr) api_doc->children; 70 } 71 return(api_dtd); 72 } 73 74 static xmlNodePtr 75 get_api_root(void) { 76 if ((api_root == NULL) || (api_root->type != XML_ELEMENT_NODE)) { 77 get_api_doc(); 78 if ((api_doc != NULL) && (api_doc->children != NULL) && 79 (api_doc->children->next != NULL) && 80 (api_doc->children->next->type == XML_ELEMENT_NODE)) 81 api_root = api_doc->children->next; 82 } 83 return(api_root); 84 } 85 86 static xmlNsPtr 87 get_api_ns(void) { 88 get_api_root(); 89 if (api_root != NULL) 90 api_ns = api_root->nsDef; 91 return(api_ns); 92 } 93 94 static xmlAttrPtr 95 get_api_attr(void) { 96 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED) 97 static int nr = 0; 98 xmlChar name[20]; 99 #endif 100 101 if ((api_root == NULL) || (api_root->type != XML_ELEMENT_NODE)) { 102 get_api_root(); 103 } 104 if (api_root == NULL) 105 return(NULL); 106 if (api_root->properties != NULL) { 107 api_attr = api_root->properties; 108 return(api_root->properties); 109 } 110 api_attr = NULL; 111 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED) 112 snprintf((char *) name, 20, "foo%d", nr++); 113 api_attr = xmlSetProp(api_root, name, (const xmlChar *) "bar"); 114 #endif 115 return(api_attr); 116 } 117 118 static int quiet = 0; 119 120 int main(int argc, char **argv) { 121 int ret; 122 int blocks, mem; 123 124 #ifdef HAVE_PUTENV 125 /* access to the proxy can slow up regression tests a lot */ 126 putenv((char *) "http_proxy="); 127 #endif 128 129 memset(chartab, 0, sizeof(chartab)); 130 strncpy((char *) chartab, " chartab\n", 20); 131 memset(inttab, 0, sizeof(inttab)); 132 memset(longtab, 0, sizeof(longtab)); 133 134 xmlInitParser(); 135 #ifdef LIBXML_SCHEMAS_ENABLED 136 xmlRelaxNGInitTypes(); 137 #endif 138 139 LIBXML_TEST_VERSION 140 141 xmlSetStructuredErrorFunc(NULL, structured_errors); 142 143 if (argc >= 2) { 144 if (!strcmp(argv[1], "-q")) { 145 quiet = 1; 146 if (argc >= 3) 147 ret = test_module(argv[2]); 148 else 149 ret = testlibxml2(); 150 } else { 151 ret = test_module(argv[1]); 152 } 153 } else 154 ret = testlibxml2(); 155 156 xmlCleanupParser(); 157 blocks = xmlMemBlocks(); 158 mem = xmlMemUsed(); 159 if ((blocks != 0) || (mem != 0)) { 160 printf("testapi leaked %d bytes in %d blocks\n", mem, blocks); 161 } 162 xmlMemoryDump(); 163 164 return (ret != 0); 165 } 166 167 #include <libxml/HTMLparser.h> 168 #include <libxml/HTMLtree.h> 169 #include <libxml/catalog.h> 170 #include <libxml/chvalid.h> 171 #include <libxml/dict.h> 172 #include <libxml/encoding.h> 173 #include <libxml/entities.h> 174 #include <libxml/hash.h> 175 #include <libxml/list.h> 176 #include <libxml/nanoftp.h> 177 #include <libxml/nanohttp.h> 178 #include <libxml/parser.h> 179 #include <libxml/parserInternals.h> 180 #include <libxml/pattern.h> 181 #include <libxml/relaxng.h> 182 #include <libxml/schemasInternals.h> 183 #include <libxml/schematron.h> 184 #include <libxml/tree.h> 185 #include <libxml/uri.h> 186 #include <libxml/valid.h> 187 #include <libxml/xinclude.h> 188 #include <libxml/xmlIO.h> 189 #include <libxml/xmlerror.h> 190 #include <libxml/xmlreader.h> 191 #include <libxml/xmlsave.h> 192 #include <libxml/xmlschemas.h> 193 #include <libxml/xmlschemastypes.h> 194 #include <libxml/xmlstring.h> 195 #include <libxml/xmlwriter.h> 196 #include <libxml/xpath.h> 197 #include <libxml/xpointer.h> 198 #include <libxml/debugXML.h> 199 200 /* 201 We manually define xmlErrMemory because it's normal declaration 202 is "hidden" by #ifdef IN_LIBXML 203 */ 204 void xmlErrMemory(xmlParserCtxtPtr ctxt, const char *extra); 205 206 /* 207 We need some "remote" addresses, but want to avoid getting into 208 name resolution delays, so we use these 209 */ 210 #define REMOTE1GOOD "http://localhost/" 211 #define REMOTE1BAD "http:http://http" 212 #define REMOTE2GOOD "ftp://localhost/foo" 213 214 #define gen_nb_void_ptr 2 215 216 static void *gen_void_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 217 return(NULL); 218 } 219 static void des_void_ptr(int no ATTRIBUTE_UNUSED, void *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 220 } 221 222 #if 0 223 #define gen_nb_const_void_ptr 2 224 225 static const void *gen_const_void_ptr(int no, int nr ATTRIBUTE_UNUSED) { 226 if (no == 0) return((const void *) "immutable string"); 227 return(NULL); 228 } 229 static void des_const_void_ptr(int no ATTRIBUTE_UNUSED, const void *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 230 } 231 #endif 232 233 #define gen_nb_userdata 3 234 235 static void *gen_userdata(int no, int nr ATTRIBUTE_UNUSED) { 236 if (no == 0) return((void *) &call_tests); 237 if (no == 1) return((void *) -1); 238 return(NULL); 239 } 240 static void des_userdata(int no ATTRIBUTE_UNUSED, void *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 241 } 242 243 244 #define gen_nb_int 4 245 246 static int gen_int(int no, int nr ATTRIBUTE_UNUSED) { 247 if (no == 0) return(0); 248 if (no == 1) return(1); 249 if (no == 2) return(-1); 250 if (no == 3) return(122); 251 return(-1); 252 } 253 254 static void des_int(int no ATTRIBUTE_UNUSED, int val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 255 } 256 257 #define gen_nb_parseroptions 5 258 259 static int gen_parseroptions(int no, int nr ATTRIBUTE_UNUSED) { 260 if (no == 0) return(XML_PARSE_NOBLANKS | XML_PARSE_RECOVER); 261 if (no == 1) return(XML_PARSE_NOENT | XML_PARSE_DTDLOAD | XML_PARSE_DTDATTR | XML_PARSE_DTDVALID | XML_PARSE_NOCDATA); 262 if (no == 2) return(XML_PARSE_XINCLUDE | XML_PARSE_NOXINCNODE | XML_PARSE_NSCLEAN); 263 if (no == 3) return(XML_PARSE_XINCLUDE | XML_PARSE_NODICT); 264 return(XML_PARSE_SAX1); 265 } 266 267 static void des_parseroptions(int no ATTRIBUTE_UNUSED, int val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 268 } 269 270 #if 0 271 #define gen_nb_long 5 272 273 static long gen_long(int no, int nr ATTRIBUTE_UNUSED) { 274 if (no == 0) return(0); 275 if (no == 1) return(1); 276 if (no == 2) return(-1); 277 if (no == 3) return(122); 278 return(-1); 279 } 280 281 static void des_long(int no ATTRIBUTE_UNUSED, long val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 282 } 283 #endif 284 285 #define gen_nb_xmlChar 4 286 287 static xmlChar gen_xmlChar(int no, int nr ATTRIBUTE_UNUSED) { 288 if (no == 0) return('a'); 289 if (no == 1) return(' '); 290 if (no == 2) return((xmlChar) '\xf8'); 291 return(0); 292 } 293 294 static void des_xmlChar(int no ATTRIBUTE_UNUSED, xmlChar val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 295 } 296 297 #define gen_nb_unsigned_int 3 298 299 static unsigned int gen_unsigned_int(int no, int nr ATTRIBUTE_UNUSED) { 300 if (no == 0) return(0); 301 if (no == 1) return(1); 302 if (no == 2) return(122); 303 return((unsigned int) -1); 304 } 305 306 static void des_unsigned_int(int no ATTRIBUTE_UNUSED, unsigned int val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 307 } 308 309 #define gen_nb_unsigned_long 4 310 311 static unsigned long gen_unsigned_long(int no, int nr ATTRIBUTE_UNUSED) { 312 if (no == 0) return(0); 313 if (no == 1) return(1); 314 if (no == 2) return(122); 315 return((unsigned long) -1); 316 } 317 318 static void des_unsigned_long(int no ATTRIBUTE_UNUSED, unsigned long val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 319 } 320 321 #define gen_nb_double 4 322 323 static double gen_double(int no, int nr ATTRIBUTE_UNUSED) { 324 if (no == 0) return(0); 325 if (no == 1) return(-1.1); 326 #if defined(LIBXML_XPATH_ENABLED) 327 if (no == 2) return(xmlXPathNAN); 328 #endif 329 return(-1); 330 } 331 332 static void des_double(int no ATTRIBUTE_UNUSED, double val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 333 } 334 335 #define gen_nb_unsigned_long_ptr 2 336 337 static unsigned long *gen_unsigned_long_ptr(int no, int nr) { 338 if (no == 0) return(&longtab[nr]); 339 return(NULL); 340 } 341 342 static void des_unsigned_long_ptr(int no ATTRIBUTE_UNUSED, unsigned long *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 343 } 344 345 #define gen_nb_int_ptr 2 346 347 static int *gen_int_ptr(int no, int nr) { 348 if (no == 0) return(&inttab[nr]); 349 return(NULL); 350 } 351 352 static void des_int_ptr(int no ATTRIBUTE_UNUSED, int *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 353 } 354 355 #define gen_nb_const_char_ptr 4 356 357 static char *gen_const_char_ptr(int no, int nr ATTRIBUTE_UNUSED) { 358 if (no == 0) return((char *) "foo"); 359 if (no == 1) return((char *) "<foo/>"); 360 if (no == 2) return((char *) "test/ent2"); 361 return(NULL); 362 } 363 static void des_const_char_ptr(int no ATTRIBUTE_UNUSED, const char *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 364 } 365 366 #define gen_nb_xmlChar_ptr 2 367 368 static xmlChar *gen_xmlChar_ptr(int no, int nr ATTRIBUTE_UNUSED) { 369 if (no == 0) return(&chartab[0]); 370 return(NULL); 371 } 372 static void des_xmlChar_ptr(int no ATTRIBUTE_UNUSED, xmlChar *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 373 } 374 375 #define gen_nb_FILE_ptr 2 376 377 static FILE *gen_FILE_ptr(int no, int nr ATTRIBUTE_UNUSED) { 378 if (no == 0) return(fopen("test.out", "a+")); 379 return(NULL); 380 } 381 static void des_FILE_ptr(int no ATTRIBUTE_UNUSED, FILE *val, int nr ATTRIBUTE_UNUSED) { 382 if (val != NULL) fclose(val); 383 } 384 385 #define gen_nb_debug_FILE_ptr 2 386 static FILE *gen_debug_FILE_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 387 return(fopen("test.out", "a+")); 388 } 389 static void des_debug_FILE_ptr(int no ATTRIBUTE_UNUSED, FILE *val, int nr ATTRIBUTE_UNUSED) { 390 if (val != NULL) fclose(val); 391 } 392 393 #define gen_nb_const_xmlChar_ptr 5 394 395 static xmlChar *gen_const_xmlChar_ptr(int no, int nr ATTRIBUTE_UNUSED) { 396 if (no == 0) return((xmlChar *) "foo"); 397 if (no == 1) return((xmlChar *) "<foo/>"); 398 if (no == 2) return((xmlChar *) "n" "\xf8" "ne"); 399 if (no == 3) return((xmlChar *) " 2ab "); 400 return(NULL); 401 } 402 static void des_const_xmlChar_ptr(int no ATTRIBUTE_UNUSED, const xmlChar *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 403 } 404 405 #define gen_nb_filepath 8 406 407 static const char *gen_filepath(int no, int nr ATTRIBUTE_UNUSED) { 408 if (no == 0) return("missing.xml"); 409 if (no == 1) return("<foo/>"); 410 if (no == 2) return("test/ent2"); 411 if (no == 3) return("test/valid/REC-xml-19980210.xml"); 412 if (no == 4) return("test/valid/dtds/xhtml1-strict.dtd"); 413 if (no == 5) return(REMOTE1GOOD); 414 if (no == 6) return(REMOTE1BAD); 415 return(NULL); 416 } 417 static void des_filepath(int no ATTRIBUTE_UNUSED, const char *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 418 } 419 420 #define gen_nb_eaten_name 2 421 422 static xmlChar *gen_eaten_name(int no, int nr ATTRIBUTE_UNUSED) { 423 if (no == 0) return(xmlStrdup(BAD_CAST "eaten")); 424 return(NULL); 425 } 426 static void des_eaten_name(int no ATTRIBUTE_UNUSED, xmlChar *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 427 } 428 429 #define gen_nb_fileoutput 6 430 431 static const char *gen_fileoutput(int no, int nr ATTRIBUTE_UNUSED) { 432 if (no == 0) return("/missing.xml"); 433 if (no == 1) return("<foo/>"); 434 if (no == 2) return(REMOTE2GOOD); 435 if (no == 3) return(REMOTE1GOOD); 436 if (no == 4) return(REMOTE1BAD); 437 return(NULL); 438 } 439 static void des_fileoutput(int no ATTRIBUTE_UNUSED, const char *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 440 } 441 442 #define gen_nb_xmlParserCtxtPtr 3 443 static xmlParserCtxtPtr gen_xmlParserCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) { 444 if (no == 0) return(xmlNewParserCtxt()); 445 if (no == 1) return(xmlCreateMemoryParserCtxt("<doc/>", 6)); 446 return(NULL); 447 } 448 static void des_xmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, xmlParserCtxtPtr val, int nr ATTRIBUTE_UNUSED) { 449 if (val != NULL) 450 xmlFreeParserCtxt(val); 451 } 452 453 #define gen_nb_xmlSAXHandlerPtr 2 454 static xmlSAXHandlerPtr gen_xmlSAXHandlerPtr(int no, int nr ATTRIBUTE_UNUSED) { 455 #ifdef LIBXML_SAX1_ENABLED 456 if (no == 0) return((xmlSAXHandlerPtr) &xmlDefaultSAXHandler); 457 #endif 458 return(NULL); 459 } 460 static void des_xmlSAXHandlerPtr(int no ATTRIBUTE_UNUSED, xmlSAXHandlerPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 461 } 462 463 #define gen_nb_xmlValidCtxtPtr 2 464 static xmlValidCtxtPtr gen_xmlValidCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) { 465 #ifdef LIBXML_VALID_ENABLED 466 if (no == 0) return(xmlNewValidCtxt()); 467 #endif 468 return(NULL); 469 } 470 static void des_xmlValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlValidCtxtPtr val, int nr ATTRIBUTE_UNUSED) { 471 #ifdef LIBXML_VALID_ENABLED 472 if (val != NULL) 473 xmlFreeValidCtxt(val); 474 #endif 475 } 476 477 #define gen_nb_xmlParserInputBufferPtr 8 478 479 static xmlParserInputBufferPtr gen_xmlParserInputBufferPtr(int no, int nr ATTRIBUTE_UNUSED) { 480 if (no == 0) return(xmlParserInputBufferCreateFilename("missing.xml", XML_CHAR_ENCODING_NONE)); 481 if (no == 1) return(xmlParserInputBufferCreateFilename("<foo/>", XML_CHAR_ENCODING_NONE)); 482 if (no == 2) return(xmlParserInputBufferCreateFilename("test/ent2", XML_CHAR_ENCODING_NONE)); 483 if (no == 3) return(xmlParserInputBufferCreateFilename("test/valid/REC-xml-19980210.xml", XML_CHAR_ENCODING_NONE)); 484 if (no == 4) return(xmlParserInputBufferCreateFilename("test/valid/dtds/xhtml1-strict.dtd", XML_CHAR_ENCODING_NONE)); 485 if (no == 5) return(xmlParserInputBufferCreateFilename(REMOTE1GOOD, XML_CHAR_ENCODING_NONE)); 486 if (no == 6) return(xmlParserInputBufferCreateFilename(REMOTE1BAD, XML_CHAR_ENCODING_NONE)); 487 return(NULL); 488 } 489 static void des_xmlParserInputBufferPtr(int no ATTRIBUTE_UNUSED, xmlParserInputBufferPtr val, int nr ATTRIBUTE_UNUSED) { 490 xmlFreeParserInputBuffer(val); 491 } 492 493 #define gen_nb_xmlDocPtr 4 494 static xmlDocPtr gen_xmlDocPtr(int no, int nr ATTRIBUTE_UNUSED) { 495 if (no == 0) return(xmlNewDoc(BAD_CAST "1.0")); 496 if (no == 1) return(xmlReadMemory("<foo/>", 6, "test", NULL, 0)); 497 if (no == 2) return(xmlReadMemory("<!DOCTYPE foo []> <foo/>", 24, "test", NULL, 0)); 498 return(NULL); 499 } 500 static void des_xmlDocPtr(int no ATTRIBUTE_UNUSED, xmlDocPtr val, int nr ATTRIBUTE_UNUSED) { 501 if ((val != NULL) && (val != api_doc) && (val->doc != api_doc)) 502 xmlFreeDoc(val); 503 } 504 505 #define gen_nb_xmlAttrPtr 2 506 static xmlAttrPtr gen_xmlAttrPtr(int no, int nr ATTRIBUTE_UNUSED) { 507 if (no == 0) return(get_api_attr()); 508 return(NULL); 509 } 510 static void des_xmlAttrPtr(int no, xmlAttrPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 511 if (no == 0) free_api_doc(); 512 } 513 514 #define gen_nb_xmlDictPtr 2 515 static xmlDictPtr gen_xmlDictPtr(int no, int nr ATTRIBUTE_UNUSED) { 516 if (no == 0) return(xmlDictCreate()); 517 return(NULL); 518 } 519 static void des_xmlDictPtr(int no ATTRIBUTE_UNUSED, xmlDictPtr val, int nr ATTRIBUTE_UNUSED) { 520 if (val != NULL) 521 xmlDictFree(val); 522 } 523 524 #define gen_nb_xmlNodePtr 3 525 static xmlNodePtr gen_xmlNodePtr(int no, int nr ATTRIBUTE_UNUSED) { 526 if (no == 0) return(xmlNewPI(BAD_CAST "test", NULL)); 527 if (no == 1) return(get_api_root()); 528 return(NULL); 529 /* if (no == 2) return((xmlNodePtr) get_api_doc()); */ 530 } 531 static void des_xmlNodePtr(int no, xmlNodePtr val, int nr ATTRIBUTE_UNUSED) { 532 if (no == 1) { 533 free_api_doc(); 534 } else if (val != NULL) { 535 xmlUnlinkNode(val); 536 xmlFreeNode(val); 537 } 538 } 539 540 #define gen_nb_xmlDtdPtr 3 541 static xmlDtdPtr gen_xmlDtdPtr(int no, int nr ATTRIBUTE_UNUSED) { 542 if (no == 0) 543 return(xmlNewDtd(NULL, BAD_CAST "dtd", BAD_CAST"foo", BAD_CAST"bar")); 544 if (no == 1) return(get_api_dtd()); 545 return(NULL); 546 } 547 static void des_xmlDtdPtr(int no, xmlDtdPtr val, int nr ATTRIBUTE_UNUSED) { 548 if (no == 1) free_api_doc(); 549 else if (val != NULL) { 550 xmlUnlinkNode((xmlNodePtr) val); 551 xmlFreeNode((xmlNodePtr) val); 552 } 553 } 554 555 #define gen_nb_xmlNsPtr 2 556 static xmlNsPtr gen_xmlNsPtr(int no, int nr ATTRIBUTE_UNUSED) { 557 if (no == 0) return(get_api_ns()); 558 return(NULL); 559 } 560 static void des_xmlNsPtr(int no, xmlNsPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 561 if (no == 0) free_api_doc(); 562 } 563 564 #define gen_nb_xmlNodePtr_in 3 565 static xmlNodePtr gen_xmlNodePtr_in(int no, int nr ATTRIBUTE_UNUSED) { 566 if (no == 0) return(xmlNewPI(BAD_CAST "test", NULL)); 567 if (no == 0) return(xmlNewText(BAD_CAST "text")); 568 return(NULL); 569 } 570 static void des_xmlNodePtr_in(int no ATTRIBUTE_UNUSED, xmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 571 } 572 573 #ifdef LIBXML_WRITER_ENABLED 574 #define gen_nb_xmlTextWriterPtr 2 575 static xmlTextWriterPtr gen_xmlTextWriterPtr(int no, int nr ATTRIBUTE_UNUSED) { 576 if (no == 0) return(xmlNewTextWriterFilename("test.out", 0)); 577 return(NULL); 578 } 579 static void des_xmlTextWriterPtr(int no ATTRIBUTE_UNUSED, xmlTextWriterPtr val, int nr ATTRIBUTE_UNUSED) { 580 if (val != NULL) xmlFreeTextWriter(val); 581 } 582 #endif 583 584 #ifdef LIBXML_READER_ENABLED 585 #define gen_nb_xmlTextReaderPtr 4 586 static xmlTextReaderPtr gen_xmlTextReaderPtr(int no, int nr ATTRIBUTE_UNUSED) { 587 if (no == 0) return(xmlNewTextReaderFilename("test/ent2")); 588 if (no == 1) return(xmlNewTextReaderFilename("test/valid/REC-xml-19980210.xml")); 589 if (no == 2) return(xmlNewTextReaderFilename("test/valid/dtds/xhtml1-strict.dtd")); 590 return(NULL); 591 } 592 static void des_xmlTextReaderPtr(int no ATTRIBUTE_UNUSED, xmlTextReaderPtr val, int nr ATTRIBUTE_UNUSED) { 593 if (val != NULL) xmlFreeTextReader(val); 594 } 595 #endif 596 597 #define gen_nb_xmlBufferPtr 3 598 static const xmlChar *static_buf_content = (xmlChar *)"a static buffer"; 599 static xmlBufferPtr gen_xmlBufferPtr(int no, int nr ATTRIBUTE_UNUSED) { 600 if (no == 0) return(xmlBufferCreate()); 601 if (no == 1) return(xmlBufferCreateStatic((void *)static_buf_content, 13)); 602 return(NULL); 603 } 604 static void des_xmlBufferPtr(int no ATTRIBUTE_UNUSED, xmlBufferPtr val, int nr ATTRIBUTE_UNUSED) { 605 if (val != NULL) { 606 xmlBufferFree(val); 607 } 608 } 609 610 #define gen_nb_xmlListPtr 2 611 static xmlListPtr gen_xmlListPtr(int no, int nr ATTRIBUTE_UNUSED) { 612 if (no == 0) return(xmlListCreate(NULL, NULL)); 613 return(NULL); 614 } 615 static void des_xmlListPtr(int no ATTRIBUTE_UNUSED, xmlListPtr val, int nr ATTRIBUTE_UNUSED) { 616 if (val != NULL) { 617 xmlListDelete(val); 618 } 619 } 620 621 #define gen_nb_xmlHashTablePtr 2 622 static xmlHashTablePtr gen_xmlHashTablePtr(int no, int nr ATTRIBUTE_UNUSED) { 623 if (no == 0) return(xmlHashCreate(10)); 624 return(NULL); 625 } 626 static void des_xmlHashTablePtr(int no ATTRIBUTE_UNUSED, xmlHashTablePtr val, int nr ATTRIBUTE_UNUSED) { 627 if (val != NULL) { 628 xmlHashFree(val, NULL); 629 } 630 } 631 632 #include <libxml/xpathInternals.h> 633 634 #ifdef LIBXML_XPATH_ENABLED 635 #define gen_nb_xmlXPathObjectPtr 5 636 static xmlXPathObjectPtr gen_xmlXPathObjectPtr(int no, int nr ATTRIBUTE_UNUSED) { 637 if (no == 0) return(xmlXPathNewString(BAD_CAST "string object")); 638 if (no == 1) return(xmlXPathNewFloat(1.1)); 639 if (no == 2) return(xmlXPathNewBoolean(1)); 640 if (no == 3) return(xmlXPathNewNodeSet(NULL)); 641 return(NULL); 642 } 643 static void des_xmlXPathObjectPtr(int no ATTRIBUTE_UNUSED, xmlXPathObjectPtr val, int nr ATTRIBUTE_UNUSED) { 644 if (val != NULL) { 645 xmlXPathFreeObject(val); 646 } 647 } 648 #endif 649 650 #ifdef LIBXML_OUTPUT_ENABLED 651 #define gen_nb_xmlOutputBufferPtr 2 652 static xmlOutputBufferPtr gen_xmlOutputBufferPtr(int no, int nr ATTRIBUTE_UNUSED) { 653 if (no == 0) return(xmlOutputBufferCreateFilename("test.out", NULL, 0)); 654 return(NULL); 655 } 656 static void des_xmlOutputBufferPtr(int no ATTRIBUTE_UNUSED, xmlOutputBufferPtr val, int nr ATTRIBUTE_UNUSED) { 657 if (val != NULL) { 658 xmlOutputBufferClose(val); 659 } 660 } 661 #endif 662 663 #ifdef LIBXML_FTP_ENABLED 664 #define gen_nb_xmlNanoFTPCtxtPtr 4 665 static void *gen_xmlNanoFTPCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) { 666 if (no == 0) return(xmlNanoFTPNewCtxt(REMOTE2GOOD)); 667 if (no == 1) return(xmlNanoFTPNewCtxt(REMOTE1GOOD)); 668 if (no == 2) return(xmlNanoFTPNewCtxt("foo")); 669 return(NULL); 670 } 671 static void des_xmlNanoFTPCtxtPtr(int no ATTRIBUTE_UNUSED, void *val, int nr ATTRIBUTE_UNUSED) { 672 if (val != NULL) { 673 xmlNanoFTPFreeCtxt(val); 674 } 675 } 676 #endif 677 678 #ifdef LIBXML_HTTP_ENABLED 679 #define gen_nb_xmlNanoHTTPCtxtPtr 1 680 static void *gen_xmlNanoHTTPCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) { 681 if (no == 0) return(xmlNanoHTTPOpen(REMOTE1GOOD, NULL)); 682 if (no == 1) return(xmlNanoHTTPOpen(REMOTE2GOOD, NULL)); 683 if (no == 2) return(xmlNanoHTTPOpen(REMOTE1BAD, NULL)); 684 return(NULL); 685 } 686 static void des_xmlNanoHTTPCtxtPtr(int no ATTRIBUTE_UNUSED, void *val, int nr ATTRIBUTE_UNUSED) { 687 if (val != NULL) { 688 xmlNanoHTTPClose(val); 689 } 690 } 691 #endif 692 693 #define gen_nb_xmlCharEncoding 4 694 static xmlCharEncoding gen_xmlCharEncoding(int no, int nr ATTRIBUTE_UNUSED) { 695 if (no == 0) return(XML_CHAR_ENCODING_UTF8); 696 if (no == 1) return(XML_CHAR_ENCODING_NONE); 697 if (no == 2) return(XML_CHAR_ENCODING_8859_1); 698 return(XML_CHAR_ENCODING_ERROR); 699 } 700 static void des_xmlCharEncoding(int no ATTRIBUTE_UNUSED, xmlCharEncoding val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 701 } 702 703 #if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_EXPR_ENABLED) 704 705 #define gen_nb_xmlExpCtxtPtr 1 706 static xmlExpCtxtPtr gen_xmlExpCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 707 return(NULL); 708 } 709 static void des_xmlExpCtxtPtr(int no ATTRIBUTE_UNUSED, xmlExpCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 710 } 711 712 #define gen_nb_xmlExpNodePtr 1 713 static xmlExpNodePtr gen_xmlExpNodePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 714 return(NULL); 715 } 716 static void des_xmlExpNodePtr(int no ATTRIBUTE_UNUSED, xmlExpNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 717 } 718 719 #endif 720 721 #if defined(LIBXML_SCHEMAS_ENABLED) 722 #define gen_nb_xmlSchemaPtr 1 723 static xmlSchemaPtr gen_xmlSchemaPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 724 return(NULL); 725 } 726 static void des_xmlSchemaPtr(int no ATTRIBUTE_UNUSED, xmlSchemaPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 727 } 728 729 #define gen_nb_xmlSchemaValidCtxtPtr 1 730 static xmlSchemaValidCtxtPtr gen_xmlSchemaValidCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 731 return(NULL); 732 } 733 static void des_xmlSchemaValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSchemaValidCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 734 } 735 736 #endif /* LIBXML_SCHEMAS_ENABLED */ 737 738 #define gen_nb_xmlHashDeallocator 2 739 static void 740 test_xmlHashDeallocator(void *payload ATTRIBUTE_UNUSED, xmlChar *name ATTRIBUTE_UNUSED) { 741 } 742 743 static xmlHashDeallocator gen_xmlHashDeallocator(int no, int nr ATTRIBUTE_UNUSED) { 744 if (no == 0) return(test_xmlHashDeallocator); 745 return(NULL); 746 } 747 static void des_xmlHashDeallocator(int no ATTRIBUTE_UNUSED, xmlHashDeallocator val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 748 } 749 750 751 static void desret_int(int val ATTRIBUTE_UNUSED) { 752 } 753 static void desret_xmlChar(xmlChar val ATTRIBUTE_UNUSED) { 754 } 755 static void desret_long(long val ATTRIBUTE_UNUSED) { 756 } 757 static void desret_unsigned_long(unsigned long val ATTRIBUTE_UNUSED) { 758 } 759 static void desret_double(double val ATTRIBUTE_UNUSED) { 760 } 761 static void desret_xmlCharEncoding(xmlCharEncoding val ATTRIBUTE_UNUSED) { 762 } 763 #if 0 764 static void desret_const_void_ptr(void *val ATTRIBUTE_UNUSED) { 765 } 766 #endif 767 static void desret_void_ptr(void *val ATTRIBUTE_UNUSED) { 768 } 769 static void desret_const_char_ptr(const char *val ATTRIBUTE_UNUSED) { 770 } 771 static void desret_const_xmlChar_ptr(const xmlChar *val ATTRIBUTE_UNUSED) { 772 } 773 static void desret_xmlChar_ptr(xmlChar *val) { 774 if (val != NULL) 775 xmlFree(val); 776 } 777 static void desret_xmlDocPtr(xmlDocPtr val) { 778 if (val != api_doc) 779 xmlFreeDoc(val); 780 } 781 static void desret_xmlDictPtr(xmlDictPtr val) { 782 xmlDictFree(val); 783 } 784 #ifdef LIBXML_OUTPUT_ENABLED 785 static void desret_xmlOutputBufferPtr(xmlOutputBufferPtr val) { 786 xmlOutputBufferClose(val); 787 } 788 #endif 789 #ifdef LIBXML_READER_ENABLED 790 static void desret_xmlTextReaderPtr(xmlTextReaderPtr val) { 791 xmlFreeTextReader(val); 792 } 793 #endif 794 static void desret_xmlNodePtr(xmlNodePtr val) { 795 if ((val != NULL) && (val != api_root) && (val != (xmlNodePtr) api_doc)) { 796 xmlUnlinkNode(val); 797 xmlFreeNode(val); 798 } 799 } 800 static void desret_xmlAttrPtr(xmlAttrPtr val) { 801 if (val != NULL) { 802 xmlUnlinkNode((xmlNodePtr) val); 803 xmlFreeNode((xmlNodePtr) val); 804 } 805 } 806 static void desret_xmlEntityPtr(xmlEntityPtr val) { 807 if (val != NULL) { 808 xmlUnlinkNode((xmlNodePtr) val); 809 xmlFreeNode((xmlNodePtr) val); 810 } 811 } 812 static void desret_xmlElementPtr(xmlElementPtr val) { 813 if (val != NULL) { 814 xmlUnlinkNode((xmlNodePtr) val); 815 } 816 } 817 static void desret_xmlAttributePtr(xmlAttributePtr val) { 818 if (val != NULL) { 819 xmlUnlinkNode((xmlNodePtr) val); 820 } 821 } 822 static void desret_xmlNsPtr(xmlNsPtr val ATTRIBUTE_UNUSED) { 823 } 824 static void desret_xmlDtdPtr(xmlDtdPtr val) { 825 desret_xmlNodePtr((xmlNodePtr)val); 826 } 827 #ifdef LIBXML_XPATH_ENABLED 828 static void desret_xmlXPathObjectPtr(xmlXPathObjectPtr val) { 829 xmlXPathFreeObject(val); 830 } 831 static void desret_xmlNodeSetPtr(xmlNodeSetPtr val) { 832 xmlXPathFreeNodeSet(val); 833 } 834 #endif 835 static void desret_xmlParserCtxtPtr(xmlParserCtxtPtr val) { 836 xmlFreeParserCtxt(val); 837 } 838 static void desret_xmlParserInputBufferPtr(xmlParserInputBufferPtr val) { 839 xmlFreeParserInputBuffer(val); 840 } 841 static void desret_xmlParserInputPtr(xmlParserInputPtr val) { 842 xmlFreeInputStream(val); 843 } 844 #ifdef LIBXML_WRITER_ENABLED 845 static void desret_xmlTextWriterPtr(xmlTextWriterPtr val) { 846 xmlFreeTextWriter(val); 847 } 848 #endif 849 static void desret_xmlBufferPtr(xmlBufferPtr val) { 850 xmlBufferFree(val); 851 } 852 #ifdef LIBXML_SCHEMAS_ENABLED 853 static void desret_xmlSchemaParserCtxtPtr(xmlSchemaParserCtxtPtr val) { 854 xmlSchemaFreeParserCtxt(val); 855 } 856 static void desret_xmlSchemaTypePtr(xmlSchemaTypePtr val ATTRIBUTE_UNUSED) { 857 } 858 static void desret_xmlRelaxNGParserCtxtPtr(xmlRelaxNGParserCtxtPtr val) { 859 xmlRelaxNGFreeParserCtxt(val); 860 } 861 #endif 862 #ifdef LIBXML_HTML_ENABLED 863 static void desret_const_htmlEntityDesc_ptr(const htmlEntityDesc * val ATTRIBUTE_UNUSED) { 864 } 865 #endif 866 #ifdef LIBXML_HTTP_ENABLED 867 static void desret_xmlNanoHTTPCtxtPtr(void *val) { 868 xmlNanoHTTPClose(val); 869 } 870 #endif 871 #ifdef LIBXML_FTP_ENABLED 872 static void desret_xmlNanoFTPCtxtPtr(void *val) { 873 xmlNanoFTPClose(val); 874 } 875 #endif 876 /* cut and pasted from autogenerated to avoid troubles */ 877 #define gen_nb_const_xmlChar_ptr_ptr 1 878 static xmlChar ** gen_const_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 879 return(NULL); 880 } 881 static void des_const_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, const xmlChar ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 882 } 883 884 #define gen_nb_unsigned_char_ptr 1 885 static unsigned char * gen_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 886 return(NULL); 887 } 888 static void des_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, unsigned char * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 889 } 890 891 #define gen_nb_const_unsigned_char_ptr 1 892 static unsigned char * gen_const_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 893 return(NULL); 894 } 895 static void des_const_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, const unsigned char * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 896 } 897 898 #ifdef LIBXML_HTML_ENABLED 899 #define gen_nb_const_htmlNodePtr 1 900 static htmlNodePtr gen_const_htmlNodePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 901 return(NULL); 902 } 903 static void des_const_htmlNodePtr(int no ATTRIBUTE_UNUSED, const htmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 904 } 905 #endif 906 907 #ifdef LIBXML_HTML_ENABLED 908 #define gen_nb_htmlDocPtr 3 909 static htmlDocPtr gen_htmlDocPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 910 if (no == 0) return(htmlNewDoc(NULL, NULL)); 911 if (no == 1) return(htmlReadMemory("<html/>", 7, "test", NULL, 0)); 912 return(NULL); 913 } 914 static void des_htmlDocPtr(int no ATTRIBUTE_UNUSED, htmlDocPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 915 if ((val != NULL) && (val != api_doc) && (val->doc != api_doc)) 916 xmlFreeDoc(val); 917 } 918 static void desret_htmlDocPtr(htmlDocPtr val) { 919 if ((val != NULL) && (val != api_doc) && (val->doc != api_doc)) 920 xmlFreeDoc(val); 921 } 922 #define gen_nb_htmlParserCtxtPtr 3 923 static htmlParserCtxtPtr gen_htmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 924 if (no == 0) return(xmlNewParserCtxt()); 925 if (no == 1) return(htmlCreateMemoryParserCtxt("<html/>", 7)); 926 return(NULL); 927 } 928 static void des_htmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, htmlParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 929 if (val != NULL) 930 htmlFreeParserCtxt(val); 931 } 932 static void desret_htmlParserCtxtPtr(htmlParserCtxtPtr val) { 933 if (val != NULL) 934 htmlFreeParserCtxt(val); 935 } 936 #endif 937 938 #ifdef LIBXML_XPATH_ENABLED 939 #define gen_nb_xmlNodeSetPtr 1 940 static xmlNodeSetPtr gen_xmlNodeSetPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 941 return(NULL); 942 } 943 static void des_xmlNodeSetPtr(int no ATTRIBUTE_UNUSED, xmlNodeSetPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 944 } 945 #endif 946 947 #ifdef LIBXML_DEBUG_ENABLED 948 #ifdef LIBXML_XPATH_ENABLED 949 #define gen_nb_xmlShellCtxtPtr 1 950 static xmlShellCtxtPtr gen_xmlShellCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 951 return(NULL); 952 } 953 static void des_xmlShellCtxtPtr(int no ATTRIBUTE_UNUSED, xmlShellCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 954 } 955 #endif 956 #endif 957 958 #ifdef LIBXML_PATTERN_ENABLED 959 #define gen_nb_xmlPatternPtr 1 960 static xmlPatternPtr gen_xmlPatternPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 961 return(NULL); 962 } 963 static void des_xmlPatternPtr(int no ATTRIBUTE_UNUSED, xmlPatternPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 964 } 965 #endif 966 967 #define gen_nb_xmlElementContentPtr 1 968 static xmlElementContentPtr gen_xmlElementContentPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 969 return(NULL); 970 } 971 static void des_xmlElementContentPtr(int no ATTRIBUTE_UNUSED, xmlElementContentPtr val, int nr ATTRIBUTE_UNUSED) { 972 if (val != NULL) 973 xmlFreeElementContent(val); 974 } 975 static void desret_xmlElementContentPtr(xmlElementContentPtr val) { 976 if (val != NULL) 977 xmlFreeElementContent(val); 978 } 979 980 #define gen_nb_xmlParserNodeInfoSeqPtr 1 981 static xmlParserNodeInfoSeqPtr gen_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 982 return(NULL); 983 } 984 static void des_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, xmlParserNodeInfoSeqPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 985 } 986 987 static void desret_const_xmlParserNodeInfo_ptr(const xmlParserNodeInfo *val ATTRIBUTE_UNUSED) { 988 } 989 990 #define gen_nb_void_ptr_ptr 1 991 static void ** gen_void_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 992 return(NULL); 993 } 994 static void des_void_ptr_ptr(int no ATTRIBUTE_UNUSED, void ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 995 } 996 997 /************************************************************************ 998 * * 999 * WARNING: end of the manually maintained part of the test code * 1000 * do not remove or alter the CUT HERE line * 1001 * * 1002 ************************************************************************/ 1003 1004 /* CUT HERE: everything below that line is generated */ 1005 #ifdef LIBXML_HTML_ENABLED 1006 static void desret_htmlStatus(htmlStatus val ATTRIBUTE_UNUSED) { 1007 } 1008 1009 #endif 1010 1011 #define gen_nb_xmlAttributeDefault 4 1012 static xmlAttributeDefault gen_xmlAttributeDefault(int no, int nr ATTRIBUTE_UNUSED) { 1013 if (no == 1) return(XML_ATTRIBUTE_FIXED); 1014 if (no == 2) return(XML_ATTRIBUTE_IMPLIED); 1015 if (no == 3) return(XML_ATTRIBUTE_NONE); 1016 if (no == 4) return(XML_ATTRIBUTE_REQUIRED); 1017 return(0); 1018 } 1019 1020 static void des_xmlAttributeDefault(int no ATTRIBUTE_UNUSED, xmlAttributeDefault val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 1021 } 1022 1023 #define gen_nb_xmlAttributeType 4 1024 static xmlAttributeType gen_xmlAttributeType(int no, int nr ATTRIBUTE_UNUSED) { 1025 if (no == 1) return(XML_ATTRIBUTE_CDATA); 1026 if (no == 2) return(XML_ATTRIBUTE_ENTITIES); 1027 if (no == 3) return(XML_ATTRIBUTE_ENTITY); 1028 if (no == 4) return(XML_ATTRIBUTE_ENUMERATION); 1029 return(0); 1030 } 1031 1032 static void des_xmlAttributeType(int no ATTRIBUTE_UNUSED, xmlAttributeType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 1033 } 1034 1035 #define gen_nb_xmlBufferAllocationScheme 4 1036 static xmlBufferAllocationScheme gen_xmlBufferAllocationScheme(int no, int nr ATTRIBUTE_UNUSED) { 1037 if (no == 1) return(XML_BUFFER_ALLOC_BOUNDED); 1038 if (no == 2) return(XML_BUFFER_ALLOC_DOUBLEIT); 1039 if (no == 3) return(XML_BUFFER_ALLOC_EXACT); 1040 if (no == 4) return(XML_BUFFER_ALLOC_HYBRID); 1041 return(0); 1042 } 1043 1044 static void des_xmlBufferAllocationScheme(int no ATTRIBUTE_UNUSED, xmlBufferAllocationScheme val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 1045 } 1046 1047 static void desret_xmlBufferAllocationScheme(xmlBufferAllocationScheme val ATTRIBUTE_UNUSED) { 1048 } 1049 1050 #ifdef LIBXML_CATALOG_ENABLED 1051 #define gen_nb_xmlCatalogAllow 4 1052 static xmlCatalogAllow gen_xmlCatalogAllow(int no, int nr ATTRIBUTE_UNUSED) { 1053 if (no == 1) return(XML_CATA_ALLOW_ALL); 1054 if (no == 2) return(XML_CATA_ALLOW_DOCUMENT); 1055 if (no == 3) return(XML_CATA_ALLOW_GLOBAL); 1056 if (no == 4) return(XML_CATA_ALLOW_NONE); 1057 return(0); 1058 } 1059 1060 static void des_xmlCatalogAllow(int no ATTRIBUTE_UNUSED, xmlCatalogAllow val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 1061 } 1062 1063 static void desret_xmlCatalogAllow(xmlCatalogAllow val ATTRIBUTE_UNUSED) { 1064 } 1065 1066 #endif 1067 1068 #ifdef LIBXML_CATALOG_ENABLED 1069 #define gen_nb_xmlCatalogPrefer 3 1070 static xmlCatalogPrefer gen_xmlCatalogPrefer(int no, int nr ATTRIBUTE_UNUSED) { 1071 if (no == 1) return(XML_CATA_PREFER_NONE); 1072 if (no == 2) return(XML_CATA_PREFER_PUBLIC); 1073 if (no == 3) return(XML_CATA_PREFER_SYSTEM); 1074 return(0); 1075 } 1076 1077 static void des_xmlCatalogPrefer(int no ATTRIBUTE_UNUSED, xmlCatalogPrefer val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 1078 } 1079 1080 static void desret_xmlCatalogPrefer(xmlCatalogPrefer val ATTRIBUTE_UNUSED) { 1081 } 1082 1083 #endif 1084 1085 #define gen_nb_xmlElementContentType 4 1086 static xmlElementContentType gen_xmlElementContentType(int no, int nr ATTRIBUTE_UNUSED) { 1087 if (no == 1) return(XML_ELEMENT_CONTENT_ELEMENT); 1088 if (no == 2) return(XML_ELEMENT_CONTENT_OR); 1089 if (no == 3) return(XML_ELEMENT_CONTENT_PCDATA); 1090 if (no == 4) return(XML_ELEMENT_CONTENT_SEQ); 1091 return(0); 1092 } 1093 1094 static void des_xmlElementContentType(int no ATTRIBUTE_UNUSED, xmlElementContentType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 1095 } 1096 1097 #define gen_nb_xmlElementTypeVal 4 1098 static xmlElementTypeVal gen_xmlElementTypeVal(int no, int nr ATTRIBUTE_UNUSED) { 1099 if (no == 1) return(XML_ELEMENT_TYPE_ANY); 1100 if (no == 2) return(XML_ELEMENT_TYPE_ELEMENT); 1101 if (no == 3) return(XML_ELEMENT_TYPE_EMPTY); 1102 if (no == 4) return(XML_ELEMENT_TYPE_MIXED); 1103 return(0); 1104 } 1105 1106 static void des_xmlElementTypeVal(int no ATTRIBUTE_UNUSED, xmlElementTypeVal val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 1107 } 1108 1109 #define gen_nb_xmlFeature 4 1110 static xmlFeature gen_xmlFeature(int no, int nr ATTRIBUTE_UNUSED) { 1111 if (no == 1) return(XML_WITH_AUTOMATA); 1112 if (no == 2) return(XML_WITH_C14N); 1113 if (no == 3) return(XML_WITH_CATALOG); 1114 if (no == 4) return(XML_WITH_DEBUG); 1115 return(0); 1116 } 1117 1118 static void des_xmlFeature(int no ATTRIBUTE_UNUSED, xmlFeature val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 1119 } 1120 1121 static void desret_xmlParserErrors(xmlParserErrors val ATTRIBUTE_UNUSED) { 1122 } 1123 1124 #ifdef LIBXML_SCHEMAS_ENABLED 1125 #define gen_nb_xmlSchemaValType 4 1126 static xmlSchemaValType gen_xmlSchemaValType(int no, int nr ATTRIBUTE_UNUSED) { 1127 if (no == 1) return(XML_SCHEMAS_ANYSIMPLETYPE); 1128 if (no == 2) return(XML_SCHEMAS_ANYTYPE); 1129 if (no == 3) return(XML_SCHEMAS_ANYURI); 1130 if (no == 4) return(XML_SCHEMAS_BASE64BINARY); 1131 return(0); 1132 } 1133 1134 static void des_xmlSchemaValType(int no ATTRIBUTE_UNUSED, xmlSchemaValType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 1135 } 1136 1137 static void desret_xmlSchemaValType(xmlSchemaValType val ATTRIBUTE_UNUSED) { 1138 } 1139 1140 #endif 1141 1142 #ifdef LIBXML_SCHEMAS_ENABLED 1143 #define gen_nb_xmlSchemaWhitespaceValueType 4 1144 static xmlSchemaWhitespaceValueType gen_xmlSchemaWhitespaceValueType(int no, int nr ATTRIBUTE_UNUSED) { 1145 if (no == 1) return(XML_SCHEMA_WHITESPACE_COLLAPSE); 1146 if (no == 2) return(XML_SCHEMA_WHITESPACE_PRESERVE); 1147 if (no == 3) return(XML_SCHEMA_WHITESPACE_REPLACE); 1148 if (no == 4) return(XML_SCHEMA_WHITESPACE_UNKNOWN); 1149 return(0); 1150 } 1151 1152 static void des_xmlSchemaWhitespaceValueType(int no ATTRIBUTE_UNUSED, xmlSchemaWhitespaceValueType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 1153 } 1154 1155 #endif 1156 1157 #include <libxml/HTMLparser.h> 1158 #include <libxml/HTMLtree.h> 1159 #include <libxml/SAX2.h> 1160 #include <libxml/c14n.h> 1161 #include <libxml/catalog.h> 1162 #include <libxml/chvalid.h> 1163 #include <libxml/debugXML.h> 1164 #include <libxml/dict.h> 1165 #include <libxml/encoding.h> 1166 #include <libxml/entities.h> 1167 #include <libxml/hash.h> 1168 #include <libxml/list.h> 1169 #include <libxml/nanoftp.h> 1170 #include <libxml/nanohttp.h> 1171 #include <libxml/parser.h> 1172 #include <libxml/parserInternals.h> 1173 #include <libxml/pattern.h> 1174 #include <libxml/relaxng.h> 1175 #include <libxml/schemasInternals.h> 1176 #include <libxml/schematron.h> 1177 #include <libxml/tree.h> 1178 #include <libxml/uri.h> 1179 #include <libxml/valid.h> 1180 #include <libxml/xinclude.h> 1181 #include <libxml/xmlIO.h> 1182 #include <libxml/xmlautomata.h> 1183 #include <libxml/xmlerror.h> 1184 #include <libxml/xmlmodule.h> 1185 #include <libxml/xmlreader.h> 1186 #include <libxml/xmlregexp.h> 1187 #include <libxml/xmlsave.h> 1188 #include <libxml/xmlschemas.h> 1189 #include <libxml/xmlschemastypes.h> 1190 #include <libxml/xmlstring.h> 1191 #include <libxml/xmlunicode.h> 1192 #include <libxml/xmlwriter.h> 1193 #include <libxml/xpath.h> 1194 #include <libxml/xpathInternals.h> 1195 #include <libxml/xpointer.h> 1196 static int test_HTMLparser(void); 1197 static int test_HTMLtree(void); 1198 static int test_SAX2(void); 1199 static int test_c14n(void); 1200 static int test_catalog(void); 1201 static int test_chvalid(void); 1202 static int test_debugXML(void); 1203 static int test_dict(void); 1204 static int test_encoding(void); 1205 static int test_entities(void); 1206 static int test_hash(void); 1207 static int test_list(void); 1208 static int test_nanoftp(void); 1209 static int test_nanohttp(void); 1210 static int test_parser(void); 1211 static int test_parserInternals(void); 1212 static int test_pattern(void); 1213 static int test_relaxng(void); 1214 static int test_schemasInternals(void); 1215 static int test_schematron(void); 1216 static int test_tree(void); 1217 static int test_uri(void); 1218 static int test_valid(void); 1219 static int test_xinclude(void); 1220 static int test_xmlIO(void); 1221 static int test_xmlautomata(void); 1222 static int test_xmlerror(void); 1223 static int test_xmlmodule(void); 1224 static int test_xmlreader(void); 1225 static int test_xmlregexp(void); 1226 static int test_xmlsave(void); 1227 static int test_xmlschemas(void); 1228 static int test_xmlschemastypes(void); 1229 static int test_xmlstring(void); 1230 static int test_xmlunicode(void); 1231 static int test_xmlwriter(void); 1232 static int test_xpath(void); 1233 static int test_xpathInternals(void); 1234 static int test_xpointer(void); 1235 1236 /** 1237 * testlibxml2: 1238 * 1239 * Main entry point of the tester for the full libxml2 module, 1240 * it calls all the tester entry point for each module. 1241 * 1242 * Returns the number of error found 1243 */ 1244 static int 1245 testlibxml2(void) 1246 { 1247 int test_ret = 0; 1248 1249 test_ret += test_HTMLparser(); 1250 test_ret += test_HTMLtree(); 1251 test_ret += test_SAX2(); 1252 test_ret += test_c14n(); 1253 test_ret += test_catalog(); 1254 test_ret += test_chvalid(); 1255 test_ret += test_debugXML(); 1256 test_ret += test_dict(); 1257 test_ret += test_encoding(); 1258 test_ret += test_entities(); 1259 test_ret += test_hash(); 1260 test_ret += test_list(); 1261 test_ret += test_nanoftp(); 1262 test_ret += test_nanohttp(); 1263 test_ret += test_parser(); 1264 test_ret += test_parserInternals(); 1265 test_ret += test_pattern(); 1266 test_ret += test_relaxng(); 1267 test_ret += test_schemasInternals(); 1268 test_ret += test_schematron(); 1269 test_ret += test_tree(); 1270 test_ret += test_uri(); 1271 test_ret += test_valid(); 1272 test_ret += test_xinclude(); 1273 test_ret += test_xmlIO(); 1274 test_ret += test_xmlautomata(); 1275 test_ret += test_xmlerror(); 1276 test_ret += test_xmlmodule(); 1277 test_ret += test_xmlreader(); 1278 test_ret += test_xmlregexp(); 1279 test_ret += test_xmlsave(); 1280 test_ret += test_xmlschemas(); 1281 test_ret += test_xmlschemastypes(); 1282 test_ret += test_xmlstring(); 1283 test_ret += test_xmlunicode(); 1284 test_ret += test_xmlwriter(); 1285 test_ret += test_xpath(); 1286 test_ret += test_xpathInternals(); 1287 test_ret += test_xpointer(); 1288 1289 printf("Total: %d functions, %d tests, %d errors\n", 1290 function_tests, call_tests, test_ret); 1291 return(test_ret); 1292 } 1293 1294 1295 static int 1296 test_UTF8ToHtml(void) { 1297 int test_ret = 0; 1298 1299 #if defined(LIBXML_HTML_ENABLED) 1300 int mem_base; 1301 int ret_val; 1302 unsigned char * out; /* a pointer to an array of bytes to store the result */ 1303 int n_out; 1304 int * outlen; /* the length of @out */ 1305 int n_outlen; 1306 unsigned char * in; /* a pointer to an array of UTF-8 chars */ 1307 int n_in; 1308 int * inlen; /* the length of @in */ 1309 int n_inlen; 1310 1311 for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) { 1312 for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) { 1313 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) { 1314 for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) { 1315 mem_base = xmlMemBlocks(); 1316 out = gen_unsigned_char_ptr(n_out, 0); 1317 outlen = gen_int_ptr(n_outlen, 1); 1318 in = gen_const_unsigned_char_ptr(n_in, 2); 1319 inlen = gen_int_ptr(n_inlen, 3); 1320 1321 ret_val = UTF8ToHtml(out, outlen, (const unsigned char *)in, inlen); 1322 desret_int(ret_val); 1323 call_tests++; 1324 des_unsigned_char_ptr(n_out, out, 0); 1325 des_int_ptr(n_outlen, outlen, 1); 1326 des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 2); 1327 des_int_ptr(n_inlen, inlen, 3); 1328 xmlResetLastError(); 1329 if (mem_base != xmlMemBlocks()) { 1330 printf("Leak of %d blocks found in UTF8ToHtml", 1331 xmlMemBlocks() - mem_base); 1332 test_ret++; 1333 printf(" %d", n_out); 1334 printf(" %d", n_outlen); 1335 printf(" %d", n_in); 1336 printf(" %d", n_inlen); 1337 printf("\n"); 1338 } 1339 } 1340 } 1341 } 1342 } 1343 function_tests++; 1344 #endif 1345 1346 return(test_ret); 1347 } 1348 1349 #ifdef LIBXML_HTML_ENABLED 1350 1351 #define gen_nb_const_htmlElemDesc_ptr 1 1352 static htmlElemDesc * gen_const_htmlElemDesc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 1353 return(NULL); 1354 } 1355 static void des_const_htmlElemDesc_ptr(int no ATTRIBUTE_UNUSED, const htmlElemDesc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 1356 } 1357 #endif 1358 1359 1360 static int 1361 test_htmlAttrAllowed(void) { 1362 int test_ret = 0; 1363 1364 #if defined(LIBXML_HTML_ENABLED) 1365 int mem_base; 1366 htmlStatus ret_val; 1367 htmlElemDesc * elt; /* HTML element */ 1368 int n_elt; 1369 xmlChar * attr; /* HTML attribute */ 1370 int n_attr; 1371 int legacy; /* whether to allow deprecated attributes */ 1372 int n_legacy; 1373 1374 for (n_elt = 0;n_elt < gen_nb_const_htmlElemDesc_ptr;n_elt++) { 1375 for (n_attr = 0;n_attr < gen_nb_const_xmlChar_ptr;n_attr++) { 1376 for (n_legacy = 0;n_legacy < gen_nb_int;n_legacy++) { 1377 mem_base = xmlMemBlocks(); 1378 elt = gen_const_htmlElemDesc_ptr(n_elt, 0); 1379 attr = gen_const_xmlChar_ptr(n_attr, 1); 1380 legacy = gen_int(n_legacy, 2); 1381 1382 ret_val = htmlAttrAllowed((const htmlElemDesc *)elt, (const xmlChar *)attr, legacy); 1383 desret_htmlStatus(ret_val); 1384 call_tests++; 1385 des_const_htmlElemDesc_ptr(n_elt, (const htmlElemDesc *)elt, 0); 1386 des_const_xmlChar_ptr(n_attr, (const xmlChar *)attr, 1); 1387 des_int(n_legacy, legacy, 2); 1388 xmlResetLastError(); 1389 if (mem_base != xmlMemBlocks()) { 1390 printf("Leak of %d blocks found in htmlAttrAllowed", 1391 xmlMemBlocks() - mem_base); 1392 test_ret++; 1393 printf(" %d", n_elt); 1394 printf(" %d", n_attr); 1395 printf(" %d", n_legacy); 1396 printf("\n"); 1397 } 1398 } 1399 } 1400 } 1401 function_tests++; 1402 #endif 1403 1404 return(test_ret); 1405 } 1406 1407 #ifdef LIBXML_HTML_ENABLED 1408 1409 #define gen_nb_htmlNodePtr 1 1410 static htmlNodePtr gen_htmlNodePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 1411 return(NULL); 1412 } 1413 static void des_htmlNodePtr(int no ATTRIBUTE_UNUSED, htmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 1414 } 1415 #endif 1416 1417 1418 static int 1419 test_htmlAutoCloseTag(void) { 1420 int test_ret = 0; 1421 1422 #if defined(LIBXML_HTML_ENABLED) 1423 int mem_base; 1424 int ret_val; 1425 htmlDocPtr doc; /* the HTML document */ 1426 int n_doc; 1427 xmlChar * name; /* The tag name */ 1428 int n_name; 1429 htmlNodePtr elem; /* the HTML element */ 1430 int n_elem; 1431 1432 for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) { 1433 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { 1434 for (n_elem = 0;n_elem < gen_nb_htmlNodePtr;n_elem++) { 1435 mem_base = xmlMemBlocks(); 1436 doc = gen_htmlDocPtr(n_doc, 0); 1437 name = gen_const_xmlChar_ptr(n_name, 1); 1438 elem = gen_htmlNodePtr(n_elem, 2); 1439 1440 ret_val = htmlAutoCloseTag(doc, (const xmlChar *)name, elem); 1441 desret_int(ret_val); 1442 call_tests++; 1443 des_htmlDocPtr(n_doc, doc, 0); 1444 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); 1445 des_htmlNodePtr(n_elem, elem, 2); 1446 xmlResetLastError(); 1447 if (mem_base != xmlMemBlocks()) { 1448 printf("Leak of %d blocks found in htmlAutoCloseTag", 1449 xmlMemBlocks() - mem_base); 1450 test_ret++; 1451 printf(" %d", n_doc); 1452 printf(" %d", n_name); 1453 printf(" %d", n_elem); 1454 printf("\n"); 1455 } 1456 } 1457 } 1458 } 1459 function_tests++; 1460 #endif 1461 1462 return(test_ret); 1463 } 1464 1465 1466 static int 1467 test_htmlCreateMemoryParserCtxt(void) { 1468 int test_ret = 0; 1469 1470 #if defined(LIBXML_HTML_ENABLED) 1471 int mem_base; 1472 htmlParserCtxtPtr ret_val; 1473 char * buffer; /* a pointer to a char array */ 1474 int n_buffer; 1475 int size; /* the size of the array */ 1476 int n_size; 1477 1478 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) { 1479 for (n_size = 0;n_size < gen_nb_int;n_size++) { 1480 mem_base = xmlMemBlocks(); 1481 buffer = gen_const_char_ptr(n_buffer, 0); 1482 size = gen_int(n_size, 1); 1483 1484 ret_val = htmlCreateMemoryParserCtxt((const char *)buffer, size); 1485 desret_htmlParserCtxtPtr(ret_val); 1486 call_tests++; 1487 des_const_char_ptr(n_buffer, (const char *)buffer, 0); 1488 des_int(n_size, size, 1); 1489 xmlResetLastError(); 1490 if (mem_base != xmlMemBlocks()) { 1491 printf("Leak of %d blocks found in htmlCreateMemoryParserCtxt", 1492 xmlMemBlocks() - mem_base); 1493 test_ret++; 1494 printf(" %d", n_buffer); 1495 printf(" %d", n_size); 1496 printf("\n"); 1497 } 1498 } 1499 } 1500 function_tests++; 1501 #endif 1502 1503 return(test_ret); 1504 } 1505 1506 #ifdef LIBXML_HTML_ENABLED 1507 1508 #define gen_nb_htmlSAXHandlerPtr 1 1509 static htmlSAXHandlerPtr gen_htmlSAXHandlerPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 1510 return(NULL); 1511 } 1512 static void des_htmlSAXHandlerPtr(int no ATTRIBUTE_UNUSED, htmlSAXHandlerPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 1513 } 1514 #endif 1515 1516 1517 static int 1518 test_htmlCreatePushParserCtxt(void) { 1519 int test_ret = 0; 1520 1521 #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_PUSH_ENABLED) 1522 int mem_base; 1523 htmlParserCtxtPtr ret_val; 1524 htmlSAXHandlerPtr sax; /* a SAX handler */ 1525 int n_sax; 1526 void * user_data; /* The user data returned on SAX callbacks */ 1527 int n_user_data; 1528 char * chunk; /* a pointer to an array of chars */ 1529 int n_chunk; 1530 int size; /* number of chars in the array */ 1531 int n_size; 1532 const char * filename; /* an optional file name or URI */ 1533 int n_filename; 1534 xmlCharEncoding enc; /* an optional encoding */ 1535 int n_enc; 1536 1537 for (n_sax = 0;n_sax < gen_nb_htmlSAXHandlerPtr;n_sax++) { 1538 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) { 1539 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) { 1540 for (n_size = 0;n_size < gen_nb_int;n_size++) { 1541 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) { 1542 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) { 1543 mem_base = xmlMemBlocks(); 1544 sax = gen_htmlSAXHandlerPtr(n_sax, 0); 1545 user_data = gen_userdata(n_user_data, 1); 1546 chunk = gen_const_char_ptr(n_chunk, 2); 1547 size = gen_int(n_size, 3); 1548 filename = gen_fileoutput(n_filename, 4); 1549 enc = gen_xmlCharEncoding(n_enc, 5); 1550 1551 ret_val = htmlCreatePushParserCtxt(sax, user_data, (const char *)chunk, size, filename, enc); 1552 desret_htmlParserCtxtPtr(ret_val); 1553 call_tests++; 1554 des_htmlSAXHandlerPtr(n_sax, sax, 0); 1555 des_userdata(n_user_data, user_data, 1); 1556 des_const_char_ptr(n_chunk, (const char *)chunk, 2); 1557 des_int(n_size, size, 3); 1558 des_fileoutput(n_filename, filename, 4); 1559 des_xmlCharEncoding(n_enc, enc, 5); 1560 xmlResetLastError(); 1561 if (mem_base != xmlMemBlocks()) { 1562 printf("Leak of %d blocks found in htmlCreatePushParserCtxt", 1563 xmlMemBlocks() - mem_base); 1564 test_ret++; 1565 printf(" %d", n_sax); 1566 printf(" %d", n_user_data); 1567 printf(" %d", n_chunk); 1568 printf(" %d", n_size); 1569 printf(" %d", n_filename); 1570 printf(" %d", n_enc); 1571 printf("\n"); 1572 } 1573 } 1574 } 1575 } 1576 } 1577 } 1578 } 1579 function_tests++; 1580 #endif 1581 1582 return(test_ret); 1583 } 1584 1585 1586 static int 1587 test_htmlCtxtReadDoc(void) { 1588 int test_ret = 0; 1589 1590 #if defined(LIBXML_HTML_ENABLED) 1591 int mem_base; 1592 htmlDocPtr ret_val; 1593 htmlParserCtxtPtr ctxt; /* an HTML parser context */ 1594 int n_ctxt; 1595 xmlChar * cur; /* a pointer to a zero terminated string */ 1596 int n_cur; 1597 const char * URL; /* the base URL to use for the document */ 1598 int n_URL; 1599 char * encoding; /* the document encoding, or NULL */ 1600 int n_encoding; 1601 int options; /* a combination of htmlParserOption(s) */ 1602 int n_options; 1603 1604 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) { 1605 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) { 1606 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) { 1607 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { 1608 for (n_options = 0;n_options < gen_nb_int;n_options++) { 1609 mem_base = xmlMemBlocks(); 1610 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0); 1611 cur = gen_const_xmlChar_ptr(n_cur, 1); 1612 URL = gen_filepath(n_URL, 2); 1613 encoding = gen_const_char_ptr(n_encoding, 3); 1614 options = gen_int(n_options, 4); 1615 1616 ret_val = htmlCtxtReadDoc(ctxt, (const xmlChar *)cur, URL, (const char *)encoding, options); 1617 desret_htmlDocPtr(ret_val); 1618 call_tests++; 1619 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0); 1620 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 1); 1621 des_filepath(n_URL, URL, 2); 1622 des_const_char_ptr(n_encoding, (const char *)encoding, 3); 1623 des_int(n_options, options, 4); 1624 xmlResetLastError(); 1625 if (mem_base != xmlMemBlocks()) { 1626 printf("Leak of %d blocks found in htmlCtxtReadDoc", 1627 xmlMemBlocks() - mem_base); 1628 test_ret++; 1629 printf(" %d", n_ctxt); 1630 printf(" %d", n_cur); 1631 printf(" %d", n_URL); 1632 printf(" %d", n_encoding); 1633 printf(" %d", n_options); 1634 printf("\n"); 1635 } 1636 } 1637 } 1638 } 1639 } 1640 } 1641 function_tests++; 1642 #endif 1643 1644 return(test_ret); 1645 } 1646 1647 1648 static int 1649 test_htmlCtxtReadFile(void) { 1650 int test_ret = 0; 1651 1652 #if defined(LIBXML_HTML_ENABLED) 1653 htmlDocPtr ret_val; 1654 htmlParserCtxtPtr ctxt; /* an HTML parser context */ 1655 int n_ctxt; 1656 const char * filename; /* a file or URL */ 1657 int n_filename; 1658 char * encoding; /* the document encoding, or NULL */ 1659 int n_encoding; 1660 int options; /* a combination of htmlParserOption(s) */ 1661 int n_options; 1662 1663 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) { 1664 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { 1665 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { 1666 for (n_options = 0;n_options < gen_nb_int;n_options++) { 1667 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0); 1668 filename = gen_filepath(n_filename, 1); 1669 encoding = gen_const_char_ptr(n_encoding, 2); 1670 options = gen_int(n_options, 3); 1671 1672 ret_val = htmlCtxtReadFile(ctxt, filename, (const char *)encoding, options); 1673 desret_htmlDocPtr(ret_val); 1674 call_tests++; 1675 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0); 1676 des_filepath(n_filename, filename, 1); 1677 des_const_char_ptr(n_encoding, (const char *)encoding, 2); 1678 des_int(n_options, options, 3); 1679 xmlResetLastError(); 1680 } 1681 } 1682 } 1683 } 1684 function_tests++; 1685 #endif 1686 1687 return(test_ret); 1688 } 1689 1690 1691 static int 1692 test_htmlCtxtReadMemory(void) { 1693 int test_ret = 0; 1694 1695 #if defined(LIBXML_HTML_ENABLED) 1696 int mem_base; 1697 htmlDocPtr ret_val; 1698 htmlParserCtxtPtr ctxt; /* an HTML parser context */ 1699 int n_ctxt; 1700 char * buffer; /* a pointer to a char array */ 1701 int n_buffer; 1702 int size; /* the size of the array */ 1703 int n_size; 1704 const char * URL; /* the base URL to use for the document */ 1705 int n_URL; 1706 char * encoding; /* the document encoding, or NULL */ 1707 int n_encoding; 1708 int options; /* a combination of htmlParserOption(s) */ 1709 int n_options; 1710 1711 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) { 1712 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) { 1713 for (n_size = 0;n_size < gen_nb_int;n_size++) { 1714 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) { 1715 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { 1716 for (n_options = 0;n_options < gen_nb_int;n_options++) { 1717 mem_base = xmlMemBlocks(); 1718 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0); 1719 buffer = gen_const_char_ptr(n_buffer, 1); 1720 size = gen_int(n_size, 2); 1721 URL = gen_filepath(n_URL, 3); 1722 encoding = gen_const_char_ptr(n_encoding, 4); 1723 options = gen_int(n_options, 5); 1724 1725 ret_val = htmlCtxtReadMemory(ctxt, (const char *)buffer, size, URL, (const char *)encoding, options); 1726 desret_htmlDocPtr(ret_val); 1727 call_tests++; 1728 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0); 1729 des_const_char_ptr(n_buffer, (const char *)buffer, 1); 1730 des_int(n_size, size, 2); 1731 des_filepath(n_URL, URL, 3); 1732 des_const_char_ptr(n_encoding, (const char *)encoding, 4); 1733 des_int(n_options, options, 5); 1734 xmlResetLastError(); 1735 if (mem_base != xmlMemBlocks()) { 1736 printf("Leak of %d blocks found in htmlCtxtReadMemory", 1737 xmlMemBlocks() - mem_base); 1738 test_ret++; 1739 printf(" %d", n_ctxt); 1740 printf(" %d", n_buffer); 1741 printf(" %d", n_size); 1742 printf(" %d", n_URL); 1743 printf(" %d", n_encoding); 1744 printf(" %d", n_options); 1745 printf("\n"); 1746 } 1747 } 1748 } 1749 } 1750 } 1751 } 1752 } 1753 function_tests++; 1754 #endif 1755 1756 return(test_ret); 1757 } 1758 1759 1760 static int 1761 test_htmlCtxtReset(void) { 1762 int test_ret = 0; 1763 1764 #if defined(LIBXML_HTML_ENABLED) 1765 int mem_base; 1766 htmlParserCtxtPtr ctxt; /* an HTML parser context */ 1767 int n_ctxt; 1768 1769 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) { 1770 mem_base = xmlMemBlocks(); 1771 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0); 1772 1773 htmlCtxtReset(ctxt); 1774 call_tests++; 1775 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0); 1776 xmlResetLastError(); 1777 if (mem_base != xmlMemBlocks()) { 1778 printf("Leak of %d blocks found in htmlCtxtReset", 1779 xmlMemBlocks() - mem_base); 1780 test_ret++; 1781 printf(" %d", n_ctxt); 1782 printf("\n"); 1783 } 1784 } 1785 function_tests++; 1786 #endif 1787 1788 return(test_ret); 1789 } 1790 1791 1792 static int 1793 test_htmlCtxtUseOptions(void) { 1794 int test_ret = 0; 1795 1796 #if defined(LIBXML_HTML_ENABLED) 1797 int mem_base; 1798 int ret_val; 1799 htmlParserCtxtPtr ctxt; /* an HTML parser context */ 1800 int n_ctxt; 1801 int options; /* a combination of htmlParserOption(s) */ 1802 int n_options; 1803 1804 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) { 1805 for (n_options = 0;n_options < gen_nb_int;n_options++) { 1806 mem_base = xmlMemBlocks(); 1807 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0); 1808 options = gen_int(n_options, 1); 1809 1810 ret_val = htmlCtxtUseOptions(ctxt, options); 1811 desret_int(ret_val); 1812 call_tests++; 1813 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0); 1814 des_int(n_options, options, 1); 1815 xmlResetLastError(); 1816 if (mem_base != xmlMemBlocks()) { 1817 printf("Leak of %d blocks found in htmlCtxtUseOptions", 1818 xmlMemBlocks() - mem_base); 1819 test_ret++; 1820 printf(" %d", n_ctxt); 1821 printf(" %d", n_options); 1822 printf("\n"); 1823 } 1824 } 1825 } 1826 function_tests++; 1827 #endif 1828 1829 return(test_ret); 1830 } 1831 1832 1833 static int 1834 test_htmlElementAllowedHere(void) { 1835 int test_ret = 0; 1836 1837 #if defined(LIBXML_HTML_ENABLED) 1838 int mem_base; 1839 int ret_val; 1840 htmlElemDesc * parent; /* HTML parent element */ 1841 int n_parent; 1842 xmlChar * elt; /* HTML element */ 1843 int n_elt; 1844 1845 for (n_parent = 0;n_parent < gen_nb_const_htmlElemDesc_ptr;n_parent++) { 1846 for (n_elt = 0;n_elt < gen_nb_const_xmlChar_ptr;n_elt++) { 1847 mem_base = xmlMemBlocks(); 1848 parent = gen_const_htmlElemDesc_ptr(n_parent, 0); 1849 elt = gen_const_xmlChar_ptr(n_elt, 1); 1850 1851 ret_val = htmlElementAllowedHere((const htmlElemDesc *)parent, (const xmlChar *)elt); 1852 desret_int(ret_val); 1853 call_tests++; 1854 des_const_htmlElemDesc_ptr(n_parent, (const htmlElemDesc *)parent, 0); 1855 des_const_xmlChar_ptr(n_elt, (const xmlChar *)elt, 1); 1856 xmlResetLastError(); 1857 if (mem_base != xmlMemBlocks()) { 1858 printf("Leak of %d blocks found in htmlElementAllowedHere", 1859 xmlMemBlocks() - mem_base); 1860 test_ret++; 1861 printf(" %d", n_parent); 1862 printf(" %d", n_elt); 1863 printf("\n"); 1864 } 1865 } 1866 } 1867 function_tests++; 1868 #endif 1869 1870 return(test_ret); 1871 } 1872 1873 1874 static int 1875 test_htmlElementStatusHere(void) { 1876 int test_ret = 0; 1877 1878 #if defined(LIBXML_HTML_ENABLED) 1879 int mem_base; 1880 htmlStatus ret_val; 1881 htmlElemDesc * parent; /* HTML parent element */ 1882 int n_parent; 1883 htmlElemDesc * elt; /* HTML element */ 1884 int n_elt; 1885 1886 for (n_parent = 0;n_parent < gen_nb_const_htmlElemDesc_ptr;n_parent++) { 1887 for (n_elt = 0;n_elt < gen_nb_const_htmlElemDesc_ptr;n_elt++) { 1888 mem_base = xmlMemBlocks(); 1889 parent = gen_const_htmlElemDesc_ptr(n_parent, 0); 1890 elt = gen_const_htmlElemDesc_ptr(n_elt, 1); 1891 1892 ret_val = htmlElementStatusHere((const htmlElemDesc *)parent, (const htmlElemDesc *)elt); 1893 desret_htmlStatus(ret_val); 1894 call_tests++; 1895 des_const_htmlElemDesc_ptr(n_parent, (const htmlElemDesc *)parent, 0); 1896 des_const_htmlElemDesc_ptr(n_elt, (const htmlElemDesc *)elt, 1); 1897 xmlResetLastError(); 1898 if (mem_base != xmlMemBlocks()) { 1899 printf("Leak of %d blocks found in htmlElementStatusHere", 1900 xmlMemBlocks() - mem_base); 1901 test_ret++; 1902 printf(" %d", n_parent); 1903 printf(" %d", n_elt); 1904 printf("\n"); 1905 } 1906 } 1907 } 1908 function_tests++; 1909 #endif 1910 1911 return(test_ret); 1912 } 1913 1914 1915 static int 1916 test_htmlEncodeEntities(void) { 1917 int test_ret = 0; 1918 1919 #if defined(LIBXML_HTML_ENABLED) 1920 int mem_base; 1921 int ret_val; 1922 unsigned char * out; /* a pointer to an array of bytes to store the result */ 1923 int n_out; 1924 int * outlen; /* the length of @out */ 1925 int n_outlen; 1926 unsigned char * in; /* a pointer to an array of UTF-8 chars */ 1927 int n_in; 1928 int * inlen; /* the length of @in */ 1929 int n_inlen; 1930 int quoteChar; /* the quote character to escape (' or ") or zero. */ 1931 int n_quoteChar; 1932 1933 for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) { 1934 for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) { 1935 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) { 1936 for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) { 1937 for (n_quoteChar = 0;n_quoteChar < gen_nb_int;n_quoteChar++) { 1938 mem_base = xmlMemBlocks(); 1939 out = gen_unsigned_char_ptr(n_out, 0); 1940 outlen = gen_int_ptr(n_outlen, 1); 1941 in = gen_const_unsigned_char_ptr(n_in, 2); 1942 inlen = gen_int_ptr(n_inlen, 3); 1943 quoteChar = gen_int(n_quoteChar, 4); 1944 1945 ret_val = htmlEncodeEntities(out, outlen, (const unsigned char *)in, inlen, quoteChar); 1946 desret_int(ret_val); 1947 call_tests++; 1948 des_unsigned_char_ptr(n_out, out, 0); 1949 des_int_ptr(n_outlen, outlen, 1); 1950 des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 2); 1951 des_int_ptr(n_inlen, inlen, 3); 1952 des_int(n_quoteChar, quoteChar, 4); 1953 xmlResetLastError(); 1954 if (mem_base != xmlMemBlocks()) { 1955 printf("Leak of %d blocks found in htmlEncodeEntities", 1956 xmlMemBlocks() - mem_base); 1957 test_ret++; 1958 printf(" %d", n_out); 1959 printf(" %d", n_outlen); 1960 printf(" %d", n_in); 1961 printf(" %d", n_inlen); 1962 printf(" %d", n_quoteChar); 1963 printf("\n"); 1964 } 1965 } 1966 } 1967 } 1968 } 1969 } 1970 function_tests++; 1971 #endif 1972 1973 return(test_ret); 1974 } 1975 1976 1977 static int 1978 test_htmlEntityLookup(void) { 1979 int test_ret = 0; 1980 1981 #if defined(LIBXML_HTML_ENABLED) 1982 int mem_base; 1983 const htmlEntityDesc * ret_val; 1984 xmlChar * name; /* the entity name */ 1985 int n_name; 1986 1987 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { 1988 mem_base = xmlMemBlocks(); 1989 name = gen_const_xmlChar_ptr(n_name, 0); 1990 1991 ret_val = htmlEntityLookup((const xmlChar *)name); 1992 desret_const_htmlEntityDesc_ptr(ret_val); 1993 call_tests++; 1994 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0); 1995 xmlResetLastError(); 1996 if (mem_base != xmlMemBlocks()) { 1997 printf("Leak of %d blocks found in htmlEntityLookup", 1998 xmlMemBlocks() - mem_base); 1999 test_ret++; 2000 printf(" %d", n_name); 2001 printf("\n"); 2002 } 2003 } 2004 function_tests++; 2005 #endif 2006 2007 return(test_ret); 2008 } 2009 2010 2011 static int 2012 test_htmlEntityValueLookup(void) { 2013 int test_ret = 0; 2014 2015 #if defined(LIBXML_HTML_ENABLED) 2016 int mem_base; 2017 const htmlEntityDesc * ret_val; 2018 unsigned int value; /* the entity's unicode value */ 2019 int n_value; 2020 2021 for (n_value = 0;n_value < gen_nb_unsigned_int;n_value++) { 2022 mem_base = xmlMemBlocks(); 2023 value = gen_unsigned_int(n_value, 0); 2024 2025 ret_val = htmlEntityValueLookup(value); 2026 desret_const_htmlEntityDesc_ptr(ret_val); 2027 call_tests++; 2028 des_unsigned_int(n_value, value, 0); 2029 xmlResetLastError(); 2030 if (mem_base != xmlMemBlocks()) { 2031 printf("Leak of %d blocks found in htmlEntityValueLookup", 2032 xmlMemBlocks() - mem_base); 2033 test_ret++; 2034 printf(" %d", n_value); 2035 printf("\n"); 2036 } 2037 } 2038 function_tests++; 2039 #endif 2040 2041 return(test_ret); 2042 } 2043 2044 2045 static int 2046 test_htmlHandleOmittedElem(void) { 2047 int test_ret = 0; 2048 2049 #if defined(LIBXML_HTML_ENABLED) 2050 int mem_base; 2051 int ret_val; 2052 int val; /* int 0 or 1 */ 2053 int n_val; 2054 2055 for (n_val = 0;n_val < gen_nb_int;n_val++) { 2056 mem_base = xmlMemBlocks(); 2057 val = gen_int(n_val, 0); 2058 2059 ret_val = htmlHandleOmittedElem(val); 2060 desret_int(ret_val); 2061 call_tests++; 2062 des_int(n_val, val, 0); 2063 xmlResetLastError(); 2064 if (mem_base != xmlMemBlocks()) { 2065 printf("Leak of %d blocks found in htmlHandleOmittedElem", 2066 xmlMemBlocks() - mem_base); 2067 test_ret++; 2068 printf(" %d", n_val); 2069 printf("\n"); 2070 } 2071 } 2072 function_tests++; 2073 #endif 2074 2075 return(test_ret); 2076 } 2077 2078 2079 static int 2080 test_htmlIsAutoClosed(void) { 2081 int test_ret = 0; 2082 2083 #if defined(LIBXML_HTML_ENABLED) 2084 int mem_base; 2085 int ret_val; 2086 htmlDocPtr doc; /* the HTML document */ 2087 int n_doc; 2088 htmlNodePtr elem; /* the HTML element */ 2089 int n_elem; 2090 2091 for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) { 2092 for (n_elem = 0;n_elem < gen_nb_htmlNodePtr;n_elem++) { 2093 mem_base = xmlMemBlocks(); 2094 doc = gen_htmlDocPtr(n_doc, 0); 2095 elem = gen_htmlNodePtr(n_elem, 1); 2096 2097 ret_val = htmlIsAutoClosed(doc, elem); 2098 desret_int(ret_val); 2099 call_tests++; 2100 des_htmlDocPtr(n_doc, doc, 0); 2101 des_htmlNodePtr(n_elem, elem, 1); 2102 xmlResetLastError(); 2103 if (mem_base != xmlMemBlocks()) { 2104 printf("Leak of %d blocks found in htmlIsAutoClosed", 2105 xmlMemBlocks() - mem_base); 2106 test_ret++; 2107 printf(" %d", n_doc); 2108 printf(" %d", n_elem); 2109 printf("\n"); 2110 } 2111 } 2112 } 2113 function_tests++; 2114 #endif 2115 2116 return(test_ret); 2117 } 2118 2119 2120 static int 2121 test_htmlIsScriptAttribute(void) { 2122 int test_ret = 0; 2123 2124 #if defined(LIBXML_HTML_ENABLED) 2125 int mem_base; 2126 int ret_val; 2127 xmlChar * name; /* an attribute name */ 2128 int n_name; 2129 2130 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { 2131 mem_base = xmlMemBlocks(); 2132 name = gen_const_xmlChar_ptr(n_name, 0); 2133 2134 ret_val = htmlIsScriptAttribute((const xmlChar *)name); 2135 desret_int(ret_val); 2136 call_tests++; 2137 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0); 2138 xmlResetLastError(); 2139 if (mem_base != xmlMemBlocks()) { 2140 printf("Leak of %d blocks found in htmlIsScriptAttribute", 2141 xmlMemBlocks() - mem_base); 2142 test_ret++; 2143 printf(" %d", n_name); 2144 printf("\n"); 2145 } 2146 } 2147 function_tests++; 2148 #endif 2149 2150 return(test_ret); 2151 } 2152 2153 2154 static int 2155 test_htmlNewParserCtxt(void) { 2156 int test_ret = 0; 2157 2158 #if defined(LIBXML_HTML_ENABLED) 2159 int mem_base; 2160 htmlParserCtxtPtr ret_val; 2161 2162 mem_base = xmlMemBlocks(); 2163 2164 ret_val = htmlNewParserCtxt(); 2165 desret_htmlParserCtxtPtr(ret_val); 2166 call_tests++; 2167 xmlResetLastError(); 2168 if (mem_base != xmlMemBlocks()) { 2169 printf("Leak of %d blocks found in htmlNewParserCtxt", 2170 xmlMemBlocks() - mem_base); 2171 test_ret++; 2172 printf("\n"); 2173 } 2174 function_tests++; 2175 #endif 2176 2177 return(test_ret); 2178 } 2179 2180 2181 static int 2182 test_htmlNodeStatus(void) { 2183 int test_ret = 0; 2184 2185 #if defined(LIBXML_HTML_ENABLED) 2186 int mem_base; 2187 htmlStatus ret_val; 2188 htmlNodePtr node; /* an htmlNodePtr in a tree */ 2189 int n_node; 2190 int legacy; /* whether to allow deprecated elements (YES is faster here for Element nodes) */ 2191 int n_legacy; 2192 2193 for (n_node = 0;n_node < gen_nb_const_htmlNodePtr;n_node++) { 2194 for (n_legacy = 0;n_legacy < gen_nb_int;n_legacy++) { 2195 mem_base = xmlMemBlocks(); 2196 node = gen_const_htmlNodePtr(n_node, 0); 2197 legacy = gen_int(n_legacy, 1); 2198 2199 ret_val = htmlNodeStatus((const htmlNodePtr)node, legacy); 2200 desret_htmlStatus(ret_val); 2201 call_tests++; 2202 des_const_htmlNodePtr(n_node, (const htmlNodePtr)node, 0); 2203 des_int(n_legacy, legacy, 1); 2204 xmlResetLastError(); 2205 if (mem_base != xmlMemBlocks()) { 2206 printf("Leak of %d blocks found in htmlNodeStatus", 2207 xmlMemBlocks() - mem_base); 2208 test_ret++; 2209 printf(" %d", n_node); 2210 printf(" %d", n_legacy); 2211 printf("\n"); 2212 } 2213 } 2214 } 2215 function_tests++; 2216 #endif 2217 2218 return(test_ret); 2219 } 2220 2221 2222 static int 2223 test_htmlParseCharRef(void) { 2224 int test_ret = 0; 2225 2226 #if defined(LIBXML_HTML_ENABLED) 2227 int mem_base; 2228 int ret_val; 2229 htmlParserCtxtPtr ctxt; /* an HTML parser context */ 2230 int n_ctxt; 2231 2232 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) { 2233 mem_base = xmlMemBlocks(); 2234 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0); 2235 2236 ret_val = htmlParseCharRef(ctxt); 2237 desret_int(ret_val); 2238 call_tests++; 2239 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0); 2240 xmlResetLastError(); 2241 if (mem_base != xmlMemBlocks()) { 2242 printf("Leak of %d blocks found in htmlParseCharRef", 2243 xmlMemBlocks() - mem_base); 2244 test_ret++; 2245 printf(" %d", n_ctxt); 2246 printf("\n"); 2247 } 2248 } 2249 function_tests++; 2250 #endif 2251 2252 return(test_ret); 2253 } 2254 2255 2256 static int 2257 test_htmlParseChunk(void) { 2258 int test_ret = 0; 2259 2260 #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_PUSH_ENABLED) 2261 int mem_base; 2262 int ret_val; 2263 htmlParserCtxtPtr ctxt; /* an HTML parser context */ 2264 int n_ctxt; 2265 char * chunk; /* an char array */ 2266 int n_chunk; 2267 int size; /* the size in byte of the chunk */ 2268 int n_size; 2269 int terminate; /* last chunk indicator */ 2270 int n_terminate; 2271 2272 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) { 2273 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) { 2274 for (n_size = 0;n_size < gen_nb_int;n_size++) { 2275 for (n_terminate = 0;n_terminate < gen_nb_int;n_terminate++) { 2276 mem_base = xmlMemBlocks(); 2277 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0); 2278 chunk = gen_const_char_ptr(n_chunk, 1); 2279 size = gen_int(n_size, 2); 2280 terminate = gen_int(n_terminate, 3); 2281 2282 ret_val = htmlParseChunk(ctxt, (const char *)chunk, size, terminate); 2283 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;} 2284 desret_int(ret_val); 2285 call_tests++; 2286 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0); 2287 des_const_char_ptr(n_chunk, (const char *)chunk, 1); 2288 des_int(n_size, size, 2); 2289 des_int(n_terminate, terminate, 3); 2290 xmlResetLastError(); 2291 if (mem_base != xmlMemBlocks()) { 2292 printf("Leak of %d blocks found in htmlParseChunk", 2293 xmlMemBlocks() - mem_base); 2294 test_ret++; 2295 printf(" %d", n_ctxt); 2296 printf(" %d", n_chunk); 2297 printf(" %d", n_size); 2298 printf(" %d", n_terminate); 2299 printf("\n"); 2300 } 2301 } 2302 } 2303 } 2304 } 2305 function_tests++; 2306 #endif 2307 2308 return(test_ret); 2309 } 2310 2311 2312 static int 2313 test_htmlParseDoc(void) { 2314 int test_ret = 0; 2315 2316 #if defined(LIBXML_HTML_ENABLED) 2317 int mem_base; 2318 htmlDocPtr ret_val; 2319 xmlChar * cur; /* a pointer to an array of xmlChar */ 2320 int n_cur; 2321 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */ 2322 int n_encoding; 2323 2324 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) { 2325 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { 2326 mem_base = xmlMemBlocks(); 2327 cur = gen_xmlChar_ptr(n_cur, 0); 2328 encoding = gen_const_char_ptr(n_encoding, 1); 2329 2330 ret_val = htmlParseDoc(cur, (const char *)encoding); 2331 desret_htmlDocPtr(ret_val); 2332 call_tests++; 2333 des_xmlChar_ptr(n_cur, cur, 0); 2334 des_const_char_ptr(n_encoding, (const char *)encoding, 1); 2335 xmlResetLastError(); 2336 if (mem_base != xmlMemBlocks()) { 2337 printf("Leak of %d blocks found in htmlParseDoc", 2338 xmlMemBlocks() - mem_base); 2339 test_ret++; 2340 printf(" %d", n_cur); 2341 printf(" %d", n_encoding); 2342 printf("\n"); 2343 } 2344 } 2345 } 2346 function_tests++; 2347 #endif 2348 2349 return(test_ret); 2350 } 2351 2352 2353 static int 2354 test_htmlParseDocument(void) { 2355 int test_ret = 0; 2356 2357 #if defined(LIBXML_HTML_ENABLED) 2358 int mem_base; 2359 int ret_val; 2360 htmlParserCtxtPtr ctxt; /* an HTML parser context */ 2361 int n_ctxt; 2362 2363 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) { 2364 mem_base = xmlMemBlocks(); 2365 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0); 2366 2367 ret_val = htmlParseDocument(ctxt); 2368 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;} 2369 desret_int(ret_val); 2370 call_tests++; 2371 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0); 2372 xmlResetLastError(); 2373 if (mem_base != xmlMemBlocks()) { 2374 printf("Leak of %d blocks found in htmlParseDocument", 2375 xmlMemBlocks() - mem_base); 2376 test_ret++; 2377 printf(" %d", n_ctxt); 2378 printf("\n"); 2379 } 2380 } 2381 function_tests++; 2382 #endif 2383 2384 return(test_ret); 2385 } 2386 2387 2388 static int 2389 test_htmlParseElement(void) { 2390 int test_ret = 0; 2391 2392 #if defined(LIBXML_HTML_ENABLED) 2393 int mem_base; 2394 htmlParserCtxtPtr ctxt; /* an HTML parser context */ 2395 int n_ctxt; 2396 2397 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) { 2398 mem_base = xmlMemBlocks(); 2399 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0); 2400 2401 htmlParseElement(ctxt); 2402 call_tests++; 2403 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0); 2404 xmlResetLastError(); 2405 if (mem_base != xmlMemBlocks()) { 2406 printf("Leak of %d blocks found in htmlParseElement", 2407 xmlMemBlocks() - mem_base); 2408 test_ret++; 2409 printf(" %d", n_ctxt); 2410 printf("\n"); 2411 } 2412 } 2413 function_tests++; 2414 #endif 2415 2416 return(test_ret); 2417 } 2418 2419 2420 static int 2421 test_htmlParseEntityRef(void) { 2422 int test_ret = 0; 2423 2424 #if defined(LIBXML_HTML_ENABLED) 2425 int mem_base; 2426 const htmlEntityDesc * ret_val; 2427 htmlParserCtxtPtr ctxt; /* an HTML parser context */ 2428 int n_ctxt; 2429 xmlChar ** str; /* location to store the entity name */ 2430 int n_str; 2431 2432 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) { 2433 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr_ptr;n_str++) { 2434 mem_base = xmlMemBlocks(); 2435 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0); 2436 str = gen_const_xmlChar_ptr_ptr(n_str, 1); 2437 2438 ret_val = htmlParseEntityRef(ctxt, (const xmlChar **)str); 2439 desret_const_htmlEntityDesc_ptr(ret_val); 2440 call_tests++; 2441 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0); 2442 des_const_xmlChar_ptr_ptr(n_str, (const xmlChar **)str, 1); 2443 xmlResetLastError(); 2444 if (mem_base != xmlMemBlocks()) { 2445 printf("Leak of %d blocks found in htmlParseEntityRef", 2446 xmlMemBlocks() - mem_base); 2447 test_ret++; 2448 printf(" %d", n_ctxt); 2449 printf(" %d", n_str); 2450 printf("\n"); 2451 } 2452 } 2453 } 2454 function_tests++; 2455 #endif 2456 2457 return(test_ret); 2458 } 2459 2460 2461 static int 2462 test_htmlParseFile(void) { 2463 int test_ret = 0; 2464 2465 #if defined(LIBXML_HTML_ENABLED) 2466 htmlDocPtr ret_val; 2467 const char * filename; /* the filename */ 2468 int n_filename; 2469 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */ 2470 int n_encoding; 2471 2472 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { 2473 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { 2474 filename = gen_filepath(n_filename, 0); 2475 encoding = gen_const_char_ptr(n_encoding, 1); 2476 2477 ret_val = htmlParseFile(filename, (const char *)encoding); 2478 desret_htmlDocPtr(ret_val); 2479 call_tests++; 2480 des_filepath(n_filename, filename, 0); 2481 des_const_char_ptr(n_encoding, (const char *)encoding, 1); 2482 xmlResetLastError(); 2483 } 2484 } 2485 function_tests++; 2486 #endif 2487 2488 return(test_ret); 2489 } 2490 2491 2492 static int 2493 test_htmlReadDoc(void) { 2494 int test_ret = 0; 2495 2496 #if defined(LIBXML_HTML_ENABLED) 2497 int mem_base; 2498 htmlDocPtr ret_val; 2499 xmlChar * cur; /* a pointer to a zero terminated string */ 2500 int n_cur; 2501 const char * URL; /* the base URL to use for the document */ 2502 int n_URL; 2503 char * encoding; /* the document encoding, or NULL */ 2504 int n_encoding; 2505 int options; /* a combination of htmlParserOption(s) */ 2506 int n_options; 2507 2508 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) { 2509 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) { 2510 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { 2511 for (n_options = 0;n_options < gen_nb_int;n_options++) { 2512 mem_base = xmlMemBlocks(); 2513 cur = gen_const_xmlChar_ptr(n_cur, 0); 2514 URL = gen_filepath(n_URL, 1); 2515 encoding = gen_const_char_ptr(n_encoding, 2); 2516 options = gen_int(n_options, 3); 2517 2518 ret_val = htmlReadDoc((const xmlChar *)cur, URL, (const char *)encoding, options); 2519 desret_htmlDocPtr(ret_val); 2520 call_tests++; 2521 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0); 2522 des_filepath(n_URL, URL, 1); 2523 des_const_char_ptr(n_encoding, (const char *)encoding, 2); 2524 des_int(n_options, options, 3); 2525 xmlResetLastError(); 2526 if (mem_base != xmlMemBlocks()) { 2527 printf("Leak of %d blocks found in htmlReadDoc", 2528 xmlMemBlocks() - mem_base); 2529 test_ret++; 2530 printf(" %d", n_cur); 2531 printf(" %d", n_URL); 2532 printf(" %d", n_encoding); 2533 printf(" %d", n_options); 2534 printf("\n"); 2535 } 2536 } 2537 } 2538 } 2539 } 2540 function_tests++; 2541 #endif 2542 2543 return(test_ret); 2544 } 2545 2546 2547 static int 2548 test_htmlReadFile(void) { 2549 int test_ret = 0; 2550 2551 #if defined(LIBXML_HTML_ENABLED) 2552 int mem_base; 2553 htmlDocPtr ret_val; 2554 const char * filename; /* a file or URL */ 2555 int n_filename; 2556 char * encoding; /* the document encoding, or NULL */ 2557 int n_encoding; 2558 int options; /* a combination of htmlParserOption(s) */ 2559 int n_options; 2560 2561 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { 2562 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { 2563 for (n_options = 0;n_options < gen_nb_int;n_options++) { 2564 mem_base = xmlMemBlocks(); 2565 filename = gen_filepath(n_filename, 0); 2566 encoding = gen_const_char_ptr(n_encoding, 1); 2567 options = gen_int(n_options, 2); 2568 2569 ret_val = htmlReadFile(filename, (const char *)encoding, options); 2570 desret_htmlDocPtr(ret_val); 2571 call_tests++; 2572 des_filepath(n_filename, filename, 0); 2573 des_const_char_ptr(n_encoding, (const char *)encoding, 1); 2574 des_int(n_options, options, 2); 2575 xmlResetLastError(); 2576 if (mem_base != xmlMemBlocks()) { 2577 printf("Leak of %d blocks found in htmlReadFile", 2578 xmlMemBlocks() - mem_base); 2579 test_ret++; 2580 printf(" %d", n_filename); 2581 printf(" %d", n_encoding); 2582 printf(" %d", n_options); 2583 printf("\n"); 2584 } 2585 } 2586 } 2587 } 2588 function_tests++; 2589 #endif 2590 2591 return(test_ret); 2592 } 2593 2594 2595 static int 2596 test_htmlReadMemory(void) { 2597 int test_ret = 0; 2598 2599 #if defined(LIBXML_HTML_ENABLED) 2600 int mem_base; 2601 htmlDocPtr ret_val; 2602 char * buffer; /* a pointer to a char array */ 2603 int n_buffer; 2604 int size; /* the size of the array */ 2605 int n_size; 2606 const char * URL; /* the base URL to use for the document */ 2607 int n_URL; 2608 char * encoding; /* the document encoding, or NULL */ 2609 int n_encoding; 2610 int options; /* a combination of htmlParserOption(s) */ 2611 int n_options; 2612 2613 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) { 2614 for (n_size = 0;n_size < gen_nb_int;n_size++) { 2615 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) { 2616 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { 2617 for (n_options = 0;n_options < gen_nb_int;n_options++) { 2618 mem_base = xmlMemBlocks(); 2619 buffer = gen_const_char_ptr(n_buffer, 0); 2620 size = gen_int(n_size, 1); 2621 URL = gen_filepath(n_URL, 2); 2622 encoding = gen_const_char_ptr(n_encoding, 3); 2623 options = gen_int(n_options, 4); 2624 2625 ret_val = htmlReadMemory((const char *)buffer, size, URL, (const char *)encoding, options); 2626 desret_htmlDocPtr(ret_val); 2627 call_tests++; 2628 des_const_char_ptr(n_buffer, (const char *)buffer, 0); 2629 des_int(n_size, size, 1); 2630 des_filepath(n_URL, URL, 2); 2631 des_const_char_ptr(n_encoding, (const char *)encoding, 3); 2632 des_int(n_options, options, 4); 2633 xmlResetLastError(); 2634 if (mem_base != xmlMemBlocks()) { 2635 printf("Leak of %d blocks found in htmlReadMemory", 2636 xmlMemBlocks() - mem_base); 2637 test_ret++; 2638 printf(" %d", n_buffer); 2639 printf(" %d", n_size); 2640 printf(" %d", n_URL); 2641 printf(" %d", n_encoding); 2642 printf(" %d", n_options); 2643 printf("\n"); 2644 } 2645 } 2646 } 2647 } 2648 } 2649 } 2650 function_tests++; 2651 #endif 2652 2653 return(test_ret); 2654 } 2655 2656 2657 static int 2658 test_htmlSAXParseDoc(void) { 2659 int test_ret = 0; 2660 2661 #if defined(LIBXML_HTML_ENABLED) 2662 int mem_base; 2663 htmlDocPtr ret_val; 2664 xmlChar * cur; /* a pointer to an array of xmlChar */ 2665 int n_cur; 2666 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */ 2667 int n_encoding; 2668 htmlSAXHandlerPtr sax; /* the SAX handler block */ 2669 int n_sax; 2670 void * userData; /* if using SAX, this pointer will be provided on callbacks. */ 2671 int n_userData; 2672 2673 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) { 2674 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { 2675 for (n_sax = 0;n_sax < gen_nb_htmlSAXHandlerPtr;n_sax++) { 2676 for (n_userData = 0;n_userData < gen_nb_userdata;n_userData++) { 2677 mem_base = xmlMemBlocks(); 2678 cur = gen_xmlChar_ptr(n_cur, 0); 2679 encoding = gen_const_char_ptr(n_encoding, 1); 2680 sax = gen_htmlSAXHandlerPtr(n_sax, 2); 2681 userData = gen_userdata(n_userData, 3); 2682 2683 ret_val = htmlSAXParseDoc(cur, (const char *)encoding, sax, userData); 2684 desret_htmlDocPtr(ret_val); 2685 call_tests++; 2686 des_xmlChar_ptr(n_cur, cur, 0); 2687 des_const_char_ptr(n_encoding, (const char *)encoding, 1); 2688 des_htmlSAXHandlerPtr(n_sax, sax, 2); 2689 des_userdata(n_userData, userData, 3); 2690 xmlResetLastError(); 2691 if (mem_base != xmlMemBlocks()) { 2692 printf("Leak of %d blocks found in htmlSAXParseDoc", 2693 xmlMemBlocks() - mem_base); 2694 test_ret++; 2695 printf(" %d", n_cur); 2696 printf(" %d", n_encoding); 2697 printf(" %d", n_sax); 2698 printf(" %d", n_userData); 2699 printf("\n"); 2700 } 2701 } 2702 } 2703 } 2704 } 2705 function_tests++; 2706 #endif 2707 2708 return(test_ret); 2709 } 2710 2711 2712 static int 2713 test_htmlSAXParseFile(void) { 2714 int test_ret = 0; 2715 2716 #if defined(LIBXML_HTML_ENABLED) 2717 int mem_base; 2718 htmlDocPtr ret_val; 2719 const char * filename; /* the filename */ 2720 int n_filename; 2721 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */ 2722 int n_encoding; 2723 htmlSAXHandlerPtr sax; /* the SAX handler block */ 2724 int n_sax; 2725 void * userData; /* if using SAX, this pointer will be provided on callbacks. */ 2726 int n_userData; 2727 2728 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { 2729 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { 2730 for (n_sax = 0;n_sax < gen_nb_htmlSAXHandlerPtr;n_sax++) { 2731 for (n_userData = 0;n_userData < gen_nb_userdata;n_userData++) { 2732 mem_base = xmlMemBlocks(); 2733 filename = gen_filepath(n_filename, 0); 2734 encoding = gen_const_char_ptr(n_encoding, 1); 2735 sax = gen_htmlSAXHandlerPtr(n_sax, 2); 2736 userData = gen_userdata(n_userData, 3); 2737 2738 ret_val = htmlSAXParseFile(filename, (const char *)encoding, sax, userData); 2739 desret_htmlDocPtr(ret_val); 2740 call_tests++; 2741 des_filepath(n_filename, filename, 0); 2742 des_const_char_ptr(n_encoding, (const char *)encoding, 1); 2743 des_htmlSAXHandlerPtr(n_sax, sax, 2); 2744 des_userdata(n_userData, userData, 3); 2745 xmlResetLastError(); 2746 if (mem_base != xmlMemBlocks()) { 2747 printf("Leak of %d blocks found in htmlSAXParseFile", 2748 xmlMemBlocks() - mem_base); 2749 test_ret++; 2750 printf(" %d", n_filename); 2751 printf(" %d", n_encoding); 2752 printf(" %d", n_sax); 2753 printf(" %d", n_userData); 2754 printf("\n"); 2755 } 2756 } 2757 } 2758 } 2759 } 2760 function_tests++; 2761 #endif 2762 2763 return(test_ret); 2764 } 2765 2766 2767 static int 2768 test_htmlTagLookup(void) { 2769 int test_ret = 0; 2770 2771 2772 /* missing type support */ 2773 return(test_ret); 2774 } 2775 2776 static int 2777 test_HTMLparser(void) { 2778 int test_ret = 0; 2779 2780 if (quiet == 0) printf("Testing HTMLparser : 32 of 38 functions ...\n"); 2781 test_ret += test_UTF8ToHtml(); 2782 test_ret += test_htmlAttrAllowed(); 2783 test_ret += test_htmlAutoCloseTag(); 2784 test_ret += test_htmlCreateMemoryParserCtxt(); 2785 test_ret += test_htmlCreatePushParserCtxt(); 2786 test_ret += test_htmlCtxtReadDoc(); 2787 test_ret += test_htmlCtxtReadFile(); 2788 test_ret += test_htmlCtxtReadMemory(); 2789 test_ret += test_htmlCtxtReset(); 2790 test_ret += test_htmlCtxtUseOptions(); 2791 test_ret += test_htmlElementAllowedHere(); 2792 test_ret += test_htmlElementStatusHere(); 2793 test_ret += test_htmlEncodeEntities(); 2794 test_ret += test_htmlEntityLookup(); 2795 test_ret += test_htmlEntityValueLookup(); 2796 test_ret += test_htmlHandleOmittedElem(); 2797 test_ret += test_htmlIsAutoClosed(); 2798 test_ret += test_htmlIsScriptAttribute(); 2799 test_ret += test_htmlNewParserCtxt(); 2800 test_ret += test_htmlNodeStatus(); 2801 test_ret += test_htmlParseCharRef(); 2802 test_ret += test_htmlParseChunk(); 2803 test_ret += test_htmlParseDoc(); 2804 test_ret += test_htmlParseDocument(); 2805 test_ret += test_htmlParseElement(); 2806 test_ret += test_htmlParseEntityRef(); 2807 test_ret += test_htmlParseFile(); 2808 test_ret += test_htmlReadDoc(); 2809 test_ret += test_htmlReadFile(); 2810 test_ret += test_htmlReadMemory(); 2811 test_ret += test_htmlSAXParseDoc(); 2812 test_ret += test_htmlSAXParseFile(); 2813 test_ret += test_htmlTagLookup(); 2814 2815 if (test_ret != 0) 2816 printf("Module HTMLparser: %d errors\n", test_ret); 2817 return(test_ret); 2818 } 2819 2820 static int 2821 test_htmlDocContentDumpFormatOutput(void) { 2822 int test_ret = 0; 2823 2824 #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) 2825 int mem_base; 2826 xmlOutputBufferPtr buf; /* the HTML buffer output */ 2827 int n_buf; 2828 xmlDocPtr cur; /* the document */ 2829 int n_cur; 2830 char * encoding; /* the encoding string */ 2831 int n_encoding; 2832 int format; /* should formatting spaces been added */ 2833 int n_format; 2834 2835 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) { 2836 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) { 2837 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { 2838 for (n_format = 0;n_format < gen_nb_int;n_format++) { 2839 mem_base = xmlMemBlocks(); 2840 buf = gen_xmlOutputBufferPtr(n_buf, 0); 2841 cur = gen_xmlDocPtr(n_cur, 1); 2842 encoding = gen_const_char_ptr(n_encoding, 2); 2843 format = gen_int(n_format, 3); 2844 2845 htmlDocContentDumpFormatOutput(buf, cur, (const char *)encoding, format); 2846 call_tests++; 2847 des_xmlOutputBufferPtr(n_buf, buf, 0); 2848 des_xmlDocPtr(n_cur, cur, 1); 2849 des_const_char_ptr(n_encoding, (const char *)encoding, 2); 2850 des_int(n_format, format, 3); 2851 xmlResetLastError(); 2852 if (mem_base != xmlMemBlocks()) { 2853 printf("Leak of %d blocks found in htmlDocContentDumpFormatOutput", 2854 xmlMemBlocks() - mem_base); 2855 test_ret++; 2856 printf(" %d", n_buf); 2857 printf(" %d", n_cur); 2858 printf(" %d", n_encoding); 2859 printf(" %d", n_format); 2860 printf("\n"); 2861 } 2862 } 2863 } 2864 } 2865 } 2866 function_tests++; 2867 #endif 2868 2869 return(test_ret); 2870 } 2871 2872 2873 static int 2874 test_htmlDocContentDumpOutput(void) { 2875 int test_ret = 0; 2876 2877 #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) 2878 int mem_base; 2879 xmlOutputBufferPtr buf; /* the HTML buffer output */ 2880 int n_buf; 2881 xmlDocPtr cur; /* the document */ 2882 int n_cur; 2883 char * encoding; /* the encoding string */ 2884 int n_encoding; 2885 2886 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) { 2887 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) { 2888 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { 2889 mem_base = xmlMemBlocks(); 2890 buf = gen_xmlOutputBufferPtr(n_buf, 0); 2891 cur = gen_xmlDocPtr(n_cur, 1); 2892 encoding = gen_const_char_ptr(n_encoding, 2); 2893 2894 htmlDocContentDumpOutput(buf, cur, (const char *)encoding); 2895 call_tests++; 2896 des_xmlOutputBufferPtr(n_buf, buf, 0); 2897 des_xmlDocPtr(n_cur, cur, 1); 2898 des_const_char_ptr(n_encoding, (const char *)encoding, 2); 2899 xmlResetLastError(); 2900 if (mem_base != xmlMemBlocks()) { 2901 printf("Leak of %d blocks found in htmlDocContentDumpOutput", 2902 xmlMemBlocks() - mem_base); 2903 test_ret++; 2904 printf(" %d", n_buf); 2905 printf(" %d", n_cur); 2906 printf(" %d", n_encoding); 2907 printf("\n"); 2908 } 2909 } 2910 } 2911 } 2912 function_tests++; 2913 #endif 2914 2915 return(test_ret); 2916 } 2917 2918 2919 static int 2920 test_htmlDocDump(void) { 2921 int test_ret = 0; 2922 2923 #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) 2924 int mem_base; 2925 int ret_val; 2926 FILE * f; /* the FILE* */ 2927 int n_f; 2928 xmlDocPtr cur; /* the document */ 2929 int n_cur; 2930 2931 for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) { 2932 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) { 2933 mem_base = xmlMemBlocks(); 2934 f = gen_FILE_ptr(n_f, 0); 2935 cur = gen_xmlDocPtr(n_cur, 1); 2936 2937 ret_val = htmlDocDump(f, cur); 2938 desret_int(ret_val); 2939 call_tests++; 2940 des_FILE_ptr(n_f, f, 0); 2941 des_xmlDocPtr(n_cur, cur, 1); 2942 xmlResetLastError(); 2943 if (mem_base != xmlMemBlocks()) { 2944 printf("Leak of %d blocks found in htmlDocDump", 2945 xmlMemBlocks() - mem_base); 2946 test_ret++; 2947 printf(" %d", n_f); 2948 printf(" %d", n_cur); 2949 printf("\n"); 2950 } 2951 } 2952 } 2953 function_tests++; 2954 #endif 2955 2956 return(test_ret); 2957 } 2958 2959 2960 #define gen_nb_xmlChar_ptr_ptr 1 2961 static xmlChar ** gen_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 2962 return(NULL); 2963 } 2964 static void des_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, xmlChar ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 2965 } 2966 2967 static int 2968 test_htmlDocDumpMemory(void) { 2969 int test_ret = 0; 2970 2971 #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) 2972 int mem_base; 2973 xmlDocPtr cur; /* the document */ 2974 int n_cur; 2975 xmlChar ** mem; /* OUT: the memory pointer */ 2976 int n_mem; 2977 int * size; /* OUT: the memory length */ 2978 int n_size; 2979 2980 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) { 2981 for (n_mem = 0;n_mem < gen_nb_xmlChar_ptr_ptr;n_mem++) { 2982 for (n_size = 0;n_size < gen_nb_int_ptr;n_size++) { 2983 mem_base = xmlMemBlocks(); 2984 cur = gen_xmlDocPtr(n_cur, 0); 2985 mem = gen_xmlChar_ptr_ptr(n_mem, 1); 2986 size = gen_int_ptr(n_size, 2); 2987 2988 htmlDocDumpMemory(cur, mem, size); 2989 call_tests++; 2990 des_xmlDocPtr(n_cur, cur, 0); 2991 des_xmlChar_ptr_ptr(n_mem, mem, 1); 2992 des_int_ptr(n_size, size, 2); 2993 xmlResetLastError(); 2994 if (mem_base != xmlMemBlocks()) { 2995 printf("Leak of %d blocks found in htmlDocDumpMemory", 2996 xmlMemBlocks() - mem_base); 2997 test_ret++; 2998 printf(" %d", n_cur); 2999 printf(" %d", n_mem); 3000 printf(" %d", n_size); 3001 printf("\n"); 3002 } 3003 } 3004 } 3005 } 3006 function_tests++; 3007 #endif 3008 3009 return(test_ret); 3010 } 3011 3012 3013 static int 3014 test_htmlDocDumpMemoryFormat(void) { 3015 int test_ret = 0; 3016 3017 #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) 3018 int mem_base; 3019 xmlDocPtr cur; /* the document */ 3020 int n_cur; 3021 xmlChar ** mem; /* OUT: the memory pointer */ 3022 int n_mem; 3023 int * size; /* OUT: the memory length */ 3024 int n_size; 3025 int format; /* should formatting spaces been added */ 3026 int n_format; 3027 3028 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) { 3029 for (n_mem = 0;n_mem < gen_nb_xmlChar_ptr_ptr;n_mem++) { 3030 for (n_size = 0;n_size < gen_nb_int_ptr;n_size++) { 3031 for (n_format = 0;n_format < gen_nb_int;n_format++) { 3032 mem_base = xmlMemBlocks(); 3033 cur = gen_xmlDocPtr(n_cur, 0); 3034 mem = gen_xmlChar_ptr_ptr(n_mem, 1); 3035 size = gen_int_ptr(n_size, 2); 3036 format = gen_int(n_format, 3); 3037 3038 htmlDocDumpMemoryFormat(cur, mem, size, format); 3039 call_tests++; 3040 des_xmlDocPtr(n_cur, cur, 0); 3041 des_xmlChar_ptr_ptr(n_mem, mem, 1); 3042 des_int_ptr(n_size, size, 2); 3043 des_int(n_format, format, 3); 3044 xmlResetLastError(); 3045 if (mem_base != xmlMemBlocks()) { 3046 printf("Leak of %d blocks found in htmlDocDumpMemoryFormat", 3047 xmlMemBlocks() - mem_base); 3048 test_ret++; 3049 printf(" %d", n_cur); 3050 printf(" %d", n_mem); 3051 printf(" %d", n_size); 3052 printf(" %d", n_format); 3053 printf("\n"); 3054 } 3055 } 3056 } 3057 } 3058 } 3059 function_tests++; 3060 #endif 3061 3062 return(test_ret); 3063 } 3064 3065 3066 static int 3067 test_htmlGetMetaEncoding(void) { 3068 int test_ret = 0; 3069 3070 #if defined(LIBXML_HTML_ENABLED) 3071 int mem_base; 3072 const xmlChar * ret_val; 3073 htmlDocPtr doc; /* the document */ 3074 int n_doc; 3075 3076 for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) { 3077 mem_base = xmlMemBlocks(); 3078 doc = gen_htmlDocPtr(n_doc, 0); 3079 3080 ret_val = htmlGetMetaEncoding(doc); 3081 desret_const_xmlChar_ptr(ret_val); 3082 call_tests++; 3083 des_htmlDocPtr(n_doc, doc, 0); 3084 xmlResetLastError(); 3085 if (mem_base != xmlMemBlocks()) { 3086 printf("Leak of %d blocks found in htmlGetMetaEncoding", 3087 xmlMemBlocks() - mem_base); 3088 test_ret++; 3089 printf(" %d", n_doc); 3090 printf("\n"); 3091 } 3092 } 3093 function_tests++; 3094 #endif 3095 3096 return(test_ret); 3097 } 3098 3099 3100 static int 3101 test_htmlIsBooleanAttr(void) { 3102 int test_ret = 0; 3103 3104 #if defined(LIBXML_HTML_ENABLED) 3105 int mem_base; 3106 int ret_val; 3107 xmlChar * name; /* the name of the attribute to check */ 3108 int n_name; 3109 3110 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { 3111 mem_base = xmlMemBlocks(); 3112 name = gen_const_xmlChar_ptr(n_name, 0); 3113 3114 ret_val = htmlIsBooleanAttr((const xmlChar *)name); 3115 desret_int(ret_val); 3116 call_tests++; 3117 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0); 3118 xmlResetLastError(); 3119 if (mem_base != xmlMemBlocks()) { 3120 printf("Leak of %d blocks found in htmlIsBooleanAttr", 3121 xmlMemBlocks() - mem_base); 3122 test_ret++; 3123 printf(" %d", n_name); 3124 printf("\n"); 3125 } 3126 } 3127 function_tests++; 3128 #endif 3129 3130 return(test_ret); 3131 } 3132 3133 3134 static int 3135 test_htmlNewDoc(void) { 3136 int test_ret = 0; 3137 3138 #if defined(LIBXML_HTML_ENABLED) 3139 int mem_base; 3140 htmlDocPtr ret_val; 3141 xmlChar * URI; /* URI for the dtd, or NULL */ 3142 int n_URI; 3143 xmlChar * ExternalID; /* the external ID of the DTD, or NULL */ 3144 int n_ExternalID; 3145 3146 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) { 3147 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) { 3148 mem_base = xmlMemBlocks(); 3149 URI = gen_const_xmlChar_ptr(n_URI, 0); 3150 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 1); 3151 3152 ret_val = htmlNewDoc((const xmlChar *)URI, (const xmlChar *)ExternalID); 3153 desret_htmlDocPtr(ret_val); 3154 call_tests++; 3155 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0); 3156 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 1); 3157 xmlResetLastError(); 3158 if (mem_base != xmlMemBlocks()) { 3159 printf("Leak of %d blocks found in htmlNewDoc", 3160 xmlMemBlocks() - mem_base); 3161 test_ret++; 3162 printf(" %d", n_URI); 3163 printf(" %d", n_ExternalID); 3164 printf("\n"); 3165 } 3166 } 3167 } 3168 function_tests++; 3169 #endif 3170 3171 return(test_ret); 3172 } 3173 3174 3175 static int 3176 test_htmlNewDocNoDtD(void) { 3177 int test_ret = 0; 3178 3179 #if defined(LIBXML_HTML_ENABLED) 3180 int mem_base; 3181 htmlDocPtr ret_val; 3182 xmlChar * URI; /* URI for the dtd, or NULL */ 3183 int n_URI; 3184 xmlChar * ExternalID; /* the external ID of the DTD, or NULL */ 3185 int n_ExternalID; 3186 3187 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) { 3188 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) { 3189 mem_base = xmlMemBlocks(); 3190 URI = gen_const_xmlChar_ptr(n_URI, 0); 3191 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 1); 3192 3193 ret_val = htmlNewDocNoDtD((const xmlChar *)URI, (const xmlChar *)ExternalID); 3194 desret_htmlDocPtr(ret_val); 3195 call_tests++; 3196 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0); 3197 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 1); 3198 xmlResetLastError(); 3199 if (mem_base != xmlMemBlocks()) { 3200 printf("Leak of %d blocks found in htmlNewDocNoDtD", 3201 xmlMemBlocks() - mem_base); 3202 test_ret++; 3203 printf(" %d", n_URI); 3204 printf(" %d", n_ExternalID); 3205 printf("\n"); 3206 } 3207 } 3208 } 3209 function_tests++; 3210 #endif 3211 3212 return(test_ret); 3213 } 3214 3215 3216 static int 3217 test_htmlNodeDump(void) { 3218 int test_ret = 0; 3219 3220 #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) 3221 int mem_base; 3222 int ret_val; 3223 xmlBufferPtr buf; /* the HTML buffer output */ 3224 int n_buf; 3225 xmlDocPtr doc; /* the document */ 3226 int n_doc; 3227 xmlNodePtr cur; /* the current node */ 3228 int n_cur; 3229 3230 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) { 3231 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { 3232 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { 3233 mem_base = xmlMemBlocks(); 3234 buf = gen_xmlBufferPtr(n_buf, 0); 3235 doc = gen_xmlDocPtr(n_doc, 1); 3236 cur = gen_xmlNodePtr(n_cur, 2); 3237 3238 ret_val = htmlNodeDump(buf, doc, cur); 3239 desret_int(ret_val); 3240 call_tests++; 3241 des_xmlBufferPtr(n_buf, buf, 0); 3242 des_xmlDocPtr(n_doc, doc, 1); 3243 des_xmlNodePtr(n_cur, cur, 2); 3244 xmlResetLastError(); 3245 if (mem_base != xmlMemBlocks()) { 3246 printf("Leak of %d blocks found in htmlNodeDump", 3247 xmlMemBlocks() - mem_base); 3248 test_ret++; 3249 printf(" %d", n_buf); 3250 printf(" %d", n_doc); 3251 printf(" %d", n_cur); 3252 printf("\n"); 3253 } 3254 } 3255 } 3256 } 3257 function_tests++; 3258 #endif 3259 3260 return(test_ret); 3261 } 3262 3263 3264 static int 3265 test_htmlNodeDumpFile(void) { 3266 int test_ret = 0; 3267 3268 #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) 3269 int mem_base; 3270 FILE * out; /* the FILE pointer */ 3271 int n_out; 3272 xmlDocPtr doc; /* the document */ 3273 int n_doc; 3274 xmlNodePtr cur; /* the current node */ 3275 int n_cur; 3276 3277 for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) { 3278 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { 3279 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { 3280 mem_base = xmlMemBlocks(); 3281 out = gen_FILE_ptr(n_out, 0); 3282 doc = gen_xmlDocPtr(n_doc, 1); 3283 cur = gen_xmlNodePtr(n_cur, 2); 3284 3285 htmlNodeDumpFile(out, doc, cur); 3286 call_tests++; 3287 des_FILE_ptr(n_out, out, 0); 3288 des_xmlDocPtr(n_doc, doc, 1); 3289 des_xmlNodePtr(n_cur, cur, 2); 3290 xmlResetLastError(); 3291 if (mem_base != xmlMemBlocks()) { 3292 printf("Leak of %d blocks found in htmlNodeDumpFile", 3293 xmlMemBlocks() - mem_base); 3294 test_ret++; 3295 printf(" %d", n_out); 3296 printf(" %d", n_doc); 3297 printf(" %d", n_cur); 3298 printf("\n"); 3299 } 3300 } 3301 } 3302 } 3303 function_tests++; 3304 #endif 3305 3306 return(test_ret); 3307 } 3308 3309 3310 static int 3311 test_htmlNodeDumpFileFormat(void) { 3312 int test_ret = 0; 3313 3314 #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) 3315 int mem_base; 3316 int ret_val; 3317 FILE * out; /* the FILE pointer */ 3318 int n_out; 3319 xmlDocPtr doc; /* the document */ 3320 int n_doc; 3321 xmlNodePtr cur; /* the current node */ 3322 int n_cur; 3323 char * encoding; /* the document encoding */ 3324 int n_encoding; 3325 int format; /* should formatting spaces been added */ 3326 int n_format; 3327 3328 for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) { 3329 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { 3330 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { 3331 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { 3332 for (n_format = 0;n_format < gen_nb_int;n_format++) { 3333 mem_base = xmlMemBlocks(); 3334 out = gen_FILE_ptr(n_out, 0); 3335 doc = gen_xmlDocPtr(n_doc, 1); 3336 cur = gen_xmlNodePtr(n_cur, 2); 3337 encoding = gen_const_char_ptr(n_encoding, 3); 3338 format = gen_int(n_format, 4); 3339 3340 ret_val = htmlNodeDumpFileFormat(out, doc, cur, (const char *)encoding, format); 3341 desret_int(ret_val); 3342 call_tests++; 3343 des_FILE_ptr(n_out, out, 0); 3344 des_xmlDocPtr(n_doc, doc, 1); 3345 des_xmlNodePtr(n_cur, cur, 2); 3346 des_const_char_ptr(n_encoding, (const char *)encoding, 3); 3347 des_int(n_format, format, 4); 3348 xmlResetLastError(); 3349 if (mem_base != xmlMemBlocks()) { 3350 printf("Leak of %d blocks found in htmlNodeDumpFileFormat", 3351 xmlMemBlocks() - mem_base); 3352 test_ret++; 3353 printf(" %d", n_out); 3354 printf(" %d", n_doc); 3355 printf(" %d", n_cur); 3356 printf(" %d", n_encoding); 3357 printf(" %d", n_format); 3358 printf("\n"); 3359 } 3360 } 3361 } 3362 } 3363 } 3364 } 3365 function_tests++; 3366 #endif 3367 3368 return(test_ret); 3369 } 3370 3371 3372 static int 3373 test_htmlNodeDumpFormatOutput(void) { 3374 int test_ret = 0; 3375 3376 #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) 3377 int mem_base; 3378 xmlOutputBufferPtr buf; /* the HTML buffer output */ 3379 int n_buf; 3380 xmlDocPtr doc; /* the document */ 3381 int n_doc; 3382 xmlNodePtr cur; /* the current node */ 3383 int n_cur; 3384 char * encoding; /* the encoding string */ 3385 int n_encoding; 3386 int format; /* should formatting spaces been added */ 3387 int n_format; 3388 3389 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) { 3390 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { 3391 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { 3392 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { 3393 for (n_format = 0;n_format < gen_nb_int;n_format++) { 3394 mem_base = xmlMemBlocks(); 3395 buf = gen_xmlOutputBufferPtr(n_buf, 0); 3396 doc = gen_xmlDocPtr(n_doc, 1); 3397 cur = gen_xmlNodePtr(n_cur, 2); 3398 encoding = gen_const_char_ptr(n_encoding, 3); 3399 format = gen_int(n_format, 4); 3400 3401 htmlNodeDumpFormatOutput(buf, doc, cur, (const char *)encoding, format); 3402 call_tests++; 3403 des_xmlOutputBufferPtr(n_buf, buf, 0); 3404 des_xmlDocPtr(n_doc, doc, 1); 3405 des_xmlNodePtr(n_cur, cur, 2); 3406 des_const_char_ptr(n_encoding, (const char *)encoding, 3); 3407 des_int(n_format, format, 4); 3408 xmlResetLastError(); 3409 if (mem_base != xmlMemBlocks()) { 3410 printf("Leak of %d blocks found in htmlNodeDumpFormatOutput", 3411 xmlMemBlocks() - mem_base); 3412 test_ret++; 3413 printf(" %d", n_buf); 3414 printf(" %d", n_doc); 3415 printf(" %d", n_cur); 3416 printf(" %d", n_encoding); 3417 printf(" %d", n_format); 3418 printf("\n"); 3419 } 3420 } 3421 } 3422 } 3423 } 3424 } 3425 function_tests++; 3426 #endif 3427 3428 return(test_ret); 3429 } 3430 3431 3432 static int 3433 test_htmlNodeDumpOutput(void) { 3434 int test_ret = 0; 3435 3436 #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) 3437 int mem_base; 3438 xmlOutputBufferPtr buf; /* the HTML buffer output */ 3439 int n_buf; 3440 xmlDocPtr doc; /* the document */ 3441 int n_doc; 3442 xmlNodePtr cur; /* the current node */ 3443 int n_cur; 3444 char * encoding; /* the encoding string */ 3445 int n_encoding; 3446 3447 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) { 3448 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { 3449 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { 3450 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { 3451 mem_base = xmlMemBlocks(); 3452 buf = gen_xmlOutputBufferPtr(n_buf, 0); 3453 doc = gen_xmlDocPtr(n_doc, 1); 3454 cur = gen_xmlNodePtr(n_cur, 2); 3455 encoding = gen_const_char_ptr(n_encoding, 3); 3456 3457 htmlNodeDumpOutput(buf, doc, cur, (const char *)encoding); 3458 call_tests++; 3459 des_xmlOutputBufferPtr(n_buf, buf, 0); 3460 des_xmlDocPtr(n_doc, doc, 1); 3461 des_xmlNodePtr(n_cur, cur, 2); 3462 des_const_char_ptr(n_encoding, (const char *)encoding, 3); 3463 xmlResetLastError(); 3464 if (mem_base != xmlMemBlocks()) { 3465 printf("Leak of %d blocks found in htmlNodeDumpOutput", 3466 xmlMemBlocks() - mem_base); 3467 test_ret++; 3468 printf(" %d", n_buf); 3469 printf(" %d", n_doc); 3470 printf(" %d", n_cur); 3471 printf(" %d", n_encoding); 3472 printf("\n"); 3473 } 3474 } 3475 } 3476 } 3477 } 3478 function_tests++; 3479 #endif 3480 3481 return(test_ret); 3482 } 3483 3484 3485 static int 3486 test_htmlSaveFile(void) { 3487 int test_ret = 0; 3488 3489 #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) 3490 int mem_base; 3491 int ret_val; 3492 const char * filename; /* the filename (or URL) */ 3493 int n_filename; 3494 xmlDocPtr cur; /* the document */ 3495 int n_cur; 3496 3497 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) { 3498 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) { 3499 mem_base = xmlMemBlocks(); 3500 filename = gen_fileoutput(n_filename, 0); 3501 cur = gen_xmlDocPtr(n_cur, 1); 3502 3503 ret_val = htmlSaveFile(filename, cur); 3504 desret_int(ret_val); 3505 call_tests++; 3506 des_fileoutput(n_filename, filename, 0); 3507 des_xmlDocPtr(n_cur, cur, 1); 3508 xmlResetLastError(); 3509 if (mem_base != xmlMemBlocks()) { 3510 printf("Leak of %d blocks found in htmlSaveFile", 3511 xmlMemBlocks() - mem_base); 3512 test_ret++; 3513 printf(" %d", n_filename); 3514 printf(" %d", n_cur); 3515 printf("\n"); 3516 } 3517 } 3518 } 3519 function_tests++; 3520 #endif 3521 3522 return(test_ret); 3523 } 3524 3525 3526 static int 3527 test_htmlSaveFileEnc(void) { 3528 int test_ret = 0; 3529 3530 #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) 3531 int mem_base; 3532 int ret_val; 3533 const char * filename; /* the filename */ 3534 int n_filename; 3535 xmlDocPtr cur; /* the document */ 3536 int n_cur; 3537 char * encoding; /* the document encoding */ 3538 int n_encoding; 3539 3540 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) { 3541 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) { 3542 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { 3543 mem_base = xmlMemBlocks(); 3544 filename = gen_fileoutput(n_filename, 0); 3545 cur = gen_xmlDocPtr(n_cur, 1); 3546 encoding = gen_const_char_ptr(n_encoding, 2); 3547 3548 ret_val = htmlSaveFileEnc(filename, cur, (const char *)encoding); 3549 desret_int(ret_val); 3550 call_tests++; 3551 des_fileoutput(n_filename, filename, 0); 3552 des_xmlDocPtr(n_cur, cur, 1); 3553 des_const_char_ptr(n_encoding, (const char *)encoding, 2); 3554 xmlResetLastError(); 3555 if (mem_base != xmlMemBlocks()) { 3556 printf("Leak of %d blocks found in htmlSaveFileEnc", 3557 xmlMemBlocks() - mem_base); 3558 test_ret++; 3559 printf(" %d", n_filename); 3560 printf(" %d", n_cur); 3561 printf(" %d", n_encoding); 3562 printf("\n"); 3563 } 3564 } 3565 } 3566 } 3567 function_tests++; 3568 #endif 3569 3570 return(test_ret); 3571 } 3572 3573 3574 static int 3575 test_htmlSaveFileFormat(void) { 3576 int test_ret = 0; 3577 3578 #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) 3579 int mem_base; 3580 int ret_val; 3581 const char * filename; /* the filename */ 3582 int n_filename; 3583 xmlDocPtr cur; /* the document */ 3584 int n_cur; 3585 char * encoding; /* the document encoding */ 3586 int n_encoding; 3587 int format; /* should formatting spaces been added */ 3588 int n_format; 3589 3590 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) { 3591 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) { 3592 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { 3593 for (n_format = 0;n_format < gen_nb_int;n_format++) { 3594 mem_base = xmlMemBlocks(); 3595 filename = gen_fileoutput(n_filename, 0); 3596 cur = gen_xmlDocPtr(n_cur, 1); 3597 encoding = gen_const_char_ptr(n_encoding, 2); 3598 format = gen_int(n_format, 3); 3599 3600 ret_val = htmlSaveFileFormat(filename, cur, (const char *)encoding, format); 3601 desret_int(ret_val); 3602 call_tests++; 3603 des_fileoutput(n_filename, filename, 0); 3604 des_xmlDocPtr(n_cur, cur, 1); 3605 des_const_char_ptr(n_encoding, (const char *)encoding, 2); 3606 des_int(n_format, format, 3); 3607 xmlResetLastError(); 3608 if (mem_base != xmlMemBlocks()) { 3609 printf("Leak of %d blocks found in htmlSaveFileFormat", 3610 xmlMemBlocks() - mem_base); 3611 test_ret++; 3612 printf(" %d", n_filename); 3613 printf(" %d", n_cur); 3614 printf(" %d", n_encoding); 3615 printf(" %d", n_format); 3616 printf("\n"); 3617 } 3618 } 3619 } 3620 } 3621 } 3622 function_tests++; 3623 #endif 3624 3625 return(test_ret); 3626 } 3627 3628 3629 static int 3630 test_htmlSetMetaEncoding(void) { 3631 int test_ret = 0; 3632 3633 #if defined(LIBXML_HTML_ENABLED) 3634 int mem_base; 3635 int ret_val; 3636 htmlDocPtr doc; /* the document */ 3637 int n_doc; 3638 xmlChar * encoding; /* the encoding string */ 3639 int n_encoding; 3640 3641 for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) { 3642 for (n_encoding = 0;n_encoding < gen_nb_const_xmlChar_ptr;n_encoding++) { 3643 mem_base = xmlMemBlocks(); 3644 doc = gen_htmlDocPtr(n_doc, 0); 3645 encoding = gen_const_xmlChar_ptr(n_encoding, 1); 3646 3647 ret_val = htmlSetMetaEncoding(doc, (const xmlChar *)encoding); 3648 desret_int(ret_val); 3649 call_tests++; 3650 des_htmlDocPtr(n_doc, doc, 0); 3651 des_const_xmlChar_ptr(n_encoding, (const xmlChar *)encoding, 1); 3652 xmlResetLastError(); 3653 if (mem_base != xmlMemBlocks()) { 3654 printf("Leak of %d blocks found in htmlSetMetaEncoding", 3655 xmlMemBlocks() - mem_base); 3656 test_ret++; 3657 printf(" %d", n_doc); 3658 printf(" %d", n_encoding); 3659 printf("\n"); 3660 } 3661 } 3662 } 3663 function_tests++; 3664 #endif 3665 3666 return(test_ret); 3667 } 3668 3669 static int 3670 test_HTMLtree(void) { 3671 int test_ret = 0; 3672 3673 if (quiet == 0) printf("Testing HTMLtree : 18 of 18 functions ...\n"); 3674 test_ret += test_htmlDocContentDumpFormatOutput(); 3675 test_ret += test_htmlDocContentDumpOutput(); 3676 test_ret += test_htmlDocDump(); 3677 test_ret += test_htmlDocDumpMemory(); 3678 test_ret += test_htmlDocDumpMemoryFormat(); 3679 test_ret += test_htmlGetMetaEncoding(); 3680 test_ret += test_htmlIsBooleanAttr(); 3681 test_ret += test_htmlNewDoc(); 3682 test_ret += test_htmlNewDocNoDtD(); 3683 test_ret += test_htmlNodeDump(); 3684 test_ret += test_htmlNodeDumpFile(); 3685 test_ret += test_htmlNodeDumpFileFormat(); 3686 test_ret += test_htmlNodeDumpFormatOutput(); 3687 test_ret += test_htmlNodeDumpOutput(); 3688 test_ret += test_htmlSaveFile(); 3689 test_ret += test_htmlSaveFileEnc(); 3690 test_ret += test_htmlSaveFileFormat(); 3691 test_ret += test_htmlSetMetaEncoding(); 3692 3693 if (test_ret != 0) 3694 printf("Module HTMLtree: %d errors\n", test_ret); 3695 return(test_ret); 3696 } 3697 3698 static int 3699 test_docbDefaultSAXHandlerInit(void) { 3700 int test_ret = 0; 3701 3702 #if defined(LIBXML_DOCB_ENABLED) 3703 #ifdef LIBXML_DOCB_ENABLED 3704 int mem_base; 3705 3706 mem_base = xmlMemBlocks(); 3707 3708 docbDefaultSAXHandlerInit(); 3709 call_tests++; 3710 xmlResetLastError(); 3711 if (mem_base != xmlMemBlocks()) { 3712 printf("Leak of %d blocks found in docbDefaultSAXHandlerInit", 3713 xmlMemBlocks() - mem_base); 3714 test_ret++; 3715 printf("\n"); 3716 } 3717 function_tests++; 3718 #endif 3719 #endif 3720 3721 return(test_ret); 3722 } 3723 3724 3725 static int 3726 test_htmlDefaultSAXHandlerInit(void) { 3727 int test_ret = 0; 3728 3729 #if defined(LIBXML_HTML_ENABLED) 3730 #ifdef LIBXML_HTML_ENABLED 3731 int mem_base; 3732 3733 mem_base = xmlMemBlocks(); 3734 3735 htmlDefaultSAXHandlerInit(); 3736 call_tests++; 3737 xmlResetLastError(); 3738 if (mem_base != xmlMemBlocks()) { 3739 printf("Leak of %d blocks found in htmlDefaultSAXHandlerInit", 3740 xmlMemBlocks() - mem_base); 3741 test_ret++; 3742 printf("\n"); 3743 } 3744 function_tests++; 3745 #endif 3746 #endif 3747 3748 return(test_ret); 3749 } 3750 3751 3752 static int 3753 test_xmlDefaultSAXHandlerInit(void) { 3754 int test_ret = 0; 3755 3756 int mem_base; 3757 3758 mem_base = xmlMemBlocks(); 3759 3760 xmlDefaultSAXHandlerInit(); 3761 call_tests++; 3762 xmlResetLastError(); 3763 if (mem_base != xmlMemBlocks()) { 3764 printf("Leak of %d blocks found in xmlDefaultSAXHandlerInit", 3765 xmlMemBlocks() - mem_base); 3766 test_ret++; 3767 printf("\n"); 3768 } 3769 function_tests++; 3770 3771 return(test_ret); 3772 } 3773 3774 3775 #define gen_nb_xmlEnumerationPtr 1 3776 static xmlEnumerationPtr gen_xmlEnumerationPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 3777 return(NULL); 3778 } 3779 static void des_xmlEnumerationPtr(int no ATTRIBUTE_UNUSED, xmlEnumerationPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 3780 } 3781 3782 static int 3783 test_xmlSAX2AttributeDecl(void) { 3784 int test_ret = 0; 3785 3786 int mem_base; 3787 void * ctx; /* the user data (XML parser context) */ 3788 int n_ctx; 3789 xmlChar * elem; /* the name of the element */ 3790 int n_elem; 3791 xmlChar * fullname; /* the attribute name */ 3792 int n_fullname; 3793 int type; /* the attribute type */ 3794 int n_type; 3795 int def; /* the type of default value */ 3796 int n_def; 3797 xmlChar * defaultValue; /* the attribute default value */ 3798 int n_defaultValue; 3799 xmlEnumerationPtr tree; /* the tree of enumerated value set */ 3800 int n_tree; 3801 3802 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { 3803 for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) { 3804 for (n_fullname = 0;n_fullname < gen_nb_const_xmlChar_ptr;n_fullname++) { 3805 for (n_type = 0;n_type < gen_nb_int;n_type++) { 3806 for (n_def = 0;n_def < gen_nb_int;n_def++) { 3807 for (n_defaultValue = 0;n_defaultValue < gen_nb_const_xmlChar_ptr;n_defaultValue++) { 3808 for (n_tree = 0;n_tree < gen_nb_xmlEnumerationPtr;n_tree++) { 3809 mem_base = xmlMemBlocks(); 3810 ctx = gen_void_ptr(n_ctx, 0); 3811 elem = gen_const_xmlChar_ptr(n_elem, 1); 3812 fullname = gen_const_xmlChar_ptr(n_fullname, 2); 3813 type = gen_int(n_type, 3); 3814 def = gen_int(n_def, 4); 3815 defaultValue = gen_const_xmlChar_ptr(n_defaultValue, 5); 3816 tree = gen_xmlEnumerationPtr(n_tree, 6); 3817 3818 xmlSAX2AttributeDecl(ctx, (const xmlChar *)elem, (const xmlChar *)fullname, type, def, (const xmlChar *)defaultValue, tree); 3819 call_tests++; 3820 des_void_ptr(n_ctx, ctx, 0); 3821 des_const_xmlChar_ptr(n_elem, (const xmlChar *)elem, 1); 3822 des_const_xmlChar_ptr(n_fullname, (const xmlChar *)fullname, 2); 3823 des_int(n_type, type, 3); 3824 des_int(n_def, def, 4); 3825 des_const_xmlChar_ptr(n_defaultValue, (const xmlChar *)defaultValue, 5); 3826 des_xmlEnumerationPtr(n_tree, tree, 6); 3827 xmlResetLastError(); 3828 if (mem_base != xmlMemBlocks()) { 3829 printf("Leak of %d blocks found in xmlSAX2AttributeDecl", 3830 xmlMemBlocks() - mem_base); 3831 test_ret++; 3832 printf(" %d", n_ctx); 3833 printf(" %d", n_elem); 3834 printf(" %d", n_fullname); 3835 printf(" %d", n_type); 3836 printf(" %d", n_def); 3837 printf(" %d", n_defaultValue); 3838 printf(" %d", n_tree); 3839 printf("\n"); 3840 } 3841 } 3842 } 3843 } 3844 } 3845 } 3846 } 3847 } 3848 function_tests++; 3849 3850 return(test_ret); 3851 } 3852 3853 3854 static int 3855 test_xmlSAX2CDataBlock(void) { 3856 int test_ret = 0; 3857 3858 int mem_base; 3859 void * ctx; /* the user data (XML parser context) */ 3860 int n_ctx; 3861 xmlChar * value; /* The pcdata content */ 3862 int n_value; 3863 int len; /* the block length */ 3864 int n_len; 3865 3866 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { 3867 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { 3868 for (n_len = 0;n_len < gen_nb_int;n_len++) { 3869 mem_base = xmlMemBlocks(); 3870 ctx = gen_void_ptr(n_ctx, 0); 3871 value = gen_const_xmlChar_ptr(n_value, 1); 3872 len = gen_int(n_len, 2); 3873 3874 xmlSAX2CDataBlock(ctx, (const xmlChar *)value, len); 3875 call_tests++; 3876 des_void_ptr(n_ctx, ctx, 0); 3877 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1); 3878 des_int(n_len, len, 2); 3879 xmlResetLastError(); 3880 if (mem_base != xmlMemBlocks()) { 3881 printf("Leak of %d blocks found in xmlSAX2CDataBlock", 3882 xmlMemBlocks() - mem_base); 3883 test_ret++; 3884 printf(" %d", n_ctx); 3885 printf(" %d", n_value); 3886 printf(" %d", n_len); 3887 printf("\n"); 3888 } 3889 } 3890 } 3891 } 3892 function_tests++; 3893 3894 return(test_ret); 3895 } 3896 3897 3898 static int 3899 test_xmlSAX2Characters(void) { 3900 int test_ret = 0; 3901 3902 int mem_base; 3903 void * ctx; /* the user data (XML parser context) */ 3904 int n_ctx; 3905 xmlChar * ch; /* a xmlChar string */ 3906 int n_ch; 3907 int len; /* the number of xmlChar */ 3908 int n_len; 3909 3910 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { 3911 for (n_ch = 0;n_ch < gen_nb_const_xmlChar_ptr;n_ch++) { 3912 for (n_len = 0;n_len < gen_nb_int;n_len++) { 3913 mem_base = xmlMemBlocks(); 3914 ctx = gen_void_ptr(n_ctx, 0); 3915 ch = gen_const_xmlChar_ptr(n_ch, 1); 3916 len = gen_int(n_len, 2); 3917 3918 xmlSAX2Characters(ctx, (const xmlChar *)ch, len); 3919 call_tests++; 3920 des_void_ptr(n_ctx, ctx, 0); 3921 des_const_xmlChar_ptr(n_ch, (const xmlChar *)ch, 1); 3922 des_int(n_len, len, 2); 3923 xmlResetLastError(); 3924 if (mem_base != xmlMemBlocks()) { 3925 printf("Leak of %d blocks found in xmlSAX2Characters", 3926 xmlMemBlocks() - mem_base); 3927 test_ret++; 3928 printf(" %d", n_ctx); 3929 printf(" %d", n_ch); 3930 printf(" %d", n_len); 3931 printf("\n"); 3932 } 3933 } 3934 } 3935 } 3936 function_tests++; 3937 3938 return(test_ret); 3939 } 3940 3941 3942 static int 3943 test_xmlSAX2Comment(void) { 3944 int test_ret = 0; 3945 3946 int mem_base; 3947 void * ctx; /* the user data (XML parser context) */ 3948 int n_ctx; 3949 xmlChar * value; /* the xmlSAX2Comment content */ 3950 int n_value; 3951 3952 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { 3953 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { 3954 mem_base = xmlMemBlocks(); 3955 ctx = gen_void_ptr(n_ctx, 0); 3956 value = gen_const_xmlChar_ptr(n_value, 1); 3957 3958 xmlSAX2Comment(ctx, (const xmlChar *)value); 3959 call_tests++; 3960 des_void_ptr(n_ctx, ctx, 0); 3961 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1); 3962 xmlResetLastError(); 3963 if (mem_base != xmlMemBlocks()) { 3964 printf("Leak of %d blocks found in xmlSAX2Comment", 3965 xmlMemBlocks() - mem_base); 3966 test_ret++; 3967 printf(" %d", n_ctx); 3968 printf(" %d", n_value); 3969 printf("\n"); 3970 } 3971 } 3972 } 3973 function_tests++; 3974 3975 return(test_ret); 3976 } 3977 3978 3979 static int 3980 test_xmlSAX2ElementDecl(void) { 3981 int test_ret = 0; 3982 3983 int mem_base; 3984 void * ctx; /* the user data (XML parser context) */ 3985 int n_ctx; 3986 xmlChar * name; /* the element name */ 3987 int n_name; 3988 int type; /* the element type */ 3989 int n_type; 3990 xmlElementContentPtr content; /* the element value tree */ 3991 int n_content; 3992 3993 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { 3994 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { 3995 for (n_type = 0;n_type < gen_nb_int;n_type++) { 3996 for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) { 3997 mem_base = xmlMemBlocks(); 3998 ctx = gen_void_ptr(n_ctx, 0); 3999 name = gen_const_xmlChar_ptr(n_name, 1); 4000 type = gen_int(n_type, 2); 4001 content = gen_xmlElementContentPtr(n_content, 3); 4002 4003 xmlSAX2ElementDecl(ctx, (const xmlChar *)name, type, content); 4004 call_tests++; 4005 des_void_ptr(n_ctx, ctx, 0); 4006 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); 4007 des_int(n_type, type, 2); 4008 des_xmlElementContentPtr(n_content, content, 3); 4009 xmlResetLastError(); 4010 if (mem_base != xmlMemBlocks()) { 4011 printf("Leak of %d blocks found in xmlSAX2ElementDecl", 4012 xmlMemBlocks() - mem_base); 4013 test_ret++; 4014 printf(" %d", n_ctx); 4015 printf(" %d", n_name); 4016 printf(" %d", n_type); 4017 printf(" %d", n_content); 4018 printf("\n"); 4019 } 4020 } 4021 } 4022 } 4023 } 4024 function_tests++; 4025 4026 return(test_ret); 4027 } 4028 4029 4030 static int 4031 test_xmlSAX2EndDocument(void) { 4032 int test_ret = 0; 4033 4034 int mem_base; 4035 void * ctx; /* the user data (XML parser context) */ 4036 int n_ctx; 4037 4038 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { 4039 mem_base = xmlMemBlocks(); 4040 ctx = gen_void_ptr(n_ctx, 0); 4041 4042 xmlSAX2EndDocument(ctx); 4043 call_tests++; 4044 des_void_ptr(n_ctx, ctx, 0); 4045 xmlResetLastError(); 4046 if (mem_base != xmlMemBlocks()) { 4047 printf("Leak of %d blocks found in xmlSAX2EndDocument", 4048 xmlMemBlocks() - mem_base); 4049 test_ret++; 4050 printf(" %d", n_ctx); 4051 printf("\n"); 4052 } 4053 } 4054 function_tests++; 4055 4056 return(test_ret); 4057 } 4058 4059 4060 static int 4061 test_xmlSAX2EndElement(void) { 4062 int test_ret = 0; 4063 4064 #if defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_DOCB_ENABLED) || defined(LIBXML_LEGACY_ENABLED) 4065 #ifdef LIBXML_SAX1_ENABLED 4066 int mem_base; 4067 void * ctx; /* the user data (XML parser context) */ 4068 int n_ctx; 4069 xmlChar * name; /* The element name */ 4070 int n_name; 4071 4072 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { 4073 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { 4074 mem_base = xmlMemBlocks(); 4075 ctx = gen_void_ptr(n_ctx, 0); 4076 name = gen_const_xmlChar_ptr(n_name, 1); 4077 4078 xmlSAX2EndElement(ctx, (const xmlChar *)name); 4079 call_tests++; 4080 des_void_ptr(n_ctx, ctx, 0); 4081 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); 4082 xmlResetLastError(); 4083 if (mem_base != xmlMemBlocks()) { 4084 printf("Leak of %d blocks found in xmlSAX2EndElement", 4085 xmlMemBlocks() - mem_base); 4086 test_ret++; 4087 printf(" %d", n_ctx); 4088 printf(" %d", n_name); 4089 printf("\n"); 4090 } 4091 } 4092 } 4093 function_tests++; 4094 #endif 4095 #endif 4096 4097 return(test_ret); 4098 } 4099 4100 4101 static int 4102 test_xmlSAX2EndElementNs(void) { 4103 int test_ret = 0; 4104 4105 int mem_base; 4106 void * ctx; /* the user data (XML parser context) */ 4107 int n_ctx; 4108 xmlChar * localname; /* the local name of the element */ 4109 int n_localname; 4110 xmlChar * prefix; /* the element namespace prefix if available */ 4111 int n_prefix; 4112 xmlChar * URI; /* the element namespace name if available */ 4113 int n_URI; 4114 4115 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { 4116 for (n_localname = 0;n_localname < gen_nb_const_xmlChar_ptr;n_localname++) { 4117 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) { 4118 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) { 4119 mem_base = xmlMemBlocks(); 4120 ctx = gen_void_ptr(n_ctx, 0); 4121 localname = gen_const_xmlChar_ptr(n_localname, 1); 4122 prefix = gen_const_xmlChar_ptr(n_prefix, 2); 4123 URI = gen_const_xmlChar_ptr(n_URI, 3); 4124 4125 xmlSAX2EndElementNs(ctx, (const xmlChar *)localname, (const xmlChar *)prefix, (const xmlChar *)URI); 4126 call_tests++; 4127 des_void_ptr(n_ctx, ctx, 0); 4128 des_const_xmlChar_ptr(n_localname, (const xmlChar *)localname, 1); 4129 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 2); 4130 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 3); 4131 xmlResetLastError(); 4132 if (mem_base != xmlMemBlocks()) { 4133 printf("Leak of %d blocks found in xmlSAX2EndElementNs", 4134 xmlMemBlocks() - mem_base); 4135 test_ret++; 4136 printf(" %d", n_ctx); 4137 printf(" %d", n_localname); 4138 printf(" %d", n_prefix); 4139 printf(" %d", n_URI); 4140 printf("\n"); 4141 } 4142 } 4143 } 4144 } 4145 } 4146 function_tests++; 4147 4148 return(test_ret); 4149 } 4150 4151 4152 static int 4153 test_xmlSAX2EntityDecl(void) { 4154 int test_ret = 0; 4155 4156 int mem_base; 4157 void * ctx; /* the user data (XML parser context) */ 4158 int n_ctx; 4159 xmlChar * name; /* the entity name */ 4160 int n_name; 4161 int type; /* the entity type */ 4162 int n_type; 4163 xmlChar * publicId; /* The public ID of the entity */ 4164 int n_publicId; 4165 xmlChar * systemId; /* The system ID of the entity */ 4166 int n_systemId; 4167 xmlChar * content; /* the entity value (without processing). */ 4168 int n_content; 4169 4170 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { 4171 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { 4172 for (n_type = 0;n_type < gen_nb_int;n_type++) { 4173 for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) { 4174 for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) { 4175 for (n_content = 0;n_content < gen_nb_xmlChar_ptr;n_content++) { 4176 mem_base = xmlMemBlocks(); 4177 ctx = gen_void_ptr(n_ctx, 0); 4178 name = gen_const_xmlChar_ptr(n_name, 1); 4179 type = gen_int(n_type, 2); 4180 publicId = gen_const_xmlChar_ptr(n_publicId, 3); 4181 systemId = gen_const_xmlChar_ptr(n_systemId, 4); 4182 content = gen_xmlChar_ptr(n_content, 5); 4183 4184 xmlSAX2EntityDecl(ctx, (const xmlChar *)name, type, (const xmlChar *)publicId, (const xmlChar *)systemId, content); 4185 call_tests++; 4186 des_void_ptr(n_ctx, ctx, 0); 4187 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); 4188 des_int(n_type, type, 2); 4189 des_const_xmlChar_ptr(n_publicId, (const xmlChar *)publicId, 3); 4190 des_const_xmlChar_ptr(n_systemId, (const xmlChar *)systemId, 4); 4191 des_xmlChar_ptr(n_content, content, 5); 4192 xmlResetLastError(); 4193 if (mem_base != xmlMemBlocks()) { 4194 printf("Leak of %d blocks found in xmlSAX2EntityDecl", 4195 xmlMemBlocks() - mem_base); 4196 test_ret++; 4197 printf(" %d", n_ctx); 4198 printf(" %d", n_name); 4199 printf(" %d", n_type); 4200 printf(" %d", n_publicId); 4201 printf(" %d", n_systemId); 4202 printf(" %d", n_content); 4203 printf("\n"); 4204 } 4205 } 4206 } 4207 } 4208 } 4209 } 4210 } 4211 function_tests++; 4212 4213 return(test_ret); 4214 } 4215 4216 4217 static int 4218 test_xmlSAX2ExternalSubset(void) { 4219 int test_ret = 0; 4220 4221 int mem_base; 4222 void * ctx; /* the user data (XML parser context) */ 4223 int n_ctx; 4224 xmlChar * name; /* the root element name */ 4225 int n_name; 4226 xmlChar * ExternalID; /* the external ID */ 4227 int n_ExternalID; 4228 xmlChar * SystemID; /* the SYSTEM ID (e.g. filename or URL) */ 4229 int n_SystemID; 4230 4231 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { 4232 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { 4233 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) { 4234 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) { 4235 mem_base = xmlMemBlocks(); 4236 ctx = gen_void_ptr(n_ctx, 0); 4237 name = gen_const_xmlChar_ptr(n_name, 1); 4238 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2); 4239 SystemID = gen_const_xmlChar_ptr(n_SystemID, 3); 4240 4241 xmlSAX2ExternalSubset(ctx, (const xmlChar *)name, (const xmlChar *)ExternalID, (const xmlChar *)SystemID); 4242 call_tests++; 4243 des_void_ptr(n_ctx, ctx, 0); 4244 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); 4245 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 2); 4246 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 3); 4247 xmlResetLastError(); 4248 if (mem_base != xmlMemBlocks()) { 4249 printf("Leak of %d blocks found in xmlSAX2ExternalSubset", 4250 xmlMemBlocks() - mem_base); 4251 test_ret++; 4252 printf(" %d", n_ctx); 4253 printf(" %d", n_name); 4254 printf(" %d", n_ExternalID); 4255 printf(" %d", n_SystemID); 4256 printf("\n"); 4257 } 4258 } 4259 } 4260 } 4261 } 4262 function_tests++; 4263 4264 return(test_ret); 4265 } 4266 4267 4268 static int 4269 test_xmlSAX2GetColumnNumber(void) { 4270 int test_ret = 0; 4271 4272 int mem_base; 4273 int ret_val; 4274 void * ctx; /* the user data (XML parser context) */ 4275 int n_ctx; 4276 4277 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { 4278 mem_base = xmlMemBlocks(); 4279 ctx = gen_void_ptr(n_ctx, 0); 4280 4281 ret_val = xmlSAX2GetColumnNumber(ctx); 4282 desret_int(ret_val); 4283 call_tests++; 4284 des_void_ptr(n_ctx, ctx, 0); 4285 xmlResetLastError(); 4286 if (mem_base != xmlMemBlocks()) { 4287 printf("Leak of %d blocks found in xmlSAX2GetColumnNumber", 4288 xmlMemBlocks() - mem_base); 4289 test_ret++; 4290 printf(" %d", n_ctx); 4291 printf("\n"); 4292 } 4293 } 4294 function_tests++; 4295 4296 return(test_ret); 4297 } 4298 4299 4300 static int 4301 test_xmlSAX2GetEntity(void) { 4302 int test_ret = 0; 4303 4304 int mem_base; 4305 xmlEntityPtr ret_val; 4306 void * ctx; /* the user data (XML parser context) */ 4307 int n_ctx; 4308 xmlChar * name; /* The entity name */ 4309 int n_name; 4310 4311 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { 4312 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { 4313 mem_base = xmlMemBlocks(); 4314 ctx = gen_void_ptr(n_ctx, 0); 4315 name = gen_const_xmlChar_ptr(n_name, 1); 4316 4317 ret_val = xmlSAX2GetEntity(ctx, (const xmlChar *)name); 4318 desret_xmlEntityPtr(ret_val); 4319 call_tests++; 4320 des_void_ptr(n_ctx, ctx, 0); 4321 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); 4322 xmlResetLastError(); 4323 if (mem_base != xmlMemBlocks()) { 4324 printf("Leak of %d blocks found in xmlSAX2GetEntity", 4325 xmlMemBlocks() - mem_base); 4326 test_ret++; 4327 printf(" %d", n_ctx); 4328 printf(" %d", n_name); 4329 printf("\n"); 4330 } 4331 } 4332 } 4333 function_tests++; 4334 4335 return(test_ret); 4336 } 4337 4338 4339 static int 4340 test_xmlSAX2GetLineNumber(void) { 4341 int test_ret = 0; 4342 4343 int mem_base; 4344 int ret_val; 4345 void * ctx; /* the user data (XML parser context) */ 4346 int n_ctx; 4347 4348 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { 4349 mem_base = xmlMemBlocks(); 4350 ctx = gen_void_ptr(n_ctx, 0); 4351 4352 ret_val = xmlSAX2GetLineNumber(ctx); 4353 desret_int(ret_val); 4354 call_tests++; 4355 des_void_ptr(n_ctx, ctx, 0); 4356 xmlResetLastError(); 4357 if (mem_base != xmlMemBlocks()) { 4358 printf("Leak of %d blocks found in xmlSAX2GetLineNumber", 4359 xmlMemBlocks() - mem_base); 4360 test_ret++; 4361 printf(" %d", n_ctx); 4362 printf("\n"); 4363 } 4364 } 4365 function_tests++; 4366 4367 return(test_ret); 4368 } 4369 4370 4371 static int 4372 test_xmlSAX2GetParameterEntity(void) { 4373 int test_ret = 0; 4374 4375 int mem_base; 4376 xmlEntityPtr ret_val; 4377 void * ctx; /* the user data (XML parser context) */ 4378 int n_ctx; 4379 xmlChar * name; /* The entity name */ 4380 int n_name; 4381 4382 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { 4383 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { 4384 mem_base = xmlMemBlocks(); 4385 ctx = gen_void_ptr(n_ctx, 0); 4386 name = gen_const_xmlChar_ptr(n_name, 1); 4387 4388 ret_val = xmlSAX2GetParameterEntity(ctx, (const xmlChar *)name); 4389 desret_xmlEntityPtr(ret_val); 4390 call_tests++; 4391 des_void_ptr(n_ctx, ctx, 0); 4392 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); 4393 xmlResetLastError(); 4394 if (mem_base != xmlMemBlocks()) { 4395 printf("Leak of %d blocks found in xmlSAX2GetParameterEntity", 4396 xmlMemBlocks() - mem_base); 4397 test_ret++; 4398 printf(" %d", n_ctx); 4399 printf(" %d", n_name); 4400 printf("\n"); 4401 } 4402 } 4403 } 4404 function_tests++; 4405 4406 return(test_ret); 4407 } 4408 4409 4410 static int 4411 test_xmlSAX2GetPublicId(void) { 4412 int test_ret = 0; 4413 4414 int mem_base; 4415 const xmlChar * ret_val; 4416 void * ctx; /* the user data (XML parser context) */ 4417 int n_ctx; 4418 4419 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { 4420 mem_base = xmlMemBlocks(); 4421 ctx = gen_void_ptr(n_ctx, 0); 4422 4423 ret_val = xmlSAX2GetPublicId(ctx); 4424 desret_const_xmlChar_ptr(ret_val); 4425 call_tests++; 4426 des_void_ptr(n_ctx, ctx, 0); 4427 xmlResetLastError(); 4428 if (mem_base != xmlMemBlocks()) { 4429 printf("Leak of %d blocks found in xmlSAX2GetPublicId", 4430 xmlMemBlocks() - mem_base); 4431 test_ret++; 4432 printf(" %d", n_ctx); 4433 printf("\n"); 4434 } 4435 } 4436 function_tests++; 4437 4438 return(test_ret); 4439 } 4440 4441 4442 static int 4443 test_xmlSAX2GetSystemId(void) { 4444 int test_ret = 0; 4445 4446 int mem_base; 4447 const xmlChar * ret_val; 4448 void * ctx; /* the user data (XML parser context) */ 4449 int n_ctx; 4450 4451 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { 4452 mem_base = xmlMemBlocks(); 4453 ctx = gen_void_ptr(n_ctx, 0); 4454 4455 ret_val = xmlSAX2GetSystemId(ctx); 4456 desret_const_xmlChar_ptr(ret_val); 4457 call_tests++; 4458 des_void_ptr(n_ctx, ctx, 0); 4459 xmlResetLastError(); 4460 if (mem_base != xmlMemBlocks()) { 4461 printf("Leak of %d blocks found in xmlSAX2GetSystemId", 4462 xmlMemBlocks() - mem_base); 4463 test_ret++; 4464 printf(" %d", n_ctx); 4465 printf("\n"); 4466 } 4467 } 4468 function_tests++; 4469 4470 return(test_ret); 4471 } 4472 4473 4474 static int 4475 test_xmlSAX2HasExternalSubset(void) { 4476 int test_ret = 0; 4477 4478 int mem_base; 4479 int ret_val; 4480 void * ctx; /* the user data (XML parser context) */ 4481 int n_ctx; 4482 4483 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { 4484 mem_base = xmlMemBlocks(); 4485 ctx = gen_void_ptr(n_ctx, 0); 4486 4487 ret_val = xmlSAX2HasExternalSubset(ctx); 4488 desret_int(ret_val); 4489 call_tests++; 4490 des_void_ptr(n_ctx, ctx, 0); 4491 xmlResetLastError(); 4492 if (mem_base != xmlMemBlocks()) { 4493 printf("Leak of %d blocks found in xmlSAX2HasExternalSubset", 4494 xmlMemBlocks() - mem_base); 4495 test_ret++; 4496 printf(" %d", n_ctx); 4497 printf("\n"); 4498 } 4499 } 4500 function_tests++; 4501 4502 return(test_ret); 4503 } 4504 4505 4506 static int 4507 test_xmlSAX2HasInternalSubset(void) { 4508 int test_ret = 0; 4509 4510 int mem_base; 4511 int ret_val; 4512 void * ctx; /* the user data (XML parser context) */ 4513 int n_ctx; 4514 4515 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { 4516 mem_base = xmlMemBlocks(); 4517 ctx = gen_void_ptr(n_ctx, 0); 4518 4519 ret_val = xmlSAX2HasInternalSubset(ctx); 4520 desret_int(ret_val); 4521 call_tests++; 4522 des_void_ptr(n_ctx, ctx, 0); 4523 xmlResetLastError(); 4524 if (mem_base != xmlMemBlocks()) { 4525 printf("Leak of %d blocks found in xmlSAX2HasInternalSubset", 4526 xmlMemBlocks() - mem_base); 4527 test_ret++; 4528 printf(" %d", n_ctx); 4529 printf("\n"); 4530 } 4531 } 4532 function_tests++; 4533 4534 return(test_ret); 4535 } 4536 4537 4538 static int 4539 test_xmlSAX2IgnorableWhitespace(void) { 4540 int test_ret = 0; 4541 4542 int mem_base; 4543 void * ctx; /* the user data (XML parser context) */ 4544 int n_ctx; 4545 xmlChar * ch; /* a xmlChar string */ 4546 int n_ch; 4547 int len; /* the number of xmlChar */ 4548 int n_len; 4549 4550 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { 4551 for (n_ch = 0;n_ch < gen_nb_const_xmlChar_ptr;n_ch++) { 4552 for (n_len = 0;n_len < gen_nb_int;n_len++) { 4553 mem_base = xmlMemBlocks(); 4554 ctx = gen_void_ptr(n_ctx, 0); 4555 ch = gen_const_xmlChar_ptr(n_ch, 1); 4556 len = gen_int(n_len, 2); 4557 4558 xmlSAX2IgnorableWhitespace(ctx, (const xmlChar *)ch, len); 4559 call_tests++; 4560 des_void_ptr(n_ctx, ctx, 0); 4561 des_const_xmlChar_ptr(n_ch, (const xmlChar *)ch, 1); 4562 des_int(n_len, len, 2); 4563 xmlResetLastError(); 4564 if (mem_base != xmlMemBlocks()) { 4565 printf("Leak of %d blocks found in xmlSAX2IgnorableWhitespace", 4566 xmlMemBlocks() - mem_base); 4567 test_ret++; 4568 printf(" %d", n_ctx); 4569 printf(" %d", n_ch); 4570 printf(" %d", n_len); 4571 printf("\n"); 4572 } 4573 } 4574 } 4575 } 4576 function_tests++; 4577 4578 return(test_ret); 4579 } 4580 4581 4582 #define gen_nb_xmlSAXHandler_ptr 1 4583 static xmlSAXHandler * gen_xmlSAXHandler_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 4584 return(NULL); 4585 } 4586 static void des_xmlSAXHandler_ptr(int no ATTRIBUTE_UNUSED, xmlSAXHandler * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 4587 } 4588 4589 static int 4590 test_xmlSAX2InitDefaultSAXHandler(void) { 4591 int test_ret = 0; 4592 4593 int mem_base; 4594 xmlSAXHandler * hdlr; /* the SAX handler */ 4595 int n_hdlr; 4596 int warning; /* flag if non-zero sets the handler warning procedure */ 4597 int n_warning; 4598 4599 for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) { 4600 for (n_warning = 0;n_warning < gen_nb_int;n_warning++) { 4601 mem_base = xmlMemBlocks(); 4602 hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0); 4603 warning = gen_int(n_warning, 1); 4604 4605 xmlSAX2InitDefaultSAXHandler(hdlr, warning); 4606 call_tests++; 4607 des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0); 4608 des_int(n_warning, warning, 1); 4609 xmlResetLastError(); 4610 if (mem_base != xmlMemBlocks()) { 4611 printf("Leak of %d blocks found in xmlSAX2InitDefaultSAXHandler", 4612 xmlMemBlocks() - mem_base); 4613 test_ret++; 4614 printf(" %d", n_hdlr); 4615 printf(" %d", n_warning); 4616 printf("\n"); 4617 } 4618 } 4619 } 4620 function_tests++; 4621 4622 return(test_ret); 4623 } 4624 4625 4626 static int 4627 test_xmlSAX2InitDocbDefaultSAXHandler(void) { 4628 int test_ret = 0; 4629 4630 #if defined(LIBXML_DOCB_ENABLED) 4631 int mem_base; 4632 xmlSAXHandler * hdlr; /* the SAX handler */ 4633 int n_hdlr; 4634 4635 for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) { 4636 mem_base = xmlMemBlocks(); 4637 hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0); 4638 4639 xmlSAX2InitDocbDefaultSAXHandler(hdlr); 4640 call_tests++; 4641 des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0); 4642 xmlResetLastError(); 4643 if (mem_base != xmlMemBlocks()) { 4644 printf("Leak of %d blocks found in xmlSAX2InitDocbDefaultSAXHandler", 4645 xmlMemBlocks() - mem_base); 4646 test_ret++; 4647 printf(" %d", n_hdlr); 4648 printf("\n"); 4649 } 4650 } 4651 function_tests++; 4652 #endif 4653 4654 return(test_ret); 4655 } 4656 4657 4658 static int 4659 test_xmlSAX2InitHtmlDefaultSAXHandler(void) { 4660 int test_ret = 0; 4661 4662 #if defined(LIBXML_HTML_ENABLED) 4663 int mem_base; 4664 xmlSAXHandler * hdlr; /* the SAX handler */ 4665 int n_hdlr; 4666 4667 for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) { 4668 mem_base = xmlMemBlocks(); 4669 hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0); 4670 4671 xmlSAX2InitHtmlDefaultSAXHandler(hdlr); 4672 call_tests++; 4673 des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0); 4674 xmlResetLastError(); 4675 if (mem_base != xmlMemBlocks()) { 4676 printf("Leak of %d blocks found in xmlSAX2InitHtmlDefaultSAXHandler", 4677 xmlMemBlocks() - mem_base); 4678 test_ret++; 4679 printf(" %d", n_hdlr); 4680 printf("\n"); 4681 } 4682 } 4683 function_tests++; 4684 #endif 4685 4686 return(test_ret); 4687 } 4688 4689 4690 static int 4691 test_xmlSAX2InternalSubset(void) { 4692 int test_ret = 0; 4693 4694 int mem_base; 4695 void * ctx; /* the user data (XML parser context) */ 4696 int n_ctx; 4697 xmlChar * name; /* the root element name */ 4698 int n_name; 4699 xmlChar * ExternalID; /* the external ID */ 4700 int n_ExternalID; 4701 xmlChar * SystemID; /* the SYSTEM ID (e.g. filename or URL) */ 4702 int n_SystemID; 4703 4704 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { 4705 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { 4706 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) { 4707 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) { 4708 mem_base = xmlMemBlocks(); 4709 ctx = gen_void_ptr(n_ctx, 0); 4710 name = gen_const_xmlChar_ptr(n_name, 1); 4711 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2); 4712 SystemID = gen_const_xmlChar_ptr(n_SystemID, 3); 4713 4714 xmlSAX2InternalSubset(ctx, (const xmlChar *)name, (const xmlChar *)ExternalID, (const xmlChar *)SystemID); 4715 call_tests++; 4716 des_void_ptr(n_ctx, ctx, 0); 4717 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); 4718 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 2); 4719 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 3); 4720 xmlResetLastError(); 4721 if (mem_base != xmlMemBlocks()) { 4722 printf("Leak of %d blocks found in xmlSAX2InternalSubset", 4723 xmlMemBlocks() - mem_base); 4724 test_ret++; 4725 printf(" %d", n_ctx); 4726 printf(" %d", n_name); 4727 printf(" %d", n_ExternalID); 4728 printf(" %d", n_SystemID); 4729 printf("\n"); 4730 } 4731 } 4732 } 4733 } 4734 } 4735 function_tests++; 4736 4737 return(test_ret); 4738 } 4739 4740 4741 static int 4742 test_xmlSAX2IsStandalone(void) { 4743 int test_ret = 0; 4744 4745 int mem_base; 4746 int ret_val; 4747 void * ctx; /* the user data (XML parser context) */ 4748 int n_ctx; 4749 4750 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { 4751 mem_base = xmlMemBlocks(); 4752 ctx = gen_void_ptr(n_ctx, 0); 4753 4754 ret_val = xmlSAX2IsStandalone(ctx); 4755 desret_int(ret_val); 4756 call_tests++; 4757 des_void_ptr(n_ctx, ctx, 0); 4758 xmlResetLastError(); 4759 if (mem_base != xmlMemBlocks()) { 4760 printf("Leak of %d blocks found in xmlSAX2IsStandalone", 4761 xmlMemBlocks() - mem_base); 4762 test_ret++; 4763 printf(" %d", n_ctx); 4764 printf("\n"); 4765 } 4766 } 4767 function_tests++; 4768 4769 return(test_ret); 4770 } 4771 4772 4773 static int 4774 test_xmlSAX2NotationDecl(void) { 4775 int test_ret = 0; 4776 4777 int mem_base; 4778 void * ctx; /* the user data (XML parser context) */ 4779 int n_ctx; 4780 xmlChar * name; /* The name of the notation */ 4781 int n_name; 4782 xmlChar * publicId; /* The public ID of the entity */ 4783 int n_publicId; 4784 xmlChar * systemId; /* The system ID of the entity */ 4785 int n_systemId; 4786 4787 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { 4788 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { 4789 for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) { 4790 for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) { 4791 mem_base = xmlMemBlocks(); 4792 ctx = gen_void_ptr(n_ctx, 0); 4793 name = gen_const_xmlChar_ptr(n_name, 1); 4794 publicId = gen_const_xmlChar_ptr(n_publicId, 2); 4795 systemId = gen_const_xmlChar_ptr(n_systemId, 3); 4796 4797 xmlSAX2NotationDecl(ctx, (const xmlChar *)name, (const xmlChar *)publicId, (const xmlChar *)systemId); 4798 call_tests++; 4799 des_void_ptr(n_ctx, ctx, 0); 4800 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); 4801 des_const_xmlChar_ptr(n_publicId, (const xmlChar *)publicId, 2); 4802 des_const_xmlChar_ptr(n_systemId, (const xmlChar *)systemId, 3); 4803 xmlResetLastError(); 4804 if (mem_base != xmlMemBlocks()) { 4805 printf("Leak of %d blocks found in xmlSAX2NotationDecl", 4806 xmlMemBlocks() - mem_base); 4807 test_ret++; 4808 printf(" %d", n_ctx); 4809 printf(" %d", n_name); 4810 printf(" %d", n_publicId); 4811 printf(" %d", n_systemId); 4812 printf("\n"); 4813 } 4814 } 4815 } 4816 } 4817 } 4818 function_tests++; 4819 4820 return(test_ret); 4821 } 4822 4823 4824 static int 4825 test_xmlSAX2ProcessingInstruction(void) { 4826 int test_ret = 0; 4827 4828 int mem_base; 4829 void * ctx; /* the user data (XML parser context) */ 4830 int n_ctx; 4831 xmlChar * target; /* the target name */ 4832 int n_target; 4833 xmlChar * data; /* the PI data's */ 4834 int n_data; 4835 4836 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { 4837 for (n_target = 0;n_target < gen_nb_const_xmlChar_ptr;n_target++) { 4838 for (n_data = 0;n_data < gen_nb_const_xmlChar_ptr;n_data++) { 4839 mem_base = xmlMemBlocks(); 4840 ctx = gen_void_ptr(n_ctx, 0); 4841 target = gen_const_xmlChar_ptr(n_target, 1); 4842 data = gen_const_xmlChar_ptr(n_data, 2); 4843 4844 xmlSAX2ProcessingInstruction(ctx, (const xmlChar *)target, (const xmlChar *)data); 4845 call_tests++; 4846 des_void_ptr(n_ctx, ctx, 0); 4847 des_const_xmlChar_ptr(n_target, (const xmlChar *)target, 1); 4848 des_const_xmlChar_ptr(n_data, (const xmlChar *)data, 2); 4849 xmlResetLastError(); 4850 if (mem_base != xmlMemBlocks()) { 4851 printf("Leak of %d blocks found in xmlSAX2ProcessingInstruction", 4852 xmlMemBlocks() - mem_base); 4853 test_ret++; 4854 printf(" %d", n_ctx); 4855 printf(" %d", n_target); 4856 printf(" %d", n_data); 4857 printf("\n"); 4858 } 4859 } 4860 } 4861 } 4862 function_tests++; 4863 4864 return(test_ret); 4865 } 4866 4867 4868 static int 4869 test_xmlSAX2Reference(void) { 4870 int test_ret = 0; 4871 4872 int mem_base; 4873 void * ctx; /* the user data (XML parser context) */ 4874 int n_ctx; 4875 xmlChar * name; /* The entity name */ 4876 int n_name; 4877 4878 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { 4879 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { 4880 mem_base = xmlMemBlocks(); 4881 ctx = gen_void_ptr(n_ctx, 0); 4882 name = gen_const_xmlChar_ptr(n_name, 1); 4883 4884 xmlSAX2Reference(ctx, (const xmlChar *)name); 4885 call_tests++; 4886 des_void_ptr(n_ctx, ctx, 0); 4887 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); 4888 xmlResetLastError(); 4889 if (mem_base != xmlMemBlocks()) { 4890 printf("Leak of %d blocks found in xmlSAX2Reference", 4891 xmlMemBlocks() - mem_base); 4892 test_ret++; 4893 printf(" %d", n_ctx); 4894 printf(" %d", n_name); 4895 printf("\n"); 4896 } 4897 } 4898 } 4899 function_tests++; 4900 4901 return(test_ret); 4902 } 4903 4904 4905 static int 4906 test_xmlSAX2ResolveEntity(void) { 4907 int test_ret = 0; 4908 4909 int mem_base; 4910 xmlParserInputPtr ret_val; 4911 void * ctx; /* the user data (XML parser context) */ 4912 int n_ctx; 4913 xmlChar * publicId; /* The public ID of the entity */ 4914 int n_publicId; 4915 xmlChar * systemId; /* The system ID of the entity */ 4916 int n_systemId; 4917 4918 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { 4919 for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) { 4920 for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) { 4921 mem_base = xmlMemBlocks(); 4922 ctx = gen_void_ptr(n_ctx, 0); 4923 publicId = gen_const_xmlChar_ptr(n_publicId, 1); 4924 systemId = gen_const_xmlChar_ptr(n_systemId, 2); 4925 4926 ret_val = xmlSAX2ResolveEntity(ctx, (const xmlChar *)publicId, (const xmlChar *)systemId); 4927 desret_xmlParserInputPtr(ret_val); 4928 call_tests++; 4929 des_void_ptr(n_ctx, ctx, 0); 4930 des_const_xmlChar_ptr(n_publicId, (const xmlChar *)publicId, 1); 4931 des_const_xmlChar_ptr(n_systemId, (const xmlChar *)systemId, 2); 4932 xmlResetLastError(); 4933 if (mem_base != xmlMemBlocks()) { 4934 printf("Leak of %d blocks found in xmlSAX2ResolveEntity", 4935 xmlMemBlocks() - mem_base); 4936 test_ret++; 4937 printf(" %d", n_ctx); 4938 printf(" %d", n_publicId); 4939 printf(" %d", n_systemId); 4940 printf("\n"); 4941 } 4942 } 4943 } 4944 } 4945 function_tests++; 4946 4947 return(test_ret); 4948 } 4949 4950 4951 #define gen_nb_xmlSAXLocatorPtr 1 4952 static xmlSAXLocatorPtr gen_xmlSAXLocatorPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 4953 return(NULL); 4954 } 4955 static void des_xmlSAXLocatorPtr(int no ATTRIBUTE_UNUSED, xmlSAXLocatorPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 4956 } 4957 4958 static int 4959 test_xmlSAX2SetDocumentLocator(void) { 4960 int test_ret = 0; 4961 4962 int mem_base; 4963 void * ctx; /* the user data (XML parser context) */ 4964 int n_ctx; 4965 xmlSAXLocatorPtr loc; /* A SAX Locator */ 4966 int n_loc; 4967 4968 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { 4969 for (n_loc = 0;n_loc < gen_nb_xmlSAXLocatorPtr;n_loc++) { 4970 mem_base = xmlMemBlocks(); 4971 ctx = gen_void_ptr(n_ctx, 0); 4972 loc = gen_xmlSAXLocatorPtr(n_loc, 1); 4973 4974 xmlSAX2SetDocumentLocator(ctx, loc); 4975 call_tests++; 4976 des_void_ptr(n_ctx, ctx, 0); 4977 des_xmlSAXLocatorPtr(n_loc, loc, 1); 4978 xmlResetLastError(); 4979 if (mem_base != xmlMemBlocks()) { 4980 printf("Leak of %d blocks found in xmlSAX2SetDocumentLocator", 4981 xmlMemBlocks() - mem_base); 4982 test_ret++; 4983 printf(" %d", n_ctx); 4984 printf(" %d", n_loc); 4985 printf("\n"); 4986 } 4987 } 4988 } 4989 function_tests++; 4990 4991 return(test_ret); 4992 } 4993 4994 4995 static int 4996 test_xmlSAX2StartDocument(void) { 4997 int test_ret = 0; 4998 4999 int mem_base; 5000 void * ctx; /* the user data (XML parser context) */ 5001 int n_ctx; 5002 5003 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { 5004 mem_base = xmlMemBlocks(); 5005 ctx = gen_void_ptr(n_ctx, 0); 5006 5007 xmlSAX2StartDocument(ctx); 5008 call_tests++; 5009 des_void_ptr(n_ctx, ctx, 0); 5010 xmlResetLastError(); 5011 if (mem_base != xmlMemBlocks()) { 5012 printf("Leak of %d blocks found in xmlSAX2StartDocument", 5013 xmlMemBlocks() - mem_base); 5014 test_ret++; 5015 printf(" %d", n_ctx); 5016 printf("\n"); 5017 } 5018 } 5019 function_tests++; 5020 5021 return(test_ret); 5022 } 5023 5024 5025 static int 5026 test_xmlSAX2StartElement(void) { 5027 int test_ret = 0; 5028 5029 #if defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_DOCB_ENABLED) || defined(LIBXML_LEGACY_ENABLED) 5030 #ifdef LIBXML_SAX1_ENABLED 5031 int mem_base; 5032 void * ctx; /* the user data (XML parser context) */ 5033 int n_ctx; 5034 xmlChar * fullname; /* The element name, including namespace prefix */ 5035 int n_fullname; 5036 xmlChar ** atts; /* An array of name/value attributes pairs, NULL terminated */ 5037 int n_atts; 5038 5039 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { 5040 for (n_fullname = 0;n_fullname < gen_nb_const_xmlChar_ptr;n_fullname++) { 5041 for (n_atts = 0;n_atts < gen_nb_const_xmlChar_ptr_ptr;n_atts++) { 5042 mem_base = xmlMemBlocks(); 5043 ctx = gen_void_ptr(n_ctx, 0); 5044 fullname = gen_const_xmlChar_ptr(n_fullname, 1); 5045 atts = gen_const_xmlChar_ptr_ptr(n_atts, 2); 5046 5047 xmlSAX2StartElement(ctx, (const xmlChar *)fullname, (const xmlChar **)atts); 5048 call_tests++; 5049 des_void_ptr(n_ctx, ctx, 0); 5050 des_const_xmlChar_ptr(n_fullname, (const xmlChar *)fullname, 1); 5051 des_const_xmlChar_ptr_ptr(n_atts, (const xmlChar **)atts, 2); 5052 xmlResetLastError(); 5053 if (mem_base != xmlMemBlocks()) { 5054 printf("Leak of %d blocks found in xmlSAX2StartElement", 5055 xmlMemBlocks() - mem_base); 5056 test_ret++; 5057 printf(" %d", n_ctx); 5058 printf(" %d", n_fullname); 5059 printf(" %d", n_atts); 5060 printf("\n"); 5061 } 5062 } 5063 } 5064 } 5065 function_tests++; 5066 #endif 5067 #endif 5068 5069 return(test_ret); 5070 } 5071 5072 5073 static int 5074 test_xmlSAX2StartElementNs(void) { 5075 int test_ret = 0; 5076 5077 int mem_base; 5078 void * ctx; /* the user data (XML parser context) */ 5079 int n_ctx; 5080 xmlChar * localname; /* the local name of the element */ 5081 int n_localname; 5082 xmlChar * prefix; /* the element namespace prefix if available */ 5083 int n_prefix; 5084 xmlChar * URI; /* the element namespace name if available */ 5085 int n_URI; 5086 int nb_namespaces; /* number of namespace definitions on that node */ 5087 int n_nb_namespaces; 5088 xmlChar ** namespaces; /* pointer to the array of prefix/URI pairs namespace definitions */ 5089 int n_namespaces; 5090 int nb_attributes; /* the number of attributes on that node */ 5091 int n_nb_attributes; 5092 int nb_defaulted; /* the number of defaulted attributes. */ 5093 int n_nb_defaulted; 5094 xmlChar ** attributes; /* pointer to the array of (localname/prefix/URI/value/end) attribute values. */ 5095 int n_attributes; 5096 5097 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { 5098 for (n_localname = 0;n_localname < gen_nb_const_xmlChar_ptr;n_localname++) { 5099 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) { 5100 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) { 5101 for (n_nb_namespaces = 0;n_nb_namespaces < gen_nb_int;n_nb_namespaces++) { 5102 for (n_namespaces = 0;n_namespaces < gen_nb_const_xmlChar_ptr_ptr;n_namespaces++) { 5103 for (n_nb_attributes = 0;n_nb_attributes < gen_nb_int;n_nb_attributes++) { 5104 for (n_nb_defaulted = 0;n_nb_defaulted < gen_nb_int;n_nb_defaulted++) { 5105 for (n_attributes = 0;n_attributes < gen_nb_const_xmlChar_ptr_ptr;n_attributes++) { 5106 mem_base = xmlMemBlocks(); 5107 ctx = gen_void_ptr(n_ctx, 0); 5108 localname = gen_const_xmlChar_ptr(n_localname, 1); 5109 prefix = gen_const_xmlChar_ptr(n_prefix, 2); 5110 URI = gen_const_xmlChar_ptr(n_URI, 3); 5111 nb_namespaces = gen_int(n_nb_namespaces, 4); 5112 namespaces = gen_const_xmlChar_ptr_ptr(n_namespaces, 5); 5113 nb_attributes = gen_int(n_nb_attributes, 6); 5114 nb_defaulted = gen_int(n_nb_defaulted, 7); 5115 attributes = gen_const_xmlChar_ptr_ptr(n_attributes, 8); 5116 5117 xmlSAX2StartElementNs(ctx, (const xmlChar *)localname, (const xmlChar *)prefix, (const xmlChar *)URI, nb_namespaces, (const xmlChar **)namespaces, nb_attributes, nb_defaulted, (const xmlChar **)attributes); 5118 call_tests++; 5119 des_void_ptr(n_ctx, ctx, 0); 5120 des_const_xmlChar_ptr(n_localname, (const xmlChar *)localname, 1); 5121 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 2); 5122 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 3); 5123 des_int(n_nb_namespaces, nb_namespaces, 4); 5124 des_const_xmlChar_ptr_ptr(n_namespaces, (const xmlChar **)namespaces, 5); 5125 des_int(n_nb_attributes, nb_attributes, 6); 5126 des_int(n_nb_defaulted, nb_defaulted, 7); 5127 des_const_xmlChar_ptr_ptr(n_attributes, (const xmlChar **)attributes, 8); 5128 xmlResetLastError(); 5129 if (mem_base != xmlMemBlocks()) { 5130 printf("Leak of %d blocks found in xmlSAX2StartElementNs", 5131 xmlMemBlocks() - mem_base); 5132 test_ret++; 5133 printf(" %d", n_ctx); 5134 printf(" %d", n_localname); 5135 printf(" %d", n_prefix); 5136 printf(" %d", n_URI); 5137 printf(" %d", n_nb_namespaces); 5138 printf(" %d", n_namespaces); 5139 printf(" %d", n_nb_attributes); 5140 printf(" %d", n_nb_defaulted); 5141 printf(" %d", n_attributes); 5142 printf("\n"); 5143 } 5144 } 5145 } 5146 } 5147 } 5148 } 5149 } 5150 } 5151 } 5152 } 5153 function_tests++; 5154 5155 return(test_ret); 5156 } 5157 5158 5159 static int 5160 test_xmlSAX2UnparsedEntityDecl(void) { 5161 int test_ret = 0; 5162 5163 int mem_base; 5164 void * ctx; /* the user data (XML parser context) */ 5165 int n_ctx; 5166 xmlChar * name; /* The name of the entity */ 5167 int n_name; 5168 xmlChar * publicId; /* The public ID of the entity */ 5169 int n_publicId; 5170 xmlChar * systemId; /* The system ID of the entity */ 5171 int n_systemId; 5172 xmlChar * notationName; /* the name of the notation */ 5173 int n_notationName; 5174 5175 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { 5176 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { 5177 for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) { 5178 for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) { 5179 for (n_notationName = 0;n_notationName < gen_nb_const_xmlChar_ptr;n_notationName++) { 5180 mem_base = xmlMemBlocks(); 5181 ctx = gen_void_ptr(n_ctx, 0); 5182 name = gen_const_xmlChar_ptr(n_name, 1); 5183 publicId = gen_const_xmlChar_ptr(n_publicId, 2); 5184 systemId = gen_const_xmlChar_ptr(n_systemId, 3); 5185 notationName = gen_const_xmlChar_ptr(n_notationName, 4); 5186 5187 xmlSAX2UnparsedEntityDecl(ctx, (const xmlChar *)name, (const xmlChar *)publicId, (const xmlChar *)systemId, (const xmlChar *)notationName); 5188 call_tests++; 5189 des_void_ptr(n_ctx, ctx, 0); 5190 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); 5191 des_const_xmlChar_ptr(n_publicId, (const xmlChar *)publicId, 2); 5192 des_const_xmlChar_ptr(n_systemId, (const xmlChar *)systemId, 3); 5193 des_const_xmlChar_ptr(n_notationName, (const xmlChar *)notationName, 4); 5194 xmlResetLastError(); 5195 if (mem_base != xmlMemBlocks()) { 5196 printf("Leak of %d blocks found in xmlSAX2UnparsedEntityDecl", 5197 xmlMemBlocks() - mem_base); 5198 test_ret++; 5199 printf(" %d", n_ctx); 5200 printf(" %d", n_name); 5201 printf(" %d", n_publicId); 5202 printf(" %d", n_systemId); 5203 printf(" %d", n_notationName); 5204 printf("\n"); 5205 } 5206 } 5207 } 5208 } 5209 } 5210 } 5211 function_tests++; 5212 5213 return(test_ret); 5214 } 5215 5216 5217 static int 5218 test_xmlSAXDefaultVersion(void) { 5219 int test_ret = 0; 5220 5221 #if defined(LIBXML_SAX1_ENABLED) 5222 #ifdef LIBXML_SAX1_ENABLED 5223 int mem_base; 5224 int ret_val; 5225 int version; /* the version, 1 or 2 */ 5226 int n_version; 5227 5228 for (n_version = 0;n_version < gen_nb_int;n_version++) { 5229 mem_base = xmlMemBlocks(); 5230 version = gen_int(n_version, 0); 5231 5232 ret_val = xmlSAXDefaultVersion(version); 5233 desret_int(ret_val); 5234 call_tests++; 5235 des_int(n_version, version, 0); 5236 xmlResetLastError(); 5237 if (mem_base != xmlMemBlocks()) { 5238 printf("Leak of %d blocks found in xmlSAXDefaultVersion", 5239 xmlMemBlocks() - mem_base); 5240 test_ret++; 5241 printf(" %d", n_version); 5242 printf("\n"); 5243 } 5244 } 5245 function_tests++; 5246 #endif 5247 #endif 5248 5249 return(test_ret); 5250 } 5251 5252 5253 static int 5254 test_xmlSAXVersion(void) { 5255 int test_ret = 0; 5256 5257 int mem_base; 5258 int ret_val; 5259 xmlSAXHandler * hdlr; /* the SAX handler */ 5260 int n_hdlr; 5261 int version; /* the version, 1 or 2 */ 5262 int n_version; 5263 5264 for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) { 5265 for (n_version = 0;n_version < gen_nb_int;n_version++) { 5266 mem_base = xmlMemBlocks(); 5267 hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0); 5268 version = gen_int(n_version, 1); 5269 5270 ret_val = xmlSAXVersion(hdlr, version); 5271 desret_int(ret_val); 5272 call_tests++; 5273 des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0); 5274 des_int(n_version, version, 1); 5275 xmlResetLastError(); 5276 if (mem_base != xmlMemBlocks()) { 5277 printf("Leak of %d blocks found in xmlSAXVersion", 5278 xmlMemBlocks() - mem_base); 5279 test_ret++; 5280 printf(" %d", n_hdlr); 5281 printf(" %d", n_version); 5282 printf("\n"); 5283 } 5284 } 5285 } 5286 function_tests++; 5287 5288 return(test_ret); 5289 } 5290 5291 static int 5292 test_SAX2(void) { 5293 int test_ret = 0; 5294 5295 if (quiet == 0) printf("Testing SAX2 : 38 of 38 functions ...\n"); 5296 test_ret += test_docbDefaultSAXHandlerInit(); 5297 test_ret += test_htmlDefaultSAXHandlerInit(); 5298 test_ret += test_xmlDefaultSAXHandlerInit(); 5299 test_ret += test_xmlSAX2AttributeDecl(); 5300 test_ret += test_xmlSAX2CDataBlock(); 5301 test_ret += test_xmlSAX2Characters(); 5302 test_ret += test_xmlSAX2Comment(); 5303 test_ret += test_xmlSAX2ElementDecl(); 5304 test_ret += test_xmlSAX2EndDocument(); 5305 test_ret += test_xmlSAX2EndElement(); 5306 test_ret += test_xmlSAX2EndElementNs(); 5307 test_ret += test_xmlSAX2EntityDecl(); 5308 test_ret += test_xmlSAX2ExternalSubset(); 5309 test_ret += test_xmlSAX2GetColumnNumber(); 5310 test_ret += test_xmlSAX2GetEntity(); 5311 test_ret += test_xmlSAX2GetLineNumber(); 5312 test_ret += test_xmlSAX2GetParameterEntity(); 5313 test_ret += test_xmlSAX2GetPublicId(); 5314 test_ret += test_xmlSAX2GetSystemId(); 5315 test_ret += test_xmlSAX2HasExternalSubset(); 5316 test_ret += test_xmlSAX2HasInternalSubset(); 5317 test_ret += test_xmlSAX2IgnorableWhitespace(); 5318 test_ret += test_xmlSAX2InitDefaultSAXHandler(); 5319 test_ret += test_xmlSAX2InitDocbDefaultSAXHandler(); 5320 test_ret += test_xmlSAX2InitHtmlDefaultSAXHandler(); 5321 test_ret += test_xmlSAX2InternalSubset(); 5322 test_ret += test_xmlSAX2IsStandalone(); 5323 test_ret += test_xmlSAX2NotationDecl(); 5324 test_ret += test_xmlSAX2ProcessingInstruction(); 5325 test_ret += test_xmlSAX2Reference(); 5326 test_ret += test_xmlSAX2ResolveEntity(); 5327 test_ret += test_xmlSAX2SetDocumentLocator(); 5328 test_ret += test_xmlSAX2StartDocument(); 5329 test_ret += test_xmlSAX2StartElement(); 5330 test_ret += test_xmlSAX2StartElementNs(); 5331 test_ret += test_xmlSAX2UnparsedEntityDecl(); 5332 test_ret += test_xmlSAXDefaultVersion(); 5333 test_ret += test_xmlSAXVersion(); 5334 5335 if (test_ret != 0) 5336 printf("Module SAX2: %d errors\n", test_ret); 5337 return(test_ret); 5338 } 5339 5340 static int 5341 test_xmlC14NDocDumpMemory(void) { 5342 int test_ret = 0; 5343 5344 #if defined(LIBXML_C14N_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) 5345 int mem_base; 5346 int ret_val; 5347 xmlDocPtr doc; /* the XML document for canonization */ 5348 int n_doc; 5349 xmlNodeSetPtr nodes; /* the nodes set to be included in the canonized image or NULL if all document nodes should be included */ 5350 int n_nodes; 5351 int mode; /* the c14n mode (see @xmlC14NMode) */ 5352 int n_mode; 5353 xmlChar ** inclusive_ns_prefixes; /* the list of inclusive namespace prefixes ended with a NULL or NULL if there is no inclusive namespaces (only for exclusive canonicalization, ignored otherwise) */ 5354 int n_inclusive_ns_prefixes; 5355 int with_comments; /* include comments in the result (!=0) or not (==0) */ 5356 int n_with_comments; 5357 xmlChar ** doc_txt_ptr; /* the memory pointer for allocated canonical XML text; the caller of this functions is responsible for calling xmlFree() to free allocated memory */ 5358 int n_doc_txt_ptr; 5359 5360 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { 5361 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) { 5362 for (n_mode = 0;n_mode < gen_nb_int;n_mode++) { 5363 for (n_inclusive_ns_prefixes = 0;n_inclusive_ns_prefixes < gen_nb_xmlChar_ptr_ptr;n_inclusive_ns_prefixes++) { 5364 for (n_with_comments = 0;n_with_comments < gen_nb_int;n_with_comments++) { 5365 for (n_doc_txt_ptr = 0;n_doc_txt_ptr < gen_nb_xmlChar_ptr_ptr;n_doc_txt_ptr++) { 5366 mem_base = xmlMemBlocks(); 5367 doc = gen_xmlDocPtr(n_doc, 0); 5368 nodes = gen_xmlNodeSetPtr(n_nodes, 1); 5369 mode = gen_int(n_mode, 2); 5370 inclusive_ns_prefixes = gen_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, 3); 5371 with_comments = gen_int(n_with_comments, 4); 5372 doc_txt_ptr = gen_xmlChar_ptr_ptr(n_doc_txt_ptr, 5); 5373 5374 ret_val = xmlC14NDocDumpMemory(doc, nodes, mode, inclusive_ns_prefixes, with_comments, doc_txt_ptr); 5375 desret_int(ret_val); 5376 call_tests++; 5377 des_xmlDocPtr(n_doc, doc, 0); 5378 des_xmlNodeSetPtr(n_nodes, nodes, 1); 5379 des_int(n_mode, mode, 2); 5380 des_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, inclusive_ns_prefixes, 3); 5381 des_int(n_with_comments, with_comments, 4); 5382 des_xmlChar_ptr_ptr(n_doc_txt_ptr, doc_txt_ptr, 5); 5383 xmlResetLastError(); 5384 if (mem_base != xmlMemBlocks()) { 5385 printf("Leak of %d blocks found in xmlC14NDocDumpMemory", 5386 xmlMemBlocks() - mem_base); 5387 test_ret++; 5388 printf(" %d", n_doc); 5389 printf(" %d", n_nodes); 5390 printf(" %d", n_mode); 5391 printf(" %d", n_inclusive_ns_prefixes); 5392 printf(" %d", n_with_comments); 5393 printf(" %d", n_doc_txt_ptr); 5394 printf("\n"); 5395 } 5396 } 5397 } 5398 } 5399 } 5400 } 5401 } 5402 function_tests++; 5403 #endif 5404 5405 return(test_ret); 5406 } 5407 5408 5409 static int 5410 test_xmlC14NDocSave(void) { 5411 int test_ret = 0; 5412 5413 #if defined(LIBXML_C14N_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) 5414 int mem_base; 5415 int ret_val; 5416 xmlDocPtr doc; /* the XML document for canonization */ 5417 int n_doc; 5418 xmlNodeSetPtr nodes; /* the nodes set to be included in the canonized image or NULL if all document nodes should be included */ 5419 int n_nodes; 5420 int mode; /* the c14n mode (see @xmlC14NMode) */ 5421 int n_mode; 5422 xmlChar ** inclusive_ns_prefixes; /* the list of inclusive namespace prefixes ended with a NULL or NULL if there is no inclusive namespaces (only for exclusive canonicalization, ignored otherwise) */ 5423 int n_inclusive_ns_prefixes; 5424 int with_comments; /* include comments in the result (!=0) or not (==0) */ 5425 int n_with_comments; 5426 const char * filename; /* the filename to store canonical XML image */ 5427 int n_filename; 5428 int compression; /* the compression level (zlib requred): -1 - libxml default, 0 - uncompressed, >0 - compression level */ 5429 int n_compression; 5430 5431 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { 5432 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) { 5433 for (n_mode = 0;n_mode < gen_nb_int;n_mode++) { 5434 for (n_inclusive_ns_prefixes = 0;n_inclusive_ns_prefixes < gen_nb_xmlChar_ptr_ptr;n_inclusive_ns_prefixes++) { 5435 for (n_with_comments = 0;n_with_comments < gen_nb_int;n_with_comments++) { 5436 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) { 5437 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) { 5438 mem_base = xmlMemBlocks(); 5439 doc = gen_xmlDocPtr(n_doc, 0); 5440 nodes = gen_xmlNodeSetPtr(n_nodes, 1); 5441 mode = gen_int(n_mode, 2); 5442 inclusive_ns_prefixes = gen_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, 3); 5443 with_comments = gen_int(n_with_comments, 4); 5444 filename = gen_fileoutput(n_filename, 5); 5445 compression = gen_int(n_compression, 6); 5446 5447 ret_val = xmlC14NDocSave(doc, nodes, mode, inclusive_ns_prefixes, with_comments, filename, compression); 5448 desret_int(ret_val); 5449 call_tests++; 5450 des_xmlDocPtr(n_doc, doc, 0); 5451 des_xmlNodeSetPtr(n_nodes, nodes, 1); 5452 des_int(n_mode, mode, 2); 5453 des_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, inclusive_ns_prefixes, 3); 5454 des_int(n_with_comments, with_comments, 4); 5455 des_fileoutput(n_filename, filename, 5); 5456 des_int(n_compression, compression, 6); 5457 xmlResetLastError(); 5458 if (mem_base != xmlMemBlocks()) { 5459 printf("Leak of %d blocks found in xmlC14NDocSave", 5460 xmlMemBlocks() - mem_base); 5461 test_ret++; 5462 printf(" %d", n_doc); 5463 printf(" %d", n_nodes); 5464 printf(" %d", n_mode); 5465 printf(" %d", n_inclusive_ns_prefixes); 5466 printf(" %d", n_with_comments); 5467 printf(" %d", n_filename); 5468 printf(" %d", n_compression); 5469 printf("\n"); 5470 } 5471 } 5472 } 5473 } 5474 } 5475 } 5476 } 5477 } 5478 function_tests++; 5479 #endif 5480 5481 return(test_ret); 5482 } 5483 5484 5485 static int 5486 test_xmlC14NDocSaveTo(void) { 5487 int test_ret = 0; 5488 5489 #if defined(LIBXML_C14N_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) 5490 int mem_base; 5491 int ret_val; 5492 xmlDocPtr doc; /* the XML document for canonization */ 5493 int n_doc; 5494 xmlNodeSetPtr nodes; /* the nodes set to be included in the canonized image or NULL if all document nodes should be included */ 5495 int n_nodes; 5496 int mode; /* the c14n mode (see @xmlC14NMode) */ 5497 int n_mode; 5498 xmlChar ** inclusive_ns_prefixes; /* the list of inclusive namespace prefixes ended with a NULL or NULL if there is no inclusive namespaces (only for exclusive canonicalization, ignored otherwise) */ 5499 int n_inclusive_ns_prefixes; 5500 int with_comments; /* include comments in the result (!=0) or not (==0) */ 5501 int n_with_comments; 5502 xmlOutputBufferPtr buf; /* the output buffer to store canonical XML; this buffer MUST have encoder==NULL because C14N requires UTF-8 output */ 5503 int n_buf; 5504 5505 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { 5506 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) { 5507 for (n_mode = 0;n_mode < gen_nb_int;n_mode++) { 5508 for (n_inclusive_ns_prefixes = 0;n_inclusive_ns_prefixes < gen_nb_xmlChar_ptr_ptr;n_inclusive_ns_prefixes++) { 5509 for (n_with_comments = 0;n_with_comments < gen_nb_int;n_with_comments++) { 5510 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) { 5511 mem_base = xmlMemBlocks(); 5512 doc = gen_xmlDocPtr(n_doc, 0); 5513 nodes = gen_xmlNodeSetPtr(n_nodes, 1); 5514 mode = gen_int(n_mode, 2); 5515 inclusive_ns_prefixes = gen_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, 3); 5516 with_comments = gen_int(n_with_comments, 4); 5517 buf = gen_xmlOutputBufferPtr(n_buf, 5); 5518 5519 ret_val = xmlC14NDocSaveTo(doc, nodes, mode, inclusive_ns_prefixes, with_comments, buf); 5520 desret_int(ret_val); 5521 call_tests++; 5522 des_xmlDocPtr(n_doc, doc, 0); 5523 des_xmlNodeSetPtr(n_nodes, nodes, 1); 5524 des_int(n_mode, mode, 2); 5525 des_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, inclusive_ns_prefixes, 3); 5526 des_int(n_with_comments, with_comments, 4); 5527 des_xmlOutputBufferPtr(n_buf, buf, 5); 5528 xmlResetLastError(); 5529 if (mem_base != xmlMemBlocks()) { 5530 printf("Leak of %d blocks found in xmlC14NDocSaveTo", 5531 xmlMemBlocks() - mem_base); 5532 test_ret++; 5533 printf(" %d", n_doc); 5534 printf(" %d", n_nodes); 5535 printf(" %d", n_mode); 5536 printf(" %d", n_inclusive_ns_prefixes); 5537 printf(" %d", n_with_comments); 5538 printf(" %d", n_buf); 5539 printf("\n"); 5540 } 5541 } 5542 } 5543 } 5544 } 5545 } 5546 } 5547 function_tests++; 5548 #endif 5549 5550 return(test_ret); 5551 } 5552 5553 5554 static int 5555 test_xmlC14NExecute(void) { 5556 int test_ret = 0; 5557 5558 5559 /* missing type support */ 5560 return(test_ret); 5561 } 5562 5563 static int 5564 test_c14n(void) { 5565 int test_ret = 0; 5566 5567 if (quiet == 0) printf("Testing c14n : 3 of 4 functions ...\n"); 5568 test_ret += test_xmlC14NDocDumpMemory(); 5569 test_ret += test_xmlC14NDocSave(); 5570 test_ret += test_xmlC14NDocSaveTo(); 5571 test_ret += test_xmlC14NExecute(); 5572 5573 if (test_ret != 0) 5574 printf("Module c14n: %d errors\n", test_ret); 5575 return(test_ret); 5576 } 5577 #ifdef LIBXML_CATALOG_ENABLED 5578 5579 #define gen_nb_xmlCatalogPtr 1 5580 static xmlCatalogPtr gen_xmlCatalogPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 5581 return(NULL); 5582 } 5583 static void des_xmlCatalogPtr(int no ATTRIBUTE_UNUSED, xmlCatalogPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 5584 } 5585 #endif 5586 5587 5588 static int 5589 test_xmlACatalogAdd(void) { 5590 int test_ret = 0; 5591 5592 #if defined(LIBXML_CATALOG_ENABLED) 5593 int mem_base; 5594 int ret_val; 5595 xmlCatalogPtr catal; /* a Catalog */ 5596 int n_catal; 5597 xmlChar * type; /* the type of record to add to the catalog */ 5598 int n_type; 5599 xmlChar * orig; /* the system, public or prefix to match */ 5600 int n_orig; 5601 xmlChar * replace; /* the replacement value for the match */ 5602 int n_replace; 5603 5604 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) { 5605 for (n_type = 0;n_type < gen_nb_const_xmlChar_ptr;n_type++) { 5606 for (n_orig = 0;n_orig < gen_nb_const_xmlChar_ptr;n_orig++) { 5607 for (n_replace = 0;n_replace < gen_nb_const_xmlChar_ptr;n_replace++) { 5608 mem_base = xmlMemBlocks(); 5609 catal = gen_xmlCatalogPtr(n_catal, 0); 5610 type = gen_const_xmlChar_ptr(n_type, 1); 5611 orig = gen_const_xmlChar_ptr(n_orig, 2); 5612 replace = gen_const_xmlChar_ptr(n_replace, 3); 5613 5614 ret_val = xmlACatalogAdd(catal, (const xmlChar *)type, (const xmlChar *)orig, (const xmlChar *)replace); 5615 desret_int(ret_val); 5616 call_tests++; 5617 des_xmlCatalogPtr(n_catal, catal, 0); 5618 des_const_xmlChar_ptr(n_type, (const xmlChar *)type, 1); 5619 des_const_xmlChar_ptr(n_orig, (const xmlChar *)orig, 2); 5620 des_const_xmlChar_ptr(n_replace, (const xmlChar *)replace, 3); 5621 xmlResetLastError(); 5622 if (mem_base != xmlMemBlocks()) { 5623 printf("Leak of %d blocks found in xmlACatalogAdd", 5624 xmlMemBlocks() - mem_base); 5625 test_ret++; 5626 printf(" %d", n_catal); 5627 printf(" %d", n_type); 5628 printf(" %d", n_orig); 5629 printf(" %d", n_replace); 5630 printf("\n"); 5631 } 5632 } 5633 } 5634 } 5635 } 5636 function_tests++; 5637 #endif 5638 5639 return(test_ret); 5640 } 5641 5642 5643 static int 5644 test_xmlACatalogDump(void) { 5645 int test_ret = 0; 5646 5647 #if defined(LIBXML_CATALOG_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) 5648 int mem_base; 5649 xmlCatalogPtr catal; /* a Catalog */ 5650 int n_catal; 5651 FILE * out; /* the file. */ 5652 int n_out; 5653 5654 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) { 5655 for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) { 5656 mem_base = xmlMemBlocks(); 5657 catal = gen_xmlCatalogPtr(n_catal, 0); 5658 out = gen_FILE_ptr(n_out, 1); 5659 5660 xmlACatalogDump(catal, out); 5661 call_tests++; 5662 des_xmlCatalogPtr(n_catal, catal, 0); 5663 des_FILE_ptr(n_out, out, 1); 5664 xmlResetLastError(); 5665 if (mem_base != xmlMemBlocks()) { 5666 printf("Leak of %d blocks found in xmlACatalogDump", 5667 xmlMemBlocks() - mem_base); 5668 test_ret++; 5669 printf(" %d", n_catal); 5670 printf(" %d", n_out); 5671 printf("\n"); 5672 } 5673 } 5674 } 5675 function_tests++; 5676 #endif 5677 5678 return(test_ret); 5679 } 5680 5681 5682 static int 5683 test_xmlACatalogRemove(void) { 5684 int test_ret = 0; 5685 5686 #if defined(LIBXML_CATALOG_ENABLED) 5687 int mem_base; 5688 int ret_val; 5689 xmlCatalogPtr catal; /* a Catalog */ 5690 int n_catal; 5691 xmlChar * value; /* the value to remove */ 5692 int n_value; 5693 5694 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) { 5695 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { 5696 mem_base = xmlMemBlocks(); 5697 catal = gen_xmlCatalogPtr(n_catal, 0); 5698 value = gen_const_xmlChar_ptr(n_value, 1); 5699 5700 ret_val = xmlACatalogRemove(catal, (const xmlChar *)value); 5701 desret_int(ret_val); 5702 call_tests++; 5703 des_xmlCatalogPtr(n_catal, catal, 0); 5704 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1); 5705 xmlResetLastError(); 5706 if (mem_base != xmlMemBlocks()) { 5707 printf("Leak of %d blocks found in xmlACatalogRemove", 5708 xmlMemBlocks() - mem_base); 5709 test_ret++; 5710 printf(" %d", n_catal); 5711 printf(" %d", n_value); 5712 printf("\n"); 5713 } 5714 } 5715 } 5716 function_tests++; 5717 #endif 5718 5719 return(test_ret); 5720 } 5721 5722 5723 static int 5724 test_xmlACatalogResolve(void) { 5725 int test_ret = 0; 5726 5727 #if defined(LIBXML_CATALOG_ENABLED) 5728 int mem_base; 5729 xmlChar * ret_val; 5730 xmlCatalogPtr catal; /* a Catalog */ 5731 int n_catal; 5732 xmlChar * pubID; /* the public ID string */ 5733 int n_pubID; 5734 xmlChar * sysID; /* the system ID string */ 5735 int n_sysID; 5736 5737 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) { 5738 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) { 5739 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) { 5740 mem_base = xmlMemBlocks(); 5741 catal = gen_xmlCatalogPtr(n_catal, 0); 5742 pubID = gen_const_xmlChar_ptr(n_pubID, 1); 5743 sysID = gen_const_xmlChar_ptr(n_sysID, 2); 5744 5745 ret_val = xmlACatalogResolve(catal, (const xmlChar *)pubID, (const xmlChar *)sysID); 5746 desret_xmlChar_ptr(ret_val); 5747 call_tests++; 5748 des_xmlCatalogPtr(n_catal, catal, 0); 5749 des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 1); 5750 des_const_xmlChar_ptr(n_sysID, (const xmlChar *)sysID, 2); 5751 xmlResetLastError(); 5752 if (mem_base != xmlMemBlocks()) { 5753 printf("Leak of %d blocks found in xmlACatalogResolve", 5754 xmlMemBlocks() - mem_base); 5755 test_ret++; 5756 printf(" %d", n_catal); 5757 printf(" %d", n_pubID); 5758 printf(" %d", n_sysID); 5759 printf("\n"); 5760 } 5761 } 5762 } 5763 } 5764 function_tests++; 5765 #endif 5766 5767 return(test_ret); 5768 } 5769 5770 5771 static int 5772 test_xmlACatalogResolvePublic(void) { 5773 int test_ret = 0; 5774 5775 #if defined(LIBXML_CATALOG_ENABLED) 5776 int mem_base; 5777 xmlChar * ret_val; 5778 xmlCatalogPtr catal; /* a Catalog */ 5779 int n_catal; 5780 xmlChar * pubID; /* the public ID string */ 5781 int n_pubID; 5782 5783 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) { 5784 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) { 5785 mem_base = xmlMemBlocks(); 5786 catal = gen_xmlCatalogPtr(n_catal, 0); 5787 pubID = gen_const_xmlChar_ptr(n_pubID, 1); 5788 5789 ret_val = xmlACatalogResolvePublic(catal, (const xmlChar *)pubID); 5790 desret_xmlChar_ptr(ret_val); 5791 call_tests++; 5792 des_xmlCatalogPtr(n_catal, catal, 0); 5793 des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 1); 5794 xmlResetLastError(); 5795 if (mem_base != xmlMemBlocks()) { 5796 printf("Leak of %d blocks found in xmlACatalogResolvePublic", 5797 xmlMemBlocks() - mem_base); 5798 test_ret++; 5799 printf(" %d", n_catal); 5800 printf(" %d", n_pubID); 5801 printf("\n"); 5802 } 5803 } 5804 } 5805 function_tests++; 5806 #endif 5807 5808 return(test_ret); 5809 } 5810 5811 5812 static int 5813 test_xmlACatalogResolveSystem(void) { 5814 int test_ret = 0; 5815 5816 #if defined(LIBXML_CATALOG_ENABLED) 5817 int mem_base; 5818 xmlChar * ret_val; 5819 xmlCatalogPtr catal; /* a Catalog */ 5820 int n_catal; 5821 xmlChar * sysID; /* the system ID string */ 5822 int n_sysID; 5823 5824 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) { 5825 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) { 5826 mem_base = xmlMemBlocks(); 5827 catal = gen_xmlCatalogPtr(n_catal, 0); 5828 sysID = gen_const_xmlChar_ptr(n_sysID, 1); 5829 5830 ret_val = xmlACatalogResolveSystem(catal, (const xmlChar *)sysID); 5831 desret_xmlChar_ptr(ret_val); 5832 call_tests++; 5833 des_xmlCatalogPtr(n_catal, catal, 0); 5834 des_const_xmlChar_ptr(n_sysID, (const xmlChar *)sysID, 1); 5835 xmlResetLastError(); 5836 if (mem_base != xmlMemBlocks()) { 5837 printf("Leak of %d blocks found in xmlACatalogResolveSystem", 5838 xmlMemBlocks() - mem_base); 5839 test_ret++; 5840 printf(" %d", n_catal); 5841 printf(" %d", n_sysID); 5842 printf("\n"); 5843 } 5844 } 5845 } 5846 function_tests++; 5847 #endif 5848 5849 return(test_ret); 5850 } 5851 5852 5853 static int 5854 test_xmlACatalogResolveURI(void) { 5855 int test_ret = 0; 5856 5857 #if defined(LIBXML_CATALOG_ENABLED) 5858 int mem_base; 5859 xmlChar * ret_val; 5860 xmlCatalogPtr catal; /* a Catalog */ 5861 int n_catal; 5862 xmlChar * URI; /* the URI */ 5863 int n_URI; 5864 5865 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) { 5866 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) { 5867 mem_base = xmlMemBlocks(); 5868 catal = gen_xmlCatalogPtr(n_catal, 0); 5869 URI = gen_const_xmlChar_ptr(n_URI, 1); 5870 5871 ret_val = xmlACatalogResolveURI(catal, (const xmlChar *)URI); 5872 desret_xmlChar_ptr(ret_val); 5873 call_tests++; 5874 des_xmlCatalogPtr(n_catal, catal, 0); 5875 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 1); 5876 xmlResetLastError(); 5877 if (mem_base != xmlMemBlocks()) { 5878 printf("Leak of %d blocks found in xmlACatalogResolveURI", 5879 xmlMemBlocks() - mem_base); 5880 test_ret++; 5881 printf(" %d", n_catal); 5882 printf(" %d", n_URI); 5883 printf("\n"); 5884 } 5885 } 5886 } 5887 function_tests++; 5888 #endif 5889 5890 return(test_ret); 5891 } 5892 5893 5894 static int 5895 test_xmlCatalogAdd(void) { 5896 int test_ret = 0; 5897 5898 #if defined(LIBXML_CATALOG_ENABLED) 5899 int mem_base; 5900 int ret_val; 5901 xmlChar * type; /* the type of record to add to the catalog */ 5902 int n_type; 5903 xmlChar * orig; /* the system, public or prefix to match */ 5904 int n_orig; 5905 xmlChar * replace; /* the replacement value for the match */ 5906 int n_replace; 5907 5908 for (n_type = 0;n_type < gen_nb_const_xmlChar_ptr;n_type++) { 5909 for (n_orig = 0;n_orig < gen_nb_const_xmlChar_ptr;n_orig++) { 5910 for (n_replace = 0;n_replace < gen_nb_const_xmlChar_ptr;n_replace++) { 5911 mem_base = xmlMemBlocks(); 5912 type = gen_const_xmlChar_ptr(n_type, 0); 5913 orig = gen_const_xmlChar_ptr(n_orig, 1); 5914 replace = gen_const_xmlChar_ptr(n_replace, 2); 5915 5916 ret_val = xmlCatalogAdd((const xmlChar *)type, (const xmlChar *)orig, (const xmlChar *)replace); 5917 desret_int(ret_val); 5918 call_tests++; 5919 des_const_xmlChar_ptr(n_type, (const xmlChar *)type, 0); 5920 des_const_xmlChar_ptr(n_orig, (const xmlChar *)orig, 1); 5921 des_const_xmlChar_ptr(n_replace, (const xmlChar *)replace, 2); 5922 xmlResetLastError(); 5923 if (mem_base != xmlMemBlocks()) { 5924 printf("Leak of %d blocks found in xmlCatalogAdd", 5925 xmlMemBlocks() - mem_base); 5926 test_ret++; 5927 printf(" %d", n_type); 5928 printf(" %d", n_orig); 5929 printf(" %d", n_replace); 5930 printf("\n"); 5931 } 5932 } 5933 } 5934 } 5935 function_tests++; 5936 #endif 5937 5938 return(test_ret); 5939 } 5940 5941 5942 static int 5943 test_xmlCatalogCleanup(void) { 5944 int test_ret = 0; 5945 5946 #if defined(LIBXML_CATALOG_ENABLED) 5947 5948 5949 xmlCatalogCleanup(); 5950 call_tests++; 5951 xmlResetLastError(); 5952 function_tests++; 5953 #endif 5954 5955 return(test_ret); 5956 } 5957 5958 5959 static int 5960 test_xmlCatalogConvert(void) { 5961 int test_ret = 0; 5962 5963 #if defined(LIBXML_CATALOG_ENABLED) 5964 int ret_val; 5965 5966 5967 ret_val = xmlCatalogConvert(); 5968 desret_int(ret_val); 5969 call_tests++; 5970 xmlResetLastError(); 5971 function_tests++; 5972 #endif 5973 5974 return(test_ret); 5975 } 5976 5977 5978 static int 5979 test_xmlCatalogDump(void) { 5980 int test_ret = 0; 5981 5982 #if defined(LIBXML_CATALOG_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) 5983 int mem_base; 5984 FILE * out; /* the file. */ 5985 int n_out; 5986 5987 for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) { 5988 mem_base = xmlMemBlocks(); 5989 out = gen_FILE_ptr(n_out, 0); 5990 5991 xmlCatalogDump(out); 5992 call_tests++; 5993 des_FILE_ptr(n_out, out, 0); 5994 xmlResetLastError(); 5995 if (mem_base != xmlMemBlocks()) { 5996 printf("Leak of %d blocks found in xmlCatalogDump", 5997 xmlMemBlocks() - mem_base); 5998 test_ret++; 5999 printf(" %d", n_out); 6000 printf("\n"); 6001 } 6002 } 6003 function_tests++; 6004 #endif 6005 6006 return(test_ret); 6007 } 6008 6009 6010 static int 6011 test_xmlCatalogGetDefaults(void) { 6012 int test_ret = 0; 6013 6014 #if defined(LIBXML_CATALOG_ENABLED) 6015 int mem_base; 6016 xmlCatalogAllow ret_val; 6017 6018 mem_base = xmlMemBlocks(); 6019 6020 ret_val = xmlCatalogGetDefaults(); 6021 desret_xmlCatalogAllow(ret_val); 6022 call_tests++; 6023 xmlResetLastError(); 6024 if (mem_base != xmlMemBlocks()) { 6025 printf("Leak of %d blocks found in xmlCatalogGetDefaults", 6026 xmlMemBlocks() - mem_base); 6027 test_ret++; 6028 printf("\n"); 6029 } 6030 function_tests++; 6031 #endif 6032 6033 return(test_ret); 6034 } 6035 6036 6037 static int 6038 test_xmlCatalogIsEmpty(void) { 6039 int test_ret = 0; 6040 6041 #if defined(LIBXML_CATALOG_ENABLED) 6042 int mem_base; 6043 int ret_val; 6044 xmlCatalogPtr catal; /* should this create an SGML catalog */ 6045 int n_catal; 6046 6047 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) { 6048 mem_base = xmlMemBlocks(); 6049 catal = gen_xmlCatalogPtr(n_catal, 0); 6050 6051 ret_val = xmlCatalogIsEmpty(catal); 6052 desret_int(ret_val); 6053 call_tests++; 6054 des_xmlCatalogPtr(n_catal, catal, 0); 6055 xmlResetLastError(); 6056 if (mem_base != xmlMemBlocks()) { 6057 printf("Leak of %d blocks found in xmlCatalogIsEmpty", 6058 xmlMemBlocks() - mem_base); 6059 test_ret++; 6060 printf(" %d", n_catal); 6061 printf("\n"); 6062 } 6063 } 6064 function_tests++; 6065 #endif 6066 6067 return(test_ret); 6068 } 6069 6070 6071 static int 6072 test_xmlCatalogLocalResolve(void) { 6073 int test_ret = 0; 6074 6075 #if defined(LIBXML_CATALOG_ENABLED) 6076 int mem_base; 6077 xmlChar * ret_val; 6078 void * catalogs; /* a document's list of catalogs */ 6079 int n_catalogs; 6080 xmlChar * pubID; /* the public ID string */ 6081 int n_pubID; 6082 xmlChar * sysID; /* the system ID string */ 6083 int n_sysID; 6084 6085 for (n_catalogs = 0;n_catalogs < gen_nb_void_ptr;n_catalogs++) { 6086 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) { 6087 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) { 6088 mem_base = xmlMemBlocks(); 6089 catalogs = gen_void_ptr(n_catalogs, 0); 6090 pubID = gen_const_xmlChar_ptr(n_pubID, 1); 6091 sysID = gen_const_xmlChar_ptr(n_sysID, 2); 6092 6093 ret_val = xmlCatalogLocalResolve(catalogs, (const xmlChar *)pubID, (const xmlChar *)sysID); 6094 desret_xmlChar_ptr(ret_val); 6095 call_tests++; 6096 des_void_ptr(n_catalogs, catalogs, 0); 6097 des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 1); 6098 des_const_xmlChar_ptr(n_sysID, (const xmlChar *)sysID, 2); 6099 xmlResetLastError(); 6100 if (mem_base != xmlMemBlocks()) { 6101 printf("Leak of %d blocks found in xmlCatalogLocalResolve", 6102 xmlMemBlocks() - mem_base); 6103 test_ret++; 6104 printf(" %d", n_catalogs); 6105 printf(" %d", n_pubID); 6106 printf(" %d", n_sysID); 6107 printf("\n"); 6108 } 6109 } 6110 } 6111 } 6112 function_tests++; 6113 #endif 6114 6115 return(test_ret); 6116 } 6117 6118 6119 static int 6120 test_xmlCatalogLocalResolveURI(void) { 6121 int test_ret = 0; 6122 6123 #if defined(LIBXML_CATALOG_ENABLED) 6124 int mem_base; 6125 xmlChar * ret_val; 6126 void * catalogs; /* a document's list of catalogs */ 6127 int n_catalogs; 6128 xmlChar * URI; /* the URI */ 6129 int n_URI; 6130 6131 for (n_catalogs = 0;n_catalogs < gen_nb_void_ptr;n_catalogs++) { 6132 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) { 6133 mem_base = xmlMemBlocks(); 6134 catalogs = gen_void_ptr(n_catalogs, 0); 6135 URI = gen_const_xmlChar_ptr(n_URI, 1); 6136 6137 ret_val = xmlCatalogLocalResolveURI(catalogs, (const xmlChar *)URI); 6138 desret_xmlChar_ptr(ret_val); 6139 call_tests++; 6140 des_void_ptr(n_catalogs, catalogs, 0); 6141 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 1); 6142 xmlResetLastError(); 6143 if (mem_base != xmlMemBlocks()) { 6144 printf("Leak of %d blocks found in xmlCatalogLocalResolveURI", 6145 xmlMemBlocks() - mem_base); 6146 test_ret++; 6147 printf(" %d", n_catalogs); 6148 printf(" %d", n_URI); 6149 printf("\n"); 6150 } 6151 } 6152 } 6153 function_tests++; 6154 #endif 6155 6156 return(test_ret); 6157 } 6158 6159 6160 static int 6161 test_xmlCatalogRemove(void) { 6162 int test_ret = 0; 6163 6164 #if defined(LIBXML_CATALOG_ENABLED) 6165 int ret_val; 6166 xmlChar * value; /* the value to remove */ 6167 int n_value; 6168 6169 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { 6170 value = gen_const_xmlChar_ptr(n_value, 0); 6171 6172 ret_val = xmlCatalogRemove((const xmlChar *)value); 6173 desret_int(ret_val); 6174 call_tests++; 6175 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0); 6176 xmlResetLastError(); 6177 } 6178 function_tests++; 6179 #endif 6180 6181 return(test_ret); 6182 } 6183 6184 6185 static int 6186 test_xmlCatalogResolve(void) { 6187 int test_ret = 0; 6188 6189 #if defined(LIBXML_CATALOG_ENABLED) 6190 xmlChar * ret_val; 6191 xmlChar * pubID; /* the public ID string */ 6192 int n_pubID; 6193 xmlChar * sysID; /* the system ID string */ 6194 int n_sysID; 6195 6196 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) { 6197 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) { 6198 pubID = gen_const_xmlChar_ptr(n_pubID, 0); 6199 sysID = gen_const_xmlChar_ptr(n_sysID, 1); 6200 6201 ret_val = xmlCatalogResolve((const xmlChar *)pubID, (const xmlChar *)sysID); 6202 desret_xmlChar_ptr(ret_val); 6203 call_tests++; 6204 des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 0); 6205 des_const_xmlChar_ptr(n_sysID, (const xmlChar *)sysID, 1); 6206 xmlResetLastError(); 6207 } 6208 } 6209 function_tests++; 6210 #endif 6211 6212 return(test_ret); 6213 } 6214 6215 6216 static int 6217 test_xmlCatalogResolvePublic(void) { 6218 int test_ret = 0; 6219 6220 #if defined(LIBXML_CATALOG_ENABLED) 6221 int mem_base; 6222 xmlChar * ret_val; 6223 xmlChar * pubID; /* the public ID string */ 6224 int n_pubID; 6225 6226 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) { 6227 mem_base = xmlMemBlocks(); 6228 pubID = gen_const_xmlChar_ptr(n_pubID, 0); 6229 6230 ret_val = xmlCatalogResolvePublic((const xmlChar *)pubID); 6231 desret_xmlChar_ptr(ret_val); 6232 call_tests++; 6233 des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 0); 6234 xmlResetLastError(); 6235 if (mem_base != xmlMemBlocks()) { 6236 printf("Leak of %d blocks found in xmlCatalogResolvePublic", 6237 xmlMemBlocks() - mem_base); 6238 test_ret++; 6239 printf(" %d", n_pubID); 6240 printf("\n"); 6241 } 6242 } 6243 function_tests++; 6244 #endif 6245 6246 return(test_ret); 6247 } 6248 6249 6250 static int 6251 test_xmlCatalogResolveSystem(void) { 6252 int test_ret = 0; 6253 6254 #if defined(LIBXML_CATALOG_ENABLED) 6255 int mem_base; 6256 xmlChar * ret_val; 6257 xmlChar * sysID; /* the system ID string */ 6258 int n_sysID; 6259 6260 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) { 6261 mem_base = xmlMemBlocks(); 6262 sysID = gen_const_xmlChar_ptr(n_sysID, 0); 6263 6264 ret_val = xmlCatalogResolveSystem((const xmlChar *)sysID); 6265 desret_xmlChar_ptr(ret_val); 6266 call_tests++; 6267 des_const_xmlChar_ptr(n_sysID, (const xmlChar *)sysID, 0); 6268 xmlResetLastError(); 6269 if (mem_base != xmlMemBlocks()) { 6270 printf("Leak of %d blocks found in xmlCatalogResolveSystem", 6271 xmlMemBlocks() - mem_base); 6272 test_ret++; 6273 printf(" %d", n_sysID); 6274 printf("\n"); 6275 } 6276 } 6277 function_tests++; 6278 #endif 6279 6280 return(test_ret); 6281 } 6282 6283 6284 static int 6285 test_xmlCatalogResolveURI(void) { 6286 int test_ret = 0; 6287 6288 #if defined(LIBXML_CATALOG_ENABLED) 6289 int mem_base; 6290 xmlChar * ret_val; 6291 xmlChar * URI; /* the URI */ 6292 int n_URI; 6293 6294 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) { 6295 mem_base = xmlMemBlocks(); 6296 URI = gen_const_xmlChar_ptr(n_URI, 0); 6297 6298 ret_val = xmlCatalogResolveURI((const xmlChar *)URI); 6299 desret_xmlChar_ptr(ret_val); 6300 call_tests++; 6301 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0); 6302 xmlResetLastError(); 6303 if (mem_base != xmlMemBlocks()) { 6304 printf("Leak of %d blocks found in xmlCatalogResolveURI", 6305 xmlMemBlocks() - mem_base); 6306 test_ret++; 6307 printf(" %d", n_URI); 6308 printf("\n"); 6309 } 6310 } 6311 function_tests++; 6312 #endif 6313 6314 return(test_ret); 6315 } 6316 6317 6318 static int 6319 test_xmlCatalogSetDefaultPrefer(void) { 6320 int test_ret = 0; 6321 6322 #if defined(LIBXML_CATALOG_ENABLED) 6323 int mem_base; 6324 xmlCatalogPrefer ret_val; 6325 xmlCatalogPrefer prefer; /* the default preference for delegation */ 6326 int n_prefer; 6327 6328 for (n_prefer = 0;n_prefer < gen_nb_xmlCatalogPrefer;n_prefer++) { 6329 mem_base = xmlMemBlocks(); 6330 prefer = gen_xmlCatalogPrefer(n_prefer, 0); 6331 6332 ret_val = xmlCatalogSetDefaultPrefer(prefer); 6333 desret_xmlCatalogPrefer(ret_val); 6334 call_tests++; 6335 des_xmlCatalogPrefer(n_prefer, prefer, 0); 6336 xmlResetLastError(); 6337 if (mem_base != xmlMemBlocks()) { 6338 printf("Leak of %d blocks found in xmlCatalogSetDefaultPrefer", 6339 xmlMemBlocks() - mem_base); 6340 test_ret++; 6341 printf(" %d", n_prefer); 6342 printf("\n"); 6343 } 6344 } 6345 function_tests++; 6346 #endif 6347 6348 return(test_ret); 6349 } 6350 6351 6352 static int 6353 test_xmlCatalogSetDefaults(void) { 6354 int test_ret = 0; 6355 6356 #if defined(LIBXML_CATALOG_ENABLED) 6357 int mem_base; 6358 xmlCatalogAllow allow; /* what catalogs should be accepted */ 6359 int n_allow; 6360 6361 for (n_allow = 0;n_allow < gen_nb_xmlCatalogAllow;n_allow++) { 6362 mem_base = xmlMemBlocks(); 6363 allow = gen_xmlCatalogAllow(n_allow, 0); 6364 6365 xmlCatalogSetDefaults(allow); 6366 call_tests++; 6367 des_xmlCatalogAllow(n_allow, allow, 0); 6368 xmlResetLastError(); 6369 if (mem_base != xmlMemBlocks()) { 6370 printf("Leak of %d blocks found in xmlCatalogSetDefaults", 6371 xmlMemBlocks() - mem_base); 6372 test_ret++; 6373 printf(" %d", n_allow); 6374 printf("\n"); 6375 } 6376 } 6377 function_tests++; 6378 #endif 6379 6380 return(test_ret); 6381 } 6382 6383 6384 static int 6385 test_xmlConvertSGMLCatalog(void) { 6386 int test_ret = 0; 6387 6388 #if defined(LIBXML_CATALOG_ENABLED) 6389 int mem_base; 6390 int ret_val; 6391 xmlCatalogPtr catal; /* the catalog */ 6392 int n_catal; 6393 6394 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) { 6395 mem_base = xmlMemBlocks(); 6396 catal = gen_xmlCatalogPtr(n_catal, 0); 6397 6398 ret_val = xmlConvertSGMLCatalog(catal); 6399 desret_int(ret_val); 6400 call_tests++; 6401 des_xmlCatalogPtr(n_catal, catal, 0); 6402 xmlResetLastError(); 6403 if (mem_base != xmlMemBlocks()) { 6404 printf("Leak of %d blocks found in xmlConvertSGMLCatalog", 6405 xmlMemBlocks() - mem_base); 6406 test_ret++; 6407 printf(" %d", n_catal); 6408 printf("\n"); 6409 } 6410 } 6411 function_tests++; 6412 #endif 6413 6414 return(test_ret); 6415 } 6416 6417 6418 static int 6419 test_xmlInitializeCatalog(void) { 6420 int test_ret = 0; 6421 6422 #if defined(LIBXML_CATALOG_ENABLED) 6423 int mem_base; 6424 6425 mem_base = xmlMemBlocks(); 6426 6427 xmlInitializeCatalog(); 6428 call_tests++; 6429 xmlResetLastError(); 6430 if (mem_base != xmlMemBlocks()) { 6431 printf("Leak of %d blocks found in xmlInitializeCatalog", 6432 xmlMemBlocks() - mem_base); 6433 test_ret++; 6434 printf("\n"); 6435 } 6436 function_tests++; 6437 #endif 6438 6439 return(test_ret); 6440 } 6441 6442 6443 static int 6444 test_xmlLoadACatalog(void) { 6445 int test_ret = 0; 6446 6447 6448 /* missing type support */ 6449 return(test_ret); 6450 } 6451 6452 6453 static int 6454 test_xmlLoadCatalog(void) { 6455 int test_ret = 0; 6456 6457 #if defined(LIBXML_CATALOG_ENABLED) 6458 int ret_val; 6459 const char * filename; /* a file path */ 6460 int n_filename; 6461 6462 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { 6463 filename = gen_filepath(n_filename, 0); 6464 6465 ret_val = xmlLoadCatalog(filename); 6466 desret_int(ret_val); 6467 call_tests++; 6468 des_filepath(n_filename, filename, 0); 6469 xmlResetLastError(); 6470 } 6471 function_tests++; 6472 #endif 6473 6474 return(test_ret); 6475 } 6476 6477 6478 static int 6479 test_xmlLoadCatalogs(void) { 6480 int test_ret = 0; 6481 6482 #if defined(LIBXML_CATALOG_ENABLED) 6483 char * pathss; /* a list of directories separated by a colon or a space. */ 6484 int n_pathss; 6485 6486 for (n_pathss = 0;n_pathss < gen_nb_const_char_ptr;n_pathss++) { 6487 pathss = gen_const_char_ptr(n_pathss, 0); 6488 6489 xmlLoadCatalogs((const char *)pathss); 6490 call_tests++; 6491 des_const_char_ptr(n_pathss, (const char *)pathss, 0); 6492 xmlResetLastError(); 6493 } 6494 function_tests++; 6495 #endif 6496 6497 return(test_ret); 6498 } 6499 6500 6501 static int 6502 test_xmlLoadSGMLSuperCatalog(void) { 6503 int test_ret = 0; 6504 6505 6506 /* missing type support */ 6507 return(test_ret); 6508 } 6509 6510 6511 static int 6512 test_xmlNewCatalog(void) { 6513 int test_ret = 0; 6514 6515 6516 /* missing type support */ 6517 return(test_ret); 6518 } 6519 6520 6521 static int 6522 test_xmlParseCatalogFile(void) { 6523 int test_ret = 0; 6524 6525 #if defined(LIBXML_CATALOG_ENABLED) 6526 int mem_base; 6527 xmlDocPtr ret_val; 6528 const char * filename; /* the filename */ 6529 int n_filename; 6530 6531 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { 6532 mem_base = xmlMemBlocks(); 6533 filename = gen_filepath(n_filename, 0); 6534 6535 ret_val = xmlParseCatalogFile(filename); 6536 desret_xmlDocPtr(ret_val); 6537 call_tests++; 6538 des_filepath(n_filename, filename, 0); 6539 xmlResetLastError(); 6540 if (mem_base != xmlMemBlocks()) { 6541 printf("Leak of %d blocks found in xmlParseCatalogFile", 6542 xmlMemBlocks() - mem_base); 6543 test_ret++; 6544 printf(" %d", n_filename); 6545 printf("\n"); 6546 } 6547 } 6548 function_tests++; 6549 #endif 6550 6551 return(test_ret); 6552 } 6553 6554 static int 6555 test_catalog(void) { 6556 int test_ret = 0; 6557 6558 if (quiet == 0) printf("Testing catalog : 27 of 36 functions ...\n"); 6559 test_ret += test_xmlACatalogAdd(); 6560 test_ret += test_xmlACatalogDump(); 6561 test_ret += test_xmlACatalogRemove(); 6562 test_ret += test_xmlACatalogResolve(); 6563 test_ret += test_xmlACatalogResolvePublic(); 6564 test_ret += test_xmlACatalogResolveSystem(); 6565 test_ret += test_xmlACatalogResolveURI(); 6566 test_ret += test_xmlCatalogAdd(); 6567 test_ret += test_xmlCatalogCleanup(); 6568 test_ret += test_xmlCatalogConvert(); 6569 test_ret += test_xmlCatalogDump(); 6570 test_ret += test_xmlCatalogGetDefaults(); 6571 test_ret += test_xmlCatalogIsEmpty(); 6572 test_ret += test_xmlCatalogLocalResolve(); 6573 test_ret += test_xmlCatalogLocalResolveURI(); 6574 test_ret += test_xmlCatalogRemove(); 6575 test_ret += test_xmlCatalogResolve(); 6576 test_ret += test_xmlCatalogResolvePublic(); 6577 test_ret += test_xmlCatalogResolveSystem(); 6578 test_ret += test_xmlCatalogResolveURI(); 6579 test_ret += test_xmlCatalogSetDefaultPrefer(); 6580 test_ret += test_xmlCatalogSetDefaults(); 6581 test_ret += test_xmlConvertSGMLCatalog(); 6582 test_ret += test_xmlInitializeCatalog(); 6583 test_ret += test_xmlLoadACatalog(); 6584 test_ret += test_xmlLoadCatalog(); 6585 test_ret += test_xmlLoadCatalogs(); 6586 test_ret += test_xmlLoadSGMLSuperCatalog(); 6587 test_ret += test_xmlNewCatalog(); 6588 test_ret += test_xmlParseCatalogFile(); 6589 6590 if (test_ret != 0) 6591 printf("Module catalog: %d errors\n", test_ret); 6592 return(test_ret); 6593 } 6594 6595 #define gen_nb_const_xmlChRangeGroup_ptr 1 6596 static xmlChRangeGroup * gen_const_xmlChRangeGroup_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 6597 return(NULL); 6598 } 6599 static void des_const_xmlChRangeGroup_ptr(int no ATTRIBUTE_UNUSED, const xmlChRangeGroup * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 6600 } 6601 6602 static int 6603 test_xmlCharInRange(void) { 6604 int test_ret = 0; 6605 6606 int mem_base; 6607 int ret_val; 6608 unsigned int val; /* character to be validated */ 6609 int n_val; 6610 xmlChRangeGroup * rptr; /* pointer to range to be used to validate */ 6611 int n_rptr; 6612 6613 for (n_val = 0;n_val < gen_nb_unsigned_int;n_val++) { 6614 for (n_rptr = 0;n_rptr < gen_nb_const_xmlChRangeGroup_ptr;n_rptr++) { 6615 mem_base = xmlMemBlocks(); 6616 val = gen_unsigned_int(n_val, 0); 6617 rptr = gen_const_xmlChRangeGroup_ptr(n_rptr, 1); 6618 6619 ret_val = xmlCharInRange(val, (const xmlChRangeGroup *)rptr); 6620 desret_int(ret_val); 6621 call_tests++; 6622 des_unsigned_int(n_val, val, 0); 6623 des_const_xmlChRangeGroup_ptr(n_rptr, (const xmlChRangeGroup *)rptr, 1); 6624 xmlResetLastError(); 6625 if (mem_base != xmlMemBlocks()) { 6626 printf("Leak of %d blocks found in xmlCharInRange", 6627 xmlMemBlocks() - mem_base); 6628 test_ret++; 6629 printf(" %d", n_val); 6630 printf(" %d", n_rptr); 6631 printf("\n"); 6632 } 6633 } 6634 } 6635 function_tests++; 6636 6637 return(test_ret); 6638 } 6639 6640 6641 static int 6642 test_xmlIsBaseChar(void) { 6643 int test_ret = 0; 6644 6645 int mem_base; 6646 int ret_val; 6647 unsigned int ch; /* character to validate */ 6648 int n_ch; 6649 6650 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) { 6651 mem_base = xmlMemBlocks(); 6652 ch = gen_unsigned_int(n_ch, 0); 6653 6654 ret_val = xmlIsBaseChar(ch); 6655 desret_int(ret_val); 6656 call_tests++; 6657 des_unsigned_int(n_ch, ch, 0); 6658 xmlResetLastError(); 6659 if (mem_base != xmlMemBlocks()) { 6660 printf("Leak of %d blocks found in xmlIsBaseChar", 6661 xmlMemBlocks() - mem_base); 6662 test_ret++; 6663 printf(" %d", n_ch); 6664 printf("\n"); 6665 } 6666 } 6667 function_tests++; 6668 6669 return(test_ret); 6670 } 6671 6672 6673 static int 6674 test_xmlIsBlank(void) { 6675 int test_ret = 0; 6676 6677 int mem_base; 6678 int ret_val; 6679 unsigned int ch; /* character to validate */ 6680 int n_ch; 6681 6682 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) { 6683 mem_base = xmlMemBlocks(); 6684 ch = gen_unsigned_int(n_ch, 0); 6685 6686 ret_val = xmlIsBlank(ch); 6687 desret_int(ret_val); 6688 call_tests++; 6689 des_unsigned_int(n_ch, ch, 0); 6690 xmlResetLastError(); 6691 if (mem_base != xmlMemBlocks()) { 6692 printf("Leak of %d blocks found in xmlIsBlank", 6693 xmlMemBlocks() - mem_base); 6694 test_ret++; 6695 printf(" %d", n_ch); 6696 printf("\n"); 6697 } 6698 } 6699 function_tests++; 6700 6701 return(test_ret); 6702 } 6703 6704 6705 static int 6706 test_xmlIsChar(void) { 6707 int test_ret = 0; 6708 6709 int mem_base; 6710 int ret_val; 6711 unsigned int ch; /* character to validate */ 6712 int n_ch; 6713 6714 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) { 6715 mem_base = xmlMemBlocks(); 6716 ch = gen_unsigned_int(n_ch, 0); 6717 6718 ret_val = xmlIsChar(ch); 6719 desret_int(ret_val); 6720 call_tests++; 6721 des_unsigned_int(n_ch, ch, 0); 6722 xmlResetLastError(); 6723 if (mem_base != xmlMemBlocks()) { 6724 printf("Leak of %d blocks found in xmlIsChar", 6725 xmlMemBlocks() - mem_base); 6726 test_ret++; 6727 printf(" %d", n_ch); 6728 printf("\n"); 6729 } 6730 } 6731 function_tests++; 6732 6733 return(test_ret); 6734 } 6735 6736 6737 static int 6738 test_xmlIsCombining(void) { 6739 int test_ret = 0; 6740 6741 int mem_base; 6742 int ret_val; 6743 unsigned int ch; /* character to validate */ 6744 int n_ch; 6745 6746 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) { 6747 mem_base = xmlMemBlocks(); 6748 ch = gen_unsigned_int(n_ch, 0); 6749 6750 ret_val = xmlIsCombining(ch); 6751 desret_int(ret_val); 6752 call_tests++; 6753 des_unsigned_int(n_ch, ch, 0); 6754 xmlResetLastError(); 6755 if (mem_base != xmlMemBlocks()) { 6756 printf("Leak of %d blocks found in xmlIsCombining", 6757 xmlMemBlocks() - mem_base); 6758 test_ret++; 6759 printf(" %d", n_ch); 6760 printf("\n"); 6761 } 6762 } 6763 function_tests++; 6764 6765 return(test_ret); 6766 } 6767 6768 6769 static int 6770 test_xmlIsDigit(void) { 6771 int test_ret = 0; 6772 6773 int mem_base; 6774 int ret_val; 6775 unsigned int ch; /* character to validate */ 6776 int n_ch; 6777 6778 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) { 6779 mem_base = xmlMemBlocks(); 6780 ch = gen_unsigned_int(n_ch, 0); 6781 6782 ret_val = xmlIsDigit(ch); 6783 desret_int(ret_val); 6784 call_tests++; 6785 des_unsigned_int(n_ch, ch, 0); 6786 xmlResetLastError(); 6787 if (mem_base != xmlMemBlocks()) { 6788 printf("Leak of %d blocks found in xmlIsDigit", 6789 xmlMemBlocks() - mem_base); 6790 test_ret++; 6791 printf(" %d", n_ch); 6792 printf("\n"); 6793 } 6794 } 6795 function_tests++; 6796 6797 return(test_ret); 6798 } 6799 6800 6801 static int 6802 test_xmlIsExtender(void) { 6803 int test_ret = 0; 6804 6805 int mem_base; 6806 int ret_val; 6807 unsigned int ch; /* character to validate */ 6808 int n_ch; 6809 6810 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) { 6811 mem_base = xmlMemBlocks(); 6812 ch = gen_unsigned_int(n_ch, 0); 6813 6814 ret_val = xmlIsExtender(ch); 6815 desret_int(ret_val); 6816 call_tests++; 6817 des_unsigned_int(n_ch, ch, 0); 6818 xmlResetLastError(); 6819 if (mem_base != xmlMemBlocks()) { 6820 printf("Leak of %d blocks found in xmlIsExtender", 6821 xmlMemBlocks() - mem_base); 6822 test_ret++; 6823 printf(" %d", n_ch); 6824 printf("\n"); 6825 } 6826 } 6827 function_tests++; 6828 6829 return(test_ret); 6830 } 6831 6832 6833 static int 6834 test_xmlIsIdeographic(void) { 6835 int test_ret = 0; 6836 6837 int mem_base; 6838 int ret_val; 6839 unsigned int ch; /* character to validate */ 6840 int n_ch; 6841 6842 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) { 6843 mem_base = xmlMemBlocks(); 6844 ch = gen_unsigned_int(n_ch, 0); 6845 6846 ret_val = xmlIsIdeographic(ch); 6847 desret_int(ret_val); 6848 call_tests++; 6849 des_unsigned_int(n_ch, ch, 0); 6850 xmlResetLastError(); 6851 if (mem_base != xmlMemBlocks()) { 6852 printf("Leak of %d blocks found in xmlIsIdeographic", 6853 xmlMemBlocks() - mem_base); 6854 test_ret++; 6855 printf(" %d", n_ch); 6856 printf("\n"); 6857 } 6858 } 6859 function_tests++; 6860 6861 return(test_ret); 6862 } 6863 6864 6865 static int 6866 test_xmlIsPubidChar(void) { 6867 int test_ret = 0; 6868 6869 int mem_base; 6870 int ret_val; 6871 unsigned int ch; /* character to validate */ 6872 int n_ch; 6873 6874 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) { 6875 mem_base = xmlMemBlocks(); 6876 ch = gen_unsigned_int(n_ch, 0); 6877 6878 ret_val = xmlIsPubidChar(ch); 6879 desret_int(ret_val); 6880 call_tests++; 6881 des_unsigned_int(n_ch, ch, 0); 6882 xmlResetLastError(); 6883 if (mem_base != xmlMemBlocks()) { 6884 printf("Leak of %d blocks found in xmlIsPubidChar", 6885 xmlMemBlocks() - mem_base); 6886 test_ret++; 6887 printf(" %d", n_ch); 6888 printf("\n"); 6889 } 6890 } 6891 function_tests++; 6892 6893 return(test_ret); 6894 } 6895 6896 static int 6897 test_chvalid(void) { 6898 int test_ret = 0; 6899 6900 if (quiet == 0) printf("Testing chvalid : 9 of 9 functions ...\n"); 6901 test_ret += test_xmlCharInRange(); 6902 test_ret += test_xmlIsBaseChar(); 6903 test_ret += test_xmlIsBlank(); 6904 test_ret += test_xmlIsChar(); 6905 test_ret += test_xmlIsCombining(); 6906 test_ret += test_xmlIsDigit(); 6907 test_ret += test_xmlIsExtender(); 6908 test_ret += test_xmlIsIdeographic(); 6909 test_ret += test_xmlIsPubidChar(); 6910 6911 if (test_ret != 0) 6912 printf("Module chvalid: %d errors\n", test_ret); 6913 return(test_ret); 6914 } 6915 6916 static int 6917 test_xmlBoolToText(void) { 6918 int test_ret = 0; 6919 6920 #if defined(LIBXML_DEBUG_ENABLED) 6921 int mem_base; 6922 const char * ret_val; 6923 int boolval; /* a bool to turn into text */ 6924 int n_boolval; 6925 6926 for (n_boolval = 0;n_boolval < gen_nb_int;n_boolval++) { 6927 mem_base = xmlMemBlocks(); 6928 boolval = gen_int(n_boolval, 0); 6929 6930 ret_val = xmlBoolToText(boolval); 6931 desret_const_char_ptr(ret_val); 6932 call_tests++; 6933 des_int(n_boolval, boolval, 0); 6934 xmlResetLastError(); 6935 if (mem_base != xmlMemBlocks()) { 6936 printf("Leak of %d blocks found in xmlBoolToText", 6937 xmlMemBlocks() - mem_base); 6938 test_ret++; 6939 printf(" %d", n_boolval); 6940 printf("\n"); 6941 } 6942 } 6943 function_tests++; 6944 #endif 6945 6946 return(test_ret); 6947 } 6948 6949 6950 static int 6951 test_xmlDebugCheckDocument(void) { 6952 int test_ret = 0; 6953 6954 #if defined(LIBXML_DEBUG_ENABLED) 6955 int mem_base; 6956 int ret_val; 6957 FILE * output; /* the FILE * for the output */ 6958 int n_output; 6959 xmlDocPtr doc; /* the document */ 6960 int n_doc; 6961 6962 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) { 6963 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { 6964 mem_base = xmlMemBlocks(); 6965 output = gen_debug_FILE_ptr(n_output, 0); 6966 doc = gen_xmlDocPtr(n_doc, 1); 6967 6968 ret_val = xmlDebugCheckDocument(output, doc); 6969 desret_int(ret_val); 6970 call_tests++; 6971 des_debug_FILE_ptr(n_output, output, 0); 6972 des_xmlDocPtr(n_doc, doc, 1); 6973 xmlResetLastError(); 6974 if (mem_base != xmlMemBlocks()) { 6975 printf("Leak of %d blocks found in xmlDebugCheckDocument", 6976 xmlMemBlocks() - mem_base); 6977 test_ret++; 6978 printf(" %d", n_output); 6979 printf(" %d", n_doc); 6980 printf("\n"); 6981 } 6982 } 6983 } 6984 function_tests++; 6985 #endif 6986 6987 return(test_ret); 6988 } 6989 6990 6991 static int 6992 test_xmlDebugDumpAttr(void) { 6993 int test_ret = 0; 6994 6995 #if defined(LIBXML_DEBUG_ENABLED) 6996 int mem_base; 6997 FILE * output; /* the FILE * for the output */ 6998 int n_output; 6999 xmlAttrPtr attr; /* the attribute */ 7000 int n_attr; 7001 int depth; /* the indentation level. */ 7002 int n_depth; 7003 7004 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) { 7005 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) { 7006 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) { 7007 mem_base = xmlMemBlocks(); 7008 output = gen_debug_FILE_ptr(n_output, 0); 7009 attr = gen_xmlAttrPtr(n_attr, 1); 7010 depth = gen_int(n_depth, 2); 7011 7012 xmlDebugDumpAttr(output, attr, depth); 7013 call_tests++; 7014 des_debug_FILE_ptr(n_output, output, 0); 7015 des_xmlAttrPtr(n_attr, attr, 1); 7016 des_int(n_depth, depth, 2); 7017 xmlResetLastError(); 7018 if (mem_base != xmlMemBlocks()) { 7019 printf("Leak of %d blocks found in xmlDebugDumpAttr", 7020 xmlMemBlocks() - mem_base); 7021 test_ret++; 7022 printf(" %d", n_output); 7023 printf(" %d", n_attr); 7024 printf(" %d", n_depth); 7025 printf("\n"); 7026 } 7027 } 7028 } 7029 } 7030 function_tests++; 7031 #endif 7032 7033 return(test_ret); 7034 } 7035 7036 7037 static int 7038 test_xmlDebugDumpAttrList(void) { 7039 int test_ret = 0; 7040 7041 #if defined(LIBXML_DEBUG_ENABLED) 7042 int mem_base; 7043 FILE * output; /* the FILE * for the output */ 7044 int n_output; 7045 xmlAttrPtr attr; /* the attribute list */ 7046 int n_attr; 7047 int depth; /* the indentation level. */ 7048 int n_depth; 7049 7050 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) { 7051 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) { 7052 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) { 7053 mem_base = xmlMemBlocks(); 7054 output = gen_debug_FILE_ptr(n_output, 0); 7055 attr = gen_xmlAttrPtr(n_attr, 1); 7056 depth = gen_int(n_depth, 2); 7057 7058 xmlDebugDumpAttrList(output, attr, depth); 7059 call_tests++; 7060 des_debug_FILE_ptr(n_output, output, 0); 7061 des_xmlAttrPtr(n_attr, attr, 1); 7062 des_int(n_depth, depth, 2); 7063 xmlResetLastError(); 7064 if (mem_base != xmlMemBlocks()) { 7065 printf("Leak of %d blocks found in xmlDebugDumpAttrList", 7066 xmlMemBlocks() - mem_base); 7067 test_ret++; 7068 printf(" %d", n_output); 7069 printf(" %d", n_attr); 7070 printf(" %d", n_depth); 7071 printf("\n"); 7072 } 7073 } 7074 } 7075 } 7076 function_tests++; 7077 #endif 7078 7079 return(test_ret); 7080 } 7081 7082 7083 static int 7084 test_xmlDebugDumpDTD(void) { 7085 int test_ret = 0; 7086 7087 #if defined(LIBXML_DEBUG_ENABLED) 7088 int mem_base; 7089 FILE * output; /* the FILE * for the output */ 7090 int n_output; 7091 xmlDtdPtr dtd; /* the DTD */ 7092 int n_dtd; 7093 7094 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) { 7095 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) { 7096 mem_base = xmlMemBlocks(); 7097 output = gen_debug_FILE_ptr(n_output, 0); 7098 dtd = gen_xmlDtdPtr(n_dtd, 1); 7099 7100 xmlDebugDumpDTD(output, dtd); 7101 call_tests++; 7102 des_debug_FILE_ptr(n_output, output, 0); 7103 des_xmlDtdPtr(n_dtd, dtd, 1); 7104 xmlResetLastError(); 7105 if (mem_base != xmlMemBlocks()) { 7106 printf("Leak of %d blocks found in xmlDebugDumpDTD", 7107 xmlMemBlocks() - mem_base); 7108 test_ret++; 7109 printf(" %d", n_output); 7110 printf(" %d", n_dtd); 7111 printf("\n"); 7112 } 7113 } 7114 } 7115 function_tests++; 7116 #endif 7117 7118 return(test_ret); 7119 } 7120 7121 7122 static int 7123 test_xmlDebugDumpDocument(void) { 7124 int test_ret = 0; 7125 7126 #if defined(LIBXML_DEBUG_ENABLED) 7127 int mem_base; 7128 FILE * output; /* the FILE * for the output */ 7129 int n_output; 7130 xmlDocPtr doc; /* the document */ 7131 int n_doc; 7132 7133 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) { 7134 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { 7135 mem_base = xmlMemBlocks(); 7136 output = gen_debug_FILE_ptr(n_output, 0); 7137 doc = gen_xmlDocPtr(n_doc, 1); 7138 7139 xmlDebugDumpDocument(output, doc); 7140 call_tests++; 7141 des_debug_FILE_ptr(n_output, output, 0); 7142 des_xmlDocPtr(n_doc, doc, 1); 7143 xmlResetLastError(); 7144 if (mem_base != xmlMemBlocks()) { 7145 printf("Leak of %d blocks found in xmlDebugDumpDocument", 7146 xmlMemBlocks() - mem_base); 7147 test_ret++; 7148 printf(" %d", n_output); 7149 printf(" %d", n_doc); 7150 printf("\n"); 7151 } 7152 } 7153 } 7154 function_tests++; 7155 #endif 7156 7157 return(test_ret); 7158 } 7159 7160 7161 static int 7162 test_xmlDebugDumpDocumentHead(void) { 7163 int test_ret = 0; 7164 7165 #if defined(LIBXML_DEBUG_ENABLED) 7166 int mem_base; 7167 FILE * output; /* the FILE * for the output */ 7168 int n_output; 7169 xmlDocPtr doc; /* the document */ 7170 int n_doc; 7171 7172 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) { 7173 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { 7174 mem_base = xmlMemBlocks(); 7175 output = gen_debug_FILE_ptr(n_output, 0); 7176 doc = gen_xmlDocPtr(n_doc, 1); 7177 7178 xmlDebugDumpDocumentHead(output, doc); 7179 call_tests++; 7180 des_debug_FILE_ptr(n_output, output, 0); 7181 des_xmlDocPtr(n_doc, doc, 1); 7182 xmlResetLastError(); 7183 if (mem_base != xmlMemBlocks()) { 7184 printf("Leak of %d blocks found in xmlDebugDumpDocumentHead", 7185 xmlMemBlocks() - mem_base); 7186 test_ret++; 7187 printf(" %d", n_output); 7188 printf(" %d", n_doc); 7189 printf("\n"); 7190 } 7191 } 7192 } 7193 function_tests++; 7194 #endif 7195 7196 return(test_ret); 7197 } 7198 7199 7200 static int 7201 test_xmlDebugDumpEntities(void) { 7202 int test_ret = 0; 7203 7204 #if defined(LIBXML_DEBUG_ENABLED) 7205 int mem_base; 7206 FILE * output; /* the FILE * for the output */ 7207 int n_output; 7208 xmlDocPtr doc; /* the document */ 7209 int n_doc; 7210 7211 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) { 7212 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { 7213 mem_base = xmlMemBlocks(); 7214 output = gen_debug_FILE_ptr(n_output, 0); 7215 doc = gen_xmlDocPtr(n_doc, 1); 7216 7217 xmlDebugDumpEntities(output, doc); 7218 call_tests++; 7219 des_debug_FILE_ptr(n_output, output, 0); 7220 des_xmlDocPtr(n_doc, doc, 1); 7221 xmlResetLastError(); 7222 if (mem_base != xmlMemBlocks()) { 7223 printf("Leak of %d blocks found in xmlDebugDumpEntities", 7224 xmlMemBlocks() - mem_base); 7225 test_ret++; 7226 printf(" %d", n_output); 7227 printf(" %d", n_doc); 7228 printf("\n"); 7229 } 7230 } 7231 } 7232 function_tests++; 7233 #endif 7234 7235 return(test_ret); 7236 } 7237 7238 7239 static int 7240 test_xmlDebugDumpNode(void) { 7241 int test_ret = 0; 7242 7243 #if defined(LIBXML_DEBUG_ENABLED) 7244 int mem_base; 7245 FILE * output; /* the FILE * for the output */ 7246 int n_output; 7247 xmlNodePtr node; /* the node */ 7248 int n_node; 7249 int depth; /* the indentation level. */ 7250 int n_depth; 7251 7252 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) { 7253 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { 7254 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) { 7255 mem_base = xmlMemBlocks(); 7256 output = gen_debug_FILE_ptr(n_output, 0); 7257 node = gen_xmlNodePtr(n_node, 1); 7258 depth = gen_int(n_depth, 2); 7259 7260 xmlDebugDumpNode(output, node, depth); 7261 call_tests++; 7262 des_debug_FILE_ptr(n_output, output, 0); 7263 des_xmlNodePtr(n_node, node, 1); 7264 des_int(n_depth, depth, 2); 7265 xmlResetLastError(); 7266 if (mem_base != xmlMemBlocks()) { 7267 printf("Leak of %d blocks found in xmlDebugDumpNode", 7268 xmlMemBlocks() - mem_base); 7269 test_ret++; 7270 printf(" %d", n_output); 7271 printf(" %d", n_node); 7272 printf(" %d", n_depth); 7273 printf("\n"); 7274 } 7275 } 7276 } 7277 } 7278 function_tests++; 7279 #endif 7280 7281 return(test_ret); 7282 } 7283 7284 7285 static int 7286 test_xmlDebugDumpNodeList(void) { 7287 int test_ret = 0; 7288 7289 #if defined(LIBXML_DEBUG_ENABLED) 7290 int mem_base; 7291 FILE * output; /* the FILE * for the output */ 7292 int n_output; 7293 xmlNodePtr node; /* the node list */ 7294 int n_node; 7295 int depth; /* the indentation level. */ 7296 int n_depth; 7297 7298 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) { 7299 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { 7300 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) { 7301 mem_base = xmlMemBlocks(); 7302 output = gen_debug_FILE_ptr(n_output, 0); 7303 node = gen_xmlNodePtr(n_node, 1); 7304 depth = gen_int(n_depth, 2); 7305 7306 xmlDebugDumpNodeList(output, node, depth); 7307 call_tests++; 7308 des_debug_FILE_ptr(n_output, output, 0); 7309 des_xmlNodePtr(n_node, node, 1); 7310 des_int(n_depth, depth, 2); 7311 xmlResetLastError(); 7312 if (mem_base != xmlMemBlocks()) { 7313 printf("Leak of %d blocks found in xmlDebugDumpNodeList", 7314 xmlMemBlocks() - mem_base); 7315 test_ret++; 7316 printf(" %d", n_output); 7317 printf(" %d", n_node); 7318 printf(" %d", n_depth); 7319 printf("\n"); 7320 } 7321 } 7322 } 7323 } 7324 function_tests++; 7325 #endif 7326 7327 return(test_ret); 7328 } 7329 7330 7331 static int 7332 test_xmlDebugDumpOneNode(void) { 7333 int test_ret = 0; 7334 7335 #if defined(LIBXML_DEBUG_ENABLED) 7336 int mem_base; 7337 FILE * output; /* the FILE * for the output */ 7338 int n_output; 7339 xmlNodePtr node; /* the node */ 7340 int n_node; 7341 int depth; /* the indentation level. */ 7342 int n_depth; 7343 7344 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) { 7345 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { 7346 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) { 7347 mem_base = xmlMemBlocks(); 7348 output = gen_debug_FILE_ptr(n_output, 0); 7349 node = gen_xmlNodePtr(n_node, 1); 7350 depth = gen_int(n_depth, 2); 7351 7352 xmlDebugDumpOneNode(output, node, depth); 7353 call_tests++; 7354 des_debug_FILE_ptr(n_output, output, 0); 7355 des_xmlNodePtr(n_node, node, 1); 7356 des_int(n_depth, depth, 2); 7357 xmlResetLastError(); 7358 if (mem_base != xmlMemBlocks()) { 7359 printf("Leak of %d blocks found in xmlDebugDumpOneNode", 7360 xmlMemBlocks() - mem_base); 7361 test_ret++; 7362 printf(" %d", n_output); 7363 printf(" %d", n_node); 7364 printf(" %d", n_depth); 7365 printf("\n"); 7366 } 7367 } 7368 } 7369 } 7370 function_tests++; 7371 #endif 7372 7373 return(test_ret); 7374 } 7375 7376 7377 static int 7378 test_xmlDebugDumpString(void) { 7379 int test_ret = 0; 7380 7381 #if defined(LIBXML_DEBUG_ENABLED) 7382 int mem_base; 7383 FILE * output; /* the FILE * for the output */ 7384 int n_output; 7385 xmlChar * str; /* the string */ 7386 int n_str; 7387 7388 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) { 7389 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) { 7390 mem_base = xmlMemBlocks(); 7391 output = gen_debug_FILE_ptr(n_output, 0); 7392 str = gen_const_xmlChar_ptr(n_str, 1); 7393 7394 xmlDebugDumpString(output, (const xmlChar *)str); 7395 call_tests++; 7396 des_debug_FILE_ptr(n_output, output, 0); 7397 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1); 7398 xmlResetLastError(); 7399 if (mem_base != xmlMemBlocks()) { 7400 printf("Leak of %d blocks found in xmlDebugDumpString", 7401 xmlMemBlocks() - mem_base); 7402 test_ret++; 7403 printf(" %d", n_output); 7404 printf(" %d", n_str); 7405 printf("\n"); 7406 } 7407 } 7408 } 7409 function_tests++; 7410 #endif 7411 7412 return(test_ret); 7413 } 7414 7415 7416 static int 7417 test_xmlLsCountNode(void) { 7418 int test_ret = 0; 7419 7420 #if defined(LIBXML_DEBUG_ENABLED) 7421 int mem_base; 7422 int ret_val; 7423 xmlNodePtr node; /* the node to count */ 7424 int n_node; 7425 7426 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { 7427 mem_base = xmlMemBlocks(); 7428 node = gen_xmlNodePtr(n_node, 0); 7429 7430 ret_val = xmlLsCountNode(node); 7431 desret_int(ret_val); 7432 call_tests++; 7433 des_xmlNodePtr(n_node, node, 0); 7434 xmlResetLastError(); 7435 if (mem_base != xmlMemBlocks()) { 7436 printf("Leak of %d blocks found in xmlLsCountNode", 7437 xmlMemBlocks() - mem_base); 7438 test_ret++; 7439 printf(" %d", n_node); 7440 printf("\n"); 7441 } 7442 } 7443 function_tests++; 7444 #endif 7445 7446 return(test_ret); 7447 } 7448 7449 7450 static int 7451 test_xmlLsOneNode(void) { 7452 int test_ret = 0; 7453 7454 #if defined(LIBXML_DEBUG_ENABLED) 7455 int mem_base; 7456 FILE * output; /* the FILE * for the output */ 7457 int n_output; 7458 xmlNodePtr node; /* the node to dump */ 7459 int n_node; 7460 7461 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) { 7462 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { 7463 mem_base = xmlMemBlocks(); 7464 output = gen_debug_FILE_ptr(n_output, 0); 7465 node = gen_xmlNodePtr(n_node, 1); 7466 7467 xmlLsOneNode(output, node); 7468 call_tests++; 7469 des_debug_FILE_ptr(n_output, output, 0); 7470 des_xmlNodePtr(n_node, node, 1); 7471 xmlResetLastError(); 7472 if (mem_base != xmlMemBlocks()) { 7473 printf("Leak of %d blocks found in xmlLsOneNode", 7474 xmlMemBlocks() - mem_base); 7475 test_ret++; 7476 printf(" %d", n_output); 7477 printf(" %d", n_node); 7478 printf("\n"); 7479 } 7480 } 7481 } 7482 function_tests++; 7483 #endif 7484 7485 return(test_ret); 7486 } 7487 7488 7489 #define gen_nb_char_ptr 1 7490 static char * gen_char_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 7491 return(NULL); 7492 } 7493 static void des_char_ptr(int no ATTRIBUTE_UNUSED, char * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 7494 } 7495 7496 static int 7497 test_xmlShell(void) { 7498 int test_ret = 0; 7499 7500 7501 /* missing type support */ 7502 return(test_ret); 7503 } 7504 7505 7506 static int 7507 test_xmlShellBase(void) { 7508 int test_ret = 0; 7509 7510 #if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) 7511 int mem_base; 7512 int ret_val; 7513 xmlShellCtxtPtr ctxt; /* the shell context */ 7514 int n_ctxt; 7515 char * arg; /* unused */ 7516 int n_arg; 7517 xmlNodePtr node; /* a node */ 7518 int n_node; 7519 xmlNodePtr node2; /* unused */ 7520 int n_node2; 7521 7522 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) { 7523 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) { 7524 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { 7525 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) { 7526 mem_base = xmlMemBlocks(); 7527 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0); 7528 arg = gen_char_ptr(n_arg, 1); 7529 node = gen_xmlNodePtr(n_node, 2); 7530 node2 = gen_xmlNodePtr(n_node2, 3); 7531 7532 ret_val = xmlShellBase(ctxt, arg, node, node2); 7533 desret_int(ret_val); 7534 call_tests++; 7535 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0); 7536 des_char_ptr(n_arg, arg, 1); 7537 des_xmlNodePtr(n_node, node, 2); 7538 des_xmlNodePtr(n_node2, node2, 3); 7539 xmlResetLastError(); 7540 if (mem_base != xmlMemBlocks()) { 7541 printf("Leak of %d blocks found in xmlShellBase", 7542 xmlMemBlocks() - mem_base); 7543 test_ret++; 7544 printf(" %d", n_ctxt); 7545 printf(" %d", n_arg); 7546 printf(" %d", n_node); 7547 printf(" %d", n_node2); 7548 printf("\n"); 7549 } 7550 } 7551 } 7552 } 7553 } 7554 function_tests++; 7555 #endif 7556 7557 return(test_ret); 7558 } 7559 7560 7561 static int 7562 test_xmlShellCat(void) { 7563 int test_ret = 0; 7564 7565 #if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) 7566 int mem_base; 7567 int ret_val; 7568 xmlShellCtxtPtr ctxt; /* the shell context */ 7569 int n_ctxt; 7570 char * arg; /* unused */ 7571 int n_arg; 7572 xmlNodePtr node; /* a node */ 7573 int n_node; 7574 xmlNodePtr node2; /* unused */ 7575 int n_node2; 7576 7577 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) { 7578 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) { 7579 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { 7580 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) { 7581 mem_base = xmlMemBlocks(); 7582 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0); 7583 arg = gen_char_ptr(n_arg, 1); 7584 node = gen_xmlNodePtr(n_node, 2); 7585 node2 = gen_xmlNodePtr(n_node2, 3); 7586 7587 ret_val = xmlShellCat(ctxt, arg, node, node2); 7588 desret_int(ret_val); 7589 call_tests++; 7590 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0); 7591 des_char_ptr(n_arg, arg, 1); 7592 des_xmlNodePtr(n_node, node, 2); 7593 des_xmlNodePtr(n_node2, node2, 3); 7594 xmlResetLastError(); 7595 if (mem_base != xmlMemBlocks()) { 7596 printf("Leak of %d blocks found in xmlShellCat", 7597 xmlMemBlocks() - mem_base); 7598 test_ret++; 7599 printf(" %d", n_ctxt); 7600 printf(" %d", n_arg); 7601 printf(" %d", n_node); 7602 printf(" %d", n_node2); 7603 printf("\n"); 7604 } 7605 } 7606 } 7607 } 7608 } 7609 function_tests++; 7610 #endif 7611 7612 return(test_ret); 7613 } 7614 7615 7616 static int 7617 test_xmlShellDir(void) { 7618 int test_ret = 0; 7619 7620 #if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) 7621 int mem_base; 7622 int ret_val; 7623 xmlShellCtxtPtr ctxt; /* the shell context */ 7624 int n_ctxt; 7625 char * arg; /* unused */ 7626 int n_arg; 7627 xmlNodePtr node; /* a node */ 7628 int n_node; 7629 xmlNodePtr node2; /* unused */ 7630 int n_node2; 7631 7632 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) { 7633 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) { 7634 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { 7635 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) { 7636 mem_base = xmlMemBlocks(); 7637 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0); 7638 arg = gen_char_ptr(n_arg, 1); 7639 node = gen_xmlNodePtr(n_node, 2); 7640 node2 = gen_xmlNodePtr(n_node2, 3); 7641 7642 ret_val = xmlShellDir(ctxt, arg, node, node2); 7643 desret_int(ret_val); 7644 call_tests++; 7645 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0); 7646 des_char_ptr(n_arg, arg, 1); 7647 des_xmlNodePtr(n_node, node, 2); 7648 des_xmlNodePtr(n_node2, node2, 3); 7649 xmlResetLastError(); 7650 if (mem_base != xmlMemBlocks()) { 7651 printf("Leak of %d blocks found in xmlShellDir", 7652 xmlMemBlocks() - mem_base); 7653 test_ret++; 7654 printf(" %d", n_ctxt); 7655 printf(" %d", n_arg); 7656 printf(" %d", n_node); 7657 printf(" %d", n_node2); 7658 printf("\n"); 7659 } 7660 } 7661 } 7662 } 7663 } 7664 function_tests++; 7665 #endif 7666 7667 return(test_ret); 7668 } 7669 7670 7671 static int 7672 test_xmlShellDu(void) { 7673 int test_ret = 0; 7674 7675 #if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) 7676 int mem_base; 7677 int ret_val; 7678 xmlShellCtxtPtr ctxt; /* the shell context */ 7679 int n_ctxt; 7680 char * arg; /* unused */ 7681 int n_arg; 7682 xmlNodePtr tree; /* a node defining a subtree */ 7683 int n_tree; 7684 xmlNodePtr node2; /* unused */ 7685 int n_node2; 7686 7687 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) { 7688 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) { 7689 for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) { 7690 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) { 7691 mem_base = xmlMemBlocks(); 7692 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0); 7693 arg = gen_char_ptr(n_arg, 1); 7694 tree = gen_xmlNodePtr(n_tree, 2); 7695 node2 = gen_xmlNodePtr(n_node2, 3); 7696 7697 ret_val = xmlShellDu(ctxt, arg, tree, node2); 7698 desret_int(ret_val); 7699 call_tests++; 7700 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0); 7701 des_char_ptr(n_arg, arg, 1); 7702 des_xmlNodePtr(n_tree, tree, 2); 7703 des_xmlNodePtr(n_node2, node2, 3); 7704 xmlResetLastError(); 7705 if (mem_base != xmlMemBlocks()) { 7706 printf("Leak of %d blocks found in xmlShellDu", 7707 xmlMemBlocks() - mem_base); 7708 test_ret++; 7709 printf(" %d", n_ctxt); 7710 printf(" %d", n_arg); 7711 printf(" %d", n_tree); 7712 printf(" %d", n_node2); 7713 printf("\n"); 7714 } 7715 } 7716 } 7717 } 7718 } 7719 function_tests++; 7720 #endif 7721 7722 return(test_ret); 7723 } 7724 7725 7726 static int 7727 test_xmlShellList(void) { 7728 int test_ret = 0; 7729 7730 #if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) 7731 int mem_base; 7732 int ret_val; 7733 xmlShellCtxtPtr ctxt; /* the shell context */ 7734 int n_ctxt; 7735 char * arg; /* unused */ 7736 int n_arg; 7737 xmlNodePtr node; /* a node */ 7738 int n_node; 7739 xmlNodePtr node2; /* unused */ 7740 int n_node2; 7741 7742 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) { 7743 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) { 7744 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { 7745 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) { 7746 mem_base = xmlMemBlocks(); 7747 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0); 7748 arg = gen_char_ptr(n_arg, 1); 7749 node = gen_xmlNodePtr(n_node, 2); 7750 node2 = gen_xmlNodePtr(n_node2, 3); 7751 7752 ret_val = xmlShellList(ctxt, arg, node, node2); 7753 desret_int(ret_val); 7754 call_tests++; 7755 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0); 7756 des_char_ptr(n_arg, arg, 1); 7757 des_xmlNodePtr(n_node, node, 2); 7758 des_xmlNodePtr(n_node2, node2, 3); 7759 xmlResetLastError(); 7760 if (mem_base != xmlMemBlocks()) { 7761 printf("Leak of %d blocks found in xmlShellList", 7762 xmlMemBlocks() - mem_base); 7763 test_ret++; 7764 printf(" %d", n_ctxt); 7765 printf(" %d", n_arg); 7766 printf(" %d", n_node); 7767 printf(" %d", n_node2); 7768 printf("\n"); 7769 } 7770 } 7771 } 7772 } 7773 } 7774 function_tests++; 7775 #endif 7776 7777 return(test_ret); 7778 } 7779 7780 7781 static int 7782 test_xmlShellLoad(void) { 7783 int test_ret = 0; 7784 7785 #if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) 7786 int mem_base; 7787 int ret_val; 7788 xmlShellCtxtPtr ctxt; /* the shell context */ 7789 int n_ctxt; 7790 char * filename; /* the file name */ 7791 int n_filename; 7792 xmlNodePtr node; /* unused */ 7793 int n_node; 7794 xmlNodePtr node2; /* unused */ 7795 int n_node2; 7796 7797 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) { 7798 for (n_filename = 0;n_filename < gen_nb_char_ptr;n_filename++) { 7799 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { 7800 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) { 7801 mem_base = xmlMemBlocks(); 7802 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0); 7803 filename = gen_char_ptr(n_filename, 1); 7804 node = gen_xmlNodePtr(n_node, 2); 7805 node2 = gen_xmlNodePtr(n_node2, 3); 7806 7807 ret_val = xmlShellLoad(ctxt, filename, node, node2); 7808 desret_int(ret_val); 7809 call_tests++; 7810 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0); 7811 des_char_ptr(n_filename, filename, 1); 7812 des_xmlNodePtr(n_node, node, 2); 7813 des_xmlNodePtr(n_node2, node2, 3); 7814 xmlResetLastError(); 7815 if (mem_base != xmlMemBlocks()) { 7816 printf("Leak of %d blocks found in xmlShellLoad", 7817 xmlMemBlocks() - mem_base); 7818 test_ret++; 7819 printf(" %d", n_ctxt); 7820 printf(" %d", n_filename); 7821 printf(" %d", n_node); 7822 printf(" %d", n_node2); 7823 printf("\n"); 7824 } 7825 } 7826 } 7827 } 7828 } 7829 function_tests++; 7830 #endif 7831 7832 return(test_ret); 7833 } 7834 7835 7836 static int 7837 test_xmlShellPrintXPathResult(void) { 7838 int test_ret = 0; 7839 7840 #if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) 7841 int mem_base; 7842 xmlXPathObjectPtr list; /* a valid result generated by an xpath evaluation */ 7843 int n_list; 7844 7845 for (n_list = 0;n_list < gen_nb_xmlXPathObjectPtr;n_list++) { 7846 mem_base = xmlMemBlocks(); 7847 list = gen_xmlXPathObjectPtr(n_list, 0); 7848 7849 xmlShellPrintXPathResult(list); 7850 call_tests++; 7851 des_xmlXPathObjectPtr(n_list, list, 0); 7852 xmlResetLastError(); 7853 if (mem_base != xmlMemBlocks()) { 7854 printf("Leak of %d blocks found in xmlShellPrintXPathResult", 7855 xmlMemBlocks() - mem_base); 7856 test_ret++; 7857 printf(" %d", n_list); 7858 printf("\n"); 7859 } 7860 } 7861 function_tests++; 7862 #endif 7863 7864 return(test_ret); 7865 } 7866 7867 7868 static int 7869 test_xmlShellPwd(void) { 7870 int test_ret = 0; 7871 7872 #if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) 7873 int mem_base; 7874 int ret_val; 7875 xmlShellCtxtPtr ctxt; /* the shell context */ 7876 int n_ctxt; 7877 char * buffer; /* the output buffer */ 7878 int n_buffer; 7879 xmlNodePtr node; /* a node */ 7880 int n_node; 7881 xmlNodePtr node2; /* unused */ 7882 int n_node2; 7883 7884 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) { 7885 for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) { 7886 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { 7887 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) { 7888 mem_base = xmlMemBlocks(); 7889 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0); 7890 buffer = gen_char_ptr(n_buffer, 1); 7891 node = gen_xmlNodePtr(n_node, 2); 7892 node2 = gen_xmlNodePtr(n_node2, 3); 7893 7894 ret_val = xmlShellPwd(ctxt, buffer, node, node2); 7895 desret_int(ret_val); 7896 call_tests++; 7897 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0); 7898 des_char_ptr(n_buffer, buffer, 1); 7899 des_xmlNodePtr(n_node, node, 2); 7900 des_xmlNodePtr(n_node2, node2, 3); 7901 xmlResetLastError(); 7902 if (mem_base != xmlMemBlocks()) { 7903 printf("Leak of %d blocks found in xmlShellPwd", 7904 xmlMemBlocks() - mem_base); 7905 test_ret++; 7906 printf(" %d", n_ctxt); 7907 printf(" %d", n_buffer); 7908 printf(" %d", n_node); 7909 printf(" %d", n_node2); 7910 printf("\n"); 7911 } 7912 } 7913 } 7914 } 7915 } 7916 function_tests++; 7917 #endif 7918 7919 return(test_ret); 7920 } 7921 7922 7923 static int 7924 test_xmlShellSave(void) { 7925 int test_ret = 0; 7926 7927 #if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) 7928 int mem_base; 7929 int ret_val; 7930 xmlShellCtxtPtr ctxt; /* the shell context */ 7931 int n_ctxt; 7932 char * filename; /* the file name (optional) */ 7933 int n_filename; 7934 xmlNodePtr node; /* unused */ 7935 int n_node; 7936 xmlNodePtr node2; /* unused */ 7937 int n_node2; 7938 7939 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) { 7940 for (n_filename = 0;n_filename < gen_nb_char_ptr;n_filename++) { 7941 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { 7942 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) { 7943 mem_base = xmlMemBlocks(); 7944 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0); 7945 filename = gen_char_ptr(n_filename, 1); 7946 node = gen_xmlNodePtr(n_node, 2); 7947 node2 = gen_xmlNodePtr(n_node2, 3); 7948 7949 ret_val = xmlShellSave(ctxt, filename, node, node2); 7950 desret_int(ret_val); 7951 call_tests++; 7952 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0); 7953 des_char_ptr(n_filename, filename, 1); 7954 des_xmlNodePtr(n_node, node, 2); 7955 des_xmlNodePtr(n_node2, node2, 3); 7956 xmlResetLastError(); 7957 if (mem_base != xmlMemBlocks()) { 7958 printf("Leak of %d blocks found in xmlShellSave", 7959 xmlMemBlocks() - mem_base); 7960 test_ret++; 7961 printf(" %d", n_ctxt); 7962 printf(" %d", n_filename); 7963 printf(" %d", n_node); 7964 printf(" %d", n_node2); 7965 printf("\n"); 7966 } 7967 } 7968 } 7969 } 7970 } 7971 function_tests++; 7972 #endif 7973 7974 return(test_ret); 7975 } 7976 7977 7978 static int 7979 test_xmlShellValidate(void) { 7980 int test_ret = 0; 7981 7982 #if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_VALID_ENABLED) 7983 int mem_base; 7984 int ret_val; 7985 xmlShellCtxtPtr ctxt; /* the shell context */ 7986 int n_ctxt; 7987 char * dtd; /* the DTD URI (optional) */ 7988 int n_dtd; 7989 xmlNodePtr node; /* unused */ 7990 int n_node; 7991 xmlNodePtr node2; /* unused */ 7992 int n_node2; 7993 7994 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) { 7995 for (n_dtd = 0;n_dtd < gen_nb_char_ptr;n_dtd++) { 7996 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { 7997 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) { 7998 mem_base = xmlMemBlocks(); 7999 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0); 8000 dtd = gen_char_ptr(n_dtd, 1); 8001 node = gen_xmlNodePtr(n_node, 2); 8002 node2 = gen_xmlNodePtr(n_node2, 3); 8003 8004 ret_val = xmlShellValidate(ctxt, dtd, node, node2); 8005 desret_int(ret_val); 8006 call_tests++; 8007 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0); 8008 des_char_ptr(n_dtd, dtd, 1); 8009 des_xmlNodePtr(n_node, node, 2); 8010 des_xmlNodePtr(n_node2, node2, 3); 8011 xmlResetLastError(); 8012 if (mem_base != xmlMemBlocks()) { 8013 printf("Leak of %d blocks found in xmlShellValidate", 8014 xmlMemBlocks() - mem_base); 8015 test_ret++; 8016 printf(" %d", n_ctxt); 8017 printf(" %d", n_dtd); 8018 printf(" %d", n_node); 8019 printf(" %d", n_node2); 8020 printf("\n"); 8021 } 8022 } 8023 } 8024 } 8025 } 8026 function_tests++; 8027 #endif 8028 8029 return(test_ret); 8030 } 8031 8032 8033 static int 8034 test_xmlShellWrite(void) { 8035 int test_ret = 0; 8036 8037 #if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) 8038 int mem_base; 8039 int ret_val; 8040 xmlShellCtxtPtr ctxt; /* the shell context */ 8041 int n_ctxt; 8042 char * filename; /* the file name */ 8043 int n_filename; 8044 xmlNodePtr node; /* a node in the tree */ 8045 int n_node; 8046 xmlNodePtr node2; /* unused */ 8047 int n_node2; 8048 8049 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) { 8050 for (n_filename = 0;n_filename < gen_nb_char_ptr;n_filename++) { 8051 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { 8052 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) { 8053 mem_base = xmlMemBlocks(); 8054 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0); 8055 filename = gen_char_ptr(n_filename, 1); 8056 node = gen_xmlNodePtr(n_node, 2); 8057 node2 = gen_xmlNodePtr(n_node2, 3); 8058 8059 ret_val = xmlShellWrite(ctxt, filename, node, node2); 8060 desret_int(ret_val); 8061 call_tests++; 8062 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0); 8063 des_char_ptr(n_filename, filename, 1); 8064 des_xmlNodePtr(n_node, node, 2); 8065 des_xmlNodePtr(n_node2, node2, 3); 8066 xmlResetLastError(); 8067 if (mem_base != xmlMemBlocks()) { 8068 printf("Leak of %d blocks found in xmlShellWrite", 8069 xmlMemBlocks() - mem_base); 8070 test_ret++; 8071 printf(" %d", n_ctxt); 8072 printf(" %d", n_filename); 8073 printf(" %d", n_node); 8074 printf(" %d", n_node2); 8075 printf("\n"); 8076 } 8077 } 8078 } 8079 } 8080 } 8081 function_tests++; 8082 #endif 8083 8084 return(test_ret); 8085 } 8086 8087 static int 8088 test_debugXML(void) { 8089 int test_ret = 0; 8090 8091 if (quiet == 0) printf("Testing debugXML : 25 of 28 functions ...\n"); 8092 test_ret += test_xmlBoolToText(); 8093 test_ret += test_xmlDebugCheckDocument(); 8094 test_ret += test_xmlDebugDumpAttr(); 8095 test_ret += test_xmlDebugDumpAttrList(); 8096 test_ret += test_xmlDebugDumpDTD(); 8097 test_ret += test_xmlDebugDumpDocument(); 8098 test_ret += test_xmlDebugDumpDocumentHead(); 8099 test_ret += test_xmlDebugDumpEntities(); 8100 test_ret += test_xmlDebugDumpNode(); 8101 test_ret += test_xmlDebugDumpNodeList(); 8102 test_ret += test_xmlDebugDumpOneNode(); 8103 test_ret += test_xmlDebugDumpString(); 8104 test_ret += test_xmlLsCountNode(); 8105 test_ret += test_xmlLsOneNode(); 8106 test_ret += test_xmlShell(); 8107 test_ret += test_xmlShellBase(); 8108 test_ret += test_xmlShellCat(); 8109 test_ret += test_xmlShellDir(); 8110 test_ret += test_xmlShellDu(); 8111 test_ret += test_xmlShellList(); 8112 test_ret += test_xmlShellLoad(); 8113 test_ret += test_xmlShellPrintXPathResult(); 8114 test_ret += test_xmlShellPwd(); 8115 test_ret += test_xmlShellSave(); 8116 test_ret += test_xmlShellValidate(); 8117 test_ret += test_xmlShellWrite(); 8118 8119 if (test_ret != 0) 8120 printf("Module debugXML: %d errors\n", test_ret); 8121 return(test_ret); 8122 } 8123 8124 static int 8125 test_xmlDictCleanup(void) { 8126 int test_ret = 0; 8127 8128 int mem_base; 8129 8130 mem_base = xmlMemBlocks(); 8131 8132 xmlDictCleanup(); 8133 call_tests++; 8134 xmlResetLastError(); 8135 if (mem_base != xmlMemBlocks()) { 8136 printf("Leak of %d blocks found in xmlDictCleanup", 8137 xmlMemBlocks() - mem_base); 8138 test_ret++; 8139 printf("\n"); 8140 } 8141 function_tests++; 8142 8143 return(test_ret); 8144 } 8145 8146 8147 static int 8148 test_xmlDictCreate(void) { 8149 int test_ret = 0; 8150 8151 int mem_base; 8152 xmlDictPtr ret_val; 8153 8154 mem_base = xmlMemBlocks(); 8155 8156 ret_val = xmlDictCreate(); 8157 desret_xmlDictPtr(ret_val); 8158 call_tests++; 8159 xmlResetLastError(); 8160 if (mem_base != xmlMemBlocks()) { 8161 printf("Leak of %d blocks found in xmlDictCreate", 8162 xmlMemBlocks() - mem_base); 8163 test_ret++; 8164 printf("\n"); 8165 } 8166 function_tests++; 8167 8168 return(test_ret); 8169 } 8170 8171 8172 static int 8173 test_xmlDictCreateSub(void) { 8174 int test_ret = 0; 8175 8176 int mem_base; 8177 xmlDictPtr ret_val; 8178 xmlDictPtr sub; /* an existing dictionnary */ 8179 int n_sub; 8180 8181 for (n_sub = 0;n_sub < gen_nb_xmlDictPtr;n_sub++) { 8182 mem_base = xmlMemBlocks(); 8183 sub = gen_xmlDictPtr(n_sub, 0); 8184 8185 ret_val = xmlDictCreateSub(sub); 8186 desret_xmlDictPtr(ret_val); 8187 call_tests++; 8188 des_xmlDictPtr(n_sub, sub, 0); 8189 xmlResetLastError(); 8190 if (mem_base != xmlMemBlocks()) { 8191 printf("Leak of %d blocks found in xmlDictCreateSub", 8192 xmlMemBlocks() - mem_base); 8193 test_ret++; 8194 printf(" %d", n_sub); 8195 printf("\n"); 8196 } 8197 } 8198 function_tests++; 8199 8200 return(test_ret); 8201 } 8202 8203 8204 static int 8205 test_xmlDictExists(void) { 8206 int test_ret = 0; 8207 8208 int mem_base; 8209 const xmlChar * ret_val; 8210 xmlDictPtr dict; /* the dictionnary */ 8211 int n_dict; 8212 xmlChar * name; /* the name of the userdata */ 8213 int n_name; 8214 int len; /* the length of the name, if -1 it is recomputed */ 8215 int n_len; 8216 8217 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) { 8218 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { 8219 for (n_len = 0;n_len < gen_nb_int;n_len++) { 8220 mem_base = xmlMemBlocks(); 8221 dict = gen_xmlDictPtr(n_dict, 0); 8222 name = gen_const_xmlChar_ptr(n_name, 1); 8223 len = gen_int(n_len, 2); 8224 8225 ret_val = xmlDictExists(dict, (const xmlChar *)name, len); 8226 desret_const_xmlChar_ptr(ret_val); 8227 call_tests++; 8228 des_xmlDictPtr(n_dict, dict, 0); 8229 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); 8230 des_int(n_len, len, 2); 8231 xmlResetLastError(); 8232 if (mem_base != xmlMemBlocks()) { 8233 printf("Leak of %d blocks found in xmlDictExists", 8234 xmlMemBlocks() - mem_base); 8235 test_ret++; 8236 printf(" %d", n_dict); 8237 printf(" %d", n_name); 8238 printf(" %d", n_len); 8239 printf("\n"); 8240 } 8241 } 8242 } 8243 } 8244 function_tests++; 8245 8246 return(test_ret); 8247 } 8248 8249 8250 static int 8251 test_xmlDictGetUsage(void) { 8252 int test_ret = 0; 8253 8254 8255 /* missing type support */ 8256 return(test_ret); 8257 } 8258 8259 8260 static int 8261 test_xmlDictLookup(void) { 8262 int test_ret = 0; 8263 8264 int mem_base; 8265 const xmlChar * ret_val; 8266 xmlDictPtr dict; /* the dictionnary */ 8267 int n_dict; 8268 xmlChar * name; /* the name of the userdata */ 8269 int n_name; 8270 int len; /* the length of the name, if -1 it is recomputed */ 8271 int n_len; 8272 8273 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) { 8274 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { 8275 for (n_len = 0;n_len < gen_nb_int;n_len++) { 8276 mem_base = xmlMemBlocks(); 8277 dict = gen_xmlDictPtr(n_dict, 0); 8278 name = gen_const_xmlChar_ptr(n_name, 1); 8279 len = gen_int(n_len, 2); 8280 8281 ret_val = xmlDictLookup(dict, (const xmlChar *)name, len); 8282 desret_const_xmlChar_ptr(ret_val); 8283 call_tests++; 8284 des_xmlDictPtr(n_dict, dict, 0); 8285 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); 8286 des_int(n_len, len, 2); 8287 xmlResetLastError(); 8288 if (mem_base != xmlMemBlocks()) { 8289 printf("Leak of %d blocks found in xmlDictLookup", 8290 xmlMemBlocks() - mem_base); 8291 test_ret++; 8292 printf(" %d", n_dict); 8293 printf(" %d", n_name); 8294 printf(" %d", n_len); 8295 printf("\n"); 8296 } 8297 } 8298 } 8299 } 8300 function_tests++; 8301 8302 return(test_ret); 8303 } 8304 8305 8306 static int 8307 test_xmlDictOwns(void) { 8308 int test_ret = 0; 8309 8310 int mem_base; 8311 int ret_val; 8312 xmlDictPtr dict; /* the dictionnary */ 8313 int n_dict; 8314 xmlChar * str; /* the string */ 8315 int n_str; 8316 8317 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) { 8318 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) { 8319 mem_base = xmlMemBlocks(); 8320 dict = gen_xmlDictPtr(n_dict, 0); 8321 str = gen_const_xmlChar_ptr(n_str, 1); 8322 8323 ret_val = xmlDictOwns(dict, (const xmlChar *)str); 8324 desret_int(ret_val); 8325 call_tests++; 8326 des_xmlDictPtr(n_dict, dict, 0); 8327 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1); 8328 xmlResetLastError(); 8329 if (mem_base != xmlMemBlocks()) { 8330 printf("Leak of %d blocks found in xmlDictOwns", 8331 xmlMemBlocks() - mem_base); 8332 test_ret++; 8333 printf(" %d", n_dict); 8334 printf(" %d", n_str); 8335 printf("\n"); 8336 } 8337 } 8338 } 8339 function_tests++; 8340 8341 return(test_ret); 8342 } 8343 8344 8345 static int 8346 test_xmlDictQLookup(void) { 8347 int test_ret = 0; 8348 8349 int mem_base; 8350 const xmlChar * ret_val; 8351 xmlDictPtr dict; /* the dictionnary */ 8352 int n_dict; 8353 xmlChar * prefix; /* the prefix */ 8354 int n_prefix; 8355 xmlChar * name; /* the name */ 8356 int n_name; 8357 8358 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) { 8359 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) { 8360 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { 8361 mem_base = xmlMemBlocks(); 8362 dict = gen_xmlDictPtr(n_dict, 0); 8363 prefix = gen_const_xmlChar_ptr(n_prefix, 1); 8364 name = gen_const_xmlChar_ptr(n_name, 2); 8365 8366 ret_val = xmlDictQLookup(dict, (const xmlChar *)prefix, (const xmlChar *)name); 8367 desret_const_xmlChar_ptr(ret_val); 8368 call_tests++; 8369 des_xmlDictPtr(n_dict, dict, 0); 8370 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1); 8371 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2); 8372 xmlResetLastError(); 8373 if (mem_base != xmlMemBlocks()) { 8374 printf("Leak of %d blocks found in xmlDictQLookup", 8375 xmlMemBlocks() - mem_base); 8376 test_ret++; 8377 printf(" %d", n_dict); 8378 printf(" %d", n_prefix); 8379 printf(" %d", n_name); 8380 printf("\n"); 8381 } 8382 } 8383 } 8384 } 8385 function_tests++; 8386 8387 return(test_ret); 8388 } 8389 8390 8391 static int 8392 test_xmlDictReference(void) { 8393 int test_ret = 0; 8394 8395 int mem_base; 8396 int ret_val; 8397 xmlDictPtr dict; /* the dictionnary */ 8398 int n_dict; 8399 8400 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) { 8401 mem_base = xmlMemBlocks(); 8402 dict = gen_xmlDictPtr(n_dict, 0); 8403 8404 ret_val = xmlDictReference(dict); 8405 xmlDictFree(dict); 8406 desret_int(ret_val); 8407 call_tests++; 8408 des_xmlDictPtr(n_dict, dict, 0); 8409 xmlResetLastError(); 8410 if (mem_base != xmlMemBlocks()) { 8411 printf("Leak of %d blocks found in xmlDictReference", 8412 xmlMemBlocks() - mem_base); 8413 test_ret++; 8414 printf(" %d", n_dict); 8415 printf("\n"); 8416 } 8417 } 8418 function_tests++; 8419 8420 return(test_ret); 8421 } 8422 8423 8424 static int 8425 test_xmlDictSetLimit(void) { 8426 int test_ret = 0; 8427 8428 8429 /* missing type support */ 8430 return(test_ret); 8431 } 8432 8433 8434 static int 8435 test_xmlDictSize(void) { 8436 int test_ret = 0; 8437 8438 int mem_base; 8439 int ret_val; 8440 xmlDictPtr dict; /* the dictionnary */ 8441 int n_dict; 8442 8443 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) { 8444 mem_base = xmlMemBlocks(); 8445 dict = gen_xmlDictPtr(n_dict, 0); 8446 8447 ret_val = xmlDictSize(dict); 8448 desret_int(ret_val); 8449 call_tests++; 8450 des_xmlDictPtr(n_dict, dict, 0); 8451 xmlResetLastError(); 8452 if (mem_base != xmlMemBlocks()) { 8453 printf("Leak of %d blocks found in xmlDictSize", 8454 xmlMemBlocks() - mem_base); 8455 test_ret++; 8456 printf(" %d", n_dict); 8457 printf("\n"); 8458 } 8459 } 8460 function_tests++; 8461 8462 return(test_ret); 8463 } 8464 8465 8466 static int 8467 test_xmlInitializeDict(void) { 8468 int test_ret = 0; 8469 8470 int mem_base; 8471 int ret_val; 8472 8473 mem_base = xmlMemBlocks(); 8474 8475 ret_val = xmlInitializeDict(); 8476 desret_int(ret_val); 8477 call_tests++; 8478 xmlResetLastError(); 8479 if (mem_base != xmlMemBlocks()) { 8480 printf("Leak of %d blocks found in xmlInitializeDict", 8481 xmlMemBlocks() - mem_base); 8482 test_ret++; 8483 printf("\n"); 8484 } 8485 function_tests++; 8486 8487 return(test_ret); 8488 } 8489 8490 static int 8491 test_dict(void) { 8492 int test_ret = 0; 8493 8494 if (quiet == 0) printf("Testing dict : 10 of 13 functions ...\n"); 8495 test_ret += test_xmlDictCleanup(); 8496 test_ret += test_xmlDictCreate(); 8497 test_ret += test_xmlDictCreateSub(); 8498 test_ret += test_xmlDictExists(); 8499 test_ret += test_xmlDictGetUsage(); 8500 test_ret += test_xmlDictLookup(); 8501 test_ret += test_xmlDictOwns(); 8502 test_ret += test_xmlDictQLookup(); 8503 test_ret += test_xmlDictReference(); 8504 test_ret += test_xmlDictSetLimit(); 8505 test_ret += test_xmlDictSize(); 8506 test_ret += test_xmlInitializeDict(); 8507 8508 if (test_ret != 0) 8509 printf("Module dict: %d errors\n", test_ret); 8510 return(test_ret); 8511 } 8512 8513 static int 8514 test_UTF8Toisolat1(void) { 8515 int test_ret = 0; 8516 8517 #if defined(LIBXML_OUTPUT_ENABLED) 8518 #ifdef LIBXML_OUTPUT_ENABLED 8519 int mem_base; 8520 int ret_val; 8521 unsigned char * out; /* a pointer to an array of bytes to store the result */ 8522 int n_out; 8523 int * outlen; /* the length of @out */ 8524 int n_outlen; 8525 unsigned char * in; /* a pointer to an array of UTF-8 chars */ 8526 int n_in; 8527 int * inlen; /* the length of @in */ 8528 int n_inlen; 8529 8530 for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) { 8531 for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) { 8532 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) { 8533 for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) { 8534 mem_base = xmlMemBlocks(); 8535 out = gen_unsigned_char_ptr(n_out, 0); 8536 outlen = gen_int_ptr(n_outlen, 1); 8537 in = gen_const_unsigned_char_ptr(n_in, 2); 8538 inlen = gen_int_ptr(n_inlen, 3); 8539 8540 ret_val = UTF8Toisolat1(out, outlen, (const unsigned char *)in, inlen); 8541 desret_int(ret_val); 8542 call_tests++; 8543 des_unsigned_char_ptr(n_out, out, 0); 8544 des_int_ptr(n_outlen, outlen, 1); 8545 des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 2); 8546 des_int_ptr(n_inlen, inlen, 3); 8547 xmlResetLastError(); 8548 if (mem_base != xmlMemBlocks()) { 8549 printf("Leak of %d blocks found in UTF8Toisolat1", 8550 xmlMemBlocks() - mem_base); 8551 test_ret++; 8552 printf(" %d", n_out); 8553 printf(" %d", n_outlen); 8554 printf(" %d", n_in); 8555 printf(" %d", n_inlen); 8556 printf("\n"); 8557 } 8558 } 8559 } 8560 } 8561 } 8562 function_tests++; 8563 #endif 8564 #endif 8565 8566 return(test_ret); 8567 } 8568 8569 8570 static int 8571 test_isolat1ToUTF8(void) { 8572 int test_ret = 0; 8573 8574 int mem_base; 8575 int ret_val; 8576 unsigned char * out; /* a pointer to an array of bytes to store the result */ 8577 int n_out; 8578 int * outlen; /* the length of @out */ 8579 int n_outlen; 8580 unsigned char * in; /* a pointer to an array of ISO Latin 1 chars */ 8581 int n_in; 8582 int * inlen; /* the length of @in */ 8583 int n_inlen; 8584 8585 for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) { 8586 for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) { 8587 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) { 8588 for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) { 8589 mem_base = xmlMemBlocks(); 8590 out = gen_unsigned_char_ptr(n_out, 0); 8591 outlen = gen_int_ptr(n_outlen, 1); 8592 in = gen_const_unsigned_char_ptr(n_in, 2); 8593 inlen = gen_int_ptr(n_inlen, 3); 8594 8595 ret_val = isolat1ToUTF8(out, outlen, (const unsigned char *)in, inlen); 8596 desret_int(ret_val); 8597 call_tests++; 8598 des_unsigned_char_ptr(n_out, out, 0); 8599 des_int_ptr(n_outlen, outlen, 1); 8600 des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 2); 8601 des_int_ptr(n_inlen, inlen, 3); 8602 xmlResetLastError(); 8603 if (mem_base != xmlMemBlocks()) { 8604 printf("Leak of %d blocks found in isolat1ToUTF8", 8605 xmlMemBlocks() - mem_base); 8606 test_ret++; 8607 printf(" %d", n_out); 8608 printf(" %d", n_outlen); 8609 printf(" %d", n_in); 8610 printf(" %d", n_inlen); 8611 printf("\n"); 8612 } 8613 } 8614 } 8615 } 8616 } 8617 function_tests++; 8618 8619 return(test_ret); 8620 } 8621 8622 8623 static int 8624 test_xmlAddEncodingAlias(void) { 8625 int test_ret = 0; 8626 8627 int ret_val; 8628 char * name; /* the encoding name as parsed, in UTF-8 format (ASCII actually) */ 8629 int n_name; 8630 char * alias; /* the alias name as parsed, in UTF-8 format (ASCII actually) */ 8631 int n_alias; 8632 8633 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) { 8634 for (n_alias = 0;n_alias < gen_nb_const_char_ptr;n_alias++) { 8635 name = gen_const_char_ptr(n_name, 0); 8636 alias = gen_const_char_ptr(n_alias, 1); 8637 8638 ret_val = xmlAddEncodingAlias((const char *)name, (const char *)alias); 8639 desret_int(ret_val); 8640 call_tests++; 8641 des_const_char_ptr(n_name, (const char *)name, 0); 8642 des_const_char_ptr(n_alias, (const char *)alias, 1); 8643 xmlResetLastError(); 8644 } 8645 } 8646 function_tests++; 8647 8648 return(test_ret); 8649 } 8650 8651 8652 #define gen_nb_xmlCharEncodingHandler_ptr 1 8653 static xmlCharEncodingHandler * gen_xmlCharEncodingHandler_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 8654 return(NULL); 8655 } 8656 static void des_xmlCharEncodingHandler_ptr(int no ATTRIBUTE_UNUSED, xmlCharEncodingHandler * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 8657 } 8658 8659 static int 8660 test_xmlCharEncCloseFunc(void) { 8661 int test_ret = 0; 8662 8663 int mem_base; 8664 int ret_val; 8665 xmlCharEncodingHandler * handler; /* char enconding transformation data structure */ 8666 int n_handler; 8667 8668 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) { 8669 mem_base = xmlMemBlocks(); 8670 handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0); 8671 8672 ret_val = xmlCharEncCloseFunc(handler); 8673 desret_int(ret_val); 8674 call_tests++; 8675 des_xmlCharEncodingHandler_ptr(n_handler, handler, 0); 8676 xmlResetLastError(); 8677 if (mem_base != xmlMemBlocks()) { 8678 printf("Leak of %d blocks found in xmlCharEncCloseFunc", 8679 xmlMemBlocks() - mem_base); 8680 test_ret++; 8681 printf(" %d", n_handler); 8682 printf("\n"); 8683 } 8684 } 8685 function_tests++; 8686 8687 return(test_ret); 8688 } 8689 8690 8691 static int 8692 test_xmlCharEncFirstLine(void) { 8693 int test_ret = 0; 8694 8695 int mem_base; 8696 int ret_val; 8697 xmlCharEncodingHandler * handler; /* char enconding transformation data structure */ 8698 int n_handler; 8699 xmlBufferPtr out; /* an xmlBuffer for the output. */ 8700 int n_out; 8701 xmlBufferPtr in; /* an xmlBuffer for the input */ 8702 int n_in; 8703 8704 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) { 8705 for (n_out = 0;n_out < gen_nb_xmlBufferPtr;n_out++) { 8706 for (n_in = 0;n_in < gen_nb_xmlBufferPtr;n_in++) { 8707 mem_base = xmlMemBlocks(); 8708 handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0); 8709 out = gen_xmlBufferPtr(n_out, 1); 8710 in = gen_xmlBufferPtr(n_in, 2); 8711 8712 ret_val = xmlCharEncFirstLine(handler, out, in); 8713 desret_int(ret_val); 8714 call_tests++; 8715 des_xmlCharEncodingHandler_ptr(n_handler, handler, 0); 8716 des_xmlBufferPtr(n_out, out, 1); 8717 des_xmlBufferPtr(n_in, in, 2); 8718 xmlResetLastError(); 8719 if (mem_base != xmlMemBlocks()) { 8720 printf("Leak of %d blocks found in xmlCharEncFirstLine", 8721 xmlMemBlocks() - mem_base); 8722 test_ret++; 8723 printf(" %d", n_handler); 8724 printf(" %d", n_out); 8725 printf(" %d", n_in); 8726 printf("\n"); 8727 } 8728 } 8729 } 8730 } 8731 function_tests++; 8732 8733 return(test_ret); 8734 } 8735 8736 8737 static int 8738 test_xmlCharEncInFunc(void) { 8739 int test_ret = 0; 8740 8741 int mem_base; 8742 int ret_val; 8743 xmlCharEncodingHandler * handler; /* char encoding transformation data structure */ 8744 int n_handler; 8745 xmlBufferPtr out; /* an xmlBuffer for the output. */ 8746 int n_out; 8747 xmlBufferPtr in; /* an xmlBuffer for the input */ 8748 int n_in; 8749 8750 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) { 8751 for (n_out = 0;n_out < gen_nb_xmlBufferPtr;n_out++) { 8752 for (n_in = 0;n_in < gen_nb_xmlBufferPtr;n_in++) { 8753 mem_base = xmlMemBlocks(); 8754 handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0); 8755 out = gen_xmlBufferPtr(n_out, 1); 8756 in = gen_xmlBufferPtr(n_in, 2); 8757 8758 ret_val = xmlCharEncInFunc(handler, out, in); 8759 desret_int(ret_val); 8760 call_tests++; 8761 des_xmlCharEncodingHandler_ptr(n_handler, handler, 0); 8762 des_xmlBufferPtr(n_out, out, 1); 8763 des_xmlBufferPtr(n_in, in, 2); 8764 xmlResetLastError(); 8765 if (mem_base != xmlMemBlocks()) { 8766 printf("Leak of %d blocks found in xmlCharEncInFunc", 8767 xmlMemBlocks() - mem_base); 8768 test_ret++; 8769 printf(" %d", n_handler); 8770 printf(" %d", n_out); 8771 printf(" %d", n_in); 8772 printf("\n"); 8773 } 8774 } 8775 } 8776 } 8777 function_tests++; 8778 8779 return(test_ret); 8780 } 8781 8782 8783 static int 8784 test_xmlCharEncOutFunc(void) { 8785 int test_ret = 0; 8786 8787 int mem_base; 8788 int ret_val; 8789 xmlCharEncodingHandler * handler; /* char enconding transformation data structure */ 8790 int n_handler; 8791 xmlBufferPtr out; /* an xmlBuffer for the output. */ 8792 int n_out; 8793 xmlBufferPtr in; /* an xmlBuffer for the input */ 8794 int n_in; 8795 8796 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) { 8797 for (n_out = 0;n_out < gen_nb_xmlBufferPtr;n_out++) { 8798 for (n_in = 0;n_in < gen_nb_xmlBufferPtr;n_in++) { 8799 mem_base = xmlMemBlocks(); 8800 handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0); 8801 out = gen_xmlBufferPtr(n_out, 1); 8802 in = gen_xmlBufferPtr(n_in, 2); 8803 8804 ret_val = xmlCharEncOutFunc(handler, out, in); 8805 desret_int(ret_val); 8806 call_tests++; 8807 des_xmlCharEncodingHandler_ptr(n_handler, handler, 0); 8808 des_xmlBufferPtr(n_out, out, 1); 8809 des_xmlBufferPtr(n_in, in, 2); 8810 xmlResetLastError(); 8811 if (mem_base != xmlMemBlocks()) { 8812 printf("Leak of %d blocks found in xmlCharEncOutFunc", 8813 xmlMemBlocks() - mem_base); 8814 test_ret++; 8815 printf(" %d", n_handler); 8816 printf(" %d", n_out); 8817 printf(" %d", n_in); 8818 printf("\n"); 8819 } 8820 } 8821 } 8822 } 8823 function_tests++; 8824 8825 return(test_ret); 8826 } 8827 8828 8829 static int 8830 test_xmlCleanupCharEncodingHandlers(void) { 8831 int test_ret = 0; 8832 8833 8834 8835 xmlCleanupCharEncodingHandlers(); 8836 call_tests++; 8837 xmlResetLastError(); 8838 function_tests++; 8839 8840 return(test_ret); 8841 } 8842 8843 8844 static int 8845 test_xmlCleanupEncodingAliases(void) { 8846 int test_ret = 0; 8847 8848 int mem_base; 8849 8850 mem_base = xmlMemBlocks(); 8851 8852 xmlCleanupEncodingAliases(); 8853 call_tests++; 8854 xmlResetLastError(); 8855 if (mem_base != xmlMemBlocks()) { 8856 printf("Leak of %d blocks found in xmlCleanupEncodingAliases", 8857 xmlMemBlocks() - mem_base); 8858 test_ret++; 8859 printf("\n"); 8860 } 8861 function_tests++; 8862 8863 return(test_ret); 8864 } 8865 8866 8867 static int 8868 test_xmlDelEncodingAlias(void) { 8869 int test_ret = 0; 8870 8871 int mem_base; 8872 int ret_val; 8873 char * alias; /* the alias name as parsed, in UTF-8 format (ASCII actually) */ 8874 int n_alias; 8875 8876 for (n_alias = 0;n_alias < gen_nb_const_char_ptr;n_alias++) { 8877 mem_base = xmlMemBlocks(); 8878 alias = gen_const_char_ptr(n_alias, 0); 8879 8880 ret_val = xmlDelEncodingAlias((const char *)alias); 8881 desret_int(ret_val); 8882 call_tests++; 8883 des_const_char_ptr(n_alias, (const char *)alias, 0); 8884 xmlResetLastError(); 8885 if (mem_base != xmlMemBlocks()) { 8886 printf("Leak of %d blocks found in xmlDelEncodingAlias", 8887 xmlMemBlocks() - mem_base); 8888 test_ret++; 8889 printf(" %d", n_alias); 8890 printf("\n"); 8891 } 8892 } 8893 function_tests++; 8894 8895 return(test_ret); 8896 } 8897 8898 8899 static int 8900 test_xmlDetectCharEncoding(void) { 8901 int test_ret = 0; 8902 8903 int mem_base; 8904 xmlCharEncoding ret_val; 8905 unsigned char * in; /* a pointer to the first bytes of the XML entity, must be at least 2 bytes long (at least 4 if encoding is UTF4 variant). */ 8906 int n_in; 8907 int len; /* pointer to the length of the buffer */ 8908 int n_len; 8909 8910 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) { 8911 for (n_len = 0;n_len < gen_nb_int;n_len++) { 8912 mem_base = xmlMemBlocks(); 8913 in = gen_const_unsigned_char_ptr(n_in, 0); 8914 len = gen_int(n_len, 1); 8915 8916 ret_val = xmlDetectCharEncoding((const unsigned char *)in, len); 8917 desret_xmlCharEncoding(ret_val); 8918 call_tests++; 8919 des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 0); 8920 des_int(n_len, len, 1); 8921 xmlResetLastError(); 8922 if (mem_base != xmlMemBlocks()) { 8923 printf("Leak of %d blocks found in xmlDetectCharEncoding", 8924 xmlMemBlocks() - mem_base); 8925 test_ret++; 8926 printf(" %d", n_in); 8927 printf(" %d", n_len); 8928 printf("\n"); 8929 } 8930 } 8931 } 8932 function_tests++; 8933 8934 return(test_ret); 8935 } 8936 8937 8938 static int 8939 test_xmlFindCharEncodingHandler(void) { 8940 int test_ret = 0; 8941 8942 8943 /* missing type support */ 8944 return(test_ret); 8945 } 8946 8947 8948 static int 8949 test_xmlGetCharEncodingHandler(void) { 8950 int test_ret = 0; 8951 8952 8953 /* missing type support */ 8954 return(test_ret); 8955 } 8956 8957 8958 static int 8959 test_xmlGetCharEncodingName(void) { 8960 int test_ret = 0; 8961 8962 int mem_base; 8963 const char * ret_val; 8964 xmlCharEncoding enc; /* the encoding */ 8965 int n_enc; 8966 8967 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) { 8968 mem_base = xmlMemBlocks(); 8969 enc = gen_xmlCharEncoding(n_enc, 0); 8970 8971 ret_val = xmlGetCharEncodingName(enc); 8972 desret_const_char_ptr(ret_val); 8973 call_tests++; 8974 des_xmlCharEncoding(n_enc, enc, 0); 8975 xmlResetLastError(); 8976 if (mem_base != xmlMemBlocks()) { 8977 printf("Leak of %d blocks found in xmlGetCharEncodingName", 8978 xmlMemBlocks() - mem_base); 8979 test_ret++; 8980 printf(" %d", n_enc); 8981 printf("\n"); 8982 } 8983 } 8984 function_tests++; 8985 8986 return(test_ret); 8987 } 8988 8989 8990 static int 8991 test_xmlGetEncodingAlias(void) { 8992 int test_ret = 0; 8993 8994 int mem_base; 8995 const char * ret_val; 8996 char * alias; /* the alias name as parsed, in UTF-8 format (ASCII actually) */ 8997 int n_alias; 8998 8999 for (n_alias = 0;n_alias < gen_nb_const_char_ptr;n_alias++) { 9000 mem_base = xmlMemBlocks(); 9001 alias = gen_const_char_ptr(n_alias, 0); 9002 9003 ret_val = xmlGetEncodingAlias((const char *)alias); 9004 desret_const_char_ptr(ret_val); 9005 call_tests++; 9006 des_const_char_ptr(n_alias, (const char *)alias, 0); 9007 xmlResetLastError(); 9008 if (mem_base != xmlMemBlocks()) { 9009 printf("Leak of %d blocks found in xmlGetEncodingAlias", 9010 xmlMemBlocks() - mem_base); 9011 test_ret++; 9012 printf(" %d", n_alias); 9013 printf("\n"); 9014 } 9015 } 9016 function_tests++; 9017 9018 return(test_ret); 9019 } 9020 9021 9022 static int 9023 test_xmlInitCharEncodingHandlers(void) { 9024 int test_ret = 0; 9025 9026 9027 9028 xmlInitCharEncodingHandlers(); 9029 call_tests++; 9030 xmlResetLastError(); 9031 function_tests++; 9032 9033 return(test_ret); 9034 } 9035 9036 9037 static int 9038 test_xmlNewCharEncodingHandler(void) { 9039 int test_ret = 0; 9040 9041 9042 /* missing type support */ 9043 return(test_ret); 9044 } 9045 9046 9047 static int 9048 test_xmlParseCharEncoding(void) { 9049 int test_ret = 0; 9050 9051 int mem_base; 9052 xmlCharEncoding ret_val; 9053 char * name; /* the encoding name as parsed, in UTF-8 format (ASCII actually) */ 9054 int n_name; 9055 9056 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) { 9057 mem_base = xmlMemBlocks(); 9058 name = gen_const_char_ptr(n_name, 0); 9059 9060 ret_val = xmlParseCharEncoding((const char *)name); 9061 desret_xmlCharEncoding(ret_val); 9062 call_tests++; 9063 des_const_char_ptr(n_name, (const char *)name, 0); 9064 xmlResetLastError(); 9065 if (mem_base != xmlMemBlocks()) { 9066 printf("Leak of %d blocks found in xmlParseCharEncoding", 9067 xmlMemBlocks() - mem_base); 9068 test_ret++; 9069 printf(" %d", n_name); 9070 printf("\n"); 9071 } 9072 } 9073 function_tests++; 9074 9075 return(test_ret); 9076 } 9077 9078 9079 #define gen_nb_xmlCharEncodingHandlerPtr 1 9080 static xmlCharEncodingHandlerPtr gen_xmlCharEncodingHandlerPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 9081 return(NULL); 9082 } 9083 static void des_xmlCharEncodingHandlerPtr(int no ATTRIBUTE_UNUSED, xmlCharEncodingHandlerPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 9084 } 9085 9086 static int 9087 test_xmlRegisterCharEncodingHandler(void) { 9088 int test_ret = 0; 9089 9090 int mem_base; 9091 xmlCharEncodingHandlerPtr handler; /* the xmlCharEncodingHandlerPtr handler block */ 9092 int n_handler; 9093 9094 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandlerPtr;n_handler++) { 9095 mem_base = xmlMemBlocks(); 9096 handler = gen_xmlCharEncodingHandlerPtr(n_handler, 0); 9097 9098 xmlRegisterCharEncodingHandler(handler); 9099 call_tests++; 9100 des_xmlCharEncodingHandlerPtr(n_handler, handler, 0); 9101 xmlResetLastError(); 9102 if (mem_base != xmlMemBlocks()) { 9103 printf("Leak of %d blocks found in xmlRegisterCharEncodingHandler", 9104 xmlMemBlocks() - mem_base); 9105 test_ret++; 9106 printf(" %d", n_handler); 9107 printf("\n"); 9108 } 9109 } 9110 function_tests++; 9111 9112 return(test_ret); 9113 } 9114 9115 static int 9116 test_encoding(void) { 9117 int test_ret = 0; 9118 9119 if (quiet == 0) printf("Testing encoding : 16 of 19 functions ...\n"); 9120 test_ret += test_UTF8Toisolat1(); 9121 test_ret += test_isolat1ToUTF8(); 9122 test_ret += test_xmlAddEncodingAlias(); 9123 test_ret += test_xmlCharEncCloseFunc(); 9124 test_ret += test_xmlCharEncFirstLine(); 9125 test_ret += test_xmlCharEncInFunc(); 9126 test_ret += test_xmlCharEncOutFunc(); 9127 test_ret += test_xmlCleanupCharEncodingHandlers(); 9128 test_ret += test_xmlCleanupEncodingAliases(); 9129 test_ret += test_xmlDelEncodingAlias(); 9130 test_ret += test_xmlDetectCharEncoding(); 9131 test_ret += test_xmlFindCharEncodingHandler(); 9132 test_ret += test_xmlGetCharEncodingHandler(); 9133 test_ret += test_xmlGetCharEncodingName(); 9134 test_ret += test_xmlGetEncodingAlias(); 9135 test_ret += test_xmlInitCharEncodingHandlers(); 9136 test_ret += test_xmlNewCharEncodingHandler(); 9137 test_ret += test_xmlParseCharEncoding(); 9138 test_ret += test_xmlRegisterCharEncodingHandler(); 9139 9140 if (test_ret != 0) 9141 printf("Module encoding: %d errors\n", test_ret); 9142 return(test_ret); 9143 } 9144 9145 static int 9146 test_xmlAddDocEntity(void) { 9147 int test_ret = 0; 9148 9149 int mem_base; 9150 xmlEntityPtr ret_val; 9151 xmlDocPtr doc; /* the document */ 9152 int n_doc; 9153 xmlChar * name; /* the entity name */ 9154 int n_name; 9155 int type; /* the entity type XML_xxx_yyy_ENTITY */ 9156 int n_type; 9157 xmlChar * ExternalID; /* the entity external ID if available */ 9158 int n_ExternalID; 9159 xmlChar * SystemID; /* the entity system ID if available */ 9160 int n_SystemID; 9161 xmlChar * content; /* the entity content */ 9162 int n_content; 9163 9164 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { 9165 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { 9166 for (n_type = 0;n_type < gen_nb_int;n_type++) { 9167 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) { 9168 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) { 9169 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) { 9170 mem_base = xmlMemBlocks(); 9171 doc = gen_xmlDocPtr(n_doc, 0); 9172 name = gen_const_xmlChar_ptr(n_name, 1); 9173 type = gen_int(n_type, 2); 9174 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 3); 9175 SystemID = gen_const_xmlChar_ptr(n_SystemID, 4); 9176 content = gen_const_xmlChar_ptr(n_content, 5); 9177 9178 ret_val = xmlAddDocEntity(doc, (const xmlChar *)name, type, (const xmlChar *)ExternalID, (const xmlChar *)SystemID, (const xmlChar *)content); 9179 desret_xmlEntityPtr(ret_val); 9180 call_tests++; 9181 des_xmlDocPtr(n_doc, doc, 0); 9182 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); 9183 des_int(n_type, type, 2); 9184 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 3); 9185 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 4); 9186 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 5); 9187 xmlResetLastError(); 9188 if (mem_base != xmlMemBlocks()) { 9189 printf("Leak of %d blocks found in xmlAddDocEntity", 9190 xmlMemBlocks() - mem_base); 9191 test_ret++; 9192 printf(" %d", n_doc); 9193 printf(" %d", n_name); 9194 printf(" %d", n_type); 9195 printf(" %d", n_ExternalID); 9196 printf(" %d", n_SystemID); 9197 printf(" %d", n_content); 9198 printf("\n"); 9199 } 9200 } 9201 } 9202 } 9203 } 9204 } 9205 } 9206 function_tests++; 9207 9208 return(test_ret); 9209 } 9210 9211 9212 static int 9213 test_xmlAddDtdEntity(void) { 9214 int test_ret = 0; 9215 9216 int mem_base; 9217 xmlEntityPtr ret_val; 9218 xmlDocPtr doc; /* the document */ 9219 int n_doc; 9220 xmlChar * name; /* the entity name */ 9221 int n_name; 9222 int type; /* the entity type XML_xxx_yyy_ENTITY */ 9223 int n_type; 9224 xmlChar * ExternalID; /* the entity external ID if available */ 9225 int n_ExternalID; 9226 xmlChar * SystemID; /* the entity system ID if available */ 9227 int n_SystemID; 9228 xmlChar * content; /* the entity content */ 9229 int n_content; 9230 9231 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { 9232 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { 9233 for (n_type = 0;n_type < gen_nb_int;n_type++) { 9234 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) { 9235 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) { 9236 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) { 9237 mem_base = xmlMemBlocks(); 9238 doc = gen_xmlDocPtr(n_doc, 0); 9239 name = gen_const_xmlChar_ptr(n_name, 1); 9240 type = gen_int(n_type, 2); 9241 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 3); 9242 SystemID = gen_const_xmlChar_ptr(n_SystemID, 4); 9243 content = gen_const_xmlChar_ptr(n_content, 5); 9244 9245 ret_val = xmlAddDtdEntity(doc, (const xmlChar *)name, type, (const xmlChar *)ExternalID, (const xmlChar *)SystemID, (const xmlChar *)content); 9246 desret_xmlEntityPtr(ret_val); 9247 call_tests++; 9248 des_xmlDocPtr(n_doc, doc, 0); 9249 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); 9250 des_int(n_type, type, 2); 9251 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 3); 9252 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 4); 9253 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 5); 9254 xmlResetLastError(); 9255 if (mem_base != xmlMemBlocks()) { 9256 printf("Leak of %d blocks found in xmlAddDtdEntity", 9257 xmlMemBlocks() - mem_base); 9258 test_ret++; 9259 printf(" %d", n_doc); 9260 printf(" %d", n_name); 9261 printf(" %d", n_type); 9262 printf(" %d", n_ExternalID); 9263 printf(" %d", n_SystemID); 9264 printf(" %d", n_content); 9265 printf("\n"); 9266 } 9267 } 9268 } 9269 } 9270 } 9271 } 9272 } 9273 function_tests++; 9274 9275 return(test_ret); 9276 } 9277 9278 9279 static int 9280 test_xmlCleanupPredefinedEntities(void) { 9281 int test_ret = 0; 9282 9283 #if defined(LIBXML_LEGACY_ENABLED) 9284 #ifdef LIBXML_LEGACY_ENABLED 9285 int mem_base; 9286 9287 mem_base = xmlMemBlocks(); 9288 9289 xmlCleanupPredefinedEntities(); 9290 call_tests++; 9291 xmlResetLastError(); 9292 if (mem_base != xmlMemBlocks()) { 9293 printf("Leak of %d blocks found in xmlCleanupPredefinedEntities", 9294 xmlMemBlocks() - mem_base); 9295 test_ret++; 9296 printf("\n"); 9297 } 9298 function_tests++; 9299 #endif 9300 #endif 9301 9302 return(test_ret); 9303 } 9304 9305 9306 #define gen_nb_xmlEntitiesTablePtr 1 9307 static xmlEntitiesTablePtr gen_xmlEntitiesTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 9308 return(NULL); 9309 } 9310 static void des_xmlEntitiesTablePtr(int no ATTRIBUTE_UNUSED, xmlEntitiesTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 9311 } 9312 9313 static int 9314 test_xmlCopyEntitiesTable(void) { 9315 int test_ret = 0; 9316 9317 9318 /* missing type support */ 9319 return(test_ret); 9320 } 9321 9322 9323 static int 9324 test_xmlCreateEntitiesTable(void) { 9325 int test_ret = 0; 9326 9327 9328 /* missing type support */ 9329 return(test_ret); 9330 } 9331 9332 9333 static int 9334 test_xmlDumpEntitiesTable(void) { 9335 int test_ret = 0; 9336 9337 #if defined(LIBXML_OUTPUT_ENABLED) 9338 int mem_base; 9339 xmlBufferPtr buf; /* An XML buffer. */ 9340 int n_buf; 9341 xmlEntitiesTablePtr table; /* An entity table */ 9342 int n_table; 9343 9344 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) { 9345 for (n_table = 0;n_table < gen_nb_xmlEntitiesTablePtr;n_table++) { 9346 mem_base = xmlMemBlocks(); 9347 buf = gen_xmlBufferPtr(n_buf, 0); 9348 table = gen_xmlEntitiesTablePtr(n_table, 1); 9349 9350 xmlDumpEntitiesTable(buf, table); 9351 call_tests++; 9352 des_xmlBufferPtr(n_buf, buf, 0); 9353 des_xmlEntitiesTablePtr(n_table, table, 1); 9354 xmlResetLastError(); 9355 if (mem_base != xmlMemBlocks()) { 9356 printf("Leak of %d blocks found in xmlDumpEntitiesTable", 9357 xmlMemBlocks() - mem_base); 9358 test_ret++; 9359 printf(" %d", n_buf); 9360 printf(" %d", n_table); 9361 printf("\n"); 9362 } 9363 } 9364 } 9365 function_tests++; 9366 #endif 9367 9368 return(test_ret); 9369 } 9370 9371 9372 #define gen_nb_xmlEntityPtr 1 9373 static xmlEntityPtr gen_xmlEntityPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 9374 return(NULL); 9375 } 9376 static void des_xmlEntityPtr(int no ATTRIBUTE_UNUSED, xmlEntityPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 9377 } 9378 9379 static int 9380 test_xmlDumpEntityDecl(void) { 9381 int test_ret = 0; 9382 9383 #if defined(LIBXML_OUTPUT_ENABLED) 9384 int mem_base; 9385 xmlBufferPtr buf; /* An XML buffer. */ 9386 int n_buf; 9387 xmlEntityPtr ent; /* An entity table */ 9388 int n_ent; 9389 9390 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) { 9391 for (n_ent = 0;n_ent < gen_nb_xmlEntityPtr;n_ent++) { 9392 mem_base = xmlMemBlocks(); 9393 buf = gen_xmlBufferPtr(n_buf, 0); 9394 ent = gen_xmlEntityPtr(n_ent, 1); 9395 9396 xmlDumpEntityDecl(buf, ent); 9397 call_tests++; 9398 des_xmlBufferPtr(n_buf, buf, 0); 9399 des_xmlEntityPtr(n_ent, ent, 1); 9400 xmlResetLastError(); 9401 if (mem_base != xmlMemBlocks()) { 9402 printf("Leak of %d blocks found in xmlDumpEntityDecl", 9403 xmlMemBlocks() - mem_base); 9404 test_ret++; 9405 printf(" %d", n_buf); 9406 printf(" %d", n_ent); 9407 printf("\n"); 9408 } 9409 } 9410 } 9411 function_tests++; 9412 #endif 9413 9414 return(test_ret); 9415 } 9416 9417 9418 static int 9419 test_xmlEncodeEntitiesReentrant(void) { 9420 int test_ret = 0; 9421 9422 int mem_base; 9423 xmlChar * ret_val; 9424 xmlDocPtr doc; /* the document containing the string */ 9425 int n_doc; 9426 xmlChar * input; /* A string to convert to XML. */ 9427 int n_input; 9428 9429 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { 9430 for (n_input = 0;n_input < gen_nb_const_xmlChar_ptr;n_input++) { 9431 mem_base = xmlMemBlocks(); 9432 doc = gen_xmlDocPtr(n_doc, 0); 9433 input = gen_const_xmlChar_ptr(n_input, 1); 9434 9435 ret_val = xmlEncodeEntitiesReentrant(doc, (const xmlChar *)input); 9436 desret_xmlChar_ptr(ret_val); 9437 call_tests++; 9438 des_xmlDocPtr(n_doc, doc, 0); 9439 des_const_xmlChar_ptr(n_input, (const xmlChar *)input, 1); 9440 xmlResetLastError(); 9441 if (mem_base != xmlMemBlocks()) { 9442 printf("Leak of %d blocks found in xmlEncodeEntitiesReentrant", 9443 xmlMemBlocks() - mem_base); 9444 test_ret++; 9445 printf(" %d", n_doc); 9446 printf(" %d", n_input); 9447 printf("\n"); 9448 } 9449 } 9450 } 9451 function_tests++; 9452 9453 return(test_ret); 9454 } 9455 9456 9457 #define gen_nb_const_xmlDoc_ptr 1 9458 static xmlDoc * gen_const_xmlDoc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 9459 return(NULL); 9460 } 9461 static void des_const_xmlDoc_ptr(int no ATTRIBUTE_UNUSED, const xmlDoc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 9462 } 9463 9464 static int 9465 test_xmlEncodeSpecialChars(void) { 9466 int test_ret = 0; 9467 9468 int mem_base; 9469 xmlChar * ret_val; 9470 xmlDoc * doc; /* the document containing the string */ 9471 int n_doc; 9472 xmlChar * input; /* A string to convert to XML. */ 9473 int n_input; 9474 9475 for (n_doc = 0;n_doc < gen_nb_const_xmlDoc_ptr;n_doc++) { 9476 for (n_input = 0;n_input < gen_nb_const_xmlChar_ptr;n_input++) { 9477 mem_base = xmlMemBlocks(); 9478 doc = gen_const_xmlDoc_ptr(n_doc, 0); 9479 input = gen_const_xmlChar_ptr(n_input, 1); 9480 9481 ret_val = xmlEncodeSpecialChars((const xmlDoc *)doc, (const xmlChar *)input); 9482 desret_xmlChar_ptr(ret_val); 9483 call_tests++; 9484 des_const_xmlDoc_ptr(n_doc, (const xmlDoc *)doc, 0); 9485 des_const_xmlChar_ptr(n_input, (const xmlChar *)input, 1); 9486 xmlResetLastError(); 9487 if (mem_base != xmlMemBlocks()) { 9488 printf("Leak of %d blocks found in xmlEncodeSpecialChars", 9489 xmlMemBlocks() - mem_base); 9490 test_ret++; 9491 printf(" %d", n_doc); 9492 printf(" %d", n_input); 9493 printf("\n"); 9494 } 9495 } 9496 } 9497 function_tests++; 9498 9499 return(test_ret); 9500 } 9501 9502 9503 static int 9504 test_xmlGetDocEntity(void) { 9505 int test_ret = 0; 9506 9507 int mem_base; 9508 xmlEntityPtr ret_val; 9509 xmlDoc * doc; /* the document referencing the entity */ 9510 int n_doc; 9511 xmlChar * name; /* the entity name */ 9512 int n_name; 9513 9514 for (n_doc = 0;n_doc < gen_nb_const_xmlDoc_ptr;n_doc++) { 9515 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { 9516 mem_base = xmlMemBlocks(); 9517 doc = gen_const_xmlDoc_ptr(n_doc, 0); 9518 name = gen_const_xmlChar_ptr(n_name, 1); 9519 9520 ret_val = xmlGetDocEntity((const xmlDoc *)doc, (const xmlChar *)name); 9521 desret_xmlEntityPtr(ret_val); 9522 call_tests++; 9523 des_const_xmlDoc_ptr(n_doc, (const xmlDoc *)doc, 0); 9524 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); 9525 xmlResetLastError(); 9526 if (mem_base != xmlMemBlocks()) { 9527 printf("Leak of %d blocks found in xmlGetDocEntity", 9528 xmlMemBlocks() - mem_base); 9529 test_ret++; 9530 printf(" %d", n_doc); 9531 printf(" %d", n_name); 9532 printf("\n"); 9533 } 9534 } 9535 } 9536 function_tests++; 9537 9538 return(test_ret); 9539 } 9540 9541 9542 static int 9543 test_xmlGetDtdEntity(void) { 9544 int test_ret = 0; 9545 9546 int mem_base; 9547 xmlEntityPtr ret_val; 9548 xmlDocPtr doc; /* the document referencing the entity */ 9549 int n_doc; 9550 xmlChar * name; /* the entity name */ 9551 int n_name; 9552 9553 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { 9554 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { 9555 mem_base = xmlMemBlocks(); 9556 doc = gen_xmlDocPtr(n_doc, 0); 9557 name = gen_const_xmlChar_ptr(n_name, 1); 9558 9559 ret_val = xmlGetDtdEntity(doc, (const xmlChar *)name); 9560 desret_xmlEntityPtr(ret_val); 9561 call_tests++; 9562 des_xmlDocPtr(n_doc, doc, 0); 9563 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); 9564 xmlResetLastError(); 9565 if (mem_base != xmlMemBlocks()) { 9566 printf("Leak of %d blocks found in xmlGetDtdEntity", 9567 xmlMemBlocks() - mem_base); 9568 test_ret++; 9569 printf(" %d", n_doc); 9570 printf(" %d", n_name); 9571 printf("\n"); 9572 } 9573 } 9574 } 9575 function_tests++; 9576 9577 return(test_ret); 9578 } 9579 9580 9581 static int 9582 test_xmlGetParameterEntity(void) { 9583 int test_ret = 0; 9584 9585 int mem_base; 9586 xmlEntityPtr ret_val; 9587 xmlDocPtr doc; /* the document referencing the entity */ 9588 int n_doc; 9589 xmlChar * name; /* the entity name */ 9590 int n_name; 9591 9592 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { 9593 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { 9594 mem_base = xmlMemBlocks(); 9595 doc = gen_xmlDocPtr(n_doc, 0); 9596 name = gen_const_xmlChar_ptr(n_name, 1); 9597 9598 ret_val = xmlGetParameterEntity(doc, (const xmlChar *)name); 9599 desret_xmlEntityPtr(ret_val); 9600 call_tests++; 9601 des_xmlDocPtr(n_doc, doc, 0); 9602 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); 9603 xmlResetLastError(); 9604 if (mem_base != xmlMemBlocks()) { 9605 printf("Leak of %d blocks found in xmlGetParameterEntity", 9606 xmlMemBlocks() - mem_base); 9607 test_ret++; 9608 printf(" %d", n_doc); 9609 printf(" %d", n_name); 9610 printf("\n"); 9611 } 9612 } 9613 } 9614 function_tests++; 9615 9616 return(test_ret); 9617 } 9618 9619 9620 static int 9621 test_xmlGetPredefinedEntity(void) { 9622 int test_ret = 0; 9623 9624 int mem_base; 9625 xmlEntityPtr ret_val; 9626 xmlChar * name; /* the entity name */ 9627 int n_name; 9628 9629 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { 9630 mem_base = xmlMemBlocks(); 9631 name = gen_const_xmlChar_ptr(n_name, 0); 9632 9633 ret_val = xmlGetPredefinedEntity((const xmlChar *)name); 9634 desret_xmlEntityPtr(ret_val); 9635 call_tests++; 9636 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0); 9637 xmlResetLastError(); 9638 if (mem_base != xmlMemBlocks()) { 9639 printf("Leak of %d blocks found in xmlGetPredefinedEntity", 9640 xmlMemBlocks() - mem_base); 9641 test_ret++; 9642 printf(" %d", n_name); 9643 printf("\n"); 9644 } 9645 } 9646 function_tests++; 9647 9648 return(test_ret); 9649 } 9650 9651 9652 static int 9653 test_xmlInitializePredefinedEntities(void) { 9654 int test_ret = 0; 9655 9656 #if defined(LIBXML_LEGACY_ENABLED) 9657 #ifdef LIBXML_LEGACY_ENABLED 9658 int mem_base; 9659 9660 mem_base = xmlMemBlocks(); 9661 9662 xmlInitializePredefinedEntities(); 9663 call_tests++; 9664 xmlResetLastError(); 9665 if (mem_base != xmlMemBlocks()) { 9666 printf("Leak of %d blocks found in xmlInitializePredefinedEntities", 9667 xmlMemBlocks() - mem_base); 9668 test_ret++; 9669 printf("\n"); 9670 } 9671 function_tests++; 9672 #endif 9673 #endif 9674 9675 return(test_ret); 9676 } 9677 9678 9679 static int 9680 test_xmlNewEntity(void) { 9681 int test_ret = 0; 9682 9683 int mem_base; 9684 xmlEntityPtr ret_val; 9685 xmlDocPtr doc; /* the document */ 9686 int n_doc; 9687 xmlChar * name; /* the entity name */ 9688 int n_name; 9689 int type; /* the entity type XML_xxx_yyy_ENTITY */ 9690 int n_type; 9691 xmlChar * ExternalID; /* the entity external ID if available */ 9692 int n_ExternalID; 9693 xmlChar * SystemID; /* the entity system ID if available */ 9694 int n_SystemID; 9695 xmlChar * content; /* the entity content */ 9696 int n_content; 9697 9698 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { 9699 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { 9700 for (n_type = 0;n_type < gen_nb_int;n_type++) { 9701 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) { 9702 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) { 9703 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) { 9704 mem_base = xmlMemBlocks(); 9705 doc = gen_xmlDocPtr(n_doc, 0); 9706 name = gen_const_xmlChar_ptr(n_name, 1); 9707 type = gen_int(n_type, 2); 9708 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 3); 9709 SystemID = gen_const_xmlChar_ptr(n_SystemID, 4); 9710 content = gen_const_xmlChar_ptr(n_content, 5); 9711 9712 ret_val = xmlNewEntity(doc, (const xmlChar *)name, type, (const xmlChar *)ExternalID, (const xmlChar *)SystemID, (const xmlChar *)content); 9713 desret_xmlEntityPtr(ret_val); 9714 call_tests++; 9715 des_xmlDocPtr(n_doc, doc, 0); 9716 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); 9717 des_int(n_type, type, 2); 9718 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 3); 9719 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 4); 9720 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 5); 9721 xmlResetLastError(); 9722 if (mem_base != xmlMemBlocks()) { 9723 printf("Leak of %d blocks found in xmlNewEntity", 9724 xmlMemBlocks() - mem_base); 9725 test_ret++; 9726 printf(" %d", n_doc); 9727 printf(" %d", n_name); 9728 printf(" %d", n_type); 9729 printf(" %d", n_ExternalID); 9730 printf(" %d", n_SystemID); 9731 printf(" %d", n_content); 9732 printf("\n"); 9733 } 9734 } 9735 } 9736 } 9737 } 9738 } 9739 } 9740 function_tests++; 9741 9742 return(test_ret); 9743 } 9744 9745 static int 9746 test_entities(void) { 9747 int test_ret = 0; 9748 9749 if (quiet == 0) printf("Testing entities : 13 of 17 functions ...\n"); 9750 test_ret += test_xmlAddDocEntity(); 9751 test_ret += test_xmlAddDtdEntity(); 9752 test_ret += test_xmlCleanupPredefinedEntities(); 9753 test_ret += test_xmlCopyEntitiesTable(); 9754 test_ret += test_xmlCreateEntitiesTable(); 9755 test_ret += test_xmlDumpEntitiesTable(); 9756 test_ret += test_xmlDumpEntityDecl(); 9757 test_ret += test_xmlEncodeEntitiesReentrant(); 9758 test_ret += test_xmlEncodeSpecialChars(); 9759 test_ret += test_xmlGetDocEntity(); 9760 test_ret += test_xmlGetDtdEntity(); 9761 test_ret += test_xmlGetParameterEntity(); 9762 test_ret += test_xmlGetPredefinedEntity(); 9763 test_ret += test_xmlInitializePredefinedEntities(); 9764 test_ret += test_xmlNewEntity(); 9765 9766 if (test_ret != 0) 9767 printf("Module entities: %d errors\n", test_ret); 9768 return(test_ret); 9769 } 9770 9771 static int 9772 test_xmlHashAddEntry(void) { 9773 int test_ret = 0; 9774 9775 int mem_base; 9776 int ret_val; 9777 xmlHashTablePtr table; /* the hash table */ 9778 int n_table; 9779 xmlChar * name; /* the name of the userdata */ 9780 int n_name; 9781 void * userdata; /* a pointer to the userdata */ 9782 int n_userdata; 9783 9784 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) { 9785 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { 9786 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) { 9787 mem_base = xmlMemBlocks(); 9788 table = gen_xmlHashTablePtr(n_table, 0); 9789 name = gen_const_xmlChar_ptr(n_name, 1); 9790 userdata = gen_userdata(n_userdata, 2); 9791 9792 ret_val = xmlHashAddEntry(table, (const xmlChar *)name, userdata); 9793 desret_int(ret_val); 9794 call_tests++; 9795 des_xmlHashTablePtr(n_table, table, 0); 9796 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); 9797 des_userdata(n_userdata, userdata, 2); 9798 xmlResetLastError(); 9799 if (mem_base != xmlMemBlocks()) { 9800 printf("Leak of %d blocks found in xmlHashAddEntry", 9801 xmlMemBlocks() - mem_base); 9802 test_ret++; 9803 printf(" %d", n_table); 9804 printf(" %d", n_name); 9805 printf(" %d", n_userdata); 9806 printf("\n"); 9807 } 9808 } 9809 } 9810 } 9811 function_tests++; 9812 9813 return(test_ret); 9814 } 9815 9816 9817 static int 9818 test_xmlHashAddEntry2(void) { 9819 int test_ret = 0; 9820 9821 int mem_base; 9822 int ret_val; 9823 xmlHashTablePtr table; /* the hash table */ 9824 int n_table; 9825 xmlChar * name; /* the name of the userdata */ 9826 int n_name; 9827 xmlChar * name2; /* a second name of the userdata */ 9828 int n_name2; 9829 void * userdata; /* a pointer to the userdata */ 9830 int n_userdata; 9831 9832 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) { 9833 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { 9834 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) { 9835 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) { 9836 mem_base = xmlMemBlocks(); 9837 table = gen_xmlHashTablePtr(n_table, 0); 9838 name = gen_const_xmlChar_ptr(n_name, 1); 9839 name2 = gen_const_xmlChar_ptr(n_name2, 2); 9840 userdata = gen_userdata(n_userdata, 3); 9841 9842 ret_val = xmlHashAddEntry2(table, (const xmlChar *)name, (const xmlChar *)name2, userdata); 9843 desret_int(ret_val); 9844 call_tests++; 9845 des_xmlHashTablePtr(n_table, table, 0); 9846 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); 9847 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2); 9848 des_userdata(n_userdata, userdata, 3); 9849 xmlResetLastError(); 9850 if (mem_base != xmlMemBlocks()) { 9851 printf("Leak of %d blocks found in xmlHashAddEntry2", 9852 xmlMemBlocks() - mem_base); 9853 test_ret++; 9854 printf(" %d", n_table); 9855 printf(" %d", n_name); 9856 printf(" %d", n_name2); 9857 printf(" %d", n_userdata); 9858 printf("\n"); 9859 } 9860 } 9861 } 9862 } 9863 } 9864 function_tests++; 9865 9866 return(test_ret); 9867 } 9868 9869 9870 static int 9871 test_xmlHashAddEntry3(void) { 9872 int test_ret = 0; 9873 9874 int mem_base; 9875 int ret_val; 9876 xmlHashTablePtr table; /* the hash table */ 9877 int n_table; 9878 xmlChar * name; /* the name of the userdata */ 9879 int n_name; 9880 xmlChar * name2; /* a second name of the userdata */ 9881 int n_name2; 9882 xmlChar * name3; /* a third name of the userdata */ 9883 int n_name3; 9884 void * userdata; /* a pointer to the userdata */ 9885 int n_userdata; 9886 9887 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) { 9888 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { 9889 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) { 9890 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) { 9891 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) { 9892 mem_base = xmlMemBlocks(); 9893 table = gen_xmlHashTablePtr(n_table, 0); 9894 name = gen_const_xmlChar_ptr(n_name, 1); 9895 name2 = gen_const_xmlChar_ptr(n_name2, 2); 9896 name3 = gen_const_xmlChar_ptr(n_name3, 3); 9897 userdata = gen_userdata(n_userdata, 4); 9898 9899 ret_val = xmlHashAddEntry3(table, (const xmlChar *)name, (const xmlChar *)name2, (const xmlChar *)name3, userdata); 9900 desret_int(ret_val); 9901 call_tests++; 9902 des_xmlHashTablePtr(n_table, table, 0); 9903 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); 9904 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2); 9905 des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 3); 9906 des_userdata(n_userdata, userdata, 4); 9907 xmlResetLastError(); 9908 if (mem_base != xmlMemBlocks()) { 9909 printf("Leak of %d blocks found in xmlHashAddEntry3", 9910 xmlMemBlocks() - mem_base); 9911 test_ret++; 9912 printf(" %d", n_table); 9913 printf(" %d", n_name); 9914 printf(" %d", n_name2); 9915 printf(" %d", n_name3); 9916 printf(" %d", n_userdata); 9917 printf("\n"); 9918 } 9919 } 9920 } 9921 } 9922 } 9923 } 9924 function_tests++; 9925 9926 return(test_ret); 9927 } 9928 9929 9930 static int 9931 test_xmlHashCopy(void) { 9932 int test_ret = 0; 9933 9934 9935 /* missing type support */ 9936 return(test_ret); 9937 } 9938 9939 9940 static int 9941 test_xmlHashCreate(void) { 9942 int test_ret = 0; 9943 9944 9945 /* missing type support */ 9946 return(test_ret); 9947 } 9948 9949 9950 static int 9951 test_xmlHashCreateDict(void) { 9952 int test_ret = 0; 9953 9954 9955 /* missing type support */ 9956 return(test_ret); 9957 } 9958 9959 9960 static int 9961 test_xmlHashLookup(void) { 9962 int test_ret = 0; 9963 9964 int mem_base; 9965 void * ret_val; 9966 xmlHashTablePtr table; /* the hash table */ 9967 int n_table; 9968 xmlChar * name; /* the name of the userdata */ 9969 int n_name; 9970 9971 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) { 9972 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { 9973 mem_base = xmlMemBlocks(); 9974 table = gen_xmlHashTablePtr(n_table, 0); 9975 name = gen_const_xmlChar_ptr(n_name, 1); 9976 9977 ret_val = xmlHashLookup(table, (const xmlChar *)name); 9978 desret_void_ptr(ret_val); 9979 call_tests++; 9980 des_xmlHashTablePtr(n_table, table, 0); 9981 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); 9982 xmlResetLastError(); 9983 if (mem_base != xmlMemBlocks()) { 9984 printf("Leak of %d blocks found in xmlHashLookup", 9985 xmlMemBlocks() - mem_base); 9986 test_ret++; 9987 printf(" %d", n_table); 9988 printf(" %d", n_name); 9989 printf("\n"); 9990 } 9991 } 9992 } 9993 function_tests++; 9994 9995 return(test_ret); 9996 } 9997 9998 9999 static int 10000 test_xmlHashLookup2(void) { 10001 int test_ret = 0; 10002 10003 int mem_base; 10004 void * ret_val; 10005 xmlHashTablePtr table; /* the hash table */ 10006 int n_table; 10007 xmlChar * name; /* the name of the userdata */ 10008 int n_name; 10009 xmlChar * name2; /* a second name of the userdata */ 10010 int n_name2; 10011 10012 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) { 10013 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { 10014 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) { 10015 mem_base = xmlMemBlocks(); 10016 table = gen_xmlHashTablePtr(n_table, 0); 10017 name = gen_const_xmlChar_ptr(n_name, 1); 10018 name2 = gen_const_xmlChar_ptr(n_name2, 2); 10019 10020 ret_val = xmlHashLookup2(table, (const xmlChar *)name, (const xmlChar *)name2); 10021 desret_void_ptr(ret_val); 10022 call_tests++; 10023 des_xmlHashTablePtr(n_table, table, 0); 10024 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); 10025 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2); 10026 xmlResetLastError(); 10027 if (mem_base != xmlMemBlocks()) { 10028 printf("Leak of %d blocks found in xmlHashLookup2", 10029 xmlMemBlocks() - mem_base); 10030 test_ret++; 10031 printf(" %d", n_table); 10032 printf(" %d", n_name); 10033 printf(" %d", n_name2); 10034 printf("\n"); 10035 } 10036 } 10037 } 10038 } 10039 function_tests++; 10040 10041 return(test_ret); 10042 } 10043 10044 10045 static int 10046 test_xmlHashLookup3(void) { 10047 int test_ret = 0; 10048 10049 int mem_base; 10050 void * ret_val; 10051 xmlHashTablePtr table; /* the hash table */ 10052 int n_table; 10053 xmlChar * name; /* the name of the userdata */ 10054 int n_name; 10055 xmlChar * name2; /* a second name of the userdata */ 10056 int n_name2; 10057 xmlChar * name3; /* a third name of the userdata */ 10058 int n_name3; 10059 10060 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) { 10061 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { 10062 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) { 10063 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) { 10064 mem_base = xmlMemBlocks(); 10065 table = gen_xmlHashTablePtr(n_table, 0); 10066 name = gen_const_xmlChar_ptr(n_name, 1); 10067 name2 = gen_const_xmlChar_ptr(n_name2, 2); 10068 name3 = gen_const_xmlChar_ptr(n_name3, 3); 10069 10070 ret_val = xmlHashLookup3(table, (const xmlChar *)name, (const xmlChar *)name2, (const xmlChar *)name3); 10071 desret_void_ptr(ret_val); 10072 call_tests++; 10073 des_xmlHashTablePtr(n_table, table, 0); 10074 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); 10075 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2); 10076 des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 3); 10077 xmlResetLastError(); 10078 if (mem_base != xmlMemBlocks()) { 10079 printf("Leak of %d blocks found in xmlHashLookup3", 10080 xmlMemBlocks() - mem_base); 10081 test_ret++; 10082 printf(" %d", n_table); 10083 printf(" %d", n_name); 10084 printf(" %d", n_name2); 10085 printf(" %d", n_name3); 10086 printf("\n"); 10087 } 10088 } 10089 } 10090 } 10091 } 10092 function_tests++; 10093 10094 return(test_ret); 10095 } 10096 10097 10098 static int 10099 test_xmlHashQLookup(void) { 10100 int test_ret = 0; 10101 10102 int mem_base; 10103 void * ret_val; 10104 xmlHashTablePtr table; /* the hash table */ 10105 int n_table; 10106 xmlChar * prefix; /* the prefix of the userdata */ 10107 int n_prefix; 10108 xmlChar * name; /* the name of the userdata */ 10109 int n_name; 10110 10111 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) { 10112 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) { 10113 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { 10114 mem_base = xmlMemBlocks(); 10115 table = gen_xmlHashTablePtr(n_table, 0); 10116 prefix = gen_const_xmlChar_ptr(n_prefix, 1); 10117 name = gen_const_xmlChar_ptr(n_name, 2); 10118 10119 ret_val = xmlHashQLookup(table, (const xmlChar *)prefix, (const xmlChar *)name); 10120 desret_void_ptr(ret_val); 10121 call_tests++; 10122 des_xmlHashTablePtr(n_table, table, 0); 10123 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1); 10124 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2); 10125 xmlResetLastError(); 10126 if (mem_base != xmlMemBlocks()) { 10127 printf("Leak of %d blocks found in xmlHashQLookup", 10128 xmlMemBlocks() - mem_base); 10129 test_ret++; 10130 printf(" %d", n_table); 10131 printf(" %d", n_prefix); 10132 printf(" %d", n_name); 10133 printf("\n"); 10134 } 10135 } 10136 } 10137 } 10138 function_tests++; 10139 10140 return(test_ret); 10141 } 10142 10143 10144 static int 10145 test_xmlHashQLookup2(void) { 10146 int test_ret = 0; 10147 10148 int mem_base; 10149 void * ret_val; 10150 xmlHashTablePtr table; /* the hash table */ 10151 int n_table; 10152 xmlChar * prefix; /* the prefix of the userdata */ 10153 int n_prefix; 10154 xmlChar * name; /* the name of the userdata */ 10155 int n_name; 10156 xmlChar * prefix2; /* the second prefix of the userdata */ 10157 int n_prefix2; 10158 xmlChar * name2; /* a second name of the userdata */ 10159 int n_name2; 10160 10161 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) { 10162 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) { 10163 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { 10164 for (n_prefix2 = 0;n_prefix2 < gen_nb_const_xmlChar_ptr;n_prefix2++) { 10165 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) { 10166 mem_base = xmlMemBlocks(); 10167 table = gen_xmlHashTablePtr(n_table, 0); 10168 prefix = gen_const_xmlChar_ptr(n_prefix, 1); 10169 name = gen_const_xmlChar_ptr(n_name, 2); 10170 prefix2 = gen_const_xmlChar_ptr(n_prefix2, 3); 10171 name2 = gen_const_xmlChar_ptr(n_name2, 4); 10172 10173 ret_val = xmlHashQLookup2(table, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)prefix2, (const xmlChar *)name2); 10174 desret_void_ptr(ret_val); 10175 call_tests++; 10176 des_xmlHashTablePtr(n_table, table, 0); 10177 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1); 10178 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2); 10179 des_const_xmlChar_ptr(n_prefix2, (const xmlChar *)prefix2, 3); 10180 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 4); 10181 xmlResetLastError(); 10182 if (mem_base != xmlMemBlocks()) { 10183 printf("Leak of %d blocks found in xmlHashQLookup2", 10184 xmlMemBlocks() - mem_base); 10185 test_ret++; 10186 printf(" %d", n_table); 10187 printf(" %d", n_prefix); 10188 printf(" %d", n_name); 10189 printf(" %d", n_prefix2); 10190 printf(" %d", n_name2); 10191 printf("\n"); 10192 } 10193 } 10194 } 10195 } 10196 } 10197 } 10198 function_tests++; 10199 10200 return(test_ret); 10201 } 10202 10203 10204 static int 10205 test_xmlHashQLookup3(void) { 10206 int test_ret = 0; 10207 10208 int mem_base; 10209 void * ret_val; 10210 xmlHashTablePtr table; /* the hash table */ 10211 int n_table; 10212 xmlChar * prefix; /* the prefix of the userdata */ 10213 int n_prefix; 10214 xmlChar * name; /* the name of the userdata */ 10215 int n_name; 10216 xmlChar * prefix2; /* the second prefix of the userdata */ 10217 int n_prefix2; 10218 xmlChar * name2; /* a second name of the userdata */ 10219 int n_name2; 10220 xmlChar * prefix3; /* the third prefix of the userdata */ 10221 int n_prefix3; 10222 xmlChar * name3; /* a third name of the userdata */ 10223 int n_name3; 10224 10225 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) { 10226 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) { 10227 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { 10228 for (n_prefix2 = 0;n_prefix2 < gen_nb_const_xmlChar_ptr;n_prefix2++) { 10229 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) { 10230 for (n_prefix3 = 0;n_prefix3 < gen_nb_const_xmlChar_ptr;n_prefix3++) { 10231 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) { 10232 mem_base = xmlMemBlocks(); 10233 table = gen_xmlHashTablePtr(n_table, 0); 10234 prefix = gen_const_xmlChar_ptr(n_prefix, 1); 10235 name = gen_const_xmlChar_ptr(n_name, 2); 10236 prefix2 = gen_const_xmlChar_ptr(n_prefix2, 3); 10237 name2 = gen_const_xmlChar_ptr(n_name2, 4); 10238 prefix3 = gen_const_xmlChar_ptr(n_prefix3, 5); 10239 name3 = gen_const_xmlChar_ptr(n_name3, 6); 10240 10241 ret_val = xmlHashQLookup3(table, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)prefix2, (const xmlChar *)name2, (const xmlChar *)prefix3, (const xmlChar *)name3); 10242 desret_void_ptr(ret_val); 10243 call_tests++; 10244 des_xmlHashTablePtr(n_table, table, 0); 10245 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1); 10246 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2); 10247 des_const_xmlChar_ptr(n_prefix2, (const xmlChar *)prefix2, 3); 10248 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 4); 10249 des_const_xmlChar_ptr(n_prefix3, (const xmlChar *)prefix3, 5); 10250 des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 6); 10251 xmlResetLastError(); 10252 if (mem_base != xmlMemBlocks()) { 10253 printf("Leak of %d blocks found in xmlHashQLookup3", 10254 xmlMemBlocks() - mem_base); 10255 test_ret++; 10256 printf(" %d", n_table); 10257 printf(" %d", n_prefix); 10258 printf(" %d", n_name); 10259 printf(" %d", n_prefix2); 10260 printf(" %d", n_name2); 10261 printf(" %d", n_prefix3); 10262 printf(" %d", n_name3); 10263 printf("\n"); 10264 } 10265 } 10266 } 10267 } 10268 } 10269 } 10270 } 10271 } 10272 function_tests++; 10273 10274 return(test_ret); 10275 } 10276 10277 10278 static int 10279 test_xmlHashRemoveEntry(void) { 10280 int test_ret = 0; 10281 10282 int mem_base; 10283 int ret_val; 10284 xmlHashTablePtr table; /* the hash table */ 10285 int n_table; 10286 xmlChar * name; /* the name of the userdata */ 10287 int n_name; 10288 xmlHashDeallocator f; /* the deallocator function for removed item (if any) */ 10289 int n_f; 10290 10291 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) { 10292 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { 10293 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) { 10294 mem_base = xmlMemBlocks(); 10295 table = gen_xmlHashTablePtr(n_table, 0); 10296 name = gen_const_xmlChar_ptr(n_name, 1); 10297 f = gen_xmlHashDeallocator(n_f, 2); 10298 10299 ret_val = xmlHashRemoveEntry(table, (const xmlChar *)name, f); 10300 desret_int(ret_val); 10301 call_tests++; 10302 des_xmlHashTablePtr(n_table, table, 0); 10303 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); 10304 des_xmlHashDeallocator(n_f, f, 2); 10305 xmlResetLastError(); 10306 if (mem_base != xmlMemBlocks()) { 10307 printf("Leak of %d blocks found in xmlHashRemoveEntry", 10308 xmlMemBlocks() - mem_base); 10309 test_ret++; 10310 printf(" %d", n_table); 10311 printf(" %d", n_name); 10312 printf(" %d", n_f); 10313 printf("\n"); 10314 } 10315 } 10316 } 10317 } 10318 function_tests++; 10319 10320 return(test_ret); 10321 } 10322 10323 10324 static int 10325 test_xmlHashRemoveEntry2(void) { 10326 int test_ret = 0; 10327 10328 int mem_base; 10329 int ret_val; 10330 xmlHashTablePtr table; /* the hash table */ 10331 int n_table; 10332 xmlChar * name; /* the name of the userdata */ 10333 int n_name; 10334 xmlChar * name2; /* a second name of the userdata */ 10335 int n_name2; 10336 xmlHashDeallocator f; /* the deallocator function for removed item (if any) */ 10337 int n_f; 10338 10339 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) { 10340 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { 10341 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) { 10342 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) { 10343 mem_base = xmlMemBlocks(); 10344 table = gen_xmlHashTablePtr(n_table, 0); 10345 name = gen_const_xmlChar_ptr(n_name, 1); 10346 name2 = gen_const_xmlChar_ptr(n_name2, 2); 10347 f = gen_xmlHashDeallocator(n_f, 3); 10348 10349 ret_val = xmlHashRemoveEntry2(table, (const xmlChar *)name, (const xmlChar *)name2, f); 10350 desret_int(ret_val); 10351 call_tests++; 10352 des_xmlHashTablePtr(n_table, table, 0); 10353 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); 10354 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2); 10355 des_xmlHashDeallocator(n_f, f, 3); 10356 xmlResetLastError(); 10357 if (mem_base != xmlMemBlocks()) { 10358 printf("Leak of %d blocks found in xmlHashRemoveEntry2", 10359 xmlMemBlocks() - mem_base); 10360 test_ret++; 10361 printf(" %d", n_table); 10362 printf(" %d", n_name); 10363 printf(" %d", n_name2); 10364 printf(" %d", n_f); 10365 printf("\n"); 10366 } 10367 } 10368 } 10369 } 10370 } 10371 function_tests++; 10372 10373 return(test_ret); 10374 } 10375 10376 10377 static int 10378 test_xmlHashRemoveEntry3(void) { 10379 int test_ret = 0; 10380 10381 int mem_base; 10382 int ret_val; 10383 xmlHashTablePtr table; /* the hash table */ 10384 int n_table; 10385 xmlChar * name; /* the name of the userdata */ 10386 int n_name; 10387 xmlChar * name2; /* a second name of the userdata */ 10388 int n_name2; 10389 xmlChar * name3; /* a third name of the userdata */ 10390 int n_name3; 10391 xmlHashDeallocator f; /* the deallocator function for removed item (if any) */ 10392 int n_f; 10393 10394 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) { 10395 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { 10396 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) { 10397 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) { 10398 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) { 10399 mem_base = xmlMemBlocks(); 10400 table = gen_xmlHashTablePtr(n_table, 0); 10401 name = gen_const_xmlChar_ptr(n_name, 1); 10402 name2 = gen_const_xmlChar_ptr(n_name2, 2); 10403 name3 = gen_const_xmlChar_ptr(n_name3, 3); 10404 f = gen_xmlHashDeallocator(n_f, 4); 10405 10406 ret_val = xmlHashRemoveEntry3(table, (const xmlChar *)name, (const xmlChar *)name2, (const xmlChar *)name3, f); 10407 desret_int(ret_val); 10408 call_tests++; 10409 des_xmlHashTablePtr(n_table, table, 0); 10410 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); 10411 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2); 10412 des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 3); 10413 des_xmlHashDeallocator(n_f, f, 4); 10414 xmlResetLastError(); 10415 if (mem_base != xmlMemBlocks()) { 10416 printf("Leak of %d blocks found in xmlHashRemoveEntry3", 10417 xmlMemBlocks() - mem_base); 10418 test_ret++; 10419 printf(" %d", n_table); 10420 printf(" %d", n_name); 10421 printf(" %d", n_name2); 10422 printf(" %d", n_name3); 10423 printf(" %d", n_f); 10424 printf("\n"); 10425 } 10426 } 10427 } 10428 } 10429 } 10430 } 10431 function_tests++; 10432 10433 return(test_ret); 10434 } 10435 10436 10437 static int 10438 test_xmlHashScan(void) { 10439 int test_ret = 0; 10440 10441 10442 /* missing type support */ 10443 return(test_ret); 10444 } 10445 10446 10447 static int 10448 test_xmlHashScan3(void) { 10449 int test_ret = 0; 10450 10451 10452 /* missing type support */ 10453 return(test_ret); 10454 } 10455 10456 10457 static int 10458 test_xmlHashScanFull(void) { 10459 int test_ret = 0; 10460 10461 10462 /* missing type support */ 10463 return(test_ret); 10464 } 10465 10466 10467 static int 10468 test_xmlHashScanFull3(void) { 10469 int test_ret = 0; 10470 10471 10472 /* missing type support */ 10473 return(test_ret); 10474 } 10475 10476 10477 static int 10478 test_xmlHashSize(void) { 10479 int test_ret = 0; 10480 10481 int mem_base; 10482 int ret_val; 10483 xmlHashTablePtr table; /* the hash table */ 10484 int n_table; 10485 10486 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) { 10487 mem_base = xmlMemBlocks(); 10488 table = gen_xmlHashTablePtr(n_table, 0); 10489 10490 ret_val = xmlHashSize(table); 10491 desret_int(ret_val); 10492 call_tests++; 10493 des_xmlHashTablePtr(n_table, table, 0); 10494 xmlResetLastError(); 10495 if (mem_base != xmlMemBlocks()) { 10496 printf("Leak of %d blocks found in xmlHashSize", 10497 xmlMemBlocks() - mem_base); 10498 test_ret++; 10499 printf(" %d", n_table); 10500 printf("\n"); 10501 } 10502 } 10503 function_tests++; 10504 10505 return(test_ret); 10506 } 10507 10508 10509 static int 10510 test_xmlHashUpdateEntry(void) { 10511 int test_ret = 0; 10512 10513 int mem_base; 10514 int ret_val; 10515 xmlHashTablePtr table; /* the hash table */ 10516 int n_table; 10517 xmlChar * name; /* the name of the userdata */ 10518 int n_name; 10519 void * userdata; /* a pointer to the userdata */ 10520 int n_userdata; 10521 xmlHashDeallocator f; /* the deallocator function for replaced item (if any) */ 10522 int n_f; 10523 10524 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) { 10525 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { 10526 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) { 10527 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) { 10528 mem_base = xmlMemBlocks(); 10529 table = gen_xmlHashTablePtr(n_table, 0); 10530 name = gen_const_xmlChar_ptr(n_name, 1); 10531 userdata = gen_userdata(n_userdata, 2); 10532 f = gen_xmlHashDeallocator(n_f, 3); 10533 10534 ret_val = xmlHashUpdateEntry(table, (const xmlChar *)name, userdata, f); 10535 desret_int(ret_val); 10536 call_tests++; 10537 des_xmlHashTablePtr(n_table, table, 0); 10538 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); 10539 des_userdata(n_userdata, userdata, 2); 10540 des_xmlHashDeallocator(n_f, f, 3); 10541 xmlResetLastError(); 10542 if (mem_base != xmlMemBlocks()) { 10543 printf("Leak of %d blocks found in xmlHashUpdateEntry", 10544 xmlMemBlocks() - mem_base); 10545 test_ret++; 10546 printf(" %d", n_table); 10547 printf(" %d", n_name); 10548 printf(" %d", n_userdata); 10549 printf(" %d", n_f); 10550 printf("\n"); 10551 } 10552 } 10553 } 10554 } 10555 } 10556 function_tests++; 10557 10558 return(test_ret); 10559 } 10560 10561 10562 static int 10563 test_xmlHashUpdateEntry2(void) { 10564 int test_ret = 0; 10565 10566 int mem_base; 10567 int ret_val; 10568 xmlHashTablePtr table; /* the hash table */ 10569 int n_table; 10570 xmlChar * name; /* the name of the userdata */ 10571 int n_name; 10572 xmlChar * name2; /* a second name of the userdata */ 10573 int n_name2; 10574 void * userdata; /* a pointer to the userdata */ 10575 int n_userdata; 10576 xmlHashDeallocator f; /* the deallocator function for replaced item (if any) */ 10577 int n_f; 10578 10579 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) { 10580 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { 10581 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) { 10582 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) { 10583 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) { 10584 mem_base = xmlMemBlocks(); 10585 table = gen_xmlHashTablePtr(n_table, 0); 10586 name = gen_const_xmlChar_ptr(n_name, 1); 10587 name2 = gen_const_xmlChar_ptr(n_name2, 2); 10588 userdata = gen_userdata(n_userdata, 3); 10589 f = gen_xmlHashDeallocator(n_f, 4); 10590 10591 ret_val = xmlHashUpdateEntry2(table, (const xmlChar *)name, (const xmlChar *)name2, userdata, f); 10592 desret_int(ret_val); 10593 call_tests++; 10594 des_xmlHashTablePtr(n_table, table, 0); 10595 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); 10596 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2); 10597 des_userdata(n_userdata, userdata, 3); 10598 des_xmlHashDeallocator(n_f, f, 4); 10599 xmlResetLastError(); 10600 if (mem_base != xmlMemBlocks()) { 10601 printf("Leak of %d blocks found in xmlHashUpdateEntry2", 10602 xmlMemBlocks() - mem_base); 10603 test_ret++; 10604 printf(" %d", n_table); 10605 printf(" %d", n_name); 10606 printf(" %d", n_name2); 10607 printf(" %d", n_userdata); 10608 printf(" %d", n_f); 10609 printf("\n"); 10610 } 10611 } 10612 } 10613 } 10614 } 10615 } 10616 function_tests++; 10617 10618 return(test_ret); 10619 } 10620 10621 10622 static int 10623 test_xmlHashUpdateEntry3(void) { 10624 int test_ret = 0; 10625 10626 int mem_base; 10627 int ret_val; 10628 xmlHashTablePtr table; /* the hash table */ 10629 int n_table; 10630 xmlChar * name; /* the name of the userdata */ 10631 int n_name; 10632 xmlChar * name2; /* a second name of the userdata */ 10633 int n_name2; 10634 xmlChar * name3; /* a third name of the userdata */ 10635 int n_name3; 10636 void * userdata; /* a pointer to the userdata */ 10637 int n_userdata; 10638 xmlHashDeallocator f; /* the deallocator function for replaced item (if any) */ 10639 int n_f; 10640 10641 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) { 10642 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { 10643 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) { 10644 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) { 10645 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) { 10646 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) { 10647 mem_base = xmlMemBlocks(); 10648 table = gen_xmlHashTablePtr(n_table, 0); 10649 name = gen_const_xmlChar_ptr(n_name, 1); 10650 name2 = gen_const_xmlChar_ptr(n_name2, 2); 10651 name3 = gen_const_xmlChar_ptr(n_name3, 3); 10652 userdata = gen_userdata(n_userdata, 4); 10653 f = gen_xmlHashDeallocator(n_f, 5); 10654 10655 ret_val = xmlHashUpdateEntry3(table, (const xmlChar *)name, (const xmlChar *)name2, (const xmlChar *)name3, userdata, f); 10656 desret_int(ret_val); 10657 call_tests++; 10658 des_xmlHashTablePtr(n_table, table, 0); 10659 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); 10660 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2); 10661 des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 3); 10662 des_userdata(n_userdata, userdata, 4); 10663 des_xmlHashDeallocator(n_f, f, 5); 10664 xmlResetLastError(); 10665 if (mem_base != xmlMemBlocks()) { 10666 printf("Leak of %d blocks found in xmlHashUpdateEntry3", 10667 xmlMemBlocks() - mem_base); 10668 test_ret++; 10669 printf(" %d", n_table); 10670 printf(" %d", n_name); 10671 printf(" %d", n_name2); 10672 printf(" %d", n_name3); 10673 printf(" %d", n_userdata); 10674 printf(" %d", n_f); 10675 printf("\n"); 10676 } 10677 } 10678 } 10679 } 10680 } 10681 } 10682 } 10683 function_tests++; 10684 10685 return(test_ret); 10686 } 10687 10688 static int 10689 test_hash(void) { 10690 int test_ret = 0; 10691 10692 if (quiet == 0) printf("Testing hash : 16 of 24 functions ...\n"); 10693 test_ret += test_xmlHashAddEntry(); 10694 test_ret += test_xmlHashAddEntry2(); 10695 test_ret += test_xmlHashAddEntry3(); 10696 test_ret += test_xmlHashCopy(); 10697 test_ret += test_xmlHashCreate(); 10698 test_ret += test_xmlHashCreateDict(); 10699 test_ret += test_xmlHashLookup(); 10700 test_ret += test_xmlHashLookup2(); 10701 test_ret += test_xmlHashLookup3(); 10702 test_ret += test_xmlHashQLookup(); 10703 test_ret += test_xmlHashQLookup2(); 10704 test_ret += test_xmlHashQLookup3(); 10705 test_ret += test_xmlHashRemoveEntry(); 10706 test_ret += test_xmlHashRemoveEntry2(); 10707 test_ret += test_xmlHashRemoveEntry3(); 10708 test_ret += test_xmlHashScan(); 10709 test_ret += test_xmlHashScan3(); 10710 test_ret += test_xmlHashScanFull(); 10711 test_ret += test_xmlHashScanFull3(); 10712 test_ret += test_xmlHashSize(); 10713 test_ret += test_xmlHashUpdateEntry(); 10714 test_ret += test_xmlHashUpdateEntry2(); 10715 test_ret += test_xmlHashUpdateEntry3(); 10716 10717 if (test_ret != 0) 10718 printf("Module hash: %d errors\n", test_ret); 10719 return(test_ret); 10720 } 10721 10722 #define gen_nb_xmlLinkPtr 1 10723 static xmlLinkPtr gen_xmlLinkPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 10724 return(NULL); 10725 } 10726 static void des_xmlLinkPtr(int no ATTRIBUTE_UNUSED, xmlLinkPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 10727 } 10728 10729 static int 10730 test_xmlLinkGetData(void) { 10731 int test_ret = 0; 10732 10733 int mem_base; 10734 void * ret_val; 10735 xmlLinkPtr lk; /* a link */ 10736 int n_lk; 10737 10738 for (n_lk = 0;n_lk < gen_nb_xmlLinkPtr;n_lk++) { 10739 mem_base = xmlMemBlocks(); 10740 lk = gen_xmlLinkPtr(n_lk, 0); 10741 10742 ret_val = xmlLinkGetData(lk); 10743 desret_void_ptr(ret_val); 10744 call_tests++; 10745 des_xmlLinkPtr(n_lk, lk, 0); 10746 xmlResetLastError(); 10747 if (mem_base != xmlMemBlocks()) { 10748 printf("Leak of %d blocks found in xmlLinkGetData", 10749 xmlMemBlocks() - mem_base); 10750 test_ret++; 10751 printf(" %d", n_lk); 10752 printf("\n"); 10753 } 10754 } 10755 function_tests++; 10756 10757 return(test_ret); 10758 } 10759 10760 10761 static int 10762 test_xmlListAppend(void) { 10763 int test_ret = 0; 10764 10765 int mem_base; 10766 int ret_val; 10767 xmlListPtr l; /* a list */ 10768 int n_l; 10769 void * data; /* the data */ 10770 int n_data; 10771 10772 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) { 10773 for (n_data = 0;n_data < gen_nb_userdata;n_data++) { 10774 mem_base = xmlMemBlocks(); 10775 l = gen_xmlListPtr(n_l, 0); 10776 data = gen_userdata(n_data, 1); 10777 10778 ret_val = xmlListAppend(l, data); 10779 desret_int(ret_val); 10780 call_tests++; 10781 des_xmlListPtr(n_l, l, 0); 10782 des_userdata(n_data, data, 1); 10783 xmlResetLastError(); 10784 if (mem_base != xmlMemBlocks()) { 10785 printf("Leak of %d blocks found in xmlListAppend", 10786 xmlMemBlocks() - mem_base); 10787 test_ret++; 10788 printf(" %d", n_l); 10789 printf(" %d", n_data); 10790 printf("\n"); 10791 } 10792 } 10793 } 10794 function_tests++; 10795 10796 return(test_ret); 10797 } 10798 10799 10800 static int 10801 test_xmlListClear(void) { 10802 int test_ret = 0; 10803 10804 int mem_base; 10805 xmlListPtr l; /* a list */ 10806 int n_l; 10807 10808 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) { 10809 mem_base = xmlMemBlocks(); 10810 l = gen_xmlListPtr(n_l, 0); 10811 10812 xmlListClear(l); 10813 call_tests++; 10814 des_xmlListPtr(n_l, l, 0); 10815 xmlResetLastError(); 10816 if (mem_base != xmlMemBlocks()) { 10817 printf("Leak of %d blocks found in xmlListClear", 10818 xmlMemBlocks() - mem_base); 10819 test_ret++; 10820 printf(" %d", n_l); 10821 printf("\n"); 10822 } 10823 } 10824 function_tests++; 10825 10826 return(test_ret); 10827 } 10828 10829 10830 #define gen_nb_const_xmlListPtr 1 10831 static xmlListPtr gen_const_xmlListPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 10832 return(NULL); 10833 } 10834 static void des_const_xmlListPtr(int no ATTRIBUTE_UNUSED, const xmlListPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 10835 } 10836 10837 static int 10838 test_xmlListCopy(void) { 10839 int test_ret = 0; 10840 10841 int mem_base; 10842 int ret_val; 10843 xmlListPtr cur; /* the new list */ 10844 int n_cur; 10845 xmlListPtr old; /* the old list */ 10846 int n_old; 10847 10848 for (n_cur = 0;n_cur < gen_nb_xmlListPtr;n_cur++) { 10849 for (n_old = 0;n_old < gen_nb_const_xmlListPtr;n_old++) { 10850 mem_base = xmlMemBlocks(); 10851 cur = gen_xmlListPtr(n_cur, 0); 10852 old = gen_const_xmlListPtr(n_old, 1); 10853 10854 ret_val = xmlListCopy(cur, (const xmlListPtr)old); 10855 desret_int(ret_val); 10856 call_tests++; 10857 des_xmlListPtr(n_cur, cur, 0); 10858 des_const_xmlListPtr(n_old, (const xmlListPtr)old, 1); 10859 xmlResetLastError(); 10860 if (mem_base != xmlMemBlocks()) { 10861 printf("Leak of %d blocks found in xmlListCopy", 10862 xmlMemBlocks() - mem_base); 10863 test_ret++; 10864 printf(" %d", n_cur); 10865 printf(" %d", n_old); 10866 printf("\n"); 10867 } 10868 } 10869 } 10870 function_tests++; 10871 10872 return(test_ret); 10873 } 10874 10875 10876 static int 10877 test_xmlListCreate(void) { 10878 int test_ret = 0; 10879 10880 10881 /* missing type support */ 10882 return(test_ret); 10883 } 10884 10885 10886 static int 10887 test_xmlListDup(void) { 10888 int test_ret = 0; 10889 10890 10891 /* missing type support */ 10892 return(test_ret); 10893 } 10894 10895 10896 static int 10897 test_xmlListEmpty(void) { 10898 int test_ret = 0; 10899 10900 int mem_base; 10901 int ret_val; 10902 xmlListPtr l; /* a list */ 10903 int n_l; 10904 10905 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) { 10906 mem_base = xmlMemBlocks(); 10907 l = gen_xmlListPtr(n_l, 0); 10908 10909 ret_val = xmlListEmpty(l); 10910 desret_int(ret_val); 10911 call_tests++; 10912 des_xmlListPtr(n_l, l, 0); 10913 xmlResetLastError(); 10914 if (mem_base != xmlMemBlocks()) { 10915 printf("Leak of %d blocks found in xmlListEmpty", 10916 xmlMemBlocks() - mem_base); 10917 test_ret++; 10918 printf(" %d", n_l); 10919 printf("\n"); 10920 } 10921 } 10922 function_tests++; 10923 10924 return(test_ret); 10925 } 10926 10927 10928 static int 10929 test_xmlListEnd(void) { 10930 int test_ret = 0; 10931 10932 10933 /* missing type support */ 10934 return(test_ret); 10935 } 10936 10937 10938 static int 10939 test_xmlListFront(void) { 10940 int test_ret = 0; 10941 10942 10943 /* missing type support */ 10944 return(test_ret); 10945 } 10946 10947 10948 static int 10949 test_xmlListInsert(void) { 10950 int test_ret = 0; 10951 10952 int mem_base; 10953 int ret_val; 10954 xmlListPtr l; /* a list */ 10955 int n_l; 10956 void * data; /* the data */ 10957 int n_data; 10958 10959 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) { 10960 for (n_data = 0;n_data < gen_nb_userdata;n_data++) { 10961 mem_base = xmlMemBlocks(); 10962 l = gen_xmlListPtr(n_l, 0); 10963 data = gen_userdata(n_data, 1); 10964 10965 ret_val = xmlListInsert(l, data); 10966 desret_int(ret_val); 10967 call_tests++; 10968 des_xmlListPtr(n_l, l, 0); 10969 des_userdata(n_data, data, 1); 10970 xmlResetLastError(); 10971 if (mem_base != xmlMemBlocks()) { 10972 printf("Leak of %d blocks found in xmlListInsert", 10973 xmlMemBlocks() - mem_base); 10974 test_ret++; 10975 printf(" %d", n_l); 10976 printf(" %d", n_data); 10977 printf("\n"); 10978 } 10979 } 10980 } 10981 function_tests++; 10982 10983 return(test_ret); 10984 } 10985 10986 10987 static int 10988 test_xmlListMerge(void) { 10989 int test_ret = 0; 10990 10991 int mem_base; 10992 xmlListPtr l1; /* the original list */ 10993 int n_l1; 10994 xmlListPtr l2; /* the new list */ 10995 int n_l2; 10996 10997 for (n_l1 = 0;n_l1 < gen_nb_xmlListPtr;n_l1++) { 10998 for (n_l2 = 0;n_l2 < gen_nb_xmlListPtr;n_l2++) { 10999 mem_base = xmlMemBlocks(); 11000 l1 = gen_xmlListPtr(n_l1, 0); 11001 l2 = gen_xmlListPtr(n_l2, 1); 11002 11003 xmlListMerge(l1, l2); 11004 call_tests++; 11005 des_xmlListPtr(n_l1, l1, 0); 11006 des_xmlListPtr(n_l2, l2, 1); 11007 xmlResetLastError(); 11008 if (mem_base != xmlMemBlocks()) { 11009 printf("Leak of %d blocks found in xmlListMerge", 11010 xmlMemBlocks() - mem_base); 11011 test_ret++; 11012 printf(" %d", n_l1); 11013 printf(" %d", n_l2); 11014 printf("\n"); 11015 } 11016 } 11017 } 11018 function_tests++; 11019 11020 return(test_ret); 11021 } 11022 11023 11024 static int 11025 test_xmlListPopBack(void) { 11026 int test_ret = 0; 11027 11028 int mem_base; 11029 xmlListPtr l; /* a list */ 11030 int n_l; 11031 11032 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) { 11033 mem_base = xmlMemBlocks(); 11034 l = gen_xmlListPtr(n_l, 0); 11035 11036 xmlListPopBack(l); 11037 call_tests++; 11038 des_xmlListPtr(n_l, l, 0); 11039 xmlResetLastError(); 11040 if (mem_base != xmlMemBlocks()) { 11041 printf("Leak of %d blocks found in xmlListPopBack", 11042 xmlMemBlocks() - mem_base); 11043 test_ret++; 11044 printf(" %d", n_l); 11045 printf("\n"); 11046 } 11047 } 11048 function_tests++; 11049 11050 return(test_ret); 11051 } 11052 11053 11054 static int 11055 test_xmlListPopFront(void) { 11056 int test_ret = 0; 11057 11058 int mem_base; 11059 xmlListPtr l; /* a list */ 11060 int n_l; 11061 11062 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) { 11063 mem_base = xmlMemBlocks(); 11064 l = gen_xmlListPtr(n_l, 0); 11065 11066 xmlListPopFront(l); 11067 call_tests++; 11068 des_xmlListPtr(n_l, l, 0); 11069 xmlResetLastError(); 11070 if (mem_base != xmlMemBlocks()) { 11071 printf("Leak of %d blocks found in xmlListPopFront", 11072 xmlMemBlocks() - mem_base); 11073 test_ret++; 11074 printf(" %d", n_l); 11075 printf("\n"); 11076 } 11077 } 11078 function_tests++; 11079 11080 return(test_ret); 11081 } 11082 11083 11084 static int 11085 test_xmlListPushBack(void) { 11086 int test_ret = 0; 11087 11088 int mem_base; 11089 int ret_val; 11090 xmlListPtr l; /* a list */ 11091 int n_l; 11092 void * data; /* new data */ 11093 int n_data; 11094 11095 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) { 11096 for (n_data = 0;n_data < gen_nb_userdata;n_data++) { 11097 mem_base = xmlMemBlocks(); 11098 l = gen_xmlListPtr(n_l, 0); 11099 data = gen_userdata(n_data, 1); 11100 11101 ret_val = xmlListPushBack(l, data); 11102 desret_int(ret_val); 11103 call_tests++; 11104 des_xmlListPtr(n_l, l, 0); 11105 des_userdata(n_data, data, 1); 11106 xmlResetLastError(); 11107 if (mem_base != xmlMemBlocks()) { 11108 printf("Leak of %d blocks found in xmlListPushBack", 11109 xmlMemBlocks() - mem_base); 11110 test_ret++; 11111 printf(" %d", n_l); 11112 printf(" %d", n_data); 11113 printf("\n"); 11114 } 11115 } 11116 } 11117 function_tests++; 11118 11119 return(test_ret); 11120 } 11121 11122 11123 static int 11124 test_xmlListPushFront(void) { 11125 int test_ret = 0; 11126 11127 int mem_base; 11128 int ret_val; 11129 xmlListPtr l; /* a list */ 11130 int n_l; 11131 void * data; /* new data */ 11132 int n_data; 11133 11134 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) { 11135 for (n_data = 0;n_data < gen_nb_userdata;n_data++) { 11136 mem_base = xmlMemBlocks(); 11137 l = gen_xmlListPtr(n_l, 0); 11138 data = gen_userdata(n_data, 1); 11139 11140 ret_val = xmlListPushFront(l, data); 11141 desret_int(ret_val); 11142 call_tests++; 11143 des_xmlListPtr(n_l, l, 0); 11144 des_userdata(n_data, data, 1); 11145 xmlResetLastError(); 11146 if (mem_base != xmlMemBlocks()) { 11147 printf("Leak of %d blocks found in xmlListPushFront", 11148 xmlMemBlocks() - mem_base); 11149 test_ret++; 11150 printf(" %d", n_l); 11151 printf(" %d", n_data); 11152 printf("\n"); 11153 } 11154 } 11155 } 11156 function_tests++; 11157 11158 return(test_ret); 11159 } 11160 11161 11162 static int 11163 test_xmlListRemoveAll(void) { 11164 int test_ret = 0; 11165 11166 int mem_base; 11167 int ret_val; 11168 xmlListPtr l; /* a list */ 11169 int n_l; 11170 void * data; /* list data */ 11171 int n_data; 11172 11173 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) { 11174 for (n_data = 0;n_data < gen_nb_userdata;n_data++) { 11175 mem_base = xmlMemBlocks(); 11176 l = gen_xmlListPtr(n_l, 0); 11177 data = gen_userdata(n_data, 1); 11178 11179 ret_val = xmlListRemoveAll(l, data); 11180 desret_int(ret_val); 11181 call_tests++; 11182 des_xmlListPtr(n_l, l, 0); 11183 des_userdata(n_data, data, 1); 11184 xmlResetLastError(); 11185 if (mem_base != xmlMemBlocks()) { 11186 printf("Leak of %d blocks found in xmlListRemoveAll", 11187 xmlMemBlocks() - mem_base); 11188 test_ret++; 11189 printf(" %d", n_l); 11190 printf(" %d", n_data); 11191 printf("\n"); 11192 } 11193 } 11194 } 11195 function_tests++; 11196 11197 return(test_ret); 11198 } 11199 11200 11201 static int 11202 test_xmlListRemoveFirst(void) { 11203 int test_ret = 0; 11204 11205 int mem_base; 11206 int ret_val; 11207 xmlListPtr l; /* a list */ 11208 int n_l; 11209 void * data; /* list data */ 11210 int n_data; 11211 11212 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) { 11213 for (n_data = 0;n_data < gen_nb_userdata;n_data++) { 11214 mem_base = xmlMemBlocks(); 11215 l = gen_xmlListPtr(n_l, 0); 11216 data = gen_userdata(n_data, 1); 11217 11218 ret_val = xmlListRemoveFirst(l, data); 11219 desret_int(ret_val); 11220 call_tests++; 11221 des_xmlListPtr(n_l, l, 0); 11222 des_userdata(n_data, data, 1); 11223 xmlResetLastError(); 11224 if (mem_base != xmlMemBlocks()) { 11225 printf("Leak of %d blocks found in xmlListRemoveFirst", 11226 xmlMemBlocks() - mem_base); 11227 test_ret++; 11228 printf(" %d", n_l); 11229 printf(" %d", n_data); 11230 printf("\n"); 11231 } 11232 } 11233 } 11234 function_tests++; 11235 11236 return(test_ret); 11237 } 11238 11239 11240 static int 11241 test_xmlListRemoveLast(void) { 11242 int test_ret = 0; 11243 11244 int mem_base; 11245 int ret_val; 11246 xmlListPtr l; /* a list */ 11247 int n_l; 11248 void * data; /* list data */ 11249 int n_data; 11250 11251 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) { 11252 for (n_data = 0;n_data < gen_nb_userdata;n_data++) { 11253 mem_base = xmlMemBlocks(); 11254 l = gen_xmlListPtr(n_l, 0); 11255 data = gen_userdata(n_data, 1); 11256 11257 ret_val = xmlListRemoveLast(l, data); 11258 desret_int(ret_val); 11259 call_tests++; 11260 des_xmlListPtr(n_l, l, 0); 11261 des_userdata(n_data, data, 1); 11262 xmlResetLastError(); 11263 if (mem_base != xmlMemBlocks()) { 11264 printf("Leak of %d blocks found in xmlListRemoveLast", 11265 xmlMemBlocks() - mem_base); 11266 test_ret++; 11267 printf(" %d", n_l); 11268 printf(" %d", n_data); 11269 printf("\n"); 11270 } 11271 } 11272 } 11273 function_tests++; 11274 11275 return(test_ret); 11276 } 11277 11278 11279 static int 11280 test_xmlListReverse(void) { 11281 int test_ret = 0; 11282 11283 int mem_base; 11284 xmlListPtr l; /* a list */ 11285 int n_l; 11286 11287 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) { 11288 mem_base = xmlMemBlocks(); 11289 l = gen_xmlListPtr(n_l, 0); 11290 11291 xmlListReverse(l); 11292 call_tests++; 11293 des_xmlListPtr(n_l, l, 0); 11294 xmlResetLastError(); 11295 if (mem_base != xmlMemBlocks()) { 11296 printf("Leak of %d blocks found in xmlListReverse", 11297 xmlMemBlocks() - mem_base); 11298 test_ret++; 11299 printf(" %d", n_l); 11300 printf("\n"); 11301 } 11302 } 11303 function_tests++; 11304 11305 return(test_ret); 11306 } 11307 11308 11309 static int 11310 test_xmlListReverseSearch(void) { 11311 int test_ret = 0; 11312 11313 int mem_base; 11314 void * ret_val; 11315 xmlListPtr l; /* a list */ 11316 int n_l; 11317 void * data; /* a search value */ 11318 int n_data; 11319 11320 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) { 11321 for (n_data = 0;n_data < gen_nb_userdata;n_data++) { 11322 mem_base = xmlMemBlocks(); 11323 l = gen_xmlListPtr(n_l, 0); 11324 data = gen_userdata(n_data, 1); 11325 11326 ret_val = xmlListReverseSearch(l, data); 11327 desret_void_ptr(ret_val); 11328 call_tests++; 11329 des_xmlListPtr(n_l, l, 0); 11330 des_userdata(n_data, data, 1); 11331 xmlResetLastError(); 11332 if (mem_base != xmlMemBlocks()) { 11333 printf("Leak of %d blocks found in xmlListReverseSearch", 11334 xmlMemBlocks() - mem_base); 11335 test_ret++; 11336 printf(" %d", n_l); 11337 printf(" %d", n_data); 11338 printf("\n"); 11339 } 11340 } 11341 } 11342 function_tests++; 11343 11344 return(test_ret); 11345 } 11346 11347 11348 static int 11349 test_xmlListReverseWalk(void) { 11350 int test_ret = 0; 11351 11352 11353 /* missing type support */ 11354 return(test_ret); 11355 } 11356 11357 11358 static int 11359 test_xmlListSearch(void) { 11360 int test_ret = 0; 11361 11362 int mem_base; 11363 void * ret_val; 11364 xmlListPtr l; /* a list */ 11365 int n_l; 11366 void * data; /* a search value */ 11367 int n_data; 11368 11369 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) { 11370 for (n_data = 0;n_data < gen_nb_userdata;n_data++) { 11371 mem_base = xmlMemBlocks(); 11372 l = gen_xmlListPtr(n_l, 0); 11373 data = gen_userdata(n_data, 1); 11374 11375 ret_val = xmlListSearch(l, data); 11376 desret_void_ptr(ret_val); 11377 call_tests++; 11378 des_xmlListPtr(n_l, l, 0); 11379 des_userdata(n_data, data, 1); 11380 xmlResetLastError(); 11381 if (mem_base != xmlMemBlocks()) { 11382 printf("Leak of %d blocks found in xmlListSearch", 11383 xmlMemBlocks() - mem_base); 11384 test_ret++; 11385 printf(" %d", n_l); 11386 printf(" %d", n_data); 11387 printf("\n"); 11388 } 11389 } 11390 } 11391 function_tests++; 11392 11393 return(test_ret); 11394 } 11395 11396 11397 static int 11398 test_xmlListSize(void) { 11399 int test_ret = 0; 11400 11401 int mem_base; 11402 int ret_val; 11403 xmlListPtr l; /* a list */ 11404 int n_l; 11405 11406 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) { 11407 mem_base = xmlMemBlocks(); 11408 l = gen_xmlListPtr(n_l, 0); 11409 11410 ret_val = xmlListSize(l); 11411 desret_int(ret_val); 11412 call_tests++; 11413 des_xmlListPtr(n_l, l, 0); 11414 xmlResetLastError(); 11415 if (mem_base != xmlMemBlocks()) { 11416 printf("Leak of %d blocks found in xmlListSize", 11417 xmlMemBlocks() - mem_base); 11418 test_ret++; 11419 printf(" %d", n_l); 11420 printf("\n"); 11421 } 11422 } 11423 function_tests++; 11424 11425 return(test_ret); 11426 } 11427 11428 11429 static int 11430 test_xmlListSort(void) { 11431 int test_ret = 0; 11432 11433 int mem_base; 11434 xmlListPtr l; /* a list */ 11435 int n_l; 11436 11437 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) { 11438 mem_base = xmlMemBlocks(); 11439 l = gen_xmlListPtr(n_l, 0); 11440 11441 xmlListSort(l); 11442 call_tests++; 11443 des_xmlListPtr(n_l, l, 0); 11444 xmlResetLastError(); 11445 if (mem_base != xmlMemBlocks()) { 11446 printf("Leak of %d blocks found in xmlListSort", 11447 xmlMemBlocks() - mem_base); 11448 test_ret++; 11449 printf(" %d", n_l); 11450 printf("\n"); 11451 } 11452 } 11453 function_tests++; 11454 11455 return(test_ret); 11456 } 11457 11458 11459 static int 11460 test_xmlListWalk(void) { 11461 int test_ret = 0; 11462 11463 11464 /* missing type support */ 11465 return(test_ret); 11466 } 11467 11468 static int 11469 test_list(void) { 11470 int test_ret = 0; 11471 11472 if (quiet == 0) printf("Testing list : 19 of 26 functions ...\n"); 11473 test_ret += test_xmlLinkGetData(); 11474 test_ret += test_xmlListAppend(); 11475 test_ret += test_xmlListClear(); 11476 test_ret += test_xmlListCopy(); 11477 test_ret += test_xmlListCreate(); 11478 test_ret += test_xmlListDup(); 11479 test_ret += test_xmlListEmpty(); 11480 test_ret += test_xmlListEnd(); 11481 test_ret += test_xmlListFront(); 11482 test_ret += test_xmlListInsert(); 11483 test_ret += test_xmlListMerge(); 11484 test_ret += test_xmlListPopBack(); 11485 test_ret += test_xmlListPopFront(); 11486 test_ret += test_xmlListPushBack(); 11487 test_ret += test_xmlListPushFront(); 11488 test_ret += test_xmlListRemoveAll(); 11489 test_ret += test_xmlListRemoveFirst(); 11490 test_ret += test_xmlListRemoveLast(); 11491 test_ret += test_xmlListReverse(); 11492 test_ret += test_xmlListReverseSearch(); 11493 test_ret += test_xmlListReverseWalk(); 11494 test_ret += test_xmlListSearch(); 11495 test_ret += test_xmlListSize(); 11496 test_ret += test_xmlListSort(); 11497 test_ret += test_xmlListWalk(); 11498 11499 if (test_ret != 0) 11500 printf("Module list: %d errors\n", test_ret); 11501 return(test_ret); 11502 } 11503 11504 static int 11505 test_xmlNanoFTPCheckResponse(void) { 11506 int test_ret = 0; 11507 11508 #if defined(LIBXML_FTP_ENABLED) 11509 int mem_base; 11510 int ret_val; 11511 void * ctx; /* an FTP context */ 11512 int n_ctx; 11513 11514 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) { 11515 mem_base = xmlMemBlocks(); 11516 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0); 11517 11518 ret_val = xmlNanoFTPCheckResponse(ctx); 11519 desret_int(ret_val); 11520 call_tests++; 11521 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0); 11522 xmlResetLastError(); 11523 if (mem_base != xmlMemBlocks()) { 11524 printf("Leak of %d blocks found in xmlNanoFTPCheckResponse", 11525 xmlMemBlocks() - mem_base); 11526 test_ret++; 11527 printf(" %d", n_ctx); 11528 printf("\n"); 11529 } 11530 } 11531 function_tests++; 11532 #endif 11533 11534 return(test_ret); 11535 } 11536 11537 11538 static int 11539 test_xmlNanoFTPCleanup(void) { 11540 int test_ret = 0; 11541 11542 #if defined(LIBXML_FTP_ENABLED) 11543 int mem_base; 11544 11545 mem_base = xmlMemBlocks(); 11546 11547 xmlNanoFTPCleanup(); 11548 call_tests++; 11549 xmlResetLastError(); 11550 if (mem_base != xmlMemBlocks()) { 11551 printf("Leak of %d blocks found in xmlNanoFTPCleanup", 11552 xmlMemBlocks() - mem_base); 11553 test_ret++; 11554 printf("\n"); 11555 } 11556 function_tests++; 11557 #endif 11558 11559 return(test_ret); 11560 } 11561 11562 11563 static int 11564 test_xmlNanoFTPCloseConnection(void) { 11565 int test_ret = 0; 11566 11567 #if defined(LIBXML_FTP_ENABLED) 11568 int mem_base; 11569 int ret_val; 11570 void * ctx; /* an FTP context */ 11571 int n_ctx; 11572 11573 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) { 11574 mem_base = xmlMemBlocks(); 11575 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0); 11576 11577 ret_val = xmlNanoFTPCloseConnection(ctx); 11578 desret_int(ret_val); 11579 call_tests++; 11580 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0); 11581 xmlResetLastError(); 11582 if (mem_base != xmlMemBlocks()) { 11583 printf("Leak of %d blocks found in xmlNanoFTPCloseConnection", 11584 xmlMemBlocks() - mem_base); 11585 test_ret++; 11586 printf(" %d", n_ctx); 11587 printf("\n"); 11588 } 11589 } 11590 function_tests++; 11591 #endif 11592 11593 return(test_ret); 11594 } 11595 11596 11597 static int 11598 test_xmlNanoFTPCwd(void) { 11599 int test_ret = 0; 11600 11601 #if defined(LIBXML_FTP_ENABLED) 11602 int mem_base; 11603 int ret_val; 11604 void * ctx; /* an FTP context */ 11605 int n_ctx; 11606 char * directory; /* a directory on the server */ 11607 int n_directory; 11608 11609 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) { 11610 for (n_directory = 0;n_directory < gen_nb_const_char_ptr;n_directory++) { 11611 mem_base = xmlMemBlocks(); 11612 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0); 11613 directory = gen_const_char_ptr(n_directory, 1); 11614 11615 ret_val = xmlNanoFTPCwd(ctx, (const char *)directory); 11616 desret_int(ret_val); 11617 call_tests++; 11618 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0); 11619 des_const_char_ptr(n_directory, (const char *)directory, 1); 11620 xmlResetLastError(); 11621 if (mem_base != xmlMemBlocks()) { 11622 printf("Leak of %d blocks found in xmlNanoFTPCwd", 11623 xmlMemBlocks() - mem_base); 11624 test_ret++; 11625 printf(" %d", n_ctx); 11626 printf(" %d", n_directory); 11627 printf("\n"); 11628 } 11629 } 11630 } 11631 function_tests++; 11632 #endif 11633 11634 return(test_ret); 11635 } 11636 11637 11638 static int 11639 test_xmlNanoFTPDele(void) { 11640 int test_ret = 0; 11641 11642 #if defined(LIBXML_FTP_ENABLED) 11643 int mem_base; 11644 int ret_val; 11645 void * ctx; /* an FTP context */ 11646 int n_ctx; 11647 const char * file; /* a file or directory on the server */ 11648 int n_file; 11649 11650 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) { 11651 for (n_file = 0;n_file < gen_nb_filepath;n_file++) { 11652 mem_base = xmlMemBlocks(); 11653 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0); 11654 file = gen_filepath(n_file, 1); 11655 11656 ret_val = xmlNanoFTPDele(ctx, file); 11657 desret_int(ret_val); 11658 call_tests++; 11659 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0); 11660 des_filepath(n_file, file, 1); 11661 xmlResetLastError(); 11662 if (mem_base != xmlMemBlocks()) { 11663 printf("Leak of %d blocks found in xmlNanoFTPDele", 11664 xmlMemBlocks() - mem_base); 11665 test_ret++; 11666 printf(" %d", n_ctx); 11667 printf(" %d", n_file); 11668 printf("\n"); 11669 } 11670 } 11671 } 11672 function_tests++; 11673 #endif 11674 11675 return(test_ret); 11676 } 11677 11678 11679 static int 11680 test_xmlNanoFTPGet(void) { 11681 int test_ret = 0; 11682 11683 11684 /* missing type support */ 11685 return(test_ret); 11686 } 11687 11688 11689 static int 11690 test_xmlNanoFTPGetConnection(void) { 11691 int test_ret = 0; 11692 11693 11694 /* missing type support */ 11695 return(test_ret); 11696 } 11697 11698 11699 static int 11700 test_xmlNanoFTPGetResponse(void) { 11701 int test_ret = 0; 11702 11703 #if defined(LIBXML_FTP_ENABLED) 11704 int mem_base; 11705 int ret_val; 11706 void * ctx; /* an FTP context */ 11707 int n_ctx; 11708 11709 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) { 11710 mem_base = xmlMemBlocks(); 11711 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0); 11712 11713 ret_val = xmlNanoFTPGetResponse(ctx); 11714 desret_int(ret_val); 11715 call_tests++; 11716 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0); 11717 xmlResetLastError(); 11718 if (mem_base != xmlMemBlocks()) { 11719 printf("Leak of %d blocks found in xmlNanoFTPGetResponse", 11720 xmlMemBlocks() - mem_base); 11721 test_ret++; 11722 printf(" %d", n_ctx); 11723 printf("\n"); 11724 } 11725 } 11726 function_tests++; 11727 #endif 11728 11729 return(test_ret); 11730 } 11731 11732 11733 static int 11734 test_xmlNanoFTPGetSocket(void) { 11735 int test_ret = 0; 11736 11737 11738 /* missing type support */ 11739 return(test_ret); 11740 } 11741 11742 11743 static int 11744 test_xmlNanoFTPInit(void) { 11745 int test_ret = 0; 11746 11747 #if defined(LIBXML_FTP_ENABLED) 11748 int mem_base; 11749 11750 mem_base = xmlMemBlocks(); 11751 11752 xmlNanoFTPInit(); 11753 call_tests++; 11754 xmlResetLastError(); 11755 if (mem_base != xmlMemBlocks()) { 11756 printf("Leak of %d blocks found in xmlNanoFTPInit", 11757 xmlMemBlocks() - mem_base); 11758 test_ret++; 11759 printf("\n"); 11760 } 11761 function_tests++; 11762 #endif 11763 11764 return(test_ret); 11765 } 11766 11767 11768 static int 11769 test_xmlNanoFTPList(void) { 11770 int test_ret = 0; 11771 11772 11773 /* missing type support */ 11774 return(test_ret); 11775 } 11776 11777 11778 static int 11779 test_xmlNanoFTPNewCtxt(void) { 11780 int test_ret = 0; 11781 11782 #if defined(LIBXML_FTP_ENABLED) 11783 int mem_base; 11784 void * ret_val; 11785 const char * URL; /* The URL used to initialize the context */ 11786 int n_URL; 11787 11788 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) { 11789 mem_base = xmlMemBlocks(); 11790 URL = gen_filepath(n_URL, 0); 11791 11792 ret_val = xmlNanoFTPNewCtxt(URL); 11793 desret_xmlNanoFTPCtxtPtr(ret_val); 11794 call_tests++; 11795 des_filepath(n_URL, URL, 0); 11796 xmlResetLastError(); 11797 if (mem_base != xmlMemBlocks()) { 11798 printf("Leak of %d blocks found in xmlNanoFTPNewCtxt", 11799 xmlMemBlocks() - mem_base); 11800 test_ret++; 11801 printf(" %d", n_URL); 11802 printf("\n"); 11803 } 11804 } 11805 function_tests++; 11806 #endif 11807 11808 return(test_ret); 11809 } 11810 11811 11812 static int 11813 test_xmlNanoFTPOpen(void) { 11814 int test_ret = 0; 11815 11816 #if defined(LIBXML_FTP_ENABLED) 11817 int mem_base; 11818 void * ret_val; 11819 const char * URL; /* the URL to the resource */ 11820 int n_URL; 11821 11822 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) { 11823 mem_base = xmlMemBlocks(); 11824 URL = gen_filepath(n_URL, 0); 11825 11826 ret_val = xmlNanoFTPOpen(URL); 11827 desret_xmlNanoFTPCtxtPtr(ret_val); 11828 call_tests++; 11829 des_filepath(n_URL, URL, 0); 11830 xmlResetLastError(); 11831 if (mem_base != xmlMemBlocks()) { 11832 printf("Leak of %d blocks found in xmlNanoFTPOpen", 11833 xmlMemBlocks() - mem_base); 11834 test_ret++; 11835 printf(" %d", n_URL); 11836 printf("\n"); 11837 } 11838 } 11839 function_tests++; 11840 #endif 11841 11842 return(test_ret); 11843 } 11844 11845 11846 static int 11847 test_xmlNanoFTPProxy(void) { 11848 int test_ret = 0; 11849 11850 #if defined(LIBXML_FTP_ENABLED) 11851 char * host; /* the proxy host name */ 11852 int n_host; 11853 int port; /* the proxy port */ 11854 int n_port; 11855 char * user; /* the proxy user name */ 11856 int n_user; 11857 char * passwd; /* the proxy password */ 11858 int n_passwd; 11859 int type; /* the type of proxy 1 for using SITE, 2 for USER a@b */ 11860 int n_type; 11861 11862 for (n_host = 0;n_host < gen_nb_const_char_ptr;n_host++) { 11863 for (n_port = 0;n_port < gen_nb_int;n_port++) { 11864 for (n_user = 0;n_user < gen_nb_const_char_ptr;n_user++) { 11865 for (n_passwd = 0;n_passwd < gen_nb_const_char_ptr;n_passwd++) { 11866 for (n_type = 0;n_type < gen_nb_int;n_type++) { 11867 host = gen_const_char_ptr(n_host, 0); 11868 port = gen_int(n_port, 1); 11869 user = gen_const_char_ptr(n_user, 2); 11870 passwd = gen_const_char_ptr(n_passwd, 3); 11871 type = gen_int(n_type, 4); 11872 11873 xmlNanoFTPProxy((const char *)host, port, (const char *)user, (const char *)passwd, type); 11874 call_tests++; 11875 des_const_char_ptr(n_host, (const char *)host, 0); 11876 des_int(n_port, port, 1); 11877 des_const_char_ptr(n_user, (const char *)user, 2); 11878 des_const_char_ptr(n_passwd, (const char *)passwd, 3); 11879 des_int(n_type, type, 4); 11880 xmlResetLastError(); 11881 } 11882 } 11883 } 11884 } 11885 } 11886 function_tests++; 11887 #endif 11888 11889 return(test_ret); 11890 } 11891 11892 11893 static int 11894 test_xmlNanoFTPQuit(void) { 11895 int test_ret = 0; 11896 11897 #if defined(LIBXML_FTP_ENABLED) 11898 int mem_base; 11899 int ret_val; 11900 void * ctx; /* an FTP context */ 11901 int n_ctx; 11902 11903 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) { 11904 mem_base = xmlMemBlocks(); 11905 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0); 11906 11907 ret_val = xmlNanoFTPQuit(ctx); 11908 desret_int(ret_val); 11909 call_tests++; 11910 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0); 11911 xmlResetLastError(); 11912 if (mem_base != xmlMemBlocks()) { 11913 printf("Leak of %d blocks found in xmlNanoFTPQuit", 11914 xmlMemBlocks() - mem_base); 11915 test_ret++; 11916 printf(" %d", n_ctx); 11917 printf("\n"); 11918 } 11919 } 11920 function_tests++; 11921 #endif 11922 11923 return(test_ret); 11924 } 11925 11926 11927 static int 11928 test_xmlNanoFTPRead(void) { 11929 int test_ret = 0; 11930 11931 #if defined(LIBXML_FTP_ENABLED) 11932 int mem_base; 11933 int ret_val; 11934 void * ctx; /* the FTP context */ 11935 int n_ctx; 11936 void * dest; /* a buffer */ 11937 int n_dest; 11938 int len; /* the buffer length */ 11939 int n_len; 11940 11941 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) { 11942 for (n_dest = 0;n_dest < gen_nb_void_ptr;n_dest++) { 11943 for (n_len = 0;n_len < gen_nb_int;n_len++) { 11944 mem_base = xmlMemBlocks(); 11945 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0); 11946 dest = gen_void_ptr(n_dest, 1); 11947 len = gen_int(n_len, 2); 11948 11949 ret_val = xmlNanoFTPRead(ctx, dest, len); 11950 desret_int(ret_val); 11951 call_tests++; 11952 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0); 11953 des_void_ptr(n_dest, dest, 1); 11954 des_int(n_len, len, 2); 11955 xmlResetLastError(); 11956 if (mem_base != xmlMemBlocks()) { 11957 printf("Leak of %d blocks found in xmlNanoFTPRead", 11958 xmlMemBlocks() - mem_base); 11959 test_ret++; 11960 printf(" %d", n_ctx); 11961 printf(" %d", n_dest); 11962 printf(" %d", n_len); 11963 printf("\n"); 11964 } 11965 } 11966 } 11967 } 11968 function_tests++; 11969 #endif 11970 11971 return(test_ret); 11972 } 11973 11974 11975 static int 11976 test_xmlNanoFTPScanProxy(void) { 11977 int test_ret = 0; 11978 11979 #if defined(LIBXML_FTP_ENABLED) 11980 const char * URL; /* The proxy URL used to initialize the proxy context */ 11981 int n_URL; 11982 11983 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) { 11984 URL = gen_filepath(n_URL, 0); 11985 11986 xmlNanoFTPScanProxy(URL); 11987 call_tests++; 11988 des_filepath(n_URL, URL, 0); 11989 xmlResetLastError(); 11990 } 11991 function_tests++; 11992 #endif 11993 11994 return(test_ret); 11995 } 11996 11997 11998 static int 11999 test_xmlNanoFTPUpdateURL(void) { 12000 int test_ret = 0; 12001 12002 #if defined(LIBXML_FTP_ENABLED) 12003 int mem_base; 12004 int ret_val; 12005 void * ctx; /* an FTP context */ 12006 int n_ctx; 12007 const char * URL; /* The URL used to update the context */ 12008 int n_URL; 12009 12010 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) { 12011 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) { 12012 mem_base = xmlMemBlocks(); 12013 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0); 12014 URL = gen_filepath(n_URL, 1); 12015 12016 ret_val = xmlNanoFTPUpdateURL(ctx, URL); 12017 desret_int(ret_val); 12018 call_tests++; 12019 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0); 12020 des_filepath(n_URL, URL, 1); 12021 xmlResetLastError(); 12022 if (mem_base != xmlMemBlocks()) { 12023 printf("Leak of %d blocks found in xmlNanoFTPUpdateURL", 12024 xmlMemBlocks() - mem_base); 12025 test_ret++; 12026 printf(" %d", n_ctx); 12027 printf(" %d", n_URL); 12028 printf("\n"); 12029 } 12030 } 12031 } 12032 function_tests++; 12033 #endif 12034 12035 return(test_ret); 12036 } 12037 12038 static int 12039 test_nanoftp(void) { 12040 int test_ret = 0; 12041 12042 if (quiet == 0) printf("Testing nanoftp : 14 of 22 functions ...\n"); 12043 test_ret += test_xmlNanoFTPCheckResponse(); 12044 test_ret += test_xmlNanoFTPCleanup(); 12045 test_ret += test_xmlNanoFTPCloseConnection(); 12046 test_ret += test_xmlNanoFTPCwd(); 12047 test_ret += test_xmlNanoFTPDele(); 12048 test_ret += test_xmlNanoFTPGet(); 12049 test_ret += test_xmlNanoFTPGetConnection(); 12050 test_ret += test_xmlNanoFTPGetResponse(); 12051 test_ret += test_xmlNanoFTPGetSocket(); 12052 test_ret += test_xmlNanoFTPInit(); 12053 test_ret += test_xmlNanoFTPList(); 12054 test_ret += test_xmlNanoFTPNewCtxt(); 12055 test_ret += test_xmlNanoFTPOpen(); 12056 test_ret += test_xmlNanoFTPProxy(); 12057 test_ret += test_xmlNanoFTPQuit(); 12058 test_ret += test_xmlNanoFTPRead(); 12059 test_ret += test_xmlNanoFTPScanProxy(); 12060 test_ret += test_xmlNanoFTPUpdateURL(); 12061 12062 if (test_ret != 0) 12063 printf("Module nanoftp: %d errors\n", test_ret); 12064 return(test_ret); 12065 } 12066 12067 static int 12068 test_xmlNanoHTTPAuthHeader(void) { 12069 int test_ret = 0; 12070 12071 #if defined(LIBXML_HTTP_ENABLED) 12072 int mem_base; 12073 const char * ret_val; 12074 void * ctx; /* the HTTP context */ 12075 int n_ctx; 12076 12077 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) { 12078 mem_base = xmlMemBlocks(); 12079 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0); 12080 12081 ret_val = xmlNanoHTTPAuthHeader(ctx); 12082 desret_const_char_ptr(ret_val); 12083 call_tests++; 12084 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0); 12085 xmlResetLastError(); 12086 if (mem_base != xmlMemBlocks()) { 12087 printf("Leak of %d blocks found in xmlNanoHTTPAuthHeader", 12088 xmlMemBlocks() - mem_base); 12089 test_ret++; 12090 printf(" %d", n_ctx); 12091 printf("\n"); 12092 } 12093 } 12094 function_tests++; 12095 #endif 12096 12097 return(test_ret); 12098 } 12099 12100 12101 static int 12102 test_xmlNanoHTTPCleanup(void) { 12103 int test_ret = 0; 12104 12105 #if defined(LIBXML_HTTP_ENABLED) 12106 int mem_base; 12107 12108 mem_base = xmlMemBlocks(); 12109 12110 xmlNanoHTTPCleanup(); 12111 call_tests++; 12112 xmlResetLastError(); 12113 if (mem_base != xmlMemBlocks()) { 12114 printf("Leak of %d blocks found in xmlNanoHTTPCleanup", 12115 xmlMemBlocks() - mem_base); 12116 test_ret++; 12117 printf("\n"); 12118 } 12119 function_tests++; 12120 #endif 12121 12122 return(test_ret); 12123 } 12124 12125 12126 static int 12127 test_xmlNanoHTTPContentLength(void) { 12128 int test_ret = 0; 12129 12130 #if defined(LIBXML_HTTP_ENABLED) 12131 int mem_base; 12132 int ret_val; 12133 void * ctx; /* the HTTP context */ 12134 int n_ctx; 12135 12136 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) { 12137 mem_base = xmlMemBlocks(); 12138 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0); 12139 12140 ret_val = xmlNanoHTTPContentLength(ctx); 12141 desret_int(ret_val); 12142 call_tests++; 12143 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0); 12144 xmlResetLastError(); 12145 if (mem_base != xmlMemBlocks()) { 12146 printf("Leak of %d blocks found in xmlNanoHTTPContentLength", 12147 xmlMemBlocks() - mem_base); 12148 test_ret++; 12149 printf(" %d", n_ctx); 12150 printf("\n"); 12151 } 12152 } 12153 function_tests++; 12154 #endif 12155 12156 return(test_ret); 12157 } 12158 12159 12160 static int 12161 test_xmlNanoHTTPEncoding(void) { 12162 int test_ret = 0; 12163 12164 #if defined(LIBXML_HTTP_ENABLED) 12165 int mem_base; 12166 const char * ret_val; 12167 void * ctx; /* the HTTP context */ 12168 int n_ctx; 12169 12170 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) { 12171 mem_base = xmlMemBlocks(); 12172 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0); 12173 12174 ret_val = xmlNanoHTTPEncoding(ctx); 12175 desret_const_char_ptr(ret_val); 12176 call_tests++; 12177 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0); 12178 xmlResetLastError(); 12179 if (mem_base != xmlMemBlocks()) { 12180 printf("Leak of %d blocks found in xmlNanoHTTPEncoding", 12181 xmlMemBlocks() - mem_base); 12182 test_ret++; 12183 printf(" %d", n_ctx); 12184 printf("\n"); 12185 } 12186 } 12187 function_tests++; 12188 #endif 12189 12190 return(test_ret); 12191 } 12192 12193 12194 #define gen_nb_char_ptr_ptr 1 12195 static char ** gen_char_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 12196 return(NULL); 12197 } 12198 static void des_char_ptr_ptr(int no ATTRIBUTE_UNUSED, char ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 12199 } 12200 12201 static int 12202 test_xmlNanoHTTPFetch(void) { 12203 int test_ret = 0; 12204 12205 #if defined(LIBXML_HTTP_ENABLED) 12206 int mem_base; 12207 int ret_val; 12208 const char * URL; /* The URL to load */ 12209 int n_URL; 12210 const char * filename; /* the filename where the content should be saved */ 12211 int n_filename; 12212 char ** contentType; /* if available the Content-Type information will be returned at that location */ 12213 int n_contentType; 12214 12215 for (n_URL = 0;n_URL < gen_nb_fileoutput;n_URL++) { 12216 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) { 12217 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) { 12218 mem_base = xmlMemBlocks(); 12219 URL = gen_fileoutput(n_URL, 0); 12220 filename = gen_fileoutput(n_filename, 1); 12221 contentType = gen_char_ptr_ptr(n_contentType, 2); 12222 12223 ret_val = xmlNanoHTTPFetch(URL, filename, contentType); 12224 desret_int(ret_val); 12225 call_tests++; 12226 des_fileoutput(n_URL, URL, 0); 12227 des_fileoutput(n_filename, filename, 1); 12228 des_char_ptr_ptr(n_contentType, contentType, 2); 12229 xmlResetLastError(); 12230 if (mem_base != xmlMemBlocks()) { 12231 printf("Leak of %d blocks found in xmlNanoHTTPFetch", 12232 xmlMemBlocks() - mem_base); 12233 test_ret++; 12234 printf(" %d", n_URL); 12235 printf(" %d", n_filename); 12236 printf(" %d", n_contentType); 12237 printf("\n"); 12238 } 12239 } 12240 } 12241 } 12242 function_tests++; 12243 #endif 12244 12245 return(test_ret); 12246 } 12247 12248 12249 static int 12250 test_xmlNanoHTTPInit(void) { 12251 int test_ret = 0; 12252 12253 #if defined(LIBXML_HTTP_ENABLED) 12254 int mem_base; 12255 12256 mem_base = xmlMemBlocks(); 12257 12258 xmlNanoHTTPInit(); 12259 call_tests++; 12260 xmlResetLastError(); 12261 if (mem_base != xmlMemBlocks()) { 12262 printf("Leak of %d blocks found in xmlNanoHTTPInit", 12263 xmlMemBlocks() - mem_base); 12264 test_ret++; 12265 printf("\n"); 12266 } 12267 function_tests++; 12268 #endif 12269 12270 return(test_ret); 12271 } 12272 12273 12274 static int 12275 test_xmlNanoHTTPMimeType(void) { 12276 int test_ret = 0; 12277 12278 #if defined(LIBXML_HTTP_ENABLED) 12279 int mem_base; 12280 const char * ret_val; 12281 void * ctx; /* the HTTP context */ 12282 int n_ctx; 12283 12284 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) { 12285 mem_base = xmlMemBlocks(); 12286 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0); 12287 12288 ret_val = xmlNanoHTTPMimeType(ctx); 12289 desret_const_char_ptr(ret_val); 12290 call_tests++; 12291 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0); 12292 xmlResetLastError(); 12293 if (mem_base != xmlMemBlocks()) { 12294 printf("Leak of %d blocks found in xmlNanoHTTPMimeType", 12295 xmlMemBlocks() - mem_base); 12296 test_ret++; 12297 printf(" %d", n_ctx); 12298 printf("\n"); 12299 } 12300 } 12301 function_tests++; 12302 #endif 12303 12304 return(test_ret); 12305 } 12306 12307 12308 static int 12309 test_xmlNanoHTTPOpen(void) { 12310 int test_ret = 0; 12311 12312 #if defined(LIBXML_HTTP_ENABLED) 12313 int mem_base; 12314 void * ret_val; 12315 const char * URL; /* The URL to load */ 12316 int n_URL; 12317 char ** contentType; /* if available the Content-Type information will be returned at that location */ 12318 int n_contentType; 12319 12320 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) { 12321 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) { 12322 mem_base = xmlMemBlocks(); 12323 URL = gen_filepath(n_URL, 0); 12324 contentType = gen_char_ptr_ptr(n_contentType, 1); 12325 12326 ret_val = xmlNanoHTTPOpen(URL, contentType); 12327 desret_xmlNanoHTTPCtxtPtr(ret_val); 12328 call_tests++; 12329 des_filepath(n_URL, URL, 0); 12330 des_char_ptr_ptr(n_contentType, contentType, 1); 12331 xmlResetLastError(); 12332 if (mem_base != xmlMemBlocks()) { 12333 printf("Leak of %d blocks found in xmlNanoHTTPOpen", 12334 xmlMemBlocks() - mem_base); 12335 test_ret++; 12336 printf(" %d", n_URL); 12337 printf(" %d", n_contentType); 12338 printf("\n"); 12339 } 12340 } 12341 } 12342 function_tests++; 12343 #endif 12344 12345 return(test_ret); 12346 } 12347 12348 12349 static int 12350 test_xmlNanoHTTPOpenRedir(void) { 12351 int test_ret = 0; 12352 12353 #if defined(LIBXML_HTTP_ENABLED) 12354 int mem_base; 12355 void * ret_val; 12356 const char * URL; /* The URL to load */ 12357 int n_URL; 12358 char ** contentType; /* if available the Content-Type information will be returned at that location */ 12359 int n_contentType; 12360 char ** redir; /* if available the redirected URL will be returned */ 12361 int n_redir; 12362 12363 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) { 12364 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) { 12365 for (n_redir = 0;n_redir < gen_nb_char_ptr_ptr;n_redir++) { 12366 mem_base = xmlMemBlocks(); 12367 URL = gen_filepath(n_URL, 0); 12368 contentType = gen_char_ptr_ptr(n_contentType, 1); 12369 redir = gen_char_ptr_ptr(n_redir, 2); 12370 12371 ret_val = xmlNanoHTTPOpenRedir(URL, contentType, redir); 12372 desret_xmlNanoHTTPCtxtPtr(ret_val); 12373 call_tests++; 12374 des_filepath(n_URL, URL, 0); 12375 des_char_ptr_ptr(n_contentType, contentType, 1); 12376 des_char_ptr_ptr(n_redir, redir, 2); 12377 xmlResetLastError(); 12378 if (mem_base != xmlMemBlocks()) { 12379 printf("Leak of %d blocks found in xmlNanoHTTPOpenRedir", 12380 xmlMemBlocks() - mem_base); 12381 test_ret++; 12382 printf(" %d", n_URL); 12383 printf(" %d", n_contentType); 12384 printf(" %d", n_redir); 12385 printf("\n"); 12386 } 12387 } 12388 } 12389 } 12390 function_tests++; 12391 #endif 12392 12393 return(test_ret); 12394 } 12395 12396 12397 static int 12398 test_xmlNanoHTTPRead(void) { 12399 int test_ret = 0; 12400 12401 #if defined(LIBXML_HTTP_ENABLED) 12402 int mem_base; 12403 int ret_val; 12404 void * ctx; /* the HTTP context */ 12405 int n_ctx; 12406 void * dest; /* a buffer */ 12407 int n_dest; 12408 int len; /* the buffer length */ 12409 int n_len; 12410 12411 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) { 12412 for (n_dest = 0;n_dest < gen_nb_void_ptr;n_dest++) { 12413 for (n_len = 0;n_len < gen_nb_int;n_len++) { 12414 mem_base = xmlMemBlocks(); 12415 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0); 12416 dest = gen_void_ptr(n_dest, 1); 12417 len = gen_int(n_len, 2); 12418 12419 ret_val = xmlNanoHTTPRead(ctx, dest, len); 12420 desret_int(ret_val); 12421 call_tests++; 12422 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0); 12423 des_void_ptr(n_dest, dest, 1); 12424 des_int(n_len, len, 2); 12425 xmlResetLastError(); 12426 if (mem_base != xmlMemBlocks()) { 12427 printf("Leak of %d blocks found in xmlNanoHTTPRead", 12428 xmlMemBlocks() - mem_base); 12429 test_ret++; 12430 printf(" %d", n_ctx); 12431 printf(" %d", n_dest); 12432 printf(" %d", n_len); 12433 printf("\n"); 12434 } 12435 } 12436 } 12437 } 12438 function_tests++; 12439 #endif 12440 12441 return(test_ret); 12442 } 12443 12444 12445 static int 12446 test_xmlNanoHTTPRedir(void) { 12447 int test_ret = 0; 12448 12449 12450 /* missing type support */ 12451 return(test_ret); 12452 } 12453 12454 12455 static int 12456 test_xmlNanoHTTPReturnCode(void) { 12457 int test_ret = 0; 12458 12459 #if defined(LIBXML_HTTP_ENABLED) 12460 int mem_base; 12461 int ret_val; 12462 void * ctx; /* the HTTP context */ 12463 int n_ctx; 12464 12465 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) { 12466 mem_base = xmlMemBlocks(); 12467 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0); 12468 12469 ret_val = xmlNanoHTTPReturnCode(ctx); 12470 desret_int(ret_val); 12471 call_tests++; 12472 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0); 12473 xmlResetLastError(); 12474 if (mem_base != xmlMemBlocks()) { 12475 printf("Leak of %d blocks found in xmlNanoHTTPReturnCode", 12476 xmlMemBlocks() - mem_base); 12477 test_ret++; 12478 printf(" %d", n_ctx); 12479 printf("\n"); 12480 } 12481 } 12482 function_tests++; 12483 #endif 12484 12485 return(test_ret); 12486 } 12487 12488 12489 static int 12490 test_xmlNanoHTTPSave(void) { 12491 int test_ret = 0; 12492 12493 #if defined(LIBXML_HTTP_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) 12494 int mem_base; 12495 int ret_val; 12496 void * ctxt; /* the HTTP context */ 12497 int n_ctxt; 12498 const char * filename; /* the filename where the content should be saved */ 12499 int n_filename; 12500 12501 for (n_ctxt = 0;n_ctxt < gen_nb_void_ptr;n_ctxt++) { 12502 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) { 12503 mem_base = xmlMemBlocks(); 12504 ctxt = gen_void_ptr(n_ctxt, 0); 12505 filename = gen_fileoutput(n_filename, 1); 12506 12507 ret_val = xmlNanoHTTPSave(ctxt, filename); 12508 desret_int(ret_val); 12509 call_tests++; 12510 des_void_ptr(n_ctxt, ctxt, 0); 12511 des_fileoutput(n_filename, filename, 1); 12512 xmlResetLastError(); 12513 if (mem_base != xmlMemBlocks()) { 12514 printf("Leak of %d blocks found in xmlNanoHTTPSave", 12515 xmlMemBlocks() - mem_base); 12516 test_ret++; 12517 printf(" %d", n_ctxt); 12518 printf(" %d", n_filename); 12519 printf("\n"); 12520 } 12521 } 12522 } 12523 function_tests++; 12524 #endif 12525 12526 return(test_ret); 12527 } 12528 12529 12530 static int 12531 test_xmlNanoHTTPScanProxy(void) { 12532 int test_ret = 0; 12533 12534 #if defined(LIBXML_HTTP_ENABLED) 12535 const char * URL; /* The proxy URL used to initialize the proxy context */ 12536 int n_URL; 12537 12538 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) { 12539 URL = gen_filepath(n_URL, 0); 12540 12541 xmlNanoHTTPScanProxy(URL); 12542 call_tests++; 12543 des_filepath(n_URL, URL, 0); 12544 xmlResetLastError(); 12545 } 12546 function_tests++; 12547 #endif 12548 12549 return(test_ret); 12550 } 12551 12552 static int 12553 test_nanohttp(void) { 12554 int test_ret = 0; 12555 12556 if (quiet == 0) printf("Testing nanohttp : 13 of 17 functions ...\n"); 12557 test_ret += test_xmlNanoHTTPAuthHeader(); 12558 test_ret += test_xmlNanoHTTPCleanup(); 12559 test_ret += test_xmlNanoHTTPContentLength(); 12560 test_ret += test_xmlNanoHTTPEncoding(); 12561 test_ret += test_xmlNanoHTTPFetch(); 12562 test_ret += test_xmlNanoHTTPInit(); 12563 test_ret += test_xmlNanoHTTPMimeType(); 12564 test_ret += test_xmlNanoHTTPOpen(); 12565 test_ret += test_xmlNanoHTTPOpenRedir(); 12566 test_ret += test_xmlNanoHTTPRead(); 12567 test_ret += test_xmlNanoHTTPRedir(); 12568 test_ret += test_xmlNanoHTTPReturnCode(); 12569 test_ret += test_xmlNanoHTTPSave(); 12570 test_ret += test_xmlNanoHTTPScanProxy(); 12571 12572 if (test_ret != 0) 12573 printf("Module nanohttp: %d errors\n", test_ret); 12574 return(test_ret); 12575 } 12576 12577 static int 12578 test_xmlByteConsumed(void) { 12579 int test_ret = 0; 12580 12581 int mem_base; 12582 long ret_val; 12583 xmlParserCtxtPtr ctxt; /* an XML parser context */ 12584 int n_ctxt; 12585 12586 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { 12587 mem_base = xmlMemBlocks(); 12588 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); 12589 12590 ret_val = xmlByteConsumed(ctxt); 12591 desret_long(ret_val); 12592 call_tests++; 12593 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); 12594 xmlResetLastError(); 12595 if (mem_base != xmlMemBlocks()) { 12596 printf("Leak of %d blocks found in xmlByteConsumed", 12597 xmlMemBlocks() - mem_base); 12598 test_ret++; 12599 printf(" %d", n_ctxt); 12600 printf("\n"); 12601 } 12602 } 12603 function_tests++; 12604 12605 return(test_ret); 12606 } 12607 12608 12609 static int 12610 test_xmlClearNodeInfoSeq(void) { 12611 int test_ret = 0; 12612 12613 int mem_base; 12614 xmlParserNodeInfoSeqPtr seq; /* a node info sequence pointer */ 12615 int n_seq; 12616 12617 for (n_seq = 0;n_seq < gen_nb_xmlParserNodeInfoSeqPtr;n_seq++) { 12618 mem_base = xmlMemBlocks(); 12619 seq = gen_xmlParserNodeInfoSeqPtr(n_seq, 0); 12620 12621 xmlClearNodeInfoSeq(seq); 12622 call_tests++; 12623 des_xmlParserNodeInfoSeqPtr(n_seq, seq, 0); 12624 xmlResetLastError(); 12625 if (mem_base != xmlMemBlocks()) { 12626 printf("Leak of %d blocks found in xmlClearNodeInfoSeq", 12627 xmlMemBlocks() - mem_base); 12628 test_ret++; 12629 printf(" %d", n_seq); 12630 printf("\n"); 12631 } 12632 } 12633 function_tests++; 12634 12635 return(test_ret); 12636 } 12637 12638 12639 static int 12640 test_xmlClearParserCtxt(void) { 12641 int test_ret = 0; 12642 12643 int mem_base; 12644 xmlParserCtxtPtr ctxt; /* an XML parser context */ 12645 int n_ctxt; 12646 12647 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { 12648 mem_base = xmlMemBlocks(); 12649 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); 12650 12651 xmlClearParserCtxt(ctxt); 12652 call_tests++; 12653 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); 12654 xmlResetLastError(); 12655 if (mem_base != xmlMemBlocks()) { 12656 printf("Leak of %d blocks found in xmlClearParserCtxt", 12657 xmlMemBlocks() - mem_base); 12658 test_ret++; 12659 printf(" %d", n_ctxt); 12660 printf("\n"); 12661 } 12662 } 12663 function_tests++; 12664 12665 return(test_ret); 12666 } 12667 12668 12669 static int 12670 test_xmlCreateDocParserCtxt(void) { 12671 int test_ret = 0; 12672 12673 int mem_base; 12674 xmlParserCtxtPtr ret_val; 12675 xmlChar * cur; /* a pointer to an array of xmlChar */ 12676 int n_cur; 12677 12678 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) { 12679 mem_base = xmlMemBlocks(); 12680 cur = gen_const_xmlChar_ptr(n_cur, 0); 12681 12682 ret_val = xmlCreateDocParserCtxt((const xmlChar *)cur); 12683 desret_xmlParserCtxtPtr(ret_val); 12684 call_tests++; 12685 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0); 12686 xmlResetLastError(); 12687 if (mem_base != xmlMemBlocks()) { 12688 printf("Leak of %d blocks found in xmlCreateDocParserCtxt", 12689 xmlMemBlocks() - mem_base); 12690 test_ret++; 12691 printf(" %d", n_cur); 12692 printf("\n"); 12693 } 12694 } 12695 function_tests++; 12696 12697 return(test_ret); 12698 } 12699 12700 12701 static int 12702 test_xmlCreatePushParserCtxt(void) { 12703 int test_ret = 0; 12704 12705 #if defined(LIBXML_PUSH_ENABLED) 12706 int mem_base; 12707 xmlParserCtxtPtr ret_val; 12708 xmlSAXHandlerPtr sax; /* a SAX handler */ 12709 int n_sax; 12710 void * user_data; /* The user data returned on SAX callbacks */ 12711 int n_user_data; 12712 char * chunk; /* a pointer to an array of chars */ 12713 int n_chunk; 12714 int size; /* number of chars in the array */ 12715 int n_size; 12716 const char * filename; /* an optional file name or URI */ 12717 int n_filename; 12718 12719 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) { 12720 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) { 12721 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) { 12722 for (n_size = 0;n_size < gen_nb_int;n_size++) { 12723 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) { 12724 mem_base = xmlMemBlocks(); 12725 sax = gen_xmlSAXHandlerPtr(n_sax, 0); 12726 user_data = gen_userdata(n_user_data, 1); 12727 chunk = gen_const_char_ptr(n_chunk, 2); 12728 size = gen_int(n_size, 3); 12729 filename = gen_fileoutput(n_filename, 4); 12730 12731 ret_val = xmlCreatePushParserCtxt(sax, user_data, (const char *)chunk, size, filename); 12732 desret_xmlParserCtxtPtr(ret_val); 12733 call_tests++; 12734 des_xmlSAXHandlerPtr(n_sax, sax, 0); 12735 des_userdata(n_user_data, user_data, 1); 12736 des_const_char_ptr(n_chunk, (const char *)chunk, 2); 12737 des_int(n_size, size, 3); 12738 des_fileoutput(n_filename, filename, 4); 12739 xmlResetLastError(); 12740 if (mem_base != xmlMemBlocks()) { 12741 printf("Leak of %d blocks found in xmlCreatePushParserCtxt", 12742 xmlMemBlocks() - mem_base); 12743 test_ret++; 12744 printf(" %d", n_sax); 12745 printf(" %d", n_user_data); 12746 printf(" %d", n_chunk); 12747 printf(" %d", n_size); 12748 printf(" %d", n_filename); 12749 printf("\n"); 12750 } 12751 } 12752 } 12753 } 12754 } 12755 } 12756 function_tests++; 12757 #endif 12758 12759 return(test_ret); 12760 } 12761 12762 12763 static int 12764 test_xmlCtxtReadDoc(void) { 12765 int test_ret = 0; 12766 12767 int mem_base; 12768 xmlDocPtr ret_val; 12769 xmlParserCtxtPtr ctxt; /* an XML parser context */ 12770 int n_ctxt; 12771 xmlChar * cur; /* a pointer to a zero terminated string */ 12772 int n_cur; 12773 const char * URL; /* the base URL to use for the document */ 12774 int n_URL; 12775 char * encoding; /* the document encoding, or NULL */ 12776 int n_encoding; 12777 int options; /* a combination of xmlParserOption */ 12778 int n_options; 12779 12780 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { 12781 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) { 12782 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) { 12783 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { 12784 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) { 12785 mem_base = xmlMemBlocks(); 12786 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); 12787 cur = gen_const_xmlChar_ptr(n_cur, 1); 12788 URL = gen_filepath(n_URL, 2); 12789 encoding = gen_const_char_ptr(n_encoding, 3); 12790 options = gen_parseroptions(n_options, 4); 12791 12792 ret_val = xmlCtxtReadDoc(ctxt, (const xmlChar *)cur, URL, (const char *)encoding, options); 12793 desret_xmlDocPtr(ret_val); 12794 call_tests++; 12795 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); 12796 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 1); 12797 des_filepath(n_URL, URL, 2); 12798 des_const_char_ptr(n_encoding, (const char *)encoding, 3); 12799 des_parseroptions(n_options, options, 4); 12800 xmlResetLastError(); 12801 if (mem_base != xmlMemBlocks()) { 12802 printf("Leak of %d blocks found in xmlCtxtReadDoc", 12803 xmlMemBlocks() - mem_base); 12804 test_ret++; 12805 printf(" %d", n_ctxt); 12806 printf(" %d", n_cur); 12807 printf(" %d", n_URL); 12808 printf(" %d", n_encoding); 12809 printf(" %d", n_options); 12810 printf("\n"); 12811 } 12812 } 12813 } 12814 } 12815 } 12816 } 12817 function_tests++; 12818 12819 return(test_ret); 12820 } 12821 12822 12823 static int 12824 test_xmlCtxtReadFile(void) { 12825 int test_ret = 0; 12826 12827 int mem_base; 12828 xmlDocPtr ret_val; 12829 xmlParserCtxtPtr ctxt; /* an XML parser context */ 12830 int n_ctxt; 12831 const char * filename; /* a file or URL */ 12832 int n_filename; 12833 char * encoding; /* the document encoding, or NULL */ 12834 int n_encoding; 12835 int options; /* a combination of xmlParserOption */ 12836 int n_options; 12837 12838 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { 12839 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { 12840 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { 12841 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) { 12842 mem_base = xmlMemBlocks(); 12843 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); 12844 filename = gen_filepath(n_filename, 1); 12845 encoding = gen_const_char_ptr(n_encoding, 2); 12846 options = gen_parseroptions(n_options, 3); 12847 12848 ret_val = xmlCtxtReadFile(ctxt, filename, (const char *)encoding, options); 12849 desret_xmlDocPtr(ret_val); 12850 call_tests++; 12851 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); 12852 des_filepath(n_filename, filename, 1); 12853 des_const_char_ptr(n_encoding, (const char *)encoding, 2); 12854 des_parseroptions(n_options, options, 3); 12855 xmlResetLastError(); 12856 if (mem_base != xmlMemBlocks()) { 12857 printf("Leak of %d blocks found in xmlCtxtReadFile", 12858 xmlMemBlocks() - mem_base); 12859 test_ret++; 12860 printf(" %d", n_ctxt); 12861 printf(" %d", n_filename); 12862 printf(" %d", n_encoding); 12863 printf(" %d", n_options); 12864 printf("\n"); 12865 } 12866 } 12867 } 12868 } 12869 } 12870 function_tests++; 12871 12872 return(test_ret); 12873 } 12874 12875 12876 static int 12877 test_xmlCtxtReadMemory(void) { 12878 int test_ret = 0; 12879 12880 int mem_base; 12881 xmlDocPtr ret_val; 12882 xmlParserCtxtPtr ctxt; /* an XML parser context */ 12883 int n_ctxt; 12884 char * buffer; /* a pointer to a char array */ 12885 int n_buffer; 12886 int size; /* the size of the array */ 12887 int n_size; 12888 const char * URL; /* the base URL to use for the document */ 12889 int n_URL; 12890 char * encoding; /* the document encoding, or NULL */ 12891 int n_encoding; 12892 int options; /* a combination of xmlParserOption */ 12893 int n_options; 12894 12895 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { 12896 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) { 12897 for (n_size = 0;n_size < gen_nb_int;n_size++) { 12898 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) { 12899 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { 12900 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) { 12901 mem_base = xmlMemBlocks(); 12902 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); 12903 buffer = gen_const_char_ptr(n_buffer, 1); 12904 size = gen_int(n_size, 2); 12905 URL = gen_filepath(n_URL, 3); 12906 encoding = gen_const_char_ptr(n_encoding, 4); 12907 options = gen_parseroptions(n_options, 5); 12908 12909 ret_val = xmlCtxtReadMemory(ctxt, (const char *)buffer, size, URL, (const char *)encoding, options); 12910 desret_xmlDocPtr(ret_val); 12911 call_tests++; 12912 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); 12913 des_const_char_ptr(n_buffer, (const char *)buffer, 1); 12914 des_int(n_size, size, 2); 12915 des_filepath(n_URL, URL, 3); 12916 des_const_char_ptr(n_encoding, (const char *)encoding, 4); 12917 des_parseroptions(n_options, options, 5); 12918 xmlResetLastError(); 12919 if (mem_base != xmlMemBlocks()) { 12920 printf("Leak of %d blocks found in xmlCtxtReadMemory", 12921 xmlMemBlocks() - mem_base); 12922 test_ret++; 12923 printf(" %d", n_ctxt); 12924 printf(" %d", n_buffer); 12925 printf(" %d", n_size); 12926 printf(" %d", n_URL); 12927 printf(" %d", n_encoding); 12928 printf(" %d", n_options); 12929 printf("\n"); 12930 } 12931 } 12932 } 12933 } 12934 } 12935 } 12936 } 12937 function_tests++; 12938 12939 return(test_ret); 12940 } 12941 12942 12943 static int 12944 test_xmlCtxtReset(void) { 12945 int test_ret = 0; 12946 12947 int mem_base; 12948 xmlParserCtxtPtr ctxt; /* an XML parser context */ 12949 int n_ctxt; 12950 12951 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { 12952 mem_base = xmlMemBlocks(); 12953 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); 12954 12955 xmlCtxtReset(ctxt); 12956 call_tests++; 12957 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); 12958 xmlResetLastError(); 12959 if (mem_base != xmlMemBlocks()) { 12960 printf("Leak of %d blocks found in xmlCtxtReset", 12961 xmlMemBlocks() - mem_base); 12962 test_ret++; 12963 printf(" %d", n_ctxt); 12964 printf("\n"); 12965 } 12966 } 12967 function_tests++; 12968 12969 return(test_ret); 12970 } 12971 12972 12973 static int 12974 test_xmlCtxtResetPush(void) { 12975 int test_ret = 0; 12976 12977 int mem_base; 12978 int ret_val; 12979 xmlParserCtxtPtr ctxt; /* an XML parser context */ 12980 int n_ctxt; 12981 char * chunk; /* a pointer to an array of chars */ 12982 int n_chunk; 12983 int size; /* number of chars in the array */ 12984 int n_size; 12985 const char * filename; /* an optional file name or URI */ 12986 int n_filename; 12987 char * encoding; /* the document encoding, or NULL */ 12988 int n_encoding; 12989 12990 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { 12991 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) { 12992 for (n_size = 0;n_size < gen_nb_int;n_size++) { 12993 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { 12994 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { 12995 mem_base = xmlMemBlocks(); 12996 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); 12997 chunk = gen_const_char_ptr(n_chunk, 1); 12998 size = gen_int(n_size, 2); 12999 filename = gen_filepath(n_filename, 3); 13000 encoding = gen_const_char_ptr(n_encoding, 4); 13001 13002 ret_val = xmlCtxtResetPush(ctxt, (const char *)chunk, size, filename, (const char *)encoding); 13003 desret_int(ret_val); 13004 call_tests++; 13005 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); 13006 des_const_char_ptr(n_chunk, (const char *)chunk, 1); 13007 des_int(n_size, size, 2); 13008 des_filepath(n_filename, filename, 3); 13009 des_const_char_ptr(n_encoding, (const char *)encoding, 4); 13010 xmlResetLastError(); 13011 if (mem_base != xmlMemBlocks()) { 13012 printf("Leak of %d blocks found in xmlCtxtResetPush", 13013 xmlMemBlocks() - mem_base); 13014 test_ret++; 13015 printf(" %d", n_ctxt); 13016 printf(" %d", n_chunk); 13017 printf(" %d", n_size); 13018 printf(" %d", n_filename); 13019 printf(" %d", n_encoding); 13020 printf("\n"); 13021 } 13022 } 13023 } 13024 } 13025 } 13026 } 13027 function_tests++; 13028 13029 return(test_ret); 13030 } 13031 13032 13033 static int 13034 test_xmlCtxtUseOptions(void) { 13035 int test_ret = 0; 13036 13037 int mem_base; 13038 int ret_val; 13039 xmlParserCtxtPtr ctxt; /* an XML parser context */ 13040 int n_ctxt; 13041 int options; /* a combination of xmlParserOption */ 13042 int n_options; 13043 13044 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { 13045 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) { 13046 mem_base = xmlMemBlocks(); 13047 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); 13048 options = gen_parseroptions(n_options, 1); 13049 13050 ret_val = xmlCtxtUseOptions(ctxt, options); 13051 desret_int(ret_val); 13052 call_tests++; 13053 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); 13054 des_parseroptions(n_options, options, 1); 13055 xmlResetLastError(); 13056 if (mem_base != xmlMemBlocks()) { 13057 printf("Leak of %d blocks found in xmlCtxtUseOptions", 13058 xmlMemBlocks() - mem_base); 13059 test_ret++; 13060 printf(" %d", n_ctxt); 13061 printf(" %d", n_options); 13062 printf("\n"); 13063 } 13064 } 13065 } 13066 function_tests++; 13067 13068 return(test_ret); 13069 } 13070 13071 13072 static int 13073 test_xmlGetExternalEntityLoader(void) { 13074 int test_ret = 0; 13075 13076 13077 /* missing type support */ 13078 return(test_ret); 13079 } 13080 13081 13082 static int 13083 test_xmlGetFeature(void) { 13084 int test_ret = 0; 13085 13086 #if defined(LIBXML_LEGACY_ENABLED) 13087 #ifdef LIBXML_LEGACY_ENABLED 13088 int mem_base; 13089 int ret_val; 13090 xmlParserCtxtPtr ctxt; /* an XML/HTML parser context */ 13091 int n_ctxt; 13092 char * name; /* the feature name */ 13093 int n_name; 13094 void * result; /* location to store the result */ 13095 int n_result; 13096 13097 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { 13098 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) { 13099 for (n_result = 0;n_result < gen_nb_void_ptr;n_result++) { 13100 mem_base = xmlMemBlocks(); 13101 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); 13102 name = gen_const_char_ptr(n_name, 1); 13103 result = gen_void_ptr(n_result, 2); 13104 13105 ret_val = xmlGetFeature(ctxt, (const char *)name, result); 13106 desret_int(ret_val); 13107 call_tests++; 13108 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); 13109 des_const_char_ptr(n_name, (const char *)name, 1); 13110 des_void_ptr(n_result, result, 2); 13111 xmlResetLastError(); 13112 if (mem_base != xmlMemBlocks()) { 13113 printf("Leak of %d blocks found in xmlGetFeature", 13114 xmlMemBlocks() - mem_base); 13115 test_ret++; 13116 printf(" %d", n_ctxt); 13117 printf(" %d", n_name); 13118 printf(" %d", n_result); 13119 printf("\n"); 13120 } 13121 } 13122 } 13123 } 13124 function_tests++; 13125 #endif 13126 #endif 13127 13128 return(test_ret); 13129 } 13130 13131 13132 #define gen_nb_const_char_ptr_ptr 1 13133 static char ** gen_const_char_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 13134 return(NULL); 13135 } 13136 static void des_const_char_ptr_ptr(int no ATTRIBUTE_UNUSED, const char ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 13137 } 13138 13139 static int 13140 test_xmlGetFeaturesList(void) { 13141 int test_ret = 0; 13142 13143 #if defined(LIBXML_LEGACY_ENABLED) 13144 #ifdef LIBXML_LEGACY_ENABLED 13145 int mem_base; 13146 int ret_val; 13147 int * len; /* the length of the features name array (input/output) */ 13148 int n_len; 13149 char ** result; /* an array of string to be filled with the features name. */ 13150 int n_result; 13151 13152 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) { 13153 for (n_result = 0;n_result < gen_nb_const_char_ptr_ptr;n_result++) { 13154 mem_base = xmlMemBlocks(); 13155 len = gen_int_ptr(n_len, 0); 13156 result = gen_const_char_ptr_ptr(n_result, 1); 13157 13158 ret_val = xmlGetFeaturesList(len, (const char **)result); 13159 desret_int(ret_val); 13160 call_tests++; 13161 des_int_ptr(n_len, len, 0); 13162 des_const_char_ptr_ptr(n_result, (const char **)result, 1); 13163 xmlResetLastError(); 13164 if (mem_base != xmlMemBlocks()) { 13165 printf("Leak of %d blocks found in xmlGetFeaturesList", 13166 xmlMemBlocks() - mem_base); 13167 test_ret++; 13168 printf(" %d", n_len); 13169 printf(" %d", n_result); 13170 printf("\n"); 13171 } 13172 } 13173 } 13174 function_tests++; 13175 #endif 13176 #endif 13177 13178 return(test_ret); 13179 } 13180 13181 13182 static int 13183 test_xmlHasFeature(void) { 13184 int test_ret = 0; 13185 13186 int mem_base; 13187 int ret_val; 13188 xmlFeature feature; /* the feature to be examined */ 13189 int n_feature; 13190 13191 for (n_feature = 0;n_feature < gen_nb_xmlFeature;n_feature++) { 13192 mem_base = xmlMemBlocks(); 13193 feature = gen_xmlFeature(n_feature, 0); 13194 13195 ret_val = xmlHasFeature(feature); 13196 desret_int(ret_val); 13197 call_tests++; 13198 des_xmlFeature(n_feature, feature, 0); 13199 xmlResetLastError(); 13200 if (mem_base != xmlMemBlocks()) { 13201 printf("Leak of %d blocks found in xmlHasFeature", 13202 xmlMemBlocks() - mem_base); 13203 test_ret++; 13204 printf(" %d", n_feature); 13205 printf("\n"); 13206 } 13207 } 13208 function_tests++; 13209 13210 return(test_ret); 13211 } 13212 13213 13214 static int 13215 test_xmlIOParseDTD(void) { 13216 int test_ret = 0; 13217 13218 #if defined(LIBXML_VALID_ENABLED) 13219 #ifdef LIBXML_VALID_ENABLED 13220 xmlDtdPtr ret_val; 13221 xmlSAXHandlerPtr sax; /* the SAX handler block or NULL */ 13222 int n_sax; 13223 xmlParserInputBufferPtr input; /* an Input Buffer */ 13224 int n_input; 13225 xmlCharEncoding enc; /* the charset encoding if known */ 13226 int n_enc; 13227 13228 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) { 13229 for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) { 13230 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) { 13231 sax = gen_xmlSAXHandlerPtr(n_sax, 0); 13232 input = gen_xmlParserInputBufferPtr(n_input, 1); 13233 enc = gen_xmlCharEncoding(n_enc, 2); 13234 13235 ret_val = xmlIOParseDTD(sax, input, enc); 13236 input = NULL; 13237 desret_xmlDtdPtr(ret_val); 13238 call_tests++; 13239 des_xmlSAXHandlerPtr(n_sax, sax, 0); 13240 des_xmlParserInputBufferPtr(n_input, input, 1); 13241 des_xmlCharEncoding(n_enc, enc, 2); 13242 xmlResetLastError(); 13243 } 13244 } 13245 } 13246 function_tests++; 13247 #endif 13248 #endif 13249 13250 return(test_ret); 13251 } 13252 13253 13254 static int 13255 test_xmlInitNodeInfoSeq(void) { 13256 int test_ret = 0; 13257 13258 int mem_base; 13259 xmlParserNodeInfoSeqPtr seq; /* a node info sequence pointer */ 13260 int n_seq; 13261 13262 for (n_seq = 0;n_seq < gen_nb_xmlParserNodeInfoSeqPtr;n_seq++) { 13263 mem_base = xmlMemBlocks(); 13264 seq = gen_xmlParserNodeInfoSeqPtr(n_seq, 0); 13265 13266 xmlInitNodeInfoSeq(seq); 13267 call_tests++; 13268 des_xmlParserNodeInfoSeqPtr(n_seq, seq, 0); 13269 xmlResetLastError(); 13270 if (mem_base != xmlMemBlocks()) { 13271 printf("Leak of %d blocks found in xmlInitNodeInfoSeq", 13272 xmlMemBlocks() - mem_base); 13273 test_ret++; 13274 printf(" %d", n_seq); 13275 printf("\n"); 13276 } 13277 } 13278 function_tests++; 13279 13280 return(test_ret); 13281 } 13282 13283 13284 static int 13285 test_xmlInitParser(void) { 13286 int test_ret = 0; 13287 13288 int mem_base; 13289 13290 mem_base = xmlMemBlocks(); 13291 13292 xmlInitParser(); 13293 call_tests++; 13294 xmlResetLastError(); 13295 if (mem_base != xmlMemBlocks()) { 13296 printf("Leak of %d blocks found in xmlInitParser", 13297 xmlMemBlocks() - mem_base); 13298 test_ret++; 13299 printf("\n"); 13300 } 13301 function_tests++; 13302 13303 return(test_ret); 13304 } 13305 13306 13307 static int 13308 test_xmlInitParserCtxt(void) { 13309 int test_ret = 0; 13310 13311 int mem_base; 13312 int ret_val; 13313 xmlParserCtxtPtr ctxt; /* an XML parser context */ 13314 int n_ctxt; 13315 13316 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { 13317 mem_base = xmlMemBlocks(); 13318 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); 13319 13320 ret_val = xmlInitParserCtxt(ctxt); 13321 desret_int(ret_val); 13322 call_tests++; 13323 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); 13324 xmlResetLastError(); 13325 if (mem_base != xmlMemBlocks()) { 13326 printf("Leak of %d blocks found in xmlInitParserCtxt", 13327 xmlMemBlocks() - mem_base); 13328 test_ret++; 13329 printf(" %d", n_ctxt); 13330 printf("\n"); 13331 } 13332 } 13333 function_tests++; 13334 13335 return(test_ret); 13336 } 13337 13338 13339 static int 13340 test_xmlKeepBlanksDefault(void) { 13341 int test_ret = 0; 13342 13343 int mem_base; 13344 int ret_val; 13345 int val; /* int 0 or 1 */ 13346 int n_val; 13347 13348 for (n_val = 0;n_val < gen_nb_int;n_val++) { 13349 mem_base = xmlMemBlocks(); 13350 val = gen_int(n_val, 0); 13351 13352 ret_val = xmlKeepBlanksDefault(val); 13353 desret_int(ret_val); 13354 call_tests++; 13355 des_int(n_val, val, 0); 13356 xmlResetLastError(); 13357 if (mem_base != xmlMemBlocks()) { 13358 printf("Leak of %d blocks found in xmlKeepBlanksDefault", 13359 xmlMemBlocks() - mem_base); 13360 test_ret++; 13361 printf(" %d", n_val); 13362 printf("\n"); 13363 } 13364 } 13365 function_tests++; 13366 13367 return(test_ret); 13368 } 13369 13370 13371 static int 13372 test_xmlLineNumbersDefault(void) { 13373 int test_ret = 0; 13374 13375 int mem_base; 13376 int ret_val; 13377 int val; /* int 0 or 1 */ 13378 int n_val; 13379 13380 for (n_val = 0;n_val < gen_nb_int;n_val++) { 13381 mem_base = xmlMemBlocks(); 13382 val = gen_int(n_val, 0); 13383 13384 ret_val = xmlLineNumbersDefault(val); 13385 desret_int(ret_val); 13386 call_tests++; 13387 des_int(n_val, val, 0); 13388 xmlResetLastError(); 13389 if (mem_base != xmlMemBlocks()) { 13390 printf("Leak of %d blocks found in xmlLineNumbersDefault", 13391 xmlMemBlocks() - mem_base); 13392 test_ret++; 13393 printf(" %d", n_val); 13394 printf("\n"); 13395 } 13396 } 13397 function_tests++; 13398 13399 return(test_ret); 13400 } 13401 13402 13403 static int 13404 test_xmlLoadExternalEntity(void) { 13405 int test_ret = 0; 13406 13407 int mem_base; 13408 xmlParserInputPtr ret_val; 13409 const char * URL; /* the URL for the entity to load */ 13410 int n_URL; 13411 char * ID; /* the Public ID for the entity to load */ 13412 int n_ID; 13413 xmlParserCtxtPtr ctxt; /* the context in which the entity is called or NULL */ 13414 int n_ctxt; 13415 13416 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) { 13417 for (n_ID = 0;n_ID < gen_nb_const_char_ptr;n_ID++) { 13418 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { 13419 mem_base = xmlMemBlocks(); 13420 URL = gen_filepath(n_URL, 0); 13421 ID = gen_const_char_ptr(n_ID, 1); 13422 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 2); 13423 13424 ret_val = xmlLoadExternalEntity(URL, (const char *)ID, ctxt); 13425 desret_xmlParserInputPtr(ret_val); 13426 call_tests++; 13427 des_filepath(n_URL, URL, 0); 13428 des_const_char_ptr(n_ID, (const char *)ID, 1); 13429 des_xmlParserCtxtPtr(n_ctxt, ctxt, 2); 13430 xmlResetLastError(); 13431 if (mem_base != xmlMemBlocks()) { 13432 printf("Leak of %d blocks found in xmlLoadExternalEntity", 13433 xmlMemBlocks() - mem_base); 13434 test_ret++; 13435 printf(" %d", n_URL); 13436 printf(" %d", n_ID); 13437 printf(" %d", n_ctxt); 13438 printf("\n"); 13439 } 13440 } 13441 } 13442 } 13443 function_tests++; 13444 13445 return(test_ret); 13446 } 13447 13448 13449 static int 13450 test_xmlNewIOInputStream(void) { 13451 int test_ret = 0; 13452 13453 int mem_base; 13454 xmlParserInputPtr ret_val; 13455 xmlParserCtxtPtr ctxt; /* an XML parser context */ 13456 int n_ctxt; 13457 xmlParserInputBufferPtr input; /* an I/O Input */ 13458 int n_input; 13459 xmlCharEncoding enc; /* the charset encoding if known */ 13460 int n_enc; 13461 13462 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { 13463 for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) { 13464 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) { 13465 mem_base = xmlMemBlocks(); 13466 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); 13467 input = gen_xmlParserInputBufferPtr(n_input, 1); 13468 enc = gen_xmlCharEncoding(n_enc, 2); 13469 13470 ret_val = xmlNewIOInputStream(ctxt, input, enc); 13471 if (ret_val != NULL) input = NULL; 13472 desret_xmlParserInputPtr(ret_val); 13473 call_tests++; 13474 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); 13475 des_xmlParserInputBufferPtr(n_input, input, 1); 13476 des_xmlCharEncoding(n_enc, enc, 2); 13477 xmlResetLastError(); 13478 if (mem_base != xmlMemBlocks()) { 13479 printf("Leak of %d blocks found in xmlNewIOInputStream", 13480 xmlMemBlocks() - mem_base); 13481 test_ret++; 13482 printf(" %d", n_ctxt); 13483 printf(" %d", n_input); 13484 printf(" %d", n_enc); 13485 printf("\n"); 13486 } 13487 } 13488 } 13489 } 13490 function_tests++; 13491 13492 return(test_ret); 13493 } 13494 13495 13496 static int 13497 test_xmlNewParserCtxt(void) { 13498 int test_ret = 0; 13499 13500 int mem_base; 13501 xmlParserCtxtPtr ret_val; 13502 13503 mem_base = xmlMemBlocks(); 13504 13505 ret_val = xmlNewParserCtxt(); 13506 desret_xmlParserCtxtPtr(ret_val); 13507 call_tests++; 13508 xmlResetLastError(); 13509 if (mem_base != xmlMemBlocks()) { 13510 printf("Leak of %d blocks found in xmlNewParserCtxt", 13511 xmlMemBlocks() - mem_base); 13512 test_ret++; 13513 printf("\n"); 13514 } 13515 function_tests++; 13516 13517 return(test_ret); 13518 } 13519 13520 13521 #define gen_nb_xmlNodePtr_ptr 1 13522 static xmlNodePtr * gen_xmlNodePtr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 13523 return(NULL); 13524 } 13525 static void des_xmlNodePtr_ptr(int no ATTRIBUTE_UNUSED, xmlNodePtr * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 13526 } 13527 13528 static int 13529 test_xmlParseBalancedChunkMemory(void) { 13530 int test_ret = 0; 13531 13532 #if defined(LIBXML_SAX1_ENABLED) 13533 #ifdef LIBXML_SAX1_ENABLED 13534 int mem_base; 13535 int ret_val; 13536 xmlDocPtr doc; /* the document the chunk pertains to */ 13537 int n_doc; 13538 xmlSAXHandlerPtr sax; /* the SAX handler bloc (possibly NULL) */ 13539 int n_sax; 13540 void * user_data; /* The user data returned on SAX callbacks (possibly NULL) */ 13541 int n_user_data; 13542 int depth; /* Used for loop detection, use 0 */ 13543 int n_depth; 13544 xmlChar * string; /* the input string in UTF8 or ISO-Latin (zero terminated) */ 13545 int n_string; 13546 xmlNodePtr * lst; /* the return value for the set of parsed nodes */ 13547 int n_lst; 13548 13549 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { 13550 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) { 13551 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) { 13552 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) { 13553 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) { 13554 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) { 13555 mem_base = xmlMemBlocks(); 13556 doc = gen_xmlDocPtr(n_doc, 0); 13557 sax = gen_xmlSAXHandlerPtr(n_sax, 1); 13558 user_data = gen_userdata(n_user_data, 2); 13559 depth = gen_int(n_depth, 3); 13560 string = gen_const_xmlChar_ptr(n_string, 4); 13561 lst = gen_xmlNodePtr_ptr(n_lst, 5); 13562 13563 #ifdef LIBXML_SAX1_ENABLED 13564 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL; 13565 #endif 13566 13567 13568 ret_val = xmlParseBalancedChunkMemory(doc, sax, user_data, depth, (const xmlChar *)string, lst); 13569 desret_int(ret_val); 13570 call_tests++; 13571 des_xmlDocPtr(n_doc, doc, 0); 13572 des_xmlSAXHandlerPtr(n_sax, sax, 1); 13573 des_userdata(n_user_data, user_data, 2); 13574 des_int(n_depth, depth, 3); 13575 des_const_xmlChar_ptr(n_string, (const xmlChar *)string, 4); 13576 des_xmlNodePtr_ptr(n_lst, lst, 5); 13577 xmlResetLastError(); 13578 if (mem_base != xmlMemBlocks()) { 13579 printf("Leak of %d blocks found in xmlParseBalancedChunkMemory", 13580 xmlMemBlocks() - mem_base); 13581 test_ret++; 13582 printf(" %d", n_doc); 13583 printf(" %d", n_sax); 13584 printf(" %d", n_user_data); 13585 printf(" %d", n_depth); 13586 printf(" %d", n_string); 13587 printf(" %d", n_lst); 13588 printf("\n"); 13589 } 13590 } 13591 } 13592 } 13593 } 13594 } 13595 } 13596 function_tests++; 13597 #endif 13598 #endif 13599 13600 return(test_ret); 13601 } 13602 13603 13604 static int 13605 test_xmlParseBalancedChunkMemoryRecover(void) { 13606 int test_ret = 0; 13607 13608 #if defined(LIBXML_SAX1_ENABLED) 13609 #ifdef LIBXML_SAX1_ENABLED 13610 int mem_base; 13611 int ret_val; 13612 xmlDocPtr doc; /* the document the chunk pertains to */ 13613 int n_doc; 13614 xmlSAXHandlerPtr sax; /* the SAX handler bloc (possibly NULL) */ 13615 int n_sax; 13616 void * user_data; /* The user data returned on SAX callbacks (possibly NULL) */ 13617 int n_user_data; 13618 int depth; /* Used for loop detection, use 0 */ 13619 int n_depth; 13620 xmlChar * string; /* the input string in UTF8 or ISO-Latin (zero terminated) */ 13621 int n_string; 13622 xmlNodePtr * lst; /* the return value for the set of parsed nodes */ 13623 int n_lst; 13624 int recover; /* return nodes even if the data is broken (use 0) */ 13625 int n_recover; 13626 13627 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { 13628 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) { 13629 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) { 13630 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) { 13631 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) { 13632 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) { 13633 for (n_recover = 0;n_recover < gen_nb_int;n_recover++) { 13634 mem_base = xmlMemBlocks(); 13635 doc = gen_xmlDocPtr(n_doc, 0); 13636 sax = gen_xmlSAXHandlerPtr(n_sax, 1); 13637 user_data = gen_userdata(n_user_data, 2); 13638 depth = gen_int(n_depth, 3); 13639 string = gen_const_xmlChar_ptr(n_string, 4); 13640 lst = gen_xmlNodePtr_ptr(n_lst, 5); 13641 recover = gen_int(n_recover, 6); 13642 13643 #ifdef LIBXML_SAX1_ENABLED 13644 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL; 13645 #endif 13646 13647 13648 ret_val = xmlParseBalancedChunkMemoryRecover(doc, sax, user_data, depth, (const xmlChar *)string, lst, recover); 13649 desret_int(ret_val); 13650 call_tests++; 13651 des_xmlDocPtr(n_doc, doc, 0); 13652 des_xmlSAXHandlerPtr(n_sax, sax, 1); 13653 des_userdata(n_user_data, user_data, 2); 13654 des_int(n_depth, depth, 3); 13655 des_const_xmlChar_ptr(n_string, (const xmlChar *)string, 4); 13656 des_xmlNodePtr_ptr(n_lst, lst, 5); 13657 des_int(n_recover, recover, 6); 13658 xmlResetLastError(); 13659 if (mem_base != xmlMemBlocks()) { 13660 printf("Leak of %d blocks found in xmlParseBalancedChunkMemoryRecover", 13661 xmlMemBlocks() - mem_base); 13662 test_ret++; 13663 printf(" %d", n_doc); 13664 printf(" %d", n_sax); 13665 printf(" %d", n_user_data); 13666 printf(" %d", n_depth); 13667 printf(" %d", n_string); 13668 printf(" %d", n_lst); 13669 printf(" %d", n_recover); 13670 printf("\n"); 13671 } 13672 } 13673 } 13674 } 13675 } 13676 } 13677 } 13678 } 13679 function_tests++; 13680 #endif 13681 #endif 13682 13683 return(test_ret); 13684 } 13685 13686 13687 static int 13688 test_xmlParseChunk(void) { 13689 int test_ret = 0; 13690 13691 #if defined(LIBXML_PUSH_ENABLED) 13692 int mem_base; 13693 int ret_val; 13694 xmlParserCtxtPtr ctxt; /* an XML parser context */ 13695 int n_ctxt; 13696 char * chunk; /* an char array */ 13697 int n_chunk; 13698 int size; /* the size in byte of the chunk */ 13699 int n_size; 13700 int terminate; /* last chunk indicator */ 13701 int n_terminate; 13702 13703 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { 13704 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) { 13705 for (n_size = 0;n_size < gen_nb_int;n_size++) { 13706 for (n_terminate = 0;n_terminate < gen_nb_int;n_terminate++) { 13707 mem_base = xmlMemBlocks(); 13708 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); 13709 chunk = gen_const_char_ptr(n_chunk, 1); 13710 size = gen_int(n_size, 2); 13711 terminate = gen_int(n_terminate, 3); 13712 13713 ret_val = xmlParseChunk(ctxt, (const char *)chunk, size, terminate); 13714 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;} 13715 desret_int(ret_val); 13716 call_tests++; 13717 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); 13718 des_const_char_ptr(n_chunk, (const char *)chunk, 1); 13719 des_int(n_size, size, 2); 13720 des_int(n_terminate, terminate, 3); 13721 xmlResetLastError(); 13722 if (mem_base != xmlMemBlocks()) { 13723 printf("Leak of %d blocks found in xmlParseChunk", 13724 xmlMemBlocks() - mem_base); 13725 test_ret++; 13726 printf(" %d", n_ctxt); 13727 printf(" %d", n_chunk); 13728 printf(" %d", n_size); 13729 printf(" %d", n_terminate); 13730 printf("\n"); 13731 } 13732 } 13733 } 13734 } 13735 } 13736 function_tests++; 13737 #endif 13738 13739 return(test_ret); 13740 } 13741 13742 13743 static int 13744 test_xmlParseCtxtExternalEntity(void) { 13745 int test_ret = 0; 13746 13747 int mem_base; 13748 int ret_val; 13749 xmlParserCtxtPtr ctx; /* the existing parsing context */ 13750 int n_ctx; 13751 xmlChar * URL; /* the URL for the entity to load */ 13752 int n_URL; 13753 xmlChar * ID; /* the System ID for the entity to load */ 13754 int n_ID; 13755 xmlNodePtr * lst; /* the return value for the set of parsed nodes */ 13756 int n_lst; 13757 13758 for (n_ctx = 0;n_ctx < gen_nb_xmlParserCtxtPtr;n_ctx++) { 13759 for (n_URL = 0;n_URL < gen_nb_const_xmlChar_ptr;n_URL++) { 13760 for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) { 13761 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) { 13762 mem_base = xmlMemBlocks(); 13763 ctx = gen_xmlParserCtxtPtr(n_ctx, 0); 13764 URL = gen_const_xmlChar_ptr(n_URL, 1); 13765 ID = gen_const_xmlChar_ptr(n_ID, 2); 13766 lst = gen_xmlNodePtr_ptr(n_lst, 3); 13767 13768 ret_val = xmlParseCtxtExternalEntity(ctx, (const xmlChar *)URL, (const xmlChar *)ID, lst); 13769 desret_int(ret_val); 13770 call_tests++; 13771 des_xmlParserCtxtPtr(n_ctx, ctx, 0); 13772 des_const_xmlChar_ptr(n_URL, (const xmlChar *)URL, 1); 13773 des_const_xmlChar_ptr(n_ID, (const xmlChar *)ID, 2); 13774 des_xmlNodePtr_ptr(n_lst, lst, 3); 13775 xmlResetLastError(); 13776 if (mem_base != xmlMemBlocks()) { 13777 printf("Leak of %d blocks found in xmlParseCtxtExternalEntity", 13778 xmlMemBlocks() - mem_base); 13779 test_ret++; 13780 printf(" %d", n_ctx); 13781 printf(" %d", n_URL); 13782 printf(" %d", n_ID); 13783 printf(" %d", n_lst); 13784 printf("\n"); 13785 } 13786 } 13787 } 13788 } 13789 } 13790 function_tests++; 13791 13792 return(test_ret); 13793 } 13794 13795 13796 static int 13797 test_xmlParseDTD(void) { 13798 int test_ret = 0; 13799 13800 #if defined(LIBXML_VALID_ENABLED) 13801 #ifdef LIBXML_VALID_ENABLED 13802 int mem_base; 13803 xmlDtdPtr ret_val; 13804 xmlChar * ExternalID; /* a NAME* containing the External ID of the DTD */ 13805 int n_ExternalID; 13806 xmlChar * SystemID; /* a NAME* containing the URL to the DTD */ 13807 int n_SystemID; 13808 13809 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) { 13810 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) { 13811 mem_base = xmlMemBlocks(); 13812 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 0); 13813 SystemID = gen_const_xmlChar_ptr(n_SystemID, 1); 13814 13815 ret_val = xmlParseDTD((const xmlChar *)ExternalID, (const xmlChar *)SystemID); 13816 desret_xmlDtdPtr(ret_val); 13817 call_tests++; 13818 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 0); 13819 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 1); 13820 xmlResetLastError(); 13821 if (mem_base != xmlMemBlocks()) { 13822 printf("Leak of %d blocks found in xmlParseDTD", 13823 xmlMemBlocks() - mem_base); 13824 test_ret++; 13825 printf(" %d", n_ExternalID); 13826 printf(" %d", n_SystemID); 13827 printf("\n"); 13828 } 13829 } 13830 } 13831 function_tests++; 13832 #endif 13833 #endif 13834 13835 return(test_ret); 13836 } 13837 13838 13839 static int 13840 test_xmlParseDoc(void) { 13841 int test_ret = 0; 13842 13843 #if defined(LIBXML_SAX1_ENABLED) 13844 #ifdef LIBXML_SAX1_ENABLED 13845 int mem_base; 13846 xmlDocPtr ret_val; 13847 xmlChar * cur; /* a pointer to an array of xmlChar */ 13848 int n_cur; 13849 13850 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) { 13851 mem_base = xmlMemBlocks(); 13852 cur = gen_const_xmlChar_ptr(n_cur, 0); 13853 13854 ret_val = xmlParseDoc((const xmlChar *)cur); 13855 desret_xmlDocPtr(ret_val); 13856 call_tests++; 13857 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0); 13858 xmlResetLastError(); 13859 if (mem_base != xmlMemBlocks()) { 13860 printf("Leak of %d blocks found in xmlParseDoc", 13861 xmlMemBlocks() - mem_base); 13862 test_ret++; 13863 printf(" %d", n_cur); 13864 printf("\n"); 13865 } 13866 } 13867 function_tests++; 13868 #endif 13869 #endif 13870 13871 return(test_ret); 13872 } 13873 13874 13875 static int 13876 test_xmlParseDocument(void) { 13877 int test_ret = 0; 13878 13879 int mem_base; 13880 int ret_val; 13881 xmlParserCtxtPtr ctxt; /* an XML parser context */ 13882 int n_ctxt; 13883 13884 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { 13885 mem_base = xmlMemBlocks(); 13886 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); 13887 13888 ret_val = xmlParseDocument(ctxt); 13889 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;} 13890 desret_int(ret_val); 13891 call_tests++; 13892 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); 13893 xmlResetLastError(); 13894 if (mem_base != xmlMemBlocks()) { 13895 printf("Leak of %d blocks found in xmlParseDocument", 13896 xmlMemBlocks() - mem_base); 13897 test_ret++; 13898 printf(" %d", n_ctxt); 13899 printf("\n"); 13900 } 13901 } 13902 function_tests++; 13903 13904 return(test_ret); 13905 } 13906 13907 13908 static int 13909 test_xmlParseEntity(void) { 13910 int test_ret = 0; 13911 13912 #if defined(LIBXML_SAX1_ENABLED) 13913 #ifdef LIBXML_SAX1_ENABLED 13914 int mem_base; 13915 xmlDocPtr ret_val; 13916 const char * filename; /* the filename */ 13917 int n_filename; 13918 13919 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { 13920 mem_base = xmlMemBlocks(); 13921 filename = gen_filepath(n_filename, 0); 13922 13923 ret_val = xmlParseEntity(filename); 13924 desret_xmlDocPtr(ret_val); 13925 call_tests++; 13926 des_filepath(n_filename, filename, 0); 13927 xmlResetLastError(); 13928 if (mem_base != xmlMemBlocks()) { 13929 printf("Leak of %d blocks found in xmlParseEntity", 13930 xmlMemBlocks() - mem_base); 13931 test_ret++; 13932 printf(" %d", n_filename); 13933 printf("\n"); 13934 } 13935 } 13936 function_tests++; 13937 #endif 13938 #endif 13939 13940 return(test_ret); 13941 } 13942 13943 13944 static int 13945 test_xmlParseExtParsedEnt(void) { 13946 int test_ret = 0; 13947 13948 int mem_base; 13949 int ret_val; 13950 xmlParserCtxtPtr ctxt; /* an XML parser context */ 13951 int n_ctxt; 13952 13953 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { 13954 mem_base = xmlMemBlocks(); 13955 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); 13956 13957 ret_val = xmlParseExtParsedEnt(ctxt); 13958 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;} 13959 desret_int(ret_val); 13960 call_tests++; 13961 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); 13962 xmlResetLastError(); 13963 if (mem_base != xmlMemBlocks()) { 13964 printf("Leak of %d blocks found in xmlParseExtParsedEnt", 13965 xmlMemBlocks() - mem_base); 13966 test_ret++; 13967 printf(" %d", n_ctxt); 13968 printf("\n"); 13969 } 13970 } 13971 function_tests++; 13972 13973 return(test_ret); 13974 } 13975 13976 13977 static int 13978 test_xmlParseExternalEntity(void) { 13979 int test_ret = 0; 13980 13981 #if defined(LIBXML_SAX1_ENABLED) 13982 #ifdef LIBXML_SAX1_ENABLED 13983 int mem_base; 13984 int ret_val; 13985 xmlDocPtr doc; /* the document the chunk pertains to */ 13986 int n_doc; 13987 xmlSAXHandlerPtr sax; /* the SAX handler bloc (possibly NULL) */ 13988 int n_sax; 13989 void * user_data; /* The user data returned on SAX callbacks (possibly NULL) */ 13990 int n_user_data; 13991 int depth; /* Used for loop detection, use 0 */ 13992 int n_depth; 13993 xmlChar * URL; /* the URL for the entity to load */ 13994 int n_URL; 13995 xmlChar * ID; /* the System ID for the entity to load */ 13996 int n_ID; 13997 xmlNodePtr * lst; /* the return value for the set of parsed nodes */ 13998 int n_lst; 13999 14000 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { 14001 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) { 14002 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) { 14003 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) { 14004 for (n_URL = 0;n_URL < gen_nb_const_xmlChar_ptr;n_URL++) { 14005 for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) { 14006 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) { 14007 mem_base = xmlMemBlocks(); 14008 doc = gen_xmlDocPtr(n_doc, 0); 14009 sax = gen_xmlSAXHandlerPtr(n_sax, 1); 14010 user_data = gen_userdata(n_user_data, 2); 14011 depth = gen_int(n_depth, 3); 14012 URL = gen_const_xmlChar_ptr(n_URL, 4); 14013 ID = gen_const_xmlChar_ptr(n_ID, 5); 14014 lst = gen_xmlNodePtr_ptr(n_lst, 6); 14015 14016 ret_val = xmlParseExternalEntity(doc, sax, user_data, depth, (const xmlChar *)URL, (const xmlChar *)ID, lst); 14017 desret_int(ret_val); 14018 call_tests++; 14019 des_xmlDocPtr(n_doc, doc, 0); 14020 des_xmlSAXHandlerPtr(n_sax, sax, 1); 14021 des_userdata(n_user_data, user_data, 2); 14022 des_int(n_depth, depth, 3); 14023 des_const_xmlChar_ptr(n_URL, (const xmlChar *)URL, 4); 14024 des_const_xmlChar_ptr(n_ID, (const xmlChar *)ID, 5); 14025 des_xmlNodePtr_ptr(n_lst, lst, 6); 14026 xmlResetLastError(); 14027 if (mem_base != xmlMemBlocks()) { 14028 printf("Leak of %d blocks found in xmlParseExternalEntity", 14029 xmlMemBlocks() - mem_base); 14030 test_ret++; 14031 printf(" %d", n_doc); 14032 printf(" %d", n_sax); 14033 printf(" %d", n_user_data); 14034 printf(" %d", n_depth); 14035 printf(" %d", n_URL); 14036 printf(" %d", n_ID); 14037 printf(" %d", n_lst); 14038 printf("\n"); 14039 } 14040 } 14041 } 14042 } 14043 } 14044 } 14045 } 14046 } 14047 function_tests++; 14048 #endif 14049 #endif 14050 14051 return(test_ret); 14052 } 14053 14054 14055 static int 14056 test_xmlParseFile(void) { 14057 int test_ret = 0; 14058 14059 #if defined(LIBXML_SAX1_ENABLED) 14060 #ifdef LIBXML_SAX1_ENABLED 14061 int mem_base; 14062 xmlDocPtr ret_val; 14063 const char * filename; /* the filename */ 14064 int n_filename; 14065 14066 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { 14067 mem_base = xmlMemBlocks(); 14068 filename = gen_filepath(n_filename, 0); 14069 14070 ret_val = xmlParseFile(filename); 14071 desret_xmlDocPtr(ret_val); 14072 call_tests++; 14073 des_filepath(n_filename, filename, 0); 14074 xmlResetLastError(); 14075 if (mem_base != xmlMemBlocks()) { 14076 printf("Leak of %d blocks found in xmlParseFile", 14077 xmlMemBlocks() - mem_base); 14078 test_ret++; 14079 printf(" %d", n_filename); 14080 printf("\n"); 14081 } 14082 } 14083 function_tests++; 14084 #endif 14085 #endif 14086 14087 return(test_ret); 14088 } 14089 14090 14091 static int 14092 test_xmlParseInNodeContext(void) { 14093 int test_ret = 0; 14094 14095 int mem_base; 14096 xmlParserErrors ret_val; 14097 xmlNodePtr node; /* the context node */ 14098 int n_node; 14099 char * data; /* the input string */ 14100 int n_data; 14101 int datalen; /* the input string length in bytes */ 14102 int n_datalen; 14103 int options; /* a combination of xmlParserOption */ 14104 int n_options; 14105 xmlNodePtr * lst; /* the return value for the set of parsed nodes */ 14106 int n_lst; 14107 14108 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { 14109 for (n_data = 0;n_data < gen_nb_const_char_ptr;n_data++) { 14110 for (n_datalen = 0;n_datalen < gen_nb_int;n_datalen++) { 14111 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) { 14112 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) { 14113 mem_base = xmlMemBlocks(); 14114 node = gen_xmlNodePtr(n_node, 0); 14115 data = gen_const_char_ptr(n_data, 1); 14116 datalen = gen_int(n_datalen, 2); 14117 options = gen_parseroptions(n_options, 3); 14118 lst = gen_xmlNodePtr_ptr(n_lst, 4); 14119 14120 ret_val = xmlParseInNodeContext(node, (const char *)data, datalen, options, lst); 14121 desret_xmlParserErrors(ret_val); 14122 call_tests++; 14123 des_xmlNodePtr(n_node, node, 0); 14124 des_const_char_ptr(n_data, (const char *)data, 1); 14125 des_int(n_datalen, datalen, 2); 14126 des_parseroptions(n_options, options, 3); 14127 des_xmlNodePtr_ptr(n_lst, lst, 4); 14128 xmlResetLastError(); 14129 if (mem_base != xmlMemBlocks()) { 14130 printf("Leak of %d blocks found in xmlParseInNodeContext", 14131 xmlMemBlocks() - mem_base); 14132 test_ret++; 14133 printf(" %d", n_node); 14134 printf(" %d", n_data); 14135 printf(" %d", n_datalen); 14136 printf(" %d", n_options); 14137 printf(" %d", n_lst); 14138 printf("\n"); 14139 } 14140 } 14141 } 14142 } 14143 } 14144 } 14145 function_tests++; 14146 14147 return(test_ret); 14148 } 14149 14150 14151 static int 14152 test_xmlParseMemory(void) { 14153 int test_ret = 0; 14154 14155 #if defined(LIBXML_SAX1_ENABLED) 14156 #ifdef LIBXML_SAX1_ENABLED 14157 int mem_base; 14158 xmlDocPtr ret_val; 14159 char * buffer; /* an pointer to a char array */ 14160 int n_buffer; 14161 int size; /* the size of the array */ 14162 int n_size; 14163 14164 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) { 14165 for (n_size = 0;n_size < gen_nb_int;n_size++) { 14166 mem_base = xmlMemBlocks(); 14167 buffer = gen_const_char_ptr(n_buffer, 0); 14168 size = gen_int(n_size, 1); 14169 14170 ret_val = xmlParseMemory((const char *)buffer, size); 14171 desret_xmlDocPtr(ret_val); 14172 call_tests++; 14173 des_const_char_ptr(n_buffer, (const char *)buffer, 0); 14174 des_int(n_size, size, 1); 14175 xmlResetLastError(); 14176 if (mem_base != xmlMemBlocks()) { 14177 printf("Leak of %d blocks found in xmlParseMemory", 14178 xmlMemBlocks() - mem_base); 14179 test_ret++; 14180 printf(" %d", n_buffer); 14181 printf(" %d", n_size); 14182 printf("\n"); 14183 } 14184 } 14185 } 14186 function_tests++; 14187 #endif 14188 #endif 14189 14190 return(test_ret); 14191 } 14192 14193 14194 #define gen_nb_const_xmlParserNodeInfoPtr 1 14195 static xmlParserNodeInfoPtr gen_const_xmlParserNodeInfoPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 14196 return(NULL); 14197 } 14198 static void des_const_xmlParserNodeInfoPtr(int no ATTRIBUTE_UNUSED, const xmlParserNodeInfoPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 14199 } 14200 14201 static int 14202 test_xmlParserAddNodeInfo(void) { 14203 int test_ret = 0; 14204 14205 int mem_base; 14206 xmlParserCtxtPtr ctxt; /* an XML parser context */ 14207 int n_ctxt; 14208 xmlParserNodeInfoPtr info; /* a node info sequence pointer */ 14209 int n_info; 14210 14211 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { 14212 for (n_info = 0;n_info < gen_nb_const_xmlParserNodeInfoPtr;n_info++) { 14213 mem_base = xmlMemBlocks(); 14214 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); 14215 info = gen_const_xmlParserNodeInfoPtr(n_info, 1); 14216 14217 xmlParserAddNodeInfo(ctxt, (const xmlParserNodeInfoPtr)info); 14218 call_tests++; 14219 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); 14220 des_const_xmlParserNodeInfoPtr(n_info, (const xmlParserNodeInfoPtr)info, 1); 14221 xmlResetLastError(); 14222 if (mem_base != xmlMemBlocks()) { 14223 printf("Leak of %d blocks found in xmlParserAddNodeInfo", 14224 xmlMemBlocks() - mem_base); 14225 test_ret++; 14226 printf(" %d", n_ctxt); 14227 printf(" %d", n_info); 14228 printf("\n"); 14229 } 14230 } 14231 } 14232 function_tests++; 14233 14234 return(test_ret); 14235 } 14236 14237 14238 #define gen_nb_const_xmlParserCtxtPtr 1 14239 static xmlParserCtxtPtr gen_const_xmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 14240 return(NULL); 14241 } 14242 static void des_const_xmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, const xmlParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 14243 } 14244 14245 #define gen_nb_const_xmlNodePtr 1 14246 static xmlNodePtr gen_const_xmlNodePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 14247 return(NULL); 14248 } 14249 static void des_const_xmlNodePtr(int no ATTRIBUTE_UNUSED, const xmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 14250 } 14251 14252 static int 14253 test_xmlParserFindNodeInfo(void) { 14254 int test_ret = 0; 14255 14256 int mem_base; 14257 const xmlParserNodeInfo * ret_val; 14258 xmlParserCtxtPtr ctx; /* an XML parser context */ 14259 int n_ctx; 14260 xmlNodePtr node; /* an XML node within the tree */ 14261 int n_node; 14262 14263 for (n_ctx = 0;n_ctx < gen_nb_const_xmlParserCtxtPtr;n_ctx++) { 14264 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) { 14265 mem_base = xmlMemBlocks(); 14266 ctx = gen_const_xmlParserCtxtPtr(n_ctx, 0); 14267 node = gen_const_xmlNodePtr(n_node, 1); 14268 14269 ret_val = xmlParserFindNodeInfo((const xmlParserCtxtPtr)ctx, (const xmlNodePtr)node); 14270 desret_const_xmlParserNodeInfo_ptr(ret_val); 14271 call_tests++; 14272 des_const_xmlParserCtxtPtr(n_ctx, (const xmlParserCtxtPtr)ctx, 0); 14273 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 1); 14274 xmlResetLastError(); 14275 if (mem_base != xmlMemBlocks()) { 14276 printf("Leak of %d blocks found in xmlParserFindNodeInfo", 14277 xmlMemBlocks() - mem_base); 14278 test_ret++; 14279 printf(" %d", n_ctx); 14280 printf(" %d", n_node); 14281 printf("\n"); 14282 } 14283 } 14284 } 14285 function_tests++; 14286 14287 return(test_ret); 14288 } 14289 14290 14291 #define gen_nb_const_xmlParserNodeInfoSeqPtr 1 14292 static xmlParserNodeInfoSeqPtr gen_const_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 14293 return(NULL); 14294 } 14295 static void des_const_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, const xmlParserNodeInfoSeqPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 14296 } 14297 14298 static int 14299 test_xmlParserFindNodeInfoIndex(void) { 14300 int test_ret = 0; 14301 14302 int mem_base; 14303 unsigned long ret_val; 14304 xmlParserNodeInfoSeqPtr seq; /* a node info sequence pointer */ 14305 int n_seq; 14306 xmlNodePtr node; /* an XML node pointer */ 14307 int n_node; 14308 14309 for (n_seq = 0;n_seq < gen_nb_const_xmlParserNodeInfoSeqPtr;n_seq++) { 14310 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) { 14311 mem_base = xmlMemBlocks(); 14312 seq = gen_const_xmlParserNodeInfoSeqPtr(n_seq, 0); 14313 node = gen_const_xmlNodePtr(n_node, 1); 14314 14315 ret_val = xmlParserFindNodeInfoIndex((const xmlParserNodeInfoSeqPtr)seq, (const xmlNodePtr)node); 14316 desret_unsigned_long(ret_val); 14317 call_tests++; 14318 des_const_xmlParserNodeInfoSeqPtr(n_seq, (const xmlParserNodeInfoSeqPtr)seq, 0); 14319 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 1); 14320 xmlResetLastError(); 14321 if (mem_base != xmlMemBlocks()) { 14322 printf("Leak of %d blocks found in xmlParserFindNodeInfoIndex", 14323 xmlMemBlocks() - mem_base); 14324 test_ret++; 14325 printf(" %d", n_seq); 14326 printf(" %d", n_node); 14327 printf("\n"); 14328 } 14329 } 14330 } 14331 function_tests++; 14332 14333 return(test_ret); 14334 } 14335 14336 14337 #define gen_nb_xmlParserInputPtr 1 14338 static xmlParserInputPtr gen_xmlParserInputPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 14339 return(NULL); 14340 } 14341 static void des_xmlParserInputPtr(int no ATTRIBUTE_UNUSED, xmlParserInputPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { 14342 } 14343 14344 static int 14345 test_xmlParserInputGrow(void) { 14346 int test_ret = 0; 14347 14348 int mem_base; 14349 int ret_val; 14350 xmlParserInputPtr in; /* an XML parser input */ 14351 int n_in; 14352 int len; /* an indicative size for the lookahead */ 14353 int n_len; 14354 14355 for (n_in = 0;n_in < gen_nb_xmlParserInputPtr;n_in++) { 14356 for (n_len = 0;n_len < gen_nb_int;n_len++) { 14357 mem_base = xmlMemBlocks(); 14358 in = gen_xmlParserInputPtr(n_in, 0); 14359 len = gen_int(n_len, 1); 14360 14361 ret_val = xmlParserInputGrow(in, len); 14362 desret_int(ret_val); 14363 call_tests++; 14364 des_xmlParserInputPtr(n_in, in, 0); 14365 des_int(n_len, len, 1); 14366 xmlResetLastError(); 14367 if (mem_base != xmlMemBlocks()) { 14368 printf("Leak of %d blocks found in xmlParserInputGrow", 14369 xmlMemBlocks() - mem_base); 14370 test_ret++; 14371 printf(" %d", n_in); 14372 printf(" %d", n_len); 14373 printf("\n"); 14374 } 14375 } 14376 } 14377 function_tests++; 14378 14379 return(test_ret); 14380 } 14381 14382 14383 static int 14384 test_xmlParserInputRead(void) { 14385 int test_ret = 0; 14386 14387 int mem_base; 14388 int ret_val; 14389 xmlParserInputPtr in; /* an XML parser input */ 14390 int n_in; 14391 int len; /* an indicative size for the lookahead */ 14392 int n_len; 14393 14394 for (n_in = 0;n_in < gen_nb_xmlParserInputPtr;n_in++) { 14395 for (n_len = 0;n_len < gen_nb_int;n_len++) { 14396 mem_base = xmlMemBlocks(); 14397 in = gen_xmlParserInputPtr(n_in, 0); 14398 len = gen_int(n_len, 1); 14399 14400 ret_val = xmlParserInputRead(in, len); 14401 desret_int(ret_val); 14402 call_tests++; 14403 des_xmlParserInputPtr(n_in, in, 0); 14404 des_int(n_len, len, 1); 14405 xmlResetLastError(); 14406 if (mem_base != xmlMemBlocks()) { 14407 printf("Leak of %d blocks found in xmlParserInputRead", 14408 xmlMemBlocks() - mem_base); 14409 test_ret++; 14410 printf(" %d", n_in); 14411 printf(" %d", n_len); 14412 printf("\n"); 14413 } 14414 } 14415 } 14416 function_tests++; 14417 14418 return(test_ret); 14419 } 14420 14421 14422 static int 14423 test_xmlPedanticParserDefault(void) { 14424 int test_ret = 0; 14425 14426 int mem_base; 14427 int ret_val; 14428 int val; /* int 0 or 1 */ 14429 int n_val; 14430 14431 for (n_val = 0;n_val < gen_nb_int;n_val++) { 14432 mem_base = xmlMemBlocks(); 14433 val = gen_int(n_val, 0); 14434 14435 ret_val = xmlPedanticParserDefault(val); 14436 desret_int(ret_val); 14437 call_tests++; 14438 des_int(n_val, val, 0); 14439 xmlResetLastError(); 14440 if (mem_base != xmlMemBlocks()) { 14441 printf("Leak of %d blocks found in xmlPedanticParserDefault", 14442 xmlMemBlocks() - mem_base); 14443 test_ret++; 14444 printf(" %d", n_val); 14445 printf("\n"); 14446 } 14447 } 14448 function_tests++; 14449 14450 return(test_ret); 14451 } 14452 14453 14454 static int 14455 test_xmlReadDoc(void) { 14456 int test_ret = 0; 14457 14458 int mem_base; 14459 xmlDocPtr ret_val; 14460 xmlChar * cur; /* a pointer to a zero terminated string */ 14461 int n_cur; 14462 const char * URL; /* the base URL to use for the document */ 14463 int n_URL; 14464 char * encoding; /* the document encoding, or NULL */ 14465 int n_encoding; 14466 int options; /* a combination of xmlParserOption */ 14467 int n_options; 14468 14469 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) { 14470 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) { 14471 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { 14472 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) { 14473 mem_base = xmlMemBlocks(); 14474 cur = gen_const_xmlChar_ptr(n_cur, 0); 14475 URL = gen_filepath(n_URL, 1); 14476 encoding = gen_const_char_ptr(n_encoding, 2); 14477 options = gen_parseroptions(n_options, 3); 14478 14479 ret_val = xmlReadDoc((const xmlChar *)cur, URL, (const char *)encoding, options); 14480 desret_xmlDocPtr(ret_val); 14481 call_tests++; 14482 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0); 14483 des_filepath(n_URL, URL, 1); 14484 des_const_char_ptr(n_encoding, (const char *)encoding, 2); 14485 des_parseroptions(n_options, options, 3); 14486 xmlResetLastError(); 14487 if (mem_base != xmlMemBlocks()) { 14488 printf("Leak of %d blocks found in xmlReadDoc", 14489 xmlMemBlocks() - mem_base); 14490 test_ret++; 14491 printf(" %d", n_cur); 14492 printf(" %d", n_URL); 14493 printf(" %d", n_encoding); 14494 printf(" %d", n_options); 14495 printf("\n"); 14496 } 14497 } 14498 } 14499 } 14500 } 14501 function_tests++; 14502 14503 return(test_ret); 14504 } 14505 14506 14507 static int 14508 test_xmlReadFile(void) { 14509 int test_ret = 0; 14510 14511 int mem_base; 14512 xmlDocPtr ret_val; 14513 const char * filename; /* a file or URL */ 14514 int n_filename; 14515 char * encoding; /* the document encoding, or NULL */ 14516 int n_encoding; 14517 int options; /* a combination of xmlParserOption */ 14518 int n_options; 14519 14520 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { 14521 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { 14522 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) { 14523 mem_base = xmlMemBlocks(); 14524 filename = gen_filepath(n_filename, 0); 14525 encoding = gen_const_char_ptr(n_encoding, 1); 14526 options = gen_parseroptions(n_options, 2); 14527 14528 ret_val = xmlReadFile(filename, (const char *)encoding, options); 14529 desret_xmlDocPtr(ret_val); 14530 call_tests++; 14531 des_filepath(n_filename, filename, 0); 14532 des_const_char_ptr(n_encoding, (const char *)encoding, 1); 14533 des_parseroptions(n_options, options, 2); 14534 xmlResetLastError(); 14535 if (mem_base != xmlMemBlocks()) { 14536 printf("Leak of %d blocks found in xmlReadFile", 14537 xmlMemBlocks() - mem_base); 14538 test_ret++; 14539 printf(" %d", n_filename); 14540 printf(" %d", n_encoding); 14541 printf(" %d", n_options); 14542 printf("\n"); 14543 } 14544 } 14545 } 14546 } 14547 function_tests++; 14548 14549 return(test_ret); 14550 } 14551 14552 14553 static int 14554 test_xmlReadMemory(void) { 14555 int test_ret = 0; 14556 14557 int mem_base; 14558 xmlDocPtr ret_val; 14559 char * buffer; /* a pointer to a char array */ 14560 int n_buffer; 14561 int size; /* the size of the array */ 14562 int n_size; 14563 const char * URL; /* the base URL to use for the document */ 14564 int n_URL; 14565 char * encoding; /* the document encoding, or NULL */ 14566 int n_encoding; 14567 int options; /* a combination of xmlParserOption */ 14568 int n_options; 14569 14570 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) { 14571 for (n_size = 0;n_size < gen_nb_int;n_size++) { 14572 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) { 14573 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { 14574 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) { 14575 mem_base = xmlMemBlocks(); 14576 buffer = gen_const_char_ptr(n_buffer, 0); 14577 size = gen_int(n_size, 1); 14578 URL = gen_filepath(n_URL, 2); 14579 encoding = gen_const_char_ptr(n_encoding, 3); 14580 options = gen_parseroptions(n_options, 4); 14581 14582 ret_val = xmlReadMemory((const char *)buffer, size, URL, (const char *)encoding, options); 14583 desret_xmlDocPtr(ret_val); 14584 call_tests++; 14585 des_const_char_ptr(n_buffer, (const char *)buffer, 0); 14586 des_int(n_size, size, 1); 14587 des_filepath(n_URL, URL, 2); 14588 des_const_char_ptr(n_encoding, (const char *)encoding, 3); 14589 des_parseroptions(n_options, options, 4); 14590 xmlResetLastError(); 14591 if (mem_base != xmlMemBlocks()) { 14592 printf("Leak of %d blocks found in xmlReadMemory", 14593 xmlMemBlocks() - mem_base); 14594 test_ret++; 14595 printf(" %d", n_buffer); 14596 printf(" %d", n_size); 14597 printf(" %d", n_URL); 14598 printf(" %d", n_encoding); 14599 printf(" %d", n_options); 14600 printf("\n"); 14601 } 14602 } 14603 } 14604 } 14605 } 14606 } 14607 function_tests++; 14608 14609 return(test_ret); 14610 } 14611 14612 14613 static int 14614 test_xmlRecoverDoc(void) { 14615 int test_ret = 0; 14616 14617 #if defined(LIBXML_SAX1_ENABLED) 14618 #ifdef LIBXML_SAX1_ENABLED 14619 int mem_base; 14620 xmlDocPtr ret_val; 14621 xmlChar * cur; /* a pointer to an array of xmlChar */ 14622 int n_cur; 14623 14624 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) { 14625 mem_base = xmlMemBlocks(); 14626 cur = gen_const_xmlChar_ptr(n_cur, 0); 14627 14628 ret_val = xmlRecoverDoc((const xmlChar *)cur); 14629 desret_xmlDocPtr(ret_val); 14630 call_tests++; 14631 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0); 14632 xmlResetLastError(); 14633 if (mem_base != xmlMemBlocks()) { 14634 printf("Leak of %d blocks found in xmlRecoverDoc", 14635 xmlMemBlocks() - mem_base); 14636 test_ret++; 14637 printf(" %d", n_cur); 14638 printf("\n"); 14639 } 14640 } 14641 function_tests++; 14642 #endif 14643 #endif 14644 14645 return(test_ret); 14646 } 14647 14648 14649 static int 14650 test_xmlRecoverFile(void) { 14651 int test_ret = 0; 14652 14653 #if defined(LIBXML_SAX1_ENABLED) 14654 #ifdef LIBXML_SAX1_ENABLED 14655 int mem_base; 14656 xmlDocPtr ret_val; 14657 const char * filename; /* the filename */ 14658 int n_filename; 14659 14660 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { 14661 mem_base = xmlMemBlocks(); 14662 filename = gen_filepath(n_filename, 0); 14663 14664 ret_val = xmlRecoverFile(filename); 14665 desret_xmlDocPtr(ret_val); 14666 call_tests++; 14667 des_filepath(n_filename, filename, 0); 14668 xmlResetLastError(); 14669 if (mem_base != xmlMemBlocks()) { 14670 printf("Leak of %d blocks found in xmlRecoverFile", 14671 xmlMemBlocks() - mem_base); 14672 test_ret++; 14673 printf(" %d", n_filename); 14674 printf("\n"); 14675 } 14676 } 14677 function_tests++; 14678 #endif 14679 #endif 14680 14681 return(test_ret); 14682 } 14683 14684 14685 static int 14686 test_xmlRecoverMemory(void) { 14687 int test_ret = 0; 14688 14689 #if defined(LIBXML_SAX1_ENABLED) 14690 #ifdef LIBXML_SAX1_ENABLED 14691 int mem_base; 14692 xmlDocPtr ret_val; 14693 char * buffer; /* an pointer to a char array */ 14694 int n_buffer; 14695 int size; /* the size of the array */ 14696 int n_size; 14697 14698 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) { 14699 for (n_size = 0;n_size < gen_nb_int;n_size++) { 14700 mem_base = xmlMemBlocks(); 14701 buffer = gen_const_char_ptr(n_buffer, 0); 14702 size = gen_int(n_size, 1); 14703 14704 ret_val = xmlRecoverMemory((const char *)buffer, size); 14705 desret_xmlDocPtr(ret_val); 14706 call_tests++; 14707 des_const_char_ptr(n_buffer, (const char *)buffer, 0); 14708 des_int(n_size, size, 1); 14709 xmlResetLastError(); 14710 if (mem_base != xmlMemBlocks()) { 14711 printf("Leak of %d blocks found in xmlRecoverMemory", 14712 xmlMemBlocks() - mem_base); 14713 test_ret++; 14714 printf(" %d", n_buffer); 14715 printf(" %d", n_size); 14716 printf("\n"); 14717 } 14718 } 14719 } 14720 function_tests++; 14721 #endif 14722 #endif 14723 14724 return(test_ret); 14725 } 14726 14727 14728 static int 14729 test_xmlSAXParseDTD(void) { 14730 int test_ret = 0; 14731 14732 #if defined(LIBXML_VALID_ENABLED) 14733 #ifdef LIBXML_SAX1_ENABLED 14734 int mem_base; 14735 xmlDtdPtr ret_val; 14736 xmlSAXHandlerPtr sax; /* the SAX handler block */ 14737 int n_sax; 14738 xmlChar * ExternalID; /* a NAME* containing the External ID of the DTD */ 14739 int n_ExternalID; 14740 xmlChar * SystemID; /* a NAME* containing the URL to the DTD */ 14741 int n_SystemID; 14742 14743 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) { 14744 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) { 14745 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) { 14746 mem_base = xmlMemBlocks(); 14747 sax = gen_xmlSAXHandlerPtr(n_sax, 0); 14748 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 1); 14749 SystemID = gen_const_xmlChar_ptr(n_SystemID, 2); 14750 14751 ret_val = xmlSAXParseDTD(sax, (const xmlChar *)ExternalID, (const xmlChar *)SystemID); 14752 desret_xmlDtdPtr(ret_val); 14753 call_tests++; 14754 des_xmlSAXHandlerPtr(n_sax, sax, 0); 14755 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 1); 14756 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 2); 14757 xmlResetLastError(); 14758 if (mem_base != xmlMemBlocks()) { 14759 printf("Leak of %d blocks found in xmlSAXParseDTD", 14760 xmlMemBlocks() - mem_base); 14761 test_ret++; 14762 printf(" %d", n_sax); 14763 printf(" %d", n_ExternalID); 14764 printf(" %d", n_SystemID); 14765 printf("\n"); 14766 } 14767 } 14768 } 14769 } 14770 function_tests++; 14771 #endif 14772 #endif 14773 14774 return(test_ret); 14775 } 14776 14777 14778 static int 14779 test_xmlSAXParseDoc(void) { 14780 int test_ret = 0; 14781 14782 #if defined(LIBXML_SAX1_ENABLED) 14783 #ifdef LIBXML_SAX1_ENABLED 14784 int mem_base; 14785 xmlDocPtr ret_val; 14786 xmlSAXHandlerPtr sax; /* the SAX handler block */ 14787 int n_sax; 14788 xmlChar * cur; /* a pointer to an array of xmlChar */ 14789 int n_cur; 14790 int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */ 14791 int n_recovery; 14792 14793 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) { 14794 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) { 14795 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) { 14796 mem_base = xmlMemBlocks(); 14797 sax = gen_xmlSAXHandlerPtr(n_sax, 0); 14798 cur = gen_const_xmlChar_ptr(n_cur, 1); 14799 recovery = gen_int(n_recovery, 2); 14800 14801 ret_val = xmlSAXParseDoc(sax, (const xmlChar *)cur, recovery); 14802 desret_xmlDocPtr(ret_val); 14803 call_tests++; 14804 des_xmlSAXHandlerPtr(n_sax, sax, 0); 14805 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 1); 14806 des_int(n_recovery, recovery, 2); 14807 xmlResetLastError(); 14808 if (mem_base != xmlMemBlocks()) { 14809 printf("Leak of %d blocks found in xmlSAXParseDoc", 14810 xmlMemBlocks() - mem_base); 14811 test_ret++; 14812 printf(" %d", n_sax); 14813 printf(" %d", n_cur); 14814 printf(" %d", n_recovery); 14815 printf("\n"); 14816 } 14817 } 14818 } 14819 } 14820 function_tests++; 14821 #endif 14822 #endif 14823 14824 return(test_ret); 14825 } 14826 14827 14828 static int 14829 test_xmlSAXParseEntity(void) { 14830 int test_ret = 0; 14831 14832 #if defined(LIBXML_SAX1_ENABLED) 14833 #ifdef LIBXML_SAX1_ENABLED 14834 int mem_base; 14835 xmlDocPtr ret_val; 14836 xmlSAXHandlerPtr sax; /* the SAX handler block */ 14837 int n_sax; 14838 const char * filename; /* the filename */ 14839 int n_filename; 14840 14841 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) { 14842 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { 14843 mem_base = xmlMemBlocks(); 14844 sax = gen_xmlSAXHandlerPtr(n_sax, 0); 14845 filename = gen_filepath(n_filename, 1); 14846 14847 ret_val = xmlSAXParseEntity(sax, filename); 14848 desret_xmlDocPtr(ret_val); 14849 call_tests++; 14850 des_xmlSAXHandlerPtr(n_sax, sax, 0); 14851 des_filepath(n_filename, filename, 1); 14852 xmlResetLastError(); 14853 if (mem_base != xmlMemBlocks()) { 14854 printf("Leak of %d blocks found in xmlSAXParseEntity", 14855 xmlMemBlocks() - mem_base); 14856 test_ret++; 14857 printf(" %d", n_sax); 14858 printf(" %d", n_filename); 14859 printf("\n"); 14860 } 14861 } 14862 } 14863 function_tests++; 14864 #endif 14865 #endif 14866 14867 return(test_ret); 14868 } 14869 14870 14871 static int 14872 test_xmlSAXParseFile(void) { 14873 int test_ret = 0; 14874 14875 #if defined(LIBXML_SAX1_ENABLED) 14876 #ifdef LIBXML_SAX1_ENABLED 14877 int mem_base; 14878 xmlDocPtr ret_val; 14879 xmlSAXHandlerPtr sax; /* the SAX handler block */ 14880 int n_sax; 14881 const char * filename; /* the filename */ 14882 int n_filename; 14883 int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */ 14884 int n_recovery; 14885 14886 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) { 14887 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { 14888 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) { 14889 mem_base = xmlMemBlocks(); 14890 sax = gen_xmlSAXHandlerPtr(n_sax, 0); 14891 filename = gen_filepath(n_filename, 1); 14892 recovery = gen_int(n_recovery, 2); 14893 14894 ret_val = xmlSAXParseFile(sax, filename, recovery); 14895 desret_xmlDocPtr(ret_val); 14896 call_tests++; 14897 des_xmlSAXHandlerPtr(n_sax, sax, 0); 14898 des_filepath(n_filename, filename, 1); 14899 des_int(n_recovery, recovery, 2); 14900 xmlResetLastError(); 14901 if (mem_base != xmlMemBlocks()) { 14902 printf("Leak of %d blocks found in xmlSAXParseFile", 14903 xmlMemBlocks() - mem_base); 14904 test_ret++; 14905 printf(" %d", n_sax); 14906 printf(" %d", n_filename); 14907 printf(" %d", n_recovery); 14908 printf("\n"); 14909 } 14910 } 14911 } 14912 } 14913 function_tests++; 14914 #endif 14915 #endif 14916 14917 return(test_ret); 14918 } 14919 14920 14921 static int 14922 test_xmlSAXParseFileWithData(void) { 14923 int test_ret = 0; 14924 14925 #if defined(LIBXML_SAX1_ENABLED) 14926 #ifdef LIBXML_SAX1_ENABLED 14927 int mem_base; 14928 xmlDocPtr ret_val; 14929 xmlSAXHandlerPtr sax; /* the SAX handler block */ 14930 int n_sax; 14931 const char * filename; /* the filename */ 14932 int n_filename; 14933 int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */ 14934 int n_recovery; 14935 void * data; /* the userdata */ 14936 int n_data; 14937 14938 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) { 14939 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { 14940 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) { 14941 for (n_data = 0;n_data < gen_nb_userdata;n_data++) { 14942 mem_base = xmlMemBlocks(); 14943 sax = gen_xmlSAXHandlerPtr(n_sax, 0); 14944 filename = gen_filepath(n_filename, 1); 14945 recovery = gen_int(n_recovery, 2); 14946 data = gen_userdata(n_data, 3); 14947 14948 ret_val = xmlSAXParseFileWithData(sax, filename, recovery, data); 14949 desret_xmlDocPtr(ret_val); 14950 call_tests++; 14951 des_xmlSAXHandlerPtr(n_sax, sax, 0); 14952 des_filepath(n_filename, filename, 1); 14953 des_int(n_recovery, recovery, 2); 14954 des_userdata(n_data, data, 3); 14955 xmlResetLastError(); 14956 if (mem_base != xmlMemBlocks()) { 14957 printf("Leak of %d blocks found in xmlSAXParseFileWithData", 14958 xmlMemBlocks() - mem_base); 14959 test_ret++; 14960 printf(" %d", n_sax); 14961 printf(" %d", n_filename); 14962 printf(" %d", n_recovery); 14963 printf(" %d", n_data); 14964 printf("\n"); 14965 } 14966 } 14967 } 14968 } 14969 } 14970 function_tests++; 14971 #endif 14972 #endif 14973 14974 return(test_ret); 14975 } 14976 14977 14978 static int 14979 test_xmlSAXParseMemory(void) { 14980 int test_ret = 0; 14981 14982 #if defined(LIBXML_SAX1_ENABLED) 14983 #ifdef LIBXML_SAX1_ENABLED 14984 int mem_base; 14985 xmlDocPtr ret_val; 14986 xmlSAXHandlerPtr sax; /* the SAX handler block */ 14987 int n_sax; 14988 char * buffer; /* an pointer to a char array */ 14989 int n_buffer; 14990 int size; /* the size of the array */ 14991 int n_size; 14992 int recovery; /* work in recovery mode, i.e. tries to read not Well Formed documents */ 14993 int n_recovery; 14994 14995 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) { 14996 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) { 14997 for (n_size = 0;n_size < gen_nb_int;n_size++) { 14998 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) { 14999 mem_base = xmlMemBlocks(); 15000 sax = gen_xmlSAXHandlerPtr(n_sax, 0); 15001 buffer = gen_const_char_ptr(n_buffer, 1); 15002 size = gen_int(n_size, 2); 15003 recovery = gen_int(n_recovery, 3); 15004 15005 ret_val = xmlSAXParseMemory(sax, (const char *)buffer, size, recovery); 15006 desret_xmlDocPtr(ret_val); 15007 call_tests++; 15008 des_xmlSAXHandlerPtr(n_sax, sax, 0); 15009 des_const_char_ptr(n_buffer, (const char *)buffer, 1); 15010 des_int(n_size, size, 2); 15011 des_int(n_recovery, recovery, 3); 15012 xmlResetLastError(); 15013 if (mem_base != xmlMemBlocks()) { 15014 printf("Leak of %d blocks found in xmlSAXParseMemory", 15015 xmlMemBlocks() - mem_base); 15016 test_ret++; 15017 printf(" %d", n_sax); 15018 printf(" %d", n_buffer); 15019 printf(" %d", n_size); 15020 printf(" %d", n_recovery); 15021 printf("\n"); 15022 } 15023 } 15024 } 15025 } 15026 } 15027 function_tests++; 15028 #endif 15029 #endif 15030 15031 return(test_ret); 15032 } 15033 15034 15035 static int 15036 test_xmlSAXParseMemoryWithData(void) { 15037 int test_ret = 0; 15038 15039 #if defined(LIBXML_SAX1_ENABLED) 15040 #ifdef LIBXML_SAX1_ENABLED 15041 int mem_base; 15042 xmlDocPtr ret_val; 15043 xmlSAXHandlerPtr sax; /* the SAX handler block */ 15044 int n_sax; 15045 char * buffer; /* an pointer to a char array */ 15046 int n_buffer; 15047 int size; /* the size of the array */ 15048 int n_size; 15049 int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */ 15050 int n_recovery; 15051 void * data; /* the userdata */ 15052 int n_data; 15053 15054 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) { 15055 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) { 15056 for (n_size = 0;n_size < gen_nb_int;n_size++) { 15057 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) { 15058 for (n_data = 0;n_data < gen_nb_userdata;n_data++) { 15059 mem_base = xmlMemBlocks(); 15060 sax = gen_xmlSAXHandlerPtr(n_sax, 0); 15061 buffer = gen_const_char_ptr(n_buffer, 1); 15062 size = gen_int(n_size, 2); 15063 recovery = gen_int(n_recovery, 3); 15064 data = gen_userdata(n_data, 4); 15065 15066 ret_val = xmlSAXParseMemoryWithData(sax, (const char *)buffer, size, recovery, data); 15067 desret_xmlDocPtr(ret_val); 15068 call_tests++; 15069 des_xmlSAXHandlerPtr(n_sax, sax, 0); 15070 des_const_char_ptr(n_buffer, (const char *)buffer, 1); 15071 des_int(n_size, size, 2); 15072 des_int(n_recovery, recovery, 3); 15073 des_userdata(n_data, data, 4); 15074 xmlResetLastError(); 15075 if (mem_base != xmlMemBlocks()) { 15076 printf("Leak of %d blocks found in xmlSAXParseMemoryWithData", 15077 xmlMemBlocks() - mem_base); 15078 test_ret++; 15079 printf(" %d", n_sax); 15080 printf(" %d", n_buffer); 15081 printf(" %d", n_size); 15082 printf(" %d", n_recovery); 15083 printf(" %d", n_data); 15084 printf("\n"); 15085 } 15086 } 15087 } 15088 } 15089 } 15090 } 15091 function_tests++; 15092 #endif 15093 #endif 15094 15095 return(test_ret); 15096 } 15097 15098 15099 static int 15100 test_xmlSAXUserParseFile(void) { 15101 int test_ret = 0; 15102 15103 #if defined(LIBXML_SAX1_ENABLED) 15104 #ifdef LIBXML_SAX1_ENABLED 15105 int mem_base; 15106 int ret_val; 15107 xmlSAXHandlerPtr sax; /* a SAX handler */ 15108 int n_sax; 15109 void * user_data; /* The user data returned on SAX callbacks */ 15110 int n_user_data; 15111 const char * filename; /* a file name */ 15112 int n_filename; 15113 15114 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) { 15115 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) { 15116 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { 15117 mem_base = xmlMemBlocks(); 15118 sax = gen_xmlSAXHandlerPtr(n_sax, 0); 15119 user_data = gen_userdata(n_user_data, 1); 15120 filename = gen_filepath(n_filename, 2); 15121 15122 #ifdef LIBXML_SAX1_ENABLED 15123 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL; 15124 #endif 15125 15126 15127 ret_val = xmlSAXUserParseFile(sax, user_data, filename); 15128 desret_int(ret_val); 15129 call_tests++; 15130 des_xmlSAXHandlerPtr(n_sax, sax, 0); 15131 des_userdata(n_user_data, user_data, 1); 15132 des_filepath(n_filename, filename, 2); 15133 xmlResetLastError(); 15134 if (mem_base != xmlMemBlocks()) { 15135 printf("Leak of %d blocks found in xmlSAXUserParseFile", 15136 xmlMemBlocks() - mem_base); 15137 test_ret++; 15138 printf(" %d", n_sax); 15139 printf(" %d", n_user_data); 15140 printf(" %d", n_filename); 15141 printf("\n"); 15142 } 15143 } 15144 } 15145 } 15146 function_tests++; 15147 #endif 15148 #endif 15149 15150 return(test_ret); 15151 } 15152 15153 15154 static int 15155 test_xmlSAXUserParseMemory(void) { 15156 int test_ret = 0; 15157 15158 #if defined(LIBXML_SAX1_ENABLED) 15159 #ifdef LIBXML_SAX1_ENABLED 15160 int mem_base; 15161 int ret_val; 15162 xmlSAXHandlerPtr sax; /* a SAX handler */ 15163 int n_sax; 15164 void * user_data; /* The user data returned on SAX callbacks */ 15165 int n_user_data; 15166 char * buffer; /* an in-memory XML document input */ 15167 int n_buffer; 15168 int size; /* the length of the XML document in bytes */ 15169 int n_size; 15170 15171 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) { 15172 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) { 15173 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) { 15174 for (n_size = 0;n_size < gen_nb_int;n_size++) { 15175 mem_base = xmlMemBlocks(); 15176 sax = gen_xmlSAXHandlerPtr(n_sax, 0); 15177 user_data = gen_userdata(n_user_data, 1); 15178 buffer = gen_const_char_ptr(n_buffer, 2); 15179 size = gen_int(n_size, 3); 15180 15181 #ifdef LIBXML_SAX1_ENABLED 15182 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL; 15183 #endif 15184 15185 15186 ret_val = xmlSAXUserParseMemory(sax, user_data, (const char *)buffer, size); 15187 desret_int(ret_val); 15188 call_tests++; 15189 des_xmlSAXHandlerPtr(n_sax, sax, 0); 15190 des_userdata(n_user_data, user_data, 1); 15191 des_const_char_ptr(n_buffer, (const char *)buffer, 2); 15192 des_int(n_size, size, 3); 15193 xmlResetLastError(); 15194 if (mem_base != xmlMemBlocks()) { 15195 printf("Leak of %d blocks found in xmlSAXUserParseMemory", 15196 xmlMemBlocks() - mem_base); 15197 test_ret++; 15198 printf(" %d", n_sax); 15199 printf(" %d", n_user_data); 15200 printf(" %d", n_buffer); 15201 printf(" %d", n_size); 15202 printf("\n"); 15203 } 15204 } 15205 } 15206 } 15207 } 15208 function_tests++; 15209 #endif 15210 #endif 15211 15212 return(test_ret); 15213 } 15214 15215 15216 static int 15217 test_xmlSetExternalEntityLoader(void) { 15218 int test_ret = 0; 15219 15220 15221 /* missing type support */ 15222 return(test_ret); 15223 } 15224 15225 15226 static int 15227 test_xmlSetFeature(void) { 15228 int test_ret = 0; 15229 15230 #if defined(LIBXML_LEGACY_ENABLED) 15231 #ifdef LIBXML_LEGACY_ENABLED 15232 int mem_base; 15233 int ret_val; 15234 xmlParserCtxtPtr ctxt; /* an XML/HTML parser context */ 15235 int n_ctxt; 15236 char * name; /* the feature name */ 15237 int n_name; 15238 void * value; /* pointer to the location of the new value */ 15239 int n_value; 15240 15241 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { 15242 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) { 15243 for (n_value = 0;n_value < gen_nb_void_ptr;n_value++) { 15244 mem_base = xmlMemBlocks(); 15245 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); 15246 name = gen_const_char_ptr(n_name, 1); 15247 value = gen_void_ptr(n_value, 2); 15248 15249 ret_val = xmlSetFeature(ctxt, (const char *)name, value); 15250 desret_int(ret_val); 15251 call_tests++; 15252 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); 15253 des_const_char_ptr(n_name, (const char *)name, 1); 15254 des_void_ptr(n_value, value, 2); 15255 xmlResetLastError(); 15256 if (mem_base != xmlMemBlocks()) { 15257 printf("Leak of %d blocks found in xmlSetFeature", 15258 xmlMemBlocks() - mem_base); 15259 test_ret++; 15260 printf(" %d", n_ctxt); 15261 printf(" %d", n_name); 15262 printf(" %d", n_value); 15263 printf("\n"); 15264 } 15265 } 15266 } 15267 } 15268 function_tests++; 15269 #endif 15270 #endif 15271 15272 return(test_ret); 15273 } 15274 15275 15276 static int 15277 test_xmlSetupParserForBuffer(void) { 15278 int test_ret = 0; 15279 15280 #if defined(LIBXML_SAX1_ENABLED) 15281 #ifdef LIBXML_SAX1_ENABLED 15282 int mem_base; 15283 xmlParserCtxtPtr ctxt; /* an XML parser context */ 15284 int n_ctxt; 15285 xmlChar * buffer; /* a xmlChar * buffer */ 15286 int n_buffer; 15287 const char * filename; /* a file name */ 15288 int n_filename; 15289 15290 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { 15291 for (n_buffer = 0;n_buffer < gen_nb_const_xmlChar_ptr;n_buffer++) { 15292 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { 15293 mem_base = xmlMemBlocks(); 15294 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); 15295 buffer = gen_const_xmlChar_ptr(n_buffer, 1); 15296 filename = gen_filepath(n_filename, 2); 15297 15298 xmlSetupParserForBuffer(ctxt, (const xmlChar *)buffer, filename); 15299 call_tests++; 15300 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); 15301 des_const_xmlChar_ptr(n_buffer, (const xmlChar *)buffer, 1); 15302 des_filepath(n_filename, filename, 2); 15303 xmlResetLastError(); 15304 if (mem_base != xmlMemBlocks()) { 15305 printf("Leak of %d blocks found in xmlSetupParserForBuffer", 15306 xmlMemBlocks() - mem_base); 15307 test_ret++; 15308 printf(" %d", n_ctxt); 15309 printf(" %d", n_buffer); 15310 printf(" %d", n_filename); 15311 printf("\n"); 15312 } 15313 } 15314 } 15315 } 15316 function_tests++; 15317 #endif 15318 #endif 15319 15320 return(test_ret); 15321 } 15322 15323 15324 static int 15325 test_xmlStopParser(void) { 15326 int test_ret = 0; 15327 15328 #ifdef LIBXML_PUSH_ENABLED 15329 int mem_base; 15330 xmlParserCtxtPtr ctxt; /* an XML parser context */ 15331 int n_ctxt; 15332 15333 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { 15334 mem_base = xmlMemBlocks(); 15335 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); 15336 15337 xmlStopParser(ctxt); 15338 call_tests++; 15339 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); 15340 xmlResetLastError(); 15341 if (mem_base != xmlMemBlocks()) { 15342 printf("Leak of %d blocks found in xmlStopParser", 15343 xmlMemBlocks() - mem_base); 15344 test_ret++; 15345 printf(" %d", n_ctxt); 15346 printf("\n"); 15347 } 15348 } 15349 function_tests++; 15350 #endif 15351 15352 return(test_ret); 15353 } 15354 15355 15356 static int 15357 test_xmlSubstituteEntitiesDefault(void) { 15358 int test_ret = 0; 15359 15360 int mem_base; 15361 int ret_val; 15362 int val; /* int 0 or 1 */ 15363 int n_val; 15364 15365 for (n_val = 0;n_val < gen_nb_int;n_val++) { 15366 mem_base = xmlMemBlocks(); 15367 val = gen_int(n_val, 0); 15368 15369 ret_val = xmlSubstituteEntitiesDefault(val); 15370 desret_int(ret_val); 15371 call_tests++; 15372 des_int(n_val, val, 0); 15373 xmlResetLastError(); 15374 if (mem_base != xmlMemBlocks()) { 15375 printf("Leak of %d blocks found in xmlSubstituteEntitiesDefault", 15376 xmlMemBlocks() - mem_base); 15377 test_ret++; 15378 printf(" %d", n_val); 15379 printf("\n"); 15380 } 15381 } 15382 function_tests++; 15383 15384 return(test_ret); 15385 } 15386 15387 static int 15388 test_parser(void) { 15389 int test_ret = 0; 15390 15391 if (quiet == 0) printf("Testing parser : 61 of 70 functions ...\n"); 15392 test_ret += test_xmlByteConsumed(); 15393 test_ret += test_xmlClearNodeInfoSeq(); 15394 test_ret += test_xmlClearParserCtxt(); 15395 test_ret += test_xmlCreateDocParserCtxt(); 15396 test_ret += test_xmlCreatePushParserCtxt(); 15397 test_ret += test_xmlCtxtReadDoc(); 15398 test_ret += test_xmlCtxtReadFile(); 15399 test_ret += test_xmlCtxtReadMemory(); 15400 test_ret += test_xmlCtxtReset(); 15401 test_ret += test_xmlCtxtResetPush(); 15402 test_ret += test_xmlCtxtUseOptions(); 15403 test_ret += test_xmlGetExternalEntityLoader(); 15404 test_ret += test_xmlGetFeature(); 15405 test_ret += test_xmlGetFeaturesList(); 15406 test_ret += test_xmlHasFeature(); 15407 test_ret += test_xmlIOParseDTD(); 15408 test_ret += test_xmlInitNodeInfoSeq(); 15409 test_ret += test_xmlInitParser(); 15410 test_ret += test_xmlInitParserCtxt(); 15411 test_ret += test_xmlKeepBlanksDefault(); 15412 test_ret += test_xmlLineNumbersDefault(); 15413 test_ret += test_xmlLoadExternalEntity(); 15414 test_ret += test_xmlNewIOInputStream(); 15415 test_ret += test_xmlNewParserCtxt(); 15416 test_ret += test_xmlParseBalancedChunkMemory(); 15417 test_ret += test_xmlParseBalancedChunkMemoryRecover(); 15418 test_ret += test_xmlParseChunk(); 15419 test_ret += test_xmlParseCtxtExternalEntity(); 15420 test_ret += test_xmlParseDTD(); 15421 test_ret += test_xmlParseDoc(); 15422 test_ret += test_xmlParseDocument(); 15423 test_ret += test_xmlParseEntity(); 15424 test_ret += test_xmlParseExtParsedEnt(); 15425 test_ret += test_xmlParseExternalEntity(); 15426 test_ret += test_xmlParseFile(); 15427 test_ret += test_xmlParseInNodeContext(); 15428 test_ret += test_xmlParseMemory(); 15429 test_ret += test_xmlParserAddNodeInfo(); 15430 test_ret += test_xmlParserFindNodeInfo(); 15431 test_ret += test_xmlParserFindNodeInfoIndex(); 15432 test_ret += test_xmlParserInputGrow(); 15433 test_ret += test_xmlParserInputRead(); 15434 test_ret += test_xmlPedanticParserDefault(); 15435 test_ret += test_xmlReadDoc(); 15436 test_ret += test_xmlReadFile(); 15437 test_ret += test_xmlReadMemory(); 15438 test_ret += test_xmlRecoverDoc(); 15439 test_ret += test_xmlRecoverFile(); 15440 test_ret += test_xmlRecoverMemory(); 15441 test_ret += test_xmlSAXParseDTD(); 15442 test_ret += test_xmlSAXParseDoc(); 15443 test_ret += test_xmlSAXParseEntity(); 15444 test_ret += test_xmlSAXParseFile(); 15445 test_ret += test_xmlSAXParseFileWithData(); 15446 test_ret += test_xmlSAXParseMemory(); 15447 test_ret += test_xmlSAXParseMemoryWithData(); 15448 test_ret += test_xmlSAXUserParseFile(); 15449 test_ret += test_xmlSAXUserParseMemory(); 15450 test_ret += test_xmlSetExternalEntityLoader(); 15451 test_ret += test_xmlSetFeature(); 15452 test_ret += test_xmlSetupParserForBuffer(); 15453 test_ret += test_xmlStopParser(); 15454 test_ret += test_xmlSubstituteEntitiesDefault(); 15455 15456 if (test_ret != 0) 15457 printf("Module parser: %d errors\n", test_ret); 15458 return(test_ret); 15459 } 15460 15461 static int 15462 test_htmlCreateFileParserCtxt(void) { 15463 int test_ret = 0; 15464 15465 #if defined(LIBXML_HTML_ENABLED) 15466 int mem_base; 15467 htmlParserCtxtPtr ret_val; 15468 const char * filename; /* the filename */ 15469 int n_filename; 15470 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */ 15471 int n_encoding; 15472 15473 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) { 15474 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { 15475 mem_base = xmlMemBlocks(); 15476 filename = gen_fileoutput(n_filename, 0); 15477 encoding = gen_const_char_ptr(n_encoding, 1); 15478 15479 ret_val = htmlCreateFileParserCtxt(filename, (const char *)encoding); 15480 desret_htmlParserCtxtPtr(ret_val); 15481 call_tests++; 15482 des_fileoutput(n_filename, filename, 0); 15483 des_const_char_ptr(n_encoding, (const char *)encoding, 1); 15484 xmlResetLastError(); 15485 if (mem_base != xmlMemBlocks()) { 15486 printf("Leak of %d blocks found in htmlCreateFileParserCtxt", 15487 xmlMemBlocks() - mem_base); 15488 test_ret++; 15489 printf(" %d", n_filename); 15490 printf(" %d", n_encoding); 15491 printf("\n"); 15492 } 15493 } 15494 } 15495 function_tests++; 15496 #endif 15497 15498 return(test_ret); 15499 } 15500 15501 15502 static int 15503 test_htmlInitAutoClose(void) { 15504 int test_ret = 0; 15505 15506 #if defined(LIBXML_HTML_ENABLED) 15507 int mem_base; 15508 15509 mem_base = xmlMemBlocks(); 15510 15511 htmlInitAutoClose(); 15512 call_tests++; 15513 xmlResetLastError(); 15514 if (mem_base != xmlMemBlocks()) { 15515 printf("Leak of %d blocks found in htmlInitAutoClose", 15516 xmlMemBlocks() - mem_base); 15517 test_ret++; 15518 printf("\n"); 15519 } 15520 function_tests++; 15521 #endif 15522 15523 return(test_ret); 15524 } 15525 15526 15527 static int 15528 test_inputPop(void) { 15529 int test_ret = 0; 15530 15531 int mem_base; 15532 xmlParserInputPtr ret_val; 15533 xmlParserCtxtPtr ctxt; /* an XML parser context */ 15534 int n_ctxt; 15535 15536 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { 15537 mem_base = xmlMemBlocks(); 15538 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); 15539 15540 ret_val = inputPop(ctxt); 15541 desret_xmlParserInputPtr(ret_val); 15542 call_tests++; 15543 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); 15544 xmlResetLastError(); 15545 if (mem_base != xmlMemBlocks()) { 15546 printf("Leak of %d blocks found in inputPop", 15547 xmlMemBlocks() - mem_base); 15548 test_ret++; 15549 printf(" %d", n_ctxt); 15550 printf("\n"); 15551 } 15552 } 15553 function_tests++; 15554 15555 return(test_ret); 15556 } 15557 15558 15559 static int 15560 test_inputPush(void) { 15561 int test_ret = 0; 15562 15563 int mem_base; 15564 int ret_val; 15565 xmlParserCtxtPtr ctxt; /* an XML parser context */ 15566 int n_ctxt; 15567 xmlParserInputPtr value; /* the parser input */ 15568 int n_value; 15569 15570 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { 15571 for (n_value = 0;n_value < gen_nb_xmlParserInputPtr;n_value++) { 15572 mem_base = xmlMemBlocks(); 15573 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); 15574 value = gen_xmlParserInputPtr(n_value, 1); 15575 15576 ret_val = inputPush(ctxt, value); 15577 desret_int(ret_val); 15578 call_tests++; 15579 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); 15580 des_xmlParserInputPtr(n_value, value, 1); 15581 xmlResetLastError(); 15582 if (mem_base != xmlMemBlocks()) { 15583 printf("Leak of %d blocks found in inputPush", 15584 xmlMemBlocks() - mem_base); 15585 test_ret++; 15586 printf(" %d", n_ctxt); 15587 printf(" %d", n_value); 15588 printf("\n"); 15589 } 15590 } 15591 } 15592 function_tests++; 15593 15594 return(test_ret); 15595 } 15596 15597 15598 static int 15599 test_namePop(void) { 15600 int test_ret = 0; 15601 15602 int mem_base; 15603 const xmlChar * ret_val; 15604 xmlParserCtxtPtr ctxt; /* an XML parser context */ 15605 int n_ctxt; 15606 15607 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { 15608 mem_base = xmlMemBlocks(); 15609 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); 15610 15611 ret_val = namePop(ctxt); 15612 desret_const_xmlChar_ptr(ret_val); 15613 call_tests++; 15614 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); 15615 xmlResetLastError(); 15616 if (mem_base != xmlMemBlocks()) { 15617 printf("Leak of %d blocks found in namePop", 15618 xmlMemBlocks() - mem_base); 15619 test_ret++; 15620 printf(" %d", n_ctxt); 15621 printf("\n"); 15622 } 15623 } 15624 function_tests++; 15625 15626 return(test_ret); 15627 } 15628 15629 15630 static int 15631 test_namePush(void) { 15632 int test_ret = 0; 15633 15634 int mem_base; 15635 int ret_val; 15636 xmlParserCtxtPtr ctxt; /* an XML parser context */ 15637 int n_ctxt; 15638 xmlChar * value; /* the element name */ 15639 int n_value; 15640 15641 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { 15642 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { 15643 mem_base = xmlMemBlocks(); 15644 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); 15645 value = gen_const_xmlChar_ptr(n_value, 1); 15646 15647 ret_val = namePush(ctxt, (const xmlChar *)value); 15648 desret_int(ret_val); 15649 call_tests++; 15650 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); 15651 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1); 15652 xmlResetLastError(); 15653 if (mem_base != xmlMemBlocks()) { 15654 printf("Leak of %d blocks found in namePush", 15655 xmlMemBlocks() - mem_base); 15656 test_ret++; 15657 printf(" %d", n_ctxt); 15658 printf(" %d", n_value); 15659 printf("\n"); 15660 } 15661 } 15662 } 15663 function_tests++; 15664 15665 return(test_ret); 15666 } 15667 15668 15669 static int 15670 test_nodePop(void) { 15671 int test_ret = 0; 15672 15673 int mem_base; 15674 xmlNodePtr ret_val; 15675 xmlParserCtxtPtr ctxt; /* an XML parser context */ 15676 int n_ctxt; 15677 15678 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { 15679 mem_base = xmlMemBlocks(); 15680 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); 15681 15682 ret_val = nodePop(ctxt); 15683 desret_xmlNodePtr(ret_val); 15684 call_tests++; 15685 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); 15686 xmlResetLastError(); 15687 if (mem_base != xmlMemBlocks()) { 15688 printf("Leak of %d blocks found in nodePop", 15689 xmlMemBlocks() - mem_base); 15690 test_ret++; 15691 printf(" %d", n_ctxt); 15692 printf("\n"); 15693 } 15694 } 15695 function_tests++; 15696 15697 return(test_ret); 15698 } 15699 15700 15701 static int 15702 test_nodePush(void) { 15703 int test_ret = 0; 15704 15705 int mem_base; 15706 int ret_val; 15707 xmlParserCtxtPtr ctxt; /* an XML parser context */ 15708 int n_ctxt; 15709 xmlNodePtr value; /* the element node */ 15710 int n_value; 15711 15712 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { 15713 for (n_value = 0;n_value < gen_nb_xmlNodePtr;n_value++) { 15714 mem_base = xmlMemBlocks(); 15715 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); 15716 value = gen_xmlNodePtr(n_value, 1); 15717 15718 ret_val = nodePush(ctxt, value); 15719 desret_int(ret_val); 15720 call_tests++; 15721 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); 15722 des_xmlNodePtr(n_value, value, 1); 15723 xmlResetLastError(); 15724 if (mem_base != xmlMemBlocks()) { 15725 printf("Leak of %d blocks found in nodePush", 15726 xmlMemBlocks() - mem_base); 15727 test_ret++; 15728 printf(" %d", n_ctxt); 15729 printf(" %d", n_value); 15730 printf("\n"); 15731 } 15732 } 15733 } 15734 function_tests++; 15735 15736 return(test_ret); 15737 } 15738 15739 15740 static int 15741 test_xmlCheckLanguageID(void) { 15742 int test_ret = 0; 15743 15744 int mem_base; 15745 int ret_val; 15746 xmlChar * lang; /* pointer to the string value */ 15747 int n_lang; 15748 15749 for (n_lang = 0;n_lang < gen_nb_const_xmlChar_ptr;n_lang++) { 15750 mem_base = xmlMemBlocks(); 15751 lang = gen_const_xmlChar_ptr(n_lang, 0); 15752 15753 ret_val = xmlCheckLanguageID((const xmlChar *)lang); 15754 desret_int(ret_val); 15755 call_tests++; 15756 des_const_xmlChar_ptr(n_lang, (const xmlChar *)lang, 0); 15757 xmlResetLastError(); 15758 if (mem_base != xmlMemBlocks()) { 15759 printf("Leak of %d blocks found in xmlCheckLanguageID", 15760 xmlMemBlocks() - mem_base); 15761 test_ret++; 15762 printf(" %d", n_lang); 15763 printf("\n"); 15764 } 15765 } 15766 function_tests++; 15767 15768 return(test_ret); 15769 } 15770 15771 15772 static int 15773 test_xmlCopyChar(void) { 15774 int test_ret = 0; 15775 15776 int mem_base; 15777 int ret_val; 15778 int len; /* Ignored, compatibility */ 15779 int n_len; 15780 xmlChar * out; /* pointer to an array of xmlChar */ 15781 int n_out; 15782 int val; /* the char value */ 15783 int n_val; 15784 15785 for (n_len = 0;n_len < gen_nb_int;n_len++) { 15786 for (n_out = 0;n_out < gen_nb_xmlChar_ptr;n_out++) { 15787 for (n_val = 0;n_val < gen_nb_int;n_val++) { 15788 mem_base = xmlMemBlocks(); 15789 len = gen_int(n_len, 0); 15790 out = gen_xmlChar_ptr(n_out, 1); 15791 val = gen_int(n_val, 2); 15792 15793 ret_val = xmlCopyChar(len, out, val); 15794 desret_int(ret_val); 15795 call_tests++; 15796 des_int(n_len, len, 0); 15797 des_xmlChar_ptr(n_out, out, 1); 15798 des_int(n_val, val, 2); 15799 xmlResetLastError(); 15800 if (mem_base != xmlMemBlocks()) { 15801 printf("Leak of %d blocks found in xmlCopyChar", 15802 xmlMemBlocks() - mem_base); 15803 test_ret++; 15804 printf(" %d", n_len); 15805 printf(" %d", n_out); 15806 printf(" %d", n_val); 15807 printf("\n"); 15808 } 15809 } 15810 } 15811 } 15812 function_tests++; 15813 15814 return(test_ret); 15815 } 15816 15817 15818 static int 15819 test_xmlCopyCharMultiByte(void) { 15820 int test_ret = 0; 15821 15822 int mem_base; 15823 int ret_val; 15824 xmlChar * out; /* pointer to an array of xmlChar */ 15825 int n_out; 15826 int val; /* the char value */ 15827 int n_val; 15828 15829 for (n_out = 0;n_out < gen_nb_xmlChar_ptr;n_out++) { 15830 for (n_val = 0;n_val < gen_nb_int;n_val++) { 15831 mem_base = xmlMemBlocks(); 15832 out = gen_xmlChar_ptr(n_out, 0); 15833 val = gen_int(n_val, 1); 15834 15835 ret_val = xmlCopyCharMultiByte(out, val); 15836 desret_int(ret_val); 15837 call_tests++; 15838 des_xmlChar_ptr(n_out, out, 0); 15839 des_int(n_val, val, 1); 15840 xmlResetLastError(); 15841 if (mem_base != xmlMemBlocks()) { 15842 printf("Leak of %d blocks found in xmlCopyCharMultiByte", 15843 xmlMemBlocks() - mem_base); 15844 test_ret++; 15845 printf(" %d", n_out); 15846 printf(" %d", n_val); 15847 printf("\n"); 15848 } 15849 } 15850 } 15851 function_tests++; 15852 15853 return(test_ret); 15854 } 15855 15856 15857 static int 15858 test_xmlCreateEntityParserCtxt(void) { 15859 int test_ret = 0; 15860 15861 int mem_base; 15862 xmlParserCtxtPtr ret_val; 15863 xmlChar * URL; /* the entity URL */ 15864 int n_URL; 15865 xmlChar * ID; /* the entity PUBLIC ID */ 15866 int n_ID; 15867 xmlChar * base; /* a possible base for the target URI */ 15868 int n_base; 15869 15870 for (n_URL = 0;n_URL < gen_nb_const_xmlChar_ptr;n_URL++) { 15871 for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) { 15872 for (n_base = 0;n_base < gen_nb_const_xmlChar_ptr;n_base++) { 15873 mem_base = xmlMemBlocks(); 15874 URL = gen_const_xmlChar_ptr(n_URL, 0); 15875 ID = gen_const_xmlChar_ptr(n_ID, 1); 15876 base = gen_const_xmlChar_ptr(n_base, 2); 15877 15878 ret_val = xmlCreateEntityParserCtxt((const xmlChar *)URL, (const xmlChar *)ID, (const xmlChar *)base); 15879 desret_xmlParserCtxtPtr(ret_val); 15880 call_tests++; 15881 des_const_xmlChar_ptr(n_URL, (const xmlChar *)URL, 0); 15882 des_const_xmlChar_ptr(n_ID, (const xmlChar *)ID, 1); 15883 des_const_xmlChar_ptr(n_base, (const xmlChar *)base, 2); 15884 xmlResetLastError(); 15885 if (mem_base != xmlMemBlocks()) { 15886 printf("Leak of %d blocks found in xmlCreateEntityParserCtxt", 15887 xmlMemBlocks() - mem_base); 15888 test_ret++; 15889 printf(" %d", n_URL); 15890 printf(" %d", n_ID); 15891 printf(" %d", n_base); 15892 printf("\n"); 15893 } 15894 } 15895 } 15896 } 15897 function_tests++; 15898 15899 return(test_ret); 15900 } 15901 15902 15903 static int 15904 test_xmlCreateFileParserCtxt(void) { 15905 int test_ret = 0; 15906 15907 int mem_base; 15908 xmlParserCtxtPtr ret_val; 15909 const char * filename; /* the filename */ 15910 int n_filename; 15911 15912 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) { 15913 mem_base = xmlMemBlocks(); 15914 filename = gen_fileoutput(n_filename, 0); 15915 15916 ret_val = xmlCreateFileParserCtxt(filename); 15917 desret_xmlParserCtxtPtr(ret_val); 15918 call_tests++;