| /* |
| * testapi.c: libxml2 API tester program. |
| * |
| * Automatically generated by gentest.py from libxml2-api.xml |
| * |
| * See Copyright for the status of this software. |
| * |
| * daniel@veillard.com |
| */ |
| |
| /* Disable deprecation warnings */ |
| #define XML_DEPRECATED |
| |
| #include "libxml.h" |
| #include <stdio.h> |
| #include <stdlib.h> |
| #include <string.h> |
| #include <libxml/xmlerror.h> |
| #include <libxml/catalog.h> |
| #include <libxml/relaxng.h> |
| #include <libxml/parser.h> |
| |
| |
| static int testlibxml2(void); |
| static int test_module(const char *module); |
| |
| static int generic_errors = 0; |
| static int call_tests = 0; |
| static int function_tests = 0; |
| |
| static xmlChar chartab[1024]; |
| static int inttab[1024]; |
| static unsigned long longtab[1024]; |
| |
| static xmlDocPtr api_doc = NULL; |
| static xmlDtdPtr api_dtd = NULL; |
| static xmlNodePtr api_root = NULL; |
| static xmlAttrPtr api_attr = NULL; |
| static xmlNsPtr api_ns = NULL; |
| |
| static void |
| structured_errors(void *userData ATTRIBUTE_UNUSED, |
| const xmlError *error ATTRIBUTE_UNUSED) { |
| generic_errors++; |
| } |
| |
| static void |
| free_api_doc(void) { |
| xmlFreeDoc(api_doc); |
| api_doc = NULL; |
| api_dtd = NULL; |
| api_root = NULL; |
| api_attr = NULL; |
| api_ns = NULL; |
| } |
| |
| static xmlDocPtr |
| get_api_doc(void) { |
| if (api_doc == NULL) { |
| api_doc = xmlReadMemory("<!DOCTYPE root [<!ELEMENT root EMPTY>]><root xmlns:h='http://example.com/' h:foo='bar'/>", 88, "root_test", NULL, 0); |
| api_root = NULL; |
| api_attr = NULL; |
| } |
| return(api_doc); |
| } |
| |
| static xmlDtdPtr |
| get_api_dtd(void) { |
| if ((api_dtd == NULL) || (api_dtd->type != XML_DTD_NODE)) { |
| get_api_doc(); |
| if ((api_doc != NULL) && (api_doc->children != NULL) && |
| (api_doc->children->type == XML_DTD_NODE)) |
| api_dtd = (xmlDtdPtr) api_doc->children; |
| } |
| return(api_dtd); |
| } |
| |
| static xmlNodePtr |
| get_api_root(void) { |
| if ((api_root == NULL) || (api_root->type != XML_ELEMENT_NODE)) { |
| get_api_doc(); |
| if ((api_doc != NULL) && (api_doc->children != NULL) && |
| (api_doc->children->next != NULL) && |
| (api_doc->children->next->type == XML_ELEMENT_NODE)) |
| api_root = api_doc->children->next; |
| } |
| return(api_root); |
| } |
| |
| static xmlNsPtr |
| get_api_ns(void) { |
| get_api_root(); |
| if (api_root != NULL) |
| api_ns = api_root->nsDef; |
| return(api_ns); |
| } |
| |
| static xmlAttrPtr |
| get_api_attr(void) { |
| #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED) |
| static int nr = 0; |
| xmlChar name[20]; |
| #endif |
| |
| if ((api_root == NULL) || (api_root->type != XML_ELEMENT_NODE)) { |
| get_api_root(); |
| } |
| if (api_root == NULL) |
| return(NULL); |
| if (api_root->properties != NULL) { |
| api_attr = api_root->properties; |
| return(api_root->properties); |
| } |
| api_attr = NULL; |
| #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED) |
| snprintf((char *) name, 20, "foo%d", nr++); |
| api_attr = xmlSetProp(api_root, name, (const xmlChar *) "bar"); |
| #endif |
| return(api_attr); |
| } |
| |
| static int quiet = 0; |
| |
| int main(int argc, char **argv) { |
| int ret; |
| int blocks, mem; |
| |
| #if defined(_WIN32) |
| setvbuf(stdout, NULL, _IONBF, 0); |
| setvbuf(stderr, NULL, _IONBF, 0); |
| |
| printf("Skipping on Windows for now\n"); |
| return(0); |
| #endif |
| |
| memset(chartab, 0, sizeof(chartab)); |
| strncpy((char *) chartab, " chartab\n", 20); |
| memset(inttab, 0, sizeof(inttab)); |
| memset(longtab, 0, sizeof(longtab)); |
| |
| xmlInitParser(); |
| #ifdef LIBXML_CATALOG_ENABLED |
| xmlInitializeCatalog(); |
| #endif |
| #ifdef LIBXML_RELAXNG_ENABLED |
| xmlRelaxNGInitTypes(); |
| #endif |
| |
| LIBXML_TEST_VERSION |
| |
| xmlSetStructuredErrorFunc(NULL, structured_errors); |
| xmlSetExternalEntityLoader(xmlNoNetExternalEntityLoader); |
| |
| if (argc >= 2) { |
| if (!strcmp(argv[1], "-q")) { |
| quiet = 1; |
| if (argc >= 3) |
| ret = test_module(argv[2]); |
| else |
| ret = testlibxml2(); |
| } else { |
| ret = test_module(argv[1]); |
| } |
| } else |
| ret = testlibxml2(); |
| |
| xmlCleanupParser(); |
| blocks = xmlMemBlocks(); |
| mem = xmlMemUsed(); |
| if ((blocks != 0) || (mem != 0)) { |
| printf("testapi leaked %d bytes in %d blocks\n", mem, blocks); |
| ret = 1; |
| } |
| |
| return (ret != 0); |
| } |
| |
| #include <libxml/HTMLparser.h> |
| #include <libxml/HTMLtree.h> |
| #include <libxml/chvalid.h> |
| #include <libxml/dict.h> |
| #include <libxml/encoding.h> |
| #include <libxml/entities.h> |
| #include <libxml/hash.h> |
| #include <libxml/list.h> |
| #include <libxml/nanohttp.h> |
| #include <libxml/parser.h> |
| #include <libxml/parserInternals.h> |
| #include <libxml/pattern.h> |
| #include <libxml/relaxng.h> |
| #include <libxml/schemasInternals.h> |
| #include <libxml/schematron.h> |
| #include <libxml/tree.h> |
| #include <libxml/uri.h> |
| #include <libxml/valid.h> |
| #include <libxml/xinclude.h> |
| #include <libxml/xmlIO.h> |
| #include <libxml/xmlerror.h> |
| #include <libxml/xmlreader.h> |
| #include <libxml/xmlsave.h> |
| #include <libxml/xmlschemas.h> |
| #include <libxml/xmlschemastypes.h> |
| #include <libxml/xmlstring.h> |
| #include <libxml/xmlwriter.h> |
| #include <libxml/xpath.h> |
| #include <libxml/xpointer.h> |
| #include <libxml/debugXML.h> |
| |
| /* |
| We need some "remote" addresses, but want to avoid getting into |
| name resolution delays, so we use these |
| */ |
| #define REMOTE1GOOD "http://localhost/" |
| #define REMOTE1BAD "http:http://http" |
| #define REMOTE2GOOD "ftp://localhost/foo" |
| |
| #define gen_nb_void_ptr 2 |
| |
| static void *gen_void_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { |
| return(NULL); |
| } |
| static void des_void_ptr(int no ATTRIBUTE_UNUSED, void *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { |
| } |
| |
| #define gen_nb_userdata 3 |
| |
| static void *gen_userdata(int no, int nr ATTRIBUTE_UNUSED) { |
| if (no == 0) return((void *) &call_tests); |
| if (no == 1) return((void *) -1); |
| return(NULL); |
| } |
| static void des_userdata(int no ATTRIBUTE_UNUSED, void *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { |
| } |
| |
| |
| #define gen_nb_int 4 |
| |
| static int gen_int(int no, int nr ATTRIBUTE_UNUSED) { |
| if (no == 0) return(0); |
| if (no == 1) return(1); |
| if (no == 2) return(-1); |
| if (no == 3) return(122); |
| return(-1); |
| } |
| |
| static void des_int(int no ATTRIBUTE_UNUSED, int val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { |
| } |
| |
| #define gen_nb_parseroptions 5 |
| |
| static int gen_parseroptions(int no, int nr ATTRIBUTE_UNUSED) { |
| if (no == 0) return(XML_PARSE_NOBLANKS | XML_PARSE_RECOVER); |
| if (no == 1) return(XML_PARSE_NOENT | XML_PARSE_DTDLOAD | XML_PARSE_DTDATTR | XML_PARSE_DTDVALID | XML_PARSE_NOCDATA); |
| if (no == 2) return(XML_PARSE_XINCLUDE | XML_PARSE_NOXINCNODE | XML_PARSE_NSCLEAN); |
| if (no == 3) return(XML_PARSE_XINCLUDE | XML_PARSE_NODICT); |
| return(XML_PARSE_SAX1); |
| } |
| |
| static void des_parseroptions(int no ATTRIBUTE_UNUSED, int val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { |
| } |
| |
| #if 0 |
| #define gen_nb_long 5 |
| |
| static long gen_long(int no, int nr ATTRIBUTE_UNUSED) { |
| if (no == 0) return(0); |
| if (no == 1) return(1); |
| if (no == 2) return(-1); |
| if (no == 3) return(122); |
| return(-1); |
| } |
| |
| static void des_long(int no ATTRIBUTE_UNUSED, long val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { |
| } |
| #endif |
| |
| #define gen_nb_xmlChar 4 |
| |
| static xmlChar gen_xmlChar(int no, int nr ATTRIBUTE_UNUSED) { |
| if (no == 0) return('a'); |
| if (no == 1) return(' '); |
| if (no == 2) return((xmlChar) '\xf8'); |
| return(0); |
| } |
| |
| static void des_xmlChar(int no ATTRIBUTE_UNUSED, xmlChar val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { |
| } |
| |
| #define gen_nb_unsigned_int 3 |
| |
| static unsigned int gen_unsigned_int(int no, int nr ATTRIBUTE_UNUSED) { |
| if (no == 0) return(0); |
| if (no == 1) return(1); |
| if (no == 2) return(122); |
| return((unsigned int) -1); |
| } |
| |
| static void des_unsigned_int(int no ATTRIBUTE_UNUSED, unsigned int val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { |
| } |
| |
| #ifdef LIBXML_SCHEMAS_ENABLED |
| |
| #define gen_nb_unsigned_long 4 |
| |
| static unsigned long gen_unsigned_long(int no, int nr ATTRIBUTE_UNUSED) { |
| if (no == 0) return(0); |
| if (no == 1) return(1); |
| if (no == 2) return(122); |
| return((unsigned long) -1); |
| } |
| |
| static void des_unsigned_long(int no ATTRIBUTE_UNUSED, unsigned long val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { |
| } |
| |
| #define gen_nb_unsigned_long_ptr 2 |
| |
| static unsigned long *gen_unsigned_long_ptr(int no, int nr) { |
| if (no == 0) return(&longtab[nr]); |
| return(NULL); |
| } |
| |
| static void des_unsigned_long_ptr(int no ATTRIBUTE_UNUSED, unsigned long *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { |
| } |
| |
| #endif /* LIBXML_SCHEMAS_ENABLED */ |
| |
| #if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) |
| |
| #define gen_nb_double 4 |
| |
| static double gen_double(int no, int nr ATTRIBUTE_UNUSED) { |
| if (no == 0) return(0); |
| if (no == 1) return(-1.1); |
| #if defined(LIBXML_XPATH_ENABLED) |
| if (no == 2) return(xmlXPathNAN); |
| #endif |
| return(-1); |
| } |
| |
| static void des_double(int no ATTRIBUTE_UNUSED, double val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { |
| } |
| |
| #endif /* defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) */ |
| |
| #define gen_nb_int_ptr 2 |
| |
| static int *gen_int_ptr(int no, int nr) { |
| if (no == 0) return(&inttab[nr]); |
| return(NULL); |
| } |
| |
| static void des_int_ptr(int no ATTRIBUTE_UNUSED, int *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { |
| } |
| |
| #define gen_nb_const_char_ptr 4 |
| |
| static const char *gen_const_char_ptr(int no, int nr ATTRIBUTE_UNUSED) { |
| if (no == 0) return((char *) "foo"); |
| if (no == 1) return((char *) "<foo/>"); |
| if (no == 2) return((char *) "test/ent2"); |
| return(NULL); |
| } |
| static void des_const_char_ptr(int no ATTRIBUTE_UNUSED, const char *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { |
| } |
| |
| #define gen_nb_xmlChar_ptr 2 |
| |
| static xmlChar *gen_xmlChar_ptr(int no, int nr ATTRIBUTE_UNUSED) { |
| if (no == 0) return(&chartab[0]); |
| return(NULL); |
| } |
| static void des_xmlChar_ptr(int no ATTRIBUTE_UNUSED, xmlChar *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { |
| } |
| |
| #define gen_nb_FILE_ptr 2 |
| |
| static FILE *gen_FILE_ptr(int no, int nr ATTRIBUTE_UNUSED) { |
| if (no == 0) return(fopen("test.out", "a+")); |
| return(NULL); |
| } |
| static void des_FILE_ptr(int no ATTRIBUTE_UNUSED, FILE *val, int nr ATTRIBUTE_UNUSED) { |
| if (val != NULL) fclose(val); |
| } |
| |
| #ifdef LIBXML_DEBUG_ENABLED |
| #define gen_nb_debug_FILE_ptr 2 |
| static FILE *gen_debug_FILE_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { |
| return(fopen("test.out", "a+")); |
| } |
| static void des_debug_FILE_ptr(int no ATTRIBUTE_UNUSED, FILE *val, int nr ATTRIBUTE_UNUSED) { |
| if (val != NULL) fclose(val); |
| } |
| #endif |
| |
| #define gen_nb_const_xmlChar_ptr 5 |
| |
| static const xmlChar *gen_const_xmlChar_ptr(int no, int nr ATTRIBUTE_UNUSED) { |
| if (no == 0) return((xmlChar *) "foo"); |
| if (no == 1) return((xmlChar *) "<foo/>"); |
| if (no == 2) return((xmlChar *) "n" "\xf8" "ne"); |
| if (no == 3) return((xmlChar *) " 2ab "); |
| return(NULL); |
| } |
| static void des_const_xmlChar_ptr(int no ATTRIBUTE_UNUSED, const xmlChar *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { |
| } |
| |
| #define gen_nb_filepath 8 |
| |
| static const char *gen_filepath(int no, int nr ATTRIBUTE_UNUSED) { |
| if (no == 0) return("missing.xml"); |
| if (no == 1) return("<foo/>"); |
| if (no == 2) return("test/ent2"); |
| if (no == 3) return("test/valid/REC-xml-19980210.xml"); |
| if (no == 4) return("test/valid/dtds/xhtml1-strict.dtd"); |
| if (no == 5) return(REMOTE1GOOD); |
| if (no == 6) return(REMOTE1BAD); |
| return(NULL); |
| } |
| static void des_filepath(int no ATTRIBUTE_UNUSED, const char *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { |
| } |
| |
| #define gen_nb_eaten_name 2 |
| |
| static xmlChar *gen_eaten_name(int no, int nr ATTRIBUTE_UNUSED) { |
| if (no == 0) return(xmlStrdup(BAD_CAST "eaten")); |
| return(NULL); |
| } |
| static void des_eaten_name(int no ATTRIBUTE_UNUSED, xmlChar *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { |
| } |
| |
| #define gen_nb_fileoutput 6 |
| |
| static const char *gen_fileoutput(int no, int nr ATTRIBUTE_UNUSED) { |
| if (no == 0) return("missing/dir/missing.xml"); |
| if (no == 1) return("<foo/>"); |
| if (no == 2) return(REMOTE2GOOD); |
| if (no == 3) return(REMOTE1GOOD); |
| if (no == 4) return(REMOTE1BAD); |
| return(NULL); |
| } |
| static void des_fileoutput(int no ATTRIBUTE_UNUSED, const char *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { |
| } |
| |
| #define gen_nb_xmlParserCtxtPtr 3 |
| static xmlParserCtxtPtr gen_xmlParserCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) { |
| if (no == 0) return(xmlNewParserCtxt()); |
| if (no == 1) return(xmlCreateMemoryParserCtxt("<doc/>", 6)); |
| return(NULL); |
| } |
| static void des_xmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, xmlParserCtxtPtr val, int nr ATTRIBUTE_UNUSED) { |
| if (val != NULL) |
| xmlFreeParserCtxt(val); |
| } |
| |
| #if defined(LIBXML_SAX1_ENABLED) || \ |
| defined(LIBXML_VALID_ENABLED) || \ |
| defined(LIBXML_PUSH_ENABLED) |
| #define gen_nb_xmlSAXHandlerPtr 2 |
| static xmlSAXHandlerPtr gen_xmlSAXHandlerPtr(int no, int nr ATTRIBUTE_UNUSED) { |
| (void) no; |
| #ifdef LIBXML_SAX1_ENABLED |
| if (no == 0) return((xmlSAXHandlerPtr) &xmlDefaultSAXHandler); |
| #endif |
| return(NULL); |
| } |
| static void des_xmlSAXHandlerPtr(int no ATTRIBUTE_UNUSED, xmlSAXHandlerPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { |
| } |
| #endif |
| |
| #define gen_nb_xmlValidCtxtPtr 2 |
| static xmlValidCtxtPtr gen_xmlValidCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) { |
| (void) no; |
| #ifdef LIBXML_VALID_ENABLED |
| if (no == 0) return(xmlNewValidCtxt()); |
| #endif |
| return(NULL); |
| } |
| static void des_xmlValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlValidCtxtPtr val, int nr ATTRIBUTE_UNUSED) { |
| (void) val; |
| #ifdef LIBXML_VALID_ENABLED |
| if (val != NULL) |
| xmlFreeValidCtxt(val); |
| #endif |
| } |
| |
| #define gen_nb_xmlParserInputBufferPtr 8 |
| |
| static xmlParserInputBufferPtr gen_xmlParserInputBufferPtr(int no, int nr ATTRIBUTE_UNUSED) { |
| if (no == 0) return(xmlParserInputBufferCreateFilename("missing.xml", XML_CHAR_ENCODING_NONE)); |
| if (no == 1) return(xmlParserInputBufferCreateFilename("<foo/>", XML_CHAR_ENCODING_NONE)); |
| if (no == 2) return(xmlParserInputBufferCreateFilename("test/ent2", XML_CHAR_ENCODING_NONE)); |
| if (no == 3) return(xmlParserInputBufferCreateFilename("test/valid/REC-xml-19980210.xml", XML_CHAR_ENCODING_NONE)); |
| if (no == 4) return(xmlParserInputBufferCreateFilename("test/valid/dtds/xhtml1-strict.dtd", XML_CHAR_ENCODING_NONE)); |
| if (no == 5) return(xmlParserInputBufferCreateFilename(REMOTE1GOOD, XML_CHAR_ENCODING_NONE)); |
| if (no == 6) return(xmlParserInputBufferCreateFilename(REMOTE1BAD, XML_CHAR_ENCODING_NONE)); |
| return(NULL); |
| } |
| static void des_xmlParserInputBufferPtr(int no ATTRIBUTE_UNUSED, xmlParserInputBufferPtr val, int nr ATTRIBUTE_UNUSED) { |
| xmlFreeParserInputBuffer(val); |
| } |
| |
| #define gen_nb_xmlDocPtr 4 |
| static xmlDocPtr gen_xmlDocPtr(int no, int nr ATTRIBUTE_UNUSED) { |
| if (no == 0) return(xmlNewDoc(BAD_CAST "1.0")); |
| if (no == 1) return(xmlReadMemory("<foo/>", 6, "test", NULL, 0)); |
| if (no == 2) return(xmlReadMemory("<!DOCTYPE foo []> <foo/>", 24, "test", NULL, 0)); |
| return(NULL); |
| } |
| static void des_xmlDocPtr(int no ATTRIBUTE_UNUSED, xmlDocPtr val, int nr ATTRIBUTE_UNUSED) { |
| if ((val != NULL) && (val != api_doc) && (val->doc != api_doc)) |
| xmlFreeDoc(val); |
| } |
| |
| #define gen_nb_xmlAttrPtr 2 |
| static xmlAttrPtr gen_xmlAttrPtr(int no, int nr ATTRIBUTE_UNUSED) { |
| if (no == 0) return(get_api_attr()); |
| return(NULL); |
| } |
| static void des_xmlAttrPtr(int no, xmlAttrPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { |
| if (no == 0) free_api_doc(); |
| } |
| |
| #define gen_nb_xmlDictPtr 2 |
| static xmlDictPtr gen_xmlDictPtr(int no, int nr ATTRIBUTE_UNUSED) { |
| if (no == 0) return(xmlDictCreate()); |
| return(NULL); |
| } |
| static void des_xmlDictPtr(int no ATTRIBUTE_UNUSED, xmlDictPtr val, int nr ATTRIBUTE_UNUSED) { |
| if (val != NULL) |
| xmlDictFree(val); |
| } |
| |
| #define gen_nb_xmlNodePtr 3 |
| static xmlNodePtr gen_xmlNodePtr(int no, int nr ATTRIBUTE_UNUSED) { |
| if (no == 0) return(xmlNewPI(BAD_CAST "test", NULL)); |
| if (no == 1) return(get_api_root()); |
| return(NULL); |
| /* if (no == 2) return((xmlNodePtr) get_api_doc()); */ |
| } |
| static void des_xmlNodePtr(int no, xmlNodePtr val, int nr ATTRIBUTE_UNUSED) { |
| if (no == 1) { |
| free_api_doc(); |
| } else if (val != NULL) { |
| xmlUnlinkNode(val); |
| xmlFreeNode(val); |
| } |
| } |
| |
| #define gen_nb_xmlDtdPtr 3 |
| static xmlDtdPtr gen_xmlDtdPtr(int no, int nr ATTRIBUTE_UNUSED) { |
| if (no == 0) |
| return(xmlNewDtd(NULL, BAD_CAST "dtd", BAD_CAST"foo", BAD_CAST"bar")); |
| if (no == 1) return(get_api_dtd()); |
| return(NULL); |
| } |
| static void des_xmlDtdPtr(int no, xmlDtdPtr val, int nr ATTRIBUTE_UNUSED) { |
| if (no == 1) free_api_doc(); |
| else if (val != NULL) { |
| xmlUnlinkNode((xmlNodePtr) val); |
| xmlFreeNode((xmlNodePtr) val); |
| } |
| } |
| |
| #define gen_nb_xmlNsPtr 2 |
| static xmlNsPtr gen_xmlNsPtr(int no, int nr ATTRIBUTE_UNUSED) { |
| if (no == 0) return(get_api_ns()); |
| return(NULL); |
| } |
| static void des_xmlNsPtr(int no, xmlNsPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { |
| if (no == 0) free_api_doc(); |
| } |
| |
| #define gen_nb_xmlNodePtr_in 3 |
| static xmlNodePtr gen_xmlNodePtr_in(int no, int nr ATTRIBUTE_UNUSED) { |
| if (no == 0) return(xmlNewPI(BAD_CAST "test", NULL)); |
| if (no == 0) return(xmlNewText(BAD_CAST "text")); |
| return(NULL); |
| } |
| static void des_xmlNodePtr_in(int no ATTRIBUTE_UNUSED, xmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { |
| } |
| |
| #ifdef LIBXML_WRITER_ENABLED |
| #define gen_nb_xmlTextWriterPtr 2 |
| static xmlTextWriterPtr gen_xmlTextWriterPtr(int no, int nr ATTRIBUTE_UNUSED) { |
| if (no == 0) return(xmlNewTextWriterFilename("test.out", 0)); |
| return(NULL); |
| } |
| static void des_xmlTextWriterPtr(int no ATTRIBUTE_UNUSED, xmlTextWriterPtr val, int nr ATTRIBUTE_UNUSED) { |
| if (val != NULL) xmlFreeTextWriter(val); |
| } |
| #endif |
| |
| #ifdef LIBXML_READER_ENABLED |
| #define gen_nb_xmlTextReaderPtr 4 |
| static xmlTextReaderPtr gen_xmlTextReaderPtr(int no, int nr ATTRIBUTE_UNUSED) { |
| if (no == 0) return(xmlNewTextReaderFilename("test/ent2")); |
| if (no == 1) return(xmlNewTextReaderFilename("test/valid/REC-xml-19980210.xml")); |
| if (no == 2) return(xmlNewTextReaderFilename("test/valid/dtds/xhtml1-strict.dtd")); |
| return(NULL); |
| } |
| static void des_xmlTextReaderPtr(int no ATTRIBUTE_UNUSED, xmlTextReaderPtr val, int nr ATTRIBUTE_UNUSED) { |
| if (val != NULL) xmlFreeTextReader(val); |
| } |
| #endif |
| |
| #define gen_nb_xmlBufferPtr 3 |
| static const xmlChar *static_buf_content = (xmlChar *)"a static buffer"; |
| static xmlBufferPtr gen_xmlBufferPtr(int no, int nr ATTRIBUTE_UNUSED) { |
| if (no == 0) return(xmlBufferCreate()); |
| if (no == 1) return(xmlBufferCreateStatic((void *)static_buf_content, 13)); |
| return(NULL); |
| } |
| static void des_xmlBufferPtr(int no ATTRIBUTE_UNUSED, xmlBufferPtr val, int nr ATTRIBUTE_UNUSED) { |
| if (val != NULL) { |
| xmlBufferFree(val); |
| } |
| } |
| |
| #define gen_nb_xmlListPtr 2 |
| static xmlListPtr gen_xmlListPtr(int no, int nr ATTRIBUTE_UNUSED) { |
| if (no == 0) return(xmlListCreate(NULL, NULL)); |
| return(NULL); |
| } |
| static void des_xmlListPtr(int no ATTRIBUTE_UNUSED, xmlListPtr val, int nr ATTRIBUTE_UNUSED) { |
| if (val != NULL) { |
| xmlListDelete(val); |
| } |
| } |
| |
| #define gen_nb_xmlHashTablePtr 2 |
| static xmlHashTablePtr gen_xmlHashTablePtr(int no, int nr ATTRIBUTE_UNUSED) { |
| if (no == 0) return(xmlHashCreate(10)); |
| return(NULL); |
| } |
| static void des_xmlHashTablePtr(int no ATTRIBUTE_UNUSED, xmlHashTablePtr val, int nr ATTRIBUTE_UNUSED) { |
| if (val != NULL) { |
| xmlHashFree(val, NULL); |
| } |
| } |
| |
| #include <libxml/xpathInternals.h> |
| |
| #ifdef LIBXML_XPATH_ENABLED |
| #define gen_nb_xmlXPathObjectPtr 5 |
| static xmlXPathObjectPtr gen_xmlXPathObjectPtr(int no, int nr ATTRIBUTE_UNUSED) { |
| if (no == 0) return(xmlXPathNewString(BAD_CAST "string object")); |
| if (no == 1) return(xmlXPathNewFloat(1.1)); |
| if (no == 2) return(xmlXPathNewBoolean(1)); |
| if (no == 3) return(xmlXPathNewNodeSet(NULL)); |
| return(NULL); |
| } |
| static void des_xmlXPathObjectPtr(int no ATTRIBUTE_UNUSED, xmlXPathObjectPtr val, int nr ATTRIBUTE_UNUSED) { |
| if (val != NULL) { |
| xmlXPathFreeObject(val); |
| } |
| } |
| #endif |
| |
| #ifdef LIBXML_OUTPUT_ENABLED |
| #define gen_nb_xmlOutputBufferPtr 2 |
| static xmlOutputBufferPtr gen_xmlOutputBufferPtr(int no, int nr ATTRIBUTE_UNUSED) { |
| if (no == 0) return(xmlOutputBufferCreateFilename("test.out", NULL, 0)); |
| return(NULL); |
| } |
| static void des_xmlOutputBufferPtr(int no ATTRIBUTE_UNUSED, xmlOutputBufferPtr val, int nr ATTRIBUTE_UNUSED) { |
| if (val != NULL) { |
| xmlOutputBufferClose(val); |
| } |
| } |
| #endif |
| |
| #ifdef LIBXML_HTTP_ENABLED |
| #define gen_nb_xmlNanoHTTPCtxtPtr 1 |
| static void *gen_xmlNanoHTTPCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) { |
| if (no == 0) return(xmlNanoHTTPOpen(REMOTE1GOOD, NULL)); |
| if (no == 1) return(xmlNanoHTTPOpen(REMOTE2GOOD, NULL)); |
| if (no == 2) return(xmlNanoHTTPOpen(REMOTE1BAD, NULL)); |
| return(NULL); |
| } |
| static void des_xmlNanoHTTPCtxtPtr(int no ATTRIBUTE_UNUSED, void *val, int nr ATTRIBUTE_UNUSED) { |
| if (val != NULL) { |
| xmlNanoHTTPClose(val); |
| } |
| } |
| #endif |
| |
| #define gen_nb_xmlCharEncoding 4 |
| static xmlCharEncoding gen_xmlCharEncoding(int no, int nr ATTRIBUTE_UNUSED) { |
| if (no == 0) return(XML_CHAR_ENCODING_UTF8); |
| if (no == 1) return(XML_CHAR_ENCODING_NONE); |
| if (no == 2) return(XML_CHAR_ENCODING_8859_1); |
| return(XML_CHAR_ENCODING_ERROR); |
| } |
| static void des_xmlCharEncoding(int no ATTRIBUTE_UNUSED, xmlCharEncoding val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { |
| } |
| |
| #if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_EXPR_ENABLED) |
| |
| #define gen_nb_xmlExpCtxtPtr 1 |
| static xmlExpCtxtPtr gen_xmlExpCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { |
| return(NULL); |
| } |
| static void des_xmlExpCtxtPtr(int no ATTRIBUTE_UNUSED, xmlExpCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { |
| } |
| |
| #define gen_nb_xmlExpNodePtr 1 |
| static xmlExpNodePtr gen_xmlExpNodePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { |
| return(NULL); |
| } |
| static void des_xmlExpNodePtr(int no ATTRIBUTE_UNUSED, xmlExpNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { |
| } |
| |
| #endif |
| |
| #if defined(LIBXML_SCHEMAS_ENABLED) |
| #define gen_nb_xmlSchemaPtr 1 |
| static xmlSchemaPtr gen_xmlSchemaPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { |
| return(NULL); |
| } |
| static void des_xmlSchemaPtr(int no ATTRIBUTE_UNUSED, xmlSchemaPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { |
| } |
| |
| #define gen_nb_xmlSchemaValidCtxtPtr 1 |
| static xmlSchemaValidCtxtPtr gen_xmlSchemaValidCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { |
| return(NULL); |
| } |
| static void des_xmlSchemaValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSchemaValidCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { |
| } |
| |
| #endif /* LIBXML_SCHEMAS_ENABLED */ |
| |
| #define gen_nb_xmlHashDeallocator 2 |
| static void |
| test_xmlHashDeallocator(void *payload ATTRIBUTE_UNUSED, |
| const xmlChar *name ATTRIBUTE_UNUSED) { |
| } |
| |
| static xmlHashDeallocator gen_xmlHashDeallocator(int no, int nr ATTRIBUTE_UNUSED) { |
| if (no == 0) return(test_xmlHashDeallocator); |
| return(NULL); |
| } |
| static void des_xmlHashDeallocator(int no ATTRIBUTE_UNUSED, xmlHashDeallocator val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { |
| } |
| |
| |
| static void desret_int(int val ATTRIBUTE_UNUSED) { |
| } |
| static void desret_xmlChar(xmlChar val ATTRIBUTE_UNUSED) { |
| } |
| static void desret_long(long val ATTRIBUTE_UNUSED) { |
| } |
| static void desret_unsigned_long(unsigned long val ATTRIBUTE_UNUSED) { |
| } |
| #if defined(LIBXML_XPATH_ENABLED) |
| static void desret_double(double val ATTRIBUTE_UNUSED) { |
| } |
| #endif |
| static void desret_xmlCharEncoding(xmlCharEncoding val ATTRIBUTE_UNUSED) { |
| } |
| #if 0 |
| static void desret_const_void_ptr(void *val ATTRIBUTE_UNUSED) { |
| } |
| #endif |
| static void desret_void_ptr(void *val ATTRIBUTE_UNUSED) { |
| } |
| static void desret_const_char_ptr(const char *val ATTRIBUTE_UNUSED) { |
| } |
| static void desret_const_xmlChar_ptr(const xmlChar *val ATTRIBUTE_UNUSED) { |
| } |
| static void desret_xmlChar_ptr(xmlChar *val) { |
| if (val != NULL) |
| xmlFree(val); |
| } |
| static void desret_xmlDocPtr(xmlDocPtr val) { |
| if (val != api_doc) |
| xmlFreeDoc(val); |
| } |
| static void desret_xmlDictPtr(xmlDictPtr val) { |
| xmlDictFree(val); |
| } |
| #ifdef LIBXML_OUTPUT_ENABLED |
| static void desret_xmlOutputBufferPtr(xmlOutputBufferPtr val) { |
| xmlOutputBufferClose(val); |
| } |
| #endif |
| #ifdef LIBXML_READER_ENABLED |
| static void desret_xmlTextReaderPtr(xmlTextReaderPtr val) { |
| xmlFreeTextReader(val); |
| } |
| #endif |
| static void desret_xmlNodePtr(xmlNodePtr val) { |
| if ((val != NULL) && (val != api_root) && (val != (xmlNodePtr) api_doc)) { |
| xmlUnlinkNode(val); |
| xmlFreeNode(val); |
| } |
| } |
| static void desret_xmlAttrPtr(xmlAttrPtr val) { |
| if (val != NULL) { |
| xmlUnlinkNode((xmlNodePtr) val); |
| xmlFreeNode((xmlNodePtr) val); |
| } |
| } |
| static void desret_xmlEntityPtr(xmlEntityPtr val) { |
| if (val != NULL) { |
| xmlUnlinkNode((xmlNodePtr) val); |
| xmlFreeNode((xmlNodePtr) val); |
| } |
| } |
| static void desret_xmlElementPtr(xmlElementPtr val) { |
| if (val != NULL) { |
| xmlUnlinkNode((xmlNodePtr) val); |
| } |
| } |
| static void desret_xmlAttributePtr(xmlAttributePtr val) { |
| if (val != NULL) { |
| xmlUnlinkNode((xmlNodePtr) val); |
| } |
| } |
| static void desret_xmlNsPtr(xmlNsPtr val ATTRIBUTE_UNUSED) { |
| } |
| static void desret_xmlDtdPtr(xmlDtdPtr val) { |
| desret_xmlNodePtr((xmlNodePtr)val); |
| } |
| #ifdef LIBXML_XPATH_ENABLED |
| static void desret_xmlXPathObjectPtr(xmlXPathObjectPtr val) { |
| xmlXPathFreeObject(val); |
| } |
| static void desret_xmlNodeSetPtr(xmlNodeSetPtr val) { |
| xmlXPathFreeNodeSet(val); |
| } |
| #endif |
| static void desret_xmlParserCtxtPtr(xmlParserCtxtPtr val) { |
| xmlFreeParserCtxt(val); |
| } |
| static void desret_xmlParserInputBufferPtr(xmlParserInputBufferPtr val) { |
| xmlFreeParserInputBuffer(val); |
| } |
| static void desret_xmlParserInputPtr(xmlParserInputPtr val) { |
| xmlFreeInputStream(val); |
| } |
| #ifdef LIBXML_WRITER_ENABLED |
| static void desret_xmlTextWriterPtr(xmlTextWriterPtr val) { |
| xmlFreeTextWriter(val); |
| } |
| #endif |
| static void desret_xmlBufferPtr(xmlBufferPtr val) { |
| xmlBufferFree(val); |
| } |
| #ifdef LIBXML_SCHEMAS_ENABLED |
| static void desret_xmlSchemaParserCtxtPtr(xmlSchemaParserCtxtPtr val) { |
| xmlSchemaFreeParserCtxt(val); |
| } |
| static void desret_xmlSchemaTypePtr(xmlSchemaTypePtr val ATTRIBUTE_UNUSED) { |
| } |
| #endif |
| #ifdef LIBXML_RELAXNG_ENABLED |
| static void desret_xmlRelaxNGParserCtxtPtr(xmlRelaxNGParserCtxtPtr val) { |
| xmlRelaxNGFreeParserCtxt(val); |
| } |
| #endif |
| #ifdef LIBXML_HTML_ENABLED |
| static void desret_const_htmlEntityDesc_ptr(const htmlEntityDesc * val ATTRIBUTE_UNUSED) { |
| } |
| #endif |
| #ifdef LIBXML_HTTP_ENABLED |
| static void desret_xmlNanoHTTPCtxtPtr(void *val) { |
| xmlNanoHTTPClose(val); |
| } |
| #endif |
| /* cut and pasted from autogenerated to avoid troubles */ |
| #define gen_nb_const_xmlChar_ptr_ptr 1 |
| static const xmlChar ** |
| gen_const_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { |
| return(NULL); |
| } |
| static void des_const_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, const xmlChar ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { |
| } |
| |
| #define gen_nb_unsigned_char_ptr 1 |
| static unsigned char * gen_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { |
| return(NULL); |
| } |
| static void des_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, unsigned char * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { |
| } |
| |
| #define gen_nb_const_unsigned_char_ptr 1 |
| static const unsigned char * |
| gen_const_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { |
| return(NULL); |
| } |
| static void des_const_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, const unsigned char * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { |
| } |
| |
| #ifdef LIBXML_HTML_ENABLED |
| #define gen_nb_htmlDocPtr 3 |
| static htmlDocPtr gen_htmlDocPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { |
| if (no == 0) return(htmlNewDoc(NULL, NULL)); |
| if (no == 1) return(htmlReadMemory("<html/>", 7, "test", NULL, 0)); |
| return(NULL); |
| } |
| static void des_htmlDocPtr(int no ATTRIBUTE_UNUSED, htmlDocPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { |
| if ((val != NULL) && (val != api_doc) && (val->doc != api_doc)) |
| xmlFreeDoc(val); |
| } |
| static void desret_htmlDocPtr(htmlDocPtr val) { |
| if ((val != NULL) && (val != api_doc) && (val->doc != api_doc)) |
| xmlFreeDoc(val); |
| } |
| #define gen_nb_htmlParserCtxtPtr 3 |
| static htmlParserCtxtPtr gen_htmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { |
| if (no == 0) return(xmlNewParserCtxt()); |
| if (no == 1) return(htmlCreateMemoryParserCtxt("<html/>", 7)); |
| return(NULL); |
| } |
| static void des_htmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, htmlParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { |
| if (val != NULL) |
| htmlFreeParserCtxt(val); |
| } |
| static void desret_htmlParserCtxtPtr(htmlParserCtxtPtr val) { |
| if (val != NULL) |
| htmlFreeParserCtxt(val); |
| } |
| #endif |
| |
| #ifdef LIBXML_XPATH_ENABLED |
| #define gen_nb_xmlNodeSetPtr 1 |
| static xmlNodeSetPtr gen_xmlNodeSetPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { |
| return(NULL); |
| } |
| static void des_xmlNodeSetPtr(int no ATTRIBUTE_UNUSED, xmlNodeSetPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { |
| } |
| #endif |
| |
| #ifdef LIBXML_PATTERN_ENABLED |
| #define gen_nb_xmlPatternPtr 1 |
| static xmlPatternPtr gen_xmlPatternPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { |
| return(NULL); |
| } |
| static void des_xmlPatternPtr(int no ATTRIBUTE_UNUSED, xmlPatternPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { |
| } |
| #endif |
| |
| #define gen_nb_xmlElementContentPtr 1 |
| static xmlElementContentPtr gen_xmlElementContentPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { |
| return(NULL); |
| } |
| static void des_xmlElementContentPtr(int no ATTRIBUTE_UNUSED, xmlElementContentPtr val, int nr ATTRIBUTE_UNUSED) { |
| if (val != NULL) |
| xmlFreeElementContent(val); |
| } |
| static void desret_xmlElementContentPtr(xmlElementContentPtr val) { |
| if (val != NULL) |
| xmlFreeElementContent(val); |
| } |
| |
| #define gen_nb_xmlParserNodeInfoSeqPtr 1 |
| static xmlParserNodeInfoSeqPtr gen_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { |
| return(NULL); |
| } |
| static void des_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, xmlParserNodeInfoSeqPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { |
| } |
| |
| static void desret_const_xmlParserNodeInfo_ptr(const xmlParserNodeInfo *val ATTRIBUTE_UNUSED) { |
| } |
| |
| #if defined(LIBXML_MODULES_ENABLED) || defined(LIBXML_READER_ENABLED) || \ |
| defined(LIBXML_SCHEMAS_ENABLED) |
| #define gen_nb_void_ptr_ptr 1 |
| static void ** gen_void_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { |
| return(NULL); |
| } |
| static void des_void_ptr_ptr(int no ATTRIBUTE_UNUSED, void ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { |
| } |
| #endif |
| |
| #define gen_nb_xmlParserInputPtr 1 |
| static xmlParserInputPtr gen_xmlParserInputPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { |
| return(NULL); |
| } |
| static void des_xmlParserInputPtr(int no ATTRIBUTE_UNUSED, xmlParserInputPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { |
| } |
| |
| /************************************************************************ |
| * * |
| * WARNING: end of the manually maintained part of the test code * |
| * do not remove or alter the CUT HERE line * |
| * * |
| ************************************************************************/ |
| |
| /* CUT HERE: everything below that line is generated */ |
| #ifdef LIBXML_HTML_ENABLED |
| static void desret_htmlStatus(htmlStatus val ATTRIBUTE_UNUSED) { |
| } |
| |
| #endif |
| |
| #define gen_nb_xmlAttributeDefault 4 |
| static xmlAttributeDefault gen_xmlAttributeDefault(int no, int nr ATTRIBUTE_UNUSED) { |
| if (no == 1) return(XML_ATTRIBUTE_FIXED); |
| if (no == 2) return(XML_ATTRIBUTE_IMPLIED); |
| if (no == 3) return(XML_ATTRIBUTE_NONE); |
| if (no == 4) return(XML_ATTRIBUTE_REQUIRED); |
| return(0); |
| } |
| |
| static void des_xmlAttributeDefault(int no ATTRIBUTE_UNUSED, xmlAttributeDefault val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { |
| } |
| |
| #define gen_nb_xmlAttributeType 4 |
| static xmlAttributeType gen_xmlAttributeType(int no, int nr ATTRIBUTE_UNUSED) { |
| if (no == 1) return(XML_ATTRIBUTE_CDATA); |
| if (no == 2) return(XML_ATTRIBUTE_ENTITIES); |
| if (no == 3) return(XML_ATTRIBUTE_ENTITY); |
| if (no == 4) return(XML_ATTRIBUTE_ENUMERATION); |
| return(0); |
| } |
| |
| static void des_xmlAttributeType(int no ATTRIBUTE_UNUSED, xmlAttributeType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { |
| } |
| |
| #define gen_nb_xmlBufferAllocationScheme 4 |
| static xmlBufferAllocationScheme gen_xmlBufferAllocationScheme(int no, int nr ATTRIBUTE_UNUSED) { |
| if (no == 1) return(XML_BUFFER_ALLOC_BOUNDED); |
| if (no == 2) return(XML_BUFFER_ALLOC_DOUBLEIT); |
| if (no == 3) return(XML_BUFFER_ALLOC_EXACT); |
| if (no == 4) return(XML_BUFFER_ALLOC_HYBRID); |
| return(0); |
| } |
| |
| static void des_xmlBufferAllocationScheme(int no ATTRIBUTE_UNUSED, xmlBufferAllocationScheme val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { |
| } |
| |
| static void desret_xmlBufferAllocationScheme(xmlBufferAllocationScheme val ATTRIBUTE_UNUSED) { |
| } |
| |
| #ifdef LIBXML_CATALOG_ENABLED |
| #define gen_nb_xmlCatalogAllow 4 |
| static xmlCatalogAllow gen_xmlCatalogAllow(int no, int nr ATTRIBUTE_UNUSED) { |
| if (no == 1) return(XML_CATA_ALLOW_ALL); |
| if (no == 2) return(XML_CATA_ALLOW_DOCUMENT); |
| if (no == 3) return(XML_CATA_ALLOW_GLOBAL); |
| if (no == 4) return(XML_CATA_ALLOW_NONE); |
| return(0); |
| } |
| |
| static void des_xmlCatalogAllow(int no ATTRIBUTE_UNUSED, xmlCatalogAllow val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { |
| } |
| |
| static void desret_xmlCatalogAllow(xmlCatalogAllow val ATTRIBUTE_UNUSED) { |
| } |
| |
| #endif |
| |
| #ifdef LIBXML_CATALOG_ENABLED |
| #define gen_nb_xmlCatalogPrefer 3 |
| static xmlCatalogPrefer gen_xmlCatalogPrefer(int no, int nr ATTRIBUTE_UNUSED) { |
| if (no == 1) return(XML_CATA_PREFER_NONE); |
| if (no == 2) return(XML_CATA_PREFER_PUBLIC); |
| if (no == 3) return(XML_CATA_PREFER_SYSTEM); |
| return(0); |
| } |
| |
| static void des_xmlCatalogPrefer(int no ATTRIBUTE_UNUSED, xmlCatalogPrefer val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { |
| } |
| |
| static void desret_xmlCatalogPrefer(xmlCatalogPrefer val ATTRIBUTE_UNUSED) { |
| } |
| |
| #endif |
| |
| #define gen_nb_xmlElementContentType 4 |
| static xmlElementContentType gen_xmlElementContentType(int no, int nr ATTRIBUTE_UNUSED) { |
| if (no == 1) return(XML_ELEMENT_CONTENT_ELEMENT); |
| if (no == 2) return(XML_ELEMENT_CONTENT_OR); |
| if (no == 3) return(XML_ELEMENT_CONTENT_PCDATA); |
| if (no == 4) return(XML_ELEMENT_CONTENT_SEQ); |
| return(0); |
| } |
| |
| static void des_xmlElementContentType(int no ATTRIBUTE_UNUSED, xmlElementContentType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { |
| } |
| |
| #define gen_nb_xmlElementTypeVal 4 |
| static xmlElementTypeVal gen_xmlElementTypeVal(int no, int nr ATTRIBUTE_UNUSED) { |
| if (no == 1) return(XML_ELEMENT_TYPE_ANY); |
| if (no == 2) return(XML_ELEMENT_TYPE_ELEMENT); |
| if (no == 3) return(XML_ELEMENT_TYPE_EMPTY); |
| if (no == 4) return(XML_ELEMENT_TYPE_MIXED); |
| return(0); |
| } |
| |
| static void des_xmlElementTypeVal(int no ATTRIBUTE_UNUSED, xmlElementTypeVal val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { |
| } |
| |
| #define gen_nb_xmlFeature 4 |
| static xmlFeature gen_xmlFeature(int no, int nr ATTRIBUTE_UNUSED) { |
| if (no == 1) return(XML_WITH_AUTOMATA); |
| if (no == 2) return(XML_WITH_C14N); |
| if (no == 3) return(XML_WITH_CATALOG); |
| if (no == 4) return(XML_WITH_DEBUG); |
| return(0); |
| } |
| |
| static void des_xmlFeature(int no ATTRIBUTE_UNUSED, xmlFeature val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { |
| } |
| |
| static void desret_xmlParserErrors(xmlParserErrors val ATTRIBUTE_UNUSED) { |
| } |
| |
| #define gen_nb_xmlParserInputFlags 4 |
| static xmlParserInputFlags gen_xmlParserInputFlags(int no, int nr ATTRIBUTE_UNUSED) { |
| if (no == 1) return(XML_INPUT_BUF_STATIC); |
| if (no == 2) return(XML_INPUT_BUF_ZERO_TERMINATED); |
| if (no == 3) return(XML_INPUT_NETWORK); |
| if (no == 4) return(XML_INPUT_UNZIP); |
| return(0); |
| } |
| |
| static void des_xmlParserInputFlags(int no ATTRIBUTE_UNUSED, xmlParserInputFlags val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { |
| } |
| |
| static void desret_xmlParserStatus(xmlParserStatus val ATTRIBUTE_UNUSED) { |
| } |
| |
| #ifdef LIBXML_SCHEMAS_ENABLED |
| #define gen_nb_xmlSchemaValType 4 |
| static xmlSchemaValType gen_xmlSchemaValType(int no, int nr ATTRIBUTE_UNUSED) { |
| if (no == 1) return(XML_SCHEMAS_ANYSIMPLETYPE); |
| if (no == 2) return(XML_SCHEMAS_ANYTYPE); |
| if (no == 3) return(XML_SCHEMAS_ANYURI); |
| if (no == 4) return(XML_SCHEMAS_BASE64BINARY); |
| return(0); |
| } |
| |
| static void des_xmlSchemaValType(int no ATTRIBUTE_UNUSED, xmlSchemaValType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { |
| } |
| |
| static void desret_xmlSchemaValType(xmlSchemaValType val ATTRIBUTE_UNUSED) { |
| } |
| |
| #endif |
| |
| #ifdef LIBXML_SCHEMAS_ENABLED |
| #define gen_nb_xmlSchemaWhitespaceValueType 4 |
| static xmlSchemaWhitespaceValueType gen_xmlSchemaWhitespaceValueType(int no, int nr ATTRIBUTE_UNUSED) { |
| if (no == 1) return(XML_SCHEMA_WHITESPACE_COLLAPSE); |
| if (no == 2) return(XML_SCHEMA_WHITESPACE_PRESERVE); |
| if (no == 3) return(XML_SCHEMA_WHITESPACE_REPLACE); |
| if (no == 4) return(XML_SCHEMA_WHITESPACE_UNKNOWN); |
| return(0); |
| } |
| |
| static void des_xmlSchemaWhitespaceValueType(int no ATTRIBUTE_UNUSED, xmlSchemaWhitespaceValueType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { |
| } |
| |
| #endif |
| |
| #include <libxml/HTMLparser.h> |
| #include <libxml/HTMLtree.h> |
| #include <libxml/SAX2.h> |
| #include <libxml/c14n.h> |
| #include <libxml/catalog.h> |
| #include <libxml/chvalid.h> |
| #include <libxml/debugXML.h> |
| #include <libxml/dict.h> |
| #include <libxml/encoding.h> |
| #include <libxml/entities.h> |
| #include <libxml/hash.h> |
| #include <libxml/list.h> |
| #include <libxml/nanohttp.h> |
| #include <libxml/parser.h> |
| #include <libxml/parserInternals.h> |
| #include <libxml/pattern.h> |
| #include <libxml/relaxng.h> |
| #include <libxml/schemasInternals.h> |
| #include <libxml/schematron.h> |
| #include <libxml/tree.h> |
| #include <libxml/uri.h> |
| #include <libxml/valid.h> |
| #include <libxml/xinclude.h> |
| #include <libxml/xmlIO.h> |
| #include <libxml/xmlautomata.h> |
| #include <libxml/xmlerror.h> |
| #include <libxml/xmlmodule.h> |
| #include <libxml/xmlreader.h> |
| #include <libxml/xmlregexp.h> |
| #include <libxml/xmlsave.h> |
| #include <libxml/xmlschemas.h> |
| #include <libxml/xmlschemastypes.h> |
| #include <libxml/xmlstring.h> |
| #include <libxml/xmlwriter.h> |
| #include <libxml/xpath.h> |
| #include <libxml/xpathInternals.h> |
| #include <libxml/xpointer.h> |
| static int test_HTMLparser(void); |
| static int test_HTMLtree(void); |
| static int test_SAX2(void); |
| static int test_c14n(void); |
| static int test_catalog(void); |
| static int test_chvalid(void); |
| static int test_debugXML(void); |
| static int test_dict(void); |
| static int test_encoding(void); |
| static int test_entities(void); |
| static int test_hash(void); |
| static int test_list(void); |
| static int test_nanohttp(void); |
| static int test_parser(void); |
| static int test_parserInternals(void); |
| static int test_pattern(void); |
| static int test_relaxng(void); |
| static int test_schemasInternals(void); |
| static int test_schematron(void); |
| static int test_tree(void); |
| static int test_uri(void); |
| static int test_valid(void); |
| static int test_xinclude(void); |
| static int test_xmlIO(void); |
| static int test_xmlautomata(void); |
| static int test_xmlerror(void); |
| static int test_xmlmodule(void); |
| static int test_xmlreader(void); |
| static int test_xmlregexp(void); |
| static int test_xmlsave(void); |
| static int test_xmlschemas(void); |
| static int test_xmlschemastypes(void); |
| static int test_xmlstring(void); |
| static int test_xmlwriter(void); |
| static int test_xpath(void); |
| static int test_xpathInternals(void); |
| static int test_xpointer(void); |
| |
| /** |
| * testlibxml2: |
| * |
| * Main entry point of the tester for the full libxml2 module, |
| * it calls all the tester entry point for each module. |
| * |
| * Returns the number of error found |
| */ |
| static int |
| testlibxml2(void) |
| { |
| int test_ret = 0; |
| |
| test_ret += test_HTMLparser(); |
| test_ret += test_HTMLtree(); |
| test_ret += test_SAX2(); |
| test_ret += test_c14n(); |
| test_ret += test_catalog(); |
| test_ret += test_chvalid(); |
| test_ret += test_debugXML(); |
| test_ret += test_dict(); |
| test_ret += test_encoding(); |
| test_ret += test_entities(); |
| test_ret += test_hash(); |
| test_ret += test_list(); |
| test_ret += test_nanohttp(); |
| test_ret += test_parser(); |
| test_ret += test_parserInternals(); |
| test_ret += test_pattern(); |
| test_ret += test_relaxng(); |
| test_ret += test_schemasInternals(); |
| test_ret += test_schematron(); |
| test_ret += test_tree(); |
| test_ret += test_uri(); |
| test_ret += test_valid(); |
| test_ret += test_xinclude(); |
| test_ret += test_xmlIO(); |
| test_ret += test_xmlautomata(); |
| test_ret += test_xmlerror(); |
| test_ret += test_xmlmodule(); |
| test_ret += test_xmlreader(); |
| test_ret += test_xmlregexp(); |
| test_ret += test_xmlsave(); |
| test_ret += test_xmlschemas(); |
| test_ret += test_xmlschemastypes(); |
| test_ret += test_xmlstring(); |
| test_ret += test_xmlwriter(); |
| test_ret += test_xpath(); |
| test_ret += test_xpathInternals(); |
| test_ret += test_xpointer(); |
| |
| printf("Total: %d functions, %d tests, %d errors\n", |
| function_tests, call_tests, test_ret); |
| return(test_ret); |
| } |
| |
| #ifdef LIBXML_HTML_ENABLED |
| |
| #define gen_nb_const_htmlElemDesc_ptr 1 |
| #define gen_const_htmlElemDesc_ptr(no, nr) NULL |
| #define des_const_htmlElemDesc_ptr(no, val, nr) |
| #endif |
| |
| |
| static int |
| test_htmlAttrAllowed(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_HTML_ENABLED) |
| int mem_base; |
| htmlStatus ret_val; |
| const htmlElemDesc * elt; /* HTML element */ |
| int n_elt; |
| const xmlChar * attr; /* HTML attribute */ |
| int n_attr; |
| int legacy; /* whether to allow deprecated attributes */ |
| int n_legacy; |
| |
| for (n_elt = 0;n_elt < gen_nb_const_htmlElemDesc_ptr;n_elt++) { |
| for (n_attr = 0;n_attr < gen_nb_const_xmlChar_ptr;n_attr++) { |
| for (n_legacy = 0;n_legacy < gen_nb_int;n_legacy++) { |
| mem_base = xmlMemBlocks(); |
| elt = gen_const_htmlElemDesc_ptr(n_elt, 0); |
| attr = gen_const_xmlChar_ptr(n_attr, 1); |
| legacy = gen_int(n_legacy, 2); |
| |
| ret_val = htmlAttrAllowed(elt, attr, legacy); |
| desret_htmlStatus(ret_val); |
| call_tests++; |
| des_const_htmlElemDesc_ptr(n_elt, elt, 0); |
| des_const_xmlChar_ptr(n_attr, attr, 1); |
| des_int(n_legacy, legacy, 2); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in htmlAttrAllowed", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_elt); |
| printf(" %d", n_attr); |
| printf(" %d", n_legacy); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| #ifdef LIBXML_HTML_ENABLED |
| |
| #define gen_nb_htmlNodePtr 1 |
| #define gen_htmlNodePtr(no, nr) NULL |
| #define des_htmlNodePtr(no, val, nr) |
| #endif |
| |
| |
| static int |
| test_htmlAutoCloseTag(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_HTML_ENABLED) |
| int mem_base; |
| int ret_val; |
| htmlDocPtr doc; /* the HTML document */ |
| int n_doc; |
| const xmlChar * name; /* The tag name */ |
| int n_name; |
| htmlNodePtr elem; /* the HTML element */ |
| int n_elem; |
| |
| for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) { |
| for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { |
| for (n_elem = 0;n_elem < gen_nb_htmlNodePtr;n_elem++) { |
| mem_base = xmlMemBlocks(); |
| doc = gen_htmlDocPtr(n_doc, 0); |
| name = gen_const_xmlChar_ptr(n_name, 1); |
| elem = gen_htmlNodePtr(n_elem, 2); |
| |
| ret_val = htmlAutoCloseTag(doc, name, elem); |
| desret_int(ret_val); |
| call_tests++; |
| des_htmlDocPtr(n_doc, doc, 0); |
| des_const_xmlChar_ptr(n_name, name, 1); |
| des_htmlNodePtr(n_elem, elem, 2); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in htmlAutoCloseTag", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_doc); |
| printf(" %d", n_name); |
| printf(" %d", n_elem); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_htmlCreateFileParserCtxt(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_HTML_ENABLED) |
| int mem_base; |
| htmlParserCtxtPtr ret_val; |
| const char * filename; /* the filename */ |
| int n_filename; |
| const char * encoding; /* optional encoding */ |
| int n_encoding; |
| |
| for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) { |
| for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { |
| mem_base = xmlMemBlocks(); |
| filename = gen_fileoutput(n_filename, 0); |
| encoding = gen_const_char_ptr(n_encoding, 1); |
| |
| ret_val = htmlCreateFileParserCtxt(filename, encoding); |
| desret_htmlParserCtxtPtr(ret_val); |
| call_tests++; |
| des_fileoutput(n_filename, filename, 0); |
| des_const_char_ptr(n_encoding, encoding, 1); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in htmlCreateFileParserCtxt", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_filename); |
| printf(" %d", n_encoding); |
| printf("\n"); |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_htmlCreateMemoryParserCtxt(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_HTML_ENABLED) |
| int mem_base; |
| htmlParserCtxtPtr ret_val; |
| const char * buffer; /* a pointer to a char array */ |
| int n_buffer; |
| int size; /* the size of the array */ |
| int n_size; |
| |
| for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) { |
| for (n_size = 0;n_size < gen_nb_int;n_size++) { |
| mem_base = xmlMemBlocks(); |
| buffer = gen_const_char_ptr(n_buffer, 0); |
| size = gen_int(n_size, 1); |
| if ((buffer != NULL) && |
| (size > xmlStrlen(BAD_CAST buffer))) |
| size = 0; |
| |
| ret_val = htmlCreateMemoryParserCtxt(buffer, size); |
| desret_htmlParserCtxtPtr(ret_val); |
| call_tests++; |
| des_const_char_ptr(n_buffer, buffer, 0); |
| des_int(n_size, size, 1); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in htmlCreateMemoryParserCtxt", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_buffer); |
| printf(" %d", n_size); |
| printf("\n"); |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| #ifdef LIBXML_HTML_ENABLED |
| |
| #define gen_nb_htmlSAXHandlerPtr 1 |
| #define gen_htmlSAXHandlerPtr(no, nr) NULL |
| #define des_htmlSAXHandlerPtr(no, val, nr) |
| #endif |
| |
| |
| static int |
| test_htmlCreatePushParserCtxt(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_PUSH_ENABLED) |
| int mem_base; |
| htmlParserCtxtPtr ret_val; |
| htmlSAXHandlerPtr sax; /* a SAX handler (optional) */ |
| int n_sax; |
| void * user_data; /* The user data returned on SAX callbacks (optional) */ |
| int n_user_data; |
| const char * chunk; /* a pointer to an array of chars (optional) */ |
| int n_chunk; |
| int size; /* number of chars in the array */ |
| int n_size; |
| const char * filename; /* only used for error reporting (optional) */ |
| int n_filename; |
| xmlCharEncoding enc; /* encoding (deprecated, pass XML_CHAR_ENCODING_NONE) */ |
| int n_enc; |
| |
| for (n_sax = 0;n_sax < gen_nb_htmlSAXHandlerPtr;n_sax++) { |
| for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) { |
| for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) { |
| for (n_size = 0;n_size < gen_nb_int;n_size++) { |
| for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) { |
| for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) { |
| mem_base = xmlMemBlocks(); |
| sax = gen_htmlSAXHandlerPtr(n_sax, 0); |
| user_data = gen_userdata(n_user_data, 1); |
| chunk = gen_const_char_ptr(n_chunk, 2); |
| size = gen_int(n_size, 3); |
| filename = gen_fileoutput(n_filename, 4); |
| enc = gen_xmlCharEncoding(n_enc, 5); |
| if ((chunk != NULL) && |
| (size > xmlStrlen(BAD_CAST chunk))) |
| size = 0; |
| |
| ret_val = htmlCreatePushParserCtxt(sax, user_data, chunk, size, filename, enc); |
| desret_htmlParserCtxtPtr(ret_val); |
| call_tests++; |
| des_htmlSAXHandlerPtr(n_sax, sax, 0); |
| des_userdata(n_user_data, user_data, 1); |
| des_const_char_ptr(n_chunk, chunk, 2); |
| des_int(n_size, size, 3); |
| des_fileoutput(n_filename, filename, 4); |
| des_xmlCharEncoding(n_enc, enc, 5); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in htmlCreatePushParserCtxt", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_sax); |
| printf(" %d", n_user_data); |
| printf(" %d", n_chunk); |
| printf(" %d", n_size); |
| printf(" %d", n_filename); |
| printf(" %d", n_enc); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_htmlCtxtParseDocument(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_HTML_ENABLED) |
| int mem_base; |
| htmlDocPtr ret_val; |
| htmlParserCtxtPtr ctxt; /* an HTML parser context */ |
| int n_ctxt; |
| xmlParserInputPtr input; /* parser input */ |
| int n_input; |
| |
| for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) { |
| for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) { |
| mem_base = xmlMemBlocks(); |
| ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0); |
| input = gen_xmlParserInputPtr(n_input, 1); |
| |
| ret_val = htmlCtxtParseDocument(ctxt, input); |
| desret_htmlDocPtr(ret_val); |
| call_tests++; |
| des_htmlParserCtxtPtr(n_ctxt, ctxt, 0); |
| des_xmlParserInputPtr(n_input, input, 1); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in htmlCtxtParseDocument", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctxt); |
| printf(" %d", n_input); |
| printf("\n"); |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_htmlCtxtReadDoc(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_HTML_ENABLED) |
| int mem_base; |
| htmlDocPtr ret_val; |
| htmlParserCtxtPtr ctxt; /* an HTML parser context */ |
| int n_ctxt; |
| const xmlChar * str; /* a pointer to a zero terminated string */ |
| int n_str; |
| const char * URL; /* only used for error reporting (optional) */ |
| int n_URL; |
| const char * encoding; /* the document encoding (optional) */ |
| int n_encoding; |
| int options; /* a combination of htmlParserOptions */ |
| int n_options; |
| |
| for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) { |
| for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) { |
| for (n_URL = 0;n_URL < gen_nb_const_char_ptr;n_URL++) { |
| for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { |
| for (n_options = 0;n_options < gen_nb_int;n_options++) { |
| mem_base = xmlMemBlocks(); |
| ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0); |
| str = gen_const_xmlChar_ptr(n_str, 1); |
| URL = gen_const_char_ptr(n_URL, 2); |
| encoding = gen_const_char_ptr(n_encoding, 3); |
| options = gen_int(n_options, 4); |
| |
| ret_val = htmlCtxtReadDoc(ctxt, str, URL, encoding, options); |
| desret_htmlDocPtr(ret_val); |
| call_tests++; |
| des_htmlParserCtxtPtr(n_ctxt, ctxt, 0); |
| des_const_xmlChar_ptr(n_str, str, 1); |
| des_const_char_ptr(n_URL, URL, 2); |
| des_const_char_ptr(n_encoding, encoding, 3); |
| des_int(n_options, options, 4); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in htmlCtxtReadDoc", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctxt); |
| printf(" %d", n_str); |
| printf(" %d", n_URL); |
| printf(" %d", n_encoding); |
| printf(" %d", n_options); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_htmlCtxtReadFile(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_HTML_ENABLED) |
| htmlDocPtr ret_val; |
| htmlParserCtxtPtr ctxt; /* an HTML parser context */ |
| int n_ctxt; |
| const char * filename; /* a file or URL */ |
| int n_filename; |
| const char * encoding; /* the document encoding (optional) */ |
| int n_encoding; |
| int options; /* a combination of htmlParserOptions */ |
| int n_options; |
| |
| for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) { |
| for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { |
| for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { |
| for (n_options = 0;n_options < gen_nb_int;n_options++) { |
| ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0); |
| filename = gen_filepath(n_filename, 1); |
| encoding = gen_const_char_ptr(n_encoding, 2); |
| options = gen_int(n_options, 3); |
| |
| ret_val = htmlCtxtReadFile(ctxt, filename, encoding, options); |
| desret_htmlDocPtr(ret_val); |
| call_tests++; |
| des_htmlParserCtxtPtr(n_ctxt, ctxt, 0); |
| des_filepath(n_filename, filename, 1); |
| des_const_char_ptr(n_encoding, encoding, 2); |
| des_int(n_options, options, 3); |
| xmlResetLastError(); |
| } |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_htmlCtxtReadMemory(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_HTML_ENABLED) |
| int mem_base; |
| htmlDocPtr ret_val; |
| htmlParserCtxtPtr ctxt; /* an HTML parser context */ |
| int n_ctxt; |
| const char * buffer; /* a pointer to a char array */ |
| int n_buffer; |
| int size; /* the size of the array */ |
| int n_size; |
| const char * URL; /* only used for error reporting (optional) */ |
| int n_URL; |
| const char * encoding; /* the document encoding (optinal) */ |
| int n_encoding; |
| int options; /* a combination of htmlParserOptions */ |
| int n_options; |
| |
| for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) { |
| for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) { |
| for (n_size = 0;n_size < gen_nb_int;n_size++) { |
| for (n_URL = 0;n_URL < gen_nb_const_char_ptr;n_URL++) { |
| for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { |
| for (n_options = 0;n_options < gen_nb_int;n_options++) { |
| mem_base = xmlMemBlocks(); |
| ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0); |
| buffer = gen_const_char_ptr(n_buffer, 1); |
| size = gen_int(n_size, 2); |
| URL = gen_const_char_ptr(n_URL, 3); |
| encoding = gen_const_char_ptr(n_encoding, 4); |
| options = gen_int(n_options, 5); |
| if ((buffer != NULL) && |
| (size > xmlStrlen(BAD_CAST buffer))) |
| size = 0; |
| |
| ret_val = htmlCtxtReadMemory(ctxt, buffer, size, URL, encoding, options); |
| desret_htmlDocPtr(ret_val); |
| call_tests++; |
| des_htmlParserCtxtPtr(n_ctxt, ctxt, 0); |
| des_const_char_ptr(n_buffer, buffer, 1); |
| des_int(n_size, size, 2); |
| des_const_char_ptr(n_URL, URL, 3); |
| des_const_char_ptr(n_encoding, encoding, 4); |
| des_int(n_options, options, 5); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in htmlCtxtReadMemory", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctxt); |
| printf(" %d", n_buffer); |
| printf(" %d", n_size); |
| printf(" %d", n_URL); |
| printf(" %d", n_encoding); |
| printf(" %d", n_options); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_htmlCtxtReset(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_HTML_ENABLED) |
| int mem_base; |
| htmlParserCtxtPtr ctxt; /* an HTML parser context */ |
| int n_ctxt; |
| |
| for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) { |
| mem_base = xmlMemBlocks(); |
| ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0); |
| |
| htmlCtxtReset(ctxt); |
| call_tests++; |
| des_htmlParserCtxtPtr(n_ctxt, ctxt, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in htmlCtxtReset", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctxt); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_htmlCtxtSetOptions(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_HTML_ENABLED) |
| int mem_base; |
| int ret_val; |
| xmlParserCtxtPtr ctxt; /* an HTML parser context */ |
| int n_ctxt; |
| int options; /* a bitmask of xmlParserOption values */ |
| int n_options; |
| |
| for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { |
| for (n_options = 0;n_options < gen_nb_int;n_options++) { |
| mem_base = xmlMemBlocks(); |
| ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); |
| options = gen_int(n_options, 1); |
| |
| ret_val = htmlCtxtSetOptions(ctxt, options); |
| desret_int(ret_val); |
| call_tests++; |
| des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); |
| des_int(n_options, options, 1); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in htmlCtxtSetOptions", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctxt); |
| printf(" %d", n_options); |
| printf("\n"); |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_htmlCtxtUseOptions(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_HTML_ENABLED) |
| int mem_base; |
| int ret_val; |
| htmlParserCtxtPtr ctxt; /* an HTML parser context */ |
| int n_ctxt; |
| int options; /* a combination of htmlParserOption(s) */ |
| int n_options; |
| |
| for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) { |
| for (n_options = 0;n_options < gen_nb_int;n_options++) { |
| mem_base = xmlMemBlocks(); |
| ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0); |
| options = gen_int(n_options, 1); |
| |
| ret_val = htmlCtxtUseOptions(ctxt, options); |
| desret_int(ret_val); |
| call_tests++; |
| des_htmlParserCtxtPtr(n_ctxt, ctxt, 0); |
| des_int(n_options, options, 1); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in htmlCtxtUseOptions", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctxt); |
| printf(" %d", n_options); |
| printf("\n"); |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_htmlElementAllowedHere(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_HTML_ENABLED) |
| int mem_base; |
| int ret_val; |
| const htmlElemDesc * parent; /* HTML parent element */ |
| int n_parent; |
| const xmlChar * elt; /* HTML element */ |
| int n_elt; |
| |
| for (n_parent = 0;n_parent < gen_nb_const_htmlElemDesc_ptr;n_parent++) { |
| for (n_elt = 0;n_elt < gen_nb_const_xmlChar_ptr;n_elt++) { |
| mem_base = xmlMemBlocks(); |
| parent = gen_const_htmlElemDesc_ptr(n_parent, 0); |
| elt = gen_const_xmlChar_ptr(n_elt, 1); |
| |
| ret_val = htmlElementAllowedHere(parent, elt); |
| desret_int(ret_val); |
| call_tests++; |
| des_const_htmlElemDesc_ptr(n_parent, parent, 0); |
| des_const_xmlChar_ptr(n_elt, elt, 1); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in htmlElementAllowedHere", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_parent); |
| printf(" %d", n_elt); |
| printf("\n"); |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_htmlElementStatusHere(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_HTML_ENABLED) |
| int mem_base; |
| htmlStatus ret_val; |
| const htmlElemDesc * parent; /* HTML parent element */ |
| int n_parent; |
| const htmlElemDesc * elt; /* HTML element */ |
| int n_elt; |
| |
| for (n_parent = 0;n_parent < gen_nb_const_htmlElemDesc_ptr;n_parent++) { |
| for (n_elt = 0;n_elt < gen_nb_const_htmlElemDesc_ptr;n_elt++) { |
| mem_base = xmlMemBlocks(); |
| parent = gen_const_htmlElemDesc_ptr(n_parent, 0); |
| elt = gen_const_htmlElemDesc_ptr(n_elt, 1); |
| |
| ret_val = htmlElementStatusHere(parent, elt); |
| desret_htmlStatus(ret_val); |
| call_tests++; |
| des_const_htmlElemDesc_ptr(n_parent, parent, 0); |
| des_const_htmlElemDesc_ptr(n_elt, elt, 1); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in htmlElementStatusHere", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_parent); |
| printf(" %d", n_elt); |
| printf("\n"); |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_htmlEncodeEntities(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_HTML_ENABLED) |
| int mem_base; |
| int ret_val; |
| unsigned char * out; /* a pointer to an array of bytes to store the result */ |
| int n_out; |
| int * outlen; /* the length of @out */ |
| int n_outlen; |
| const unsigned char * in; /* a pointer to an array of UTF-8 chars */ |
| int n_in; |
| int * inlen; /* the length of @in */ |
| int n_inlen; |
| int quoteChar; /* the quote character to escape (' or ") or zero. */ |
| int n_quoteChar; |
| |
| for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) { |
| for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) { |
| for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) { |
| for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) { |
| for (n_quoteChar = 0;n_quoteChar < gen_nb_int;n_quoteChar++) { |
| mem_base = xmlMemBlocks(); |
| out = gen_unsigned_char_ptr(n_out, 0); |
| outlen = gen_int_ptr(n_outlen, 1); |
| in = gen_const_unsigned_char_ptr(n_in, 2); |
| inlen = gen_int_ptr(n_inlen, 3); |
| quoteChar = gen_int(n_quoteChar, 4); |
| |
| ret_val = htmlEncodeEntities(out, outlen, in, inlen, quoteChar); |
| desret_int(ret_val); |
| call_tests++; |
| des_unsigned_char_ptr(n_out, out, 0); |
| des_int_ptr(n_outlen, outlen, 1); |
| des_const_unsigned_char_ptr(n_in, in, 2); |
| des_int_ptr(n_inlen, inlen, 3); |
| des_int(n_quoteChar, quoteChar, 4); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in htmlEncodeEntities", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_out); |
| printf(" %d", n_outlen); |
| printf(" %d", n_in); |
| printf(" %d", n_inlen); |
| printf(" %d", n_quoteChar); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_htmlEntityLookup(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_HTML_ENABLED) |
| int mem_base; |
| const htmlEntityDesc * ret_val; |
| const xmlChar * name; /* the entity name */ |
| int n_name; |
| |
| for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { |
| mem_base = xmlMemBlocks(); |
| name = gen_const_xmlChar_ptr(n_name, 0); |
| |
| ret_val = htmlEntityLookup(name); |
| desret_const_htmlEntityDesc_ptr(ret_val); |
| call_tests++; |
| des_const_xmlChar_ptr(n_name, name, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in htmlEntityLookup", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_name); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_htmlEntityValueLookup(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_HTML_ENABLED) |
| int mem_base; |
| const htmlEntityDesc * ret_val; |
| unsigned int value; /* the entity's unicode value */ |
| int n_value; |
| |
| for (n_value = 0;n_value < gen_nb_unsigned_int;n_value++) { |
| mem_base = xmlMemBlocks(); |
| value = gen_unsigned_int(n_value, 0); |
| |
| ret_val = htmlEntityValueLookup(value); |
| desret_const_htmlEntityDesc_ptr(ret_val); |
| call_tests++; |
| des_unsigned_int(n_value, value, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in htmlEntityValueLookup", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_value); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_htmlHandleOmittedElem(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_HTML_ENABLED) |
| int mem_base; |
| int ret_val; |
| int val; /* int 0 or 1 */ |
| int n_val; |
| |
| for (n_val = 0;n_val < gen_nb_int;n_val++) { |
| mem_base = xmlMemBlocks(); |
| val = gen_int(n_val, 0); |
| |
| ret_val = htmlHandleOmittedElem(val); |
| desret_int(ret_val); |
| call_tests++; |
| des_int(n_val, val, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in htmlHandleOmittedElem", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_val); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_htmlInitAutoClose(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_HTML_ENABLED) |
| int mem_base; |
| |
| mem_base = xmlMemBlocks(); |
| |
| htmlInitAutoClose(); |
| call_tests++; |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in htmlInitAutoClose", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf("\n"); |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_htmlIsAutoClosed(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_HTML_ENABLED) |
| int mem_base; |
| int ret_val; |
| htmlDocPtr doc; /* the HTML document */ |
| int n_doc; |
| htmlNodePtr elem; /* the HTML element */ |
| int n_elem; |
| |
| for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) { |
| for (n_elem = 0;n_elem < gen_nb_htmlNodePtr;n_elem++) { |
| mem_base = xmlMemBlocks(); |
| doc = gen_htmlDocPtr(n_doc, 0); |
| elem = gen_htmlNodePtr(n_elem, 1); |
| |
| ret_val = htmlIsAutoClosed(doc, elem); |
| desret_int(ret_val); |
| call_tests++; |
| des_htmlDocPtr(n_doc, doc, 0); |
| des_htmlNodePtr(n_elem, elem, 1); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in htmlIsAutoClosed", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_doc); |
| printf(" %d", n_elem); |
| printf("\n"); |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_htmlIsScriptAttribute(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_HTML_ENABLED) |
| int mem_base; |
| int ret_val; |
| const xmlChar * name; /* an attribute name */ |
| int n_name; |
| |
| for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { |
| mem_base = xmlMemBlocks(); |
| name = gen_const_xmlChar_ptr(n_name, 0); |
| |
| ret_val = htmlIsScriptAttribute(name); |
| desret_int(ret_val); |
| call_tests++; |
| des_const_xmlChar_ptr(n_name, name, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in htmlIsScriptAttribute", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_name); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_htmlNewParserCtxt(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_HTML_ENABLED) |
| int mem_base; |
| htmlParserCtxtPtr ret_val; |
| |
| mem_base = xmlMemBlocks(); |
| |
| ret_val = htmlNewParserCtxt(); |
| desret_htmlParserCtxtPtr(ret_val); |
| call_tests++; |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in htmlNewParserCtxt", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf("\n"); |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| #ifdef LIBXML_HTML_ENABLED |
| |
| #define gen_nb_const_htmlSAXHandler_ptr 1 |
| #define gen_const_htmlSAXHandler_ptr(no, nr) NULL |
| #define des_const_htmlSAXHandler_ptr(no, val, nr) |
| #endif |
| |
| |
| static int |
| test_htmlNewSAXParserCtxt(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_HTML_ENABLED) |
| int mem_base; |
| htmlParserCtxtPtr ret_val; |
| const htmlSAXHandler * sax; /* SAX handler */ |
| int n_sax; |
| void * userData; /* user data */ |
| int n_userData; |
| |
| for (n_sax = 0;n_sax < gen_nb_const_htmlSAXHandler_ptr;n_sax++) { |
| for (n_userData = 0;n_userData < gen_nb_userdata;n_userData++) { |
| mem_base = xmlMemBlocks(); |
| sax = gen_const_htmlSAXHandler_ptr(n_sax, 0); |
| userData = gen_userdata(n_userData, 1); |
| |
| ret_val = htmlNewSAXParserCtxt(sax, userData); |
| desret_htmlParserCtxtPtr(ret_val); |
| call_tests++; |
| des_const_htmlSAXHandler_ptr(n_sax, sax, 0); |
| des_userdata(n_userData, userData, 1); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in htmlNewSAXParserCtxt", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_sax); |
| printf(" %d", n_userData); |
| printf("\n"); |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_htmlNodeStatus(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_HTML_ENABLED) |
| int mem_base; |
| htmlStatus ret_val; |
| htmlNodePtr node; /* an htmlNodePtr in a tree */ |
| int n_node; |
| int legacy; /* whether to allow deprecated elements (YES is faster here for Element nodes) */ |
| int n_legacy; |
| |
| for (n_node = 0;n_node < gen_nb_htmlNodePtr;n_node++) { |
| for (n_legacy = 0;n_legacy < gen_nb_int;n_legacy++) { |
| mem_base = xmlMemBlocks(); |
| node = gen_htmlNodePtr(n_node, 0); |
| legacy = gen_int(n_legacy, 1); |
| |
| ret_val = htmlNodeStatus(node, legacy); |
| desret_htmlStatus(ret_val); |
| call_tests++; |
| des_htmlNodePtr(n_node, node, 0); |
| des_int(n_legacy, legacy, 1); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in htmlNodeStatus", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_node); |
| printf(" %d", n_legacy); |
| printf("\n"); |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_htmlParseCharRef(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_HTML_ENABLED) |
| int mem_base; |
| int ret_val; |
| htmlParserCtxtPtr ctxt; /* an HTML parser context */ |
| int n_ctxt; |
| |
| for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) { |
| mem_base = xmlMemBlocks(); |
| ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0); |
| |
| ret_val = htmlParseCharRef(ctxt); |
| desret_int(ret_val); |
| call_tests++; |
| des_htmlParserCtxtPtr(n_ctxt, ctxt, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in htmlParseCharRef", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctxt); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_htmlParseChunk(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_PUSH_ENABLED) |
| int mem_base; |
| int ret_val; |
| htmlParserCtxtPtr ctxt; /* an HTML parser context */ |
| int n_ctxt; |
| const char * chunk; /* chunk of memory */ |
| int n_chunk; |
| int size; /* size of chunk in bytes */ |
| int n_size; |
| int terminate; /* last chunk indicator */ |
| int n_terminate; |
| |
| for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) { |
| for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) { |
| for (n_size = 0;n_size < gen_nb_int;n_size++) { |
| for (n_terminate = 0;n_terminate < gen_nb_int;n_terminate++) { |
| mem_base = xmlMemBlocks(); |
| ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0); |
| chunk = gen_const_char_ptr(n_chunk, 1); |
| size = gen_int(n_size, 2); |
| terminate = gen_int(n_terminate, 3); |
| if ((chunk != NULL) && |
| (size > xmlStrlen(BAD_CAST chunk))) |
| size = 0; |
| |
| ret_val = htmlParseChunk(ctxt, chunk, size, terminate); |
| if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;} |
| desret_int(ret_val); |
| call_tests++; |
| des_htmlParserCtxtPtr(n_ctxt, ctxt, 0); |
| des_const_char_ptr(n_chunk, chunk, 1); |
| des_int(n_size, size, 2); |
| des_int(n_terminate, terminate, 3); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in htmlParseChunk", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctxt); |
| printf(" %d", n_chunk); |
| printf(" %d", n_size); |
| printf(" %d", n_terminate); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_htmlParseDoc(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_HTML_ENABLED) |
| int mem_base; |
| htmlDocPtr ret_val; |
| const xmlChar * cur; /* a pointer to an array of xmlChar */ |
| int n_cur; |
| const char * encoding; /* the encoding (optional) */ |
| int n_encoding; |
| |
| for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) { |
| for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { |
| mem_base = xmlMemBlocks(); |
| cur = gen_const_xmlChar_ptr(n_cur, 0); |
| encoding = gen_const_char_ptr(n_encoding, 1); |
| |
| ret_val = htmlParseDoc(cur, encoding); |
| desret_htmlDocPtr(ret_val); |
| call_tests++; |
| des_const_xmlChar_ptr(n_cur, cur, 0); |
| des_const_char_ptr(n_encoding, encoding, 1); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in htmlParseDoc", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_cur); |
| printf(" %d", n_encoding); |
| printf("\n"); |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_htmlParseDocument(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_HTML_ENABLED) |
| int mem_base; |
| int ret_val; |
| htmlParserCtxtPtr ctxt; /* an HTML parser context */ |
| int n_ctxt; |
| |
| for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) { |
| mem_base = xmlMemBlocks(); |
| ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0); |
| |
| ret_val = htmlParseDocument(ctxt); |
| if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;} |
| desret_int(ret_val); |
| call_tests++; |
| des_htmlParserCtxtPtr(n_ctxt, ctxt, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in htmlParseDocument", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctxt); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_htmlParseElement(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_HTML_ENABLED) |
| int mem_base; |
| htmlParserCtxtPtr ctxt; /* an HTML parser context */ |
| int n_ctxt; |
| |
| for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) { |
| mem_base = xmlMemBlocks(); |
| ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0); |
| |
| htmlParseElement(ctxt); |
| call_tests++; |
| des_htmlParserCtxtPtr(n_ctxt, ctxt, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in htmlParseElement", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctxt); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_htmlParseEntityRef(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_HTML_ENABLED) |
| int mem_base; |
| const htmlEntityDesc * ret_val; |
| htmlParserCtxtPtr ctxt; /* an HTML parser context */ |
| int n_ctxt; |
| const xmlChar ** str; /* location to store the entity name */ |
| int n_str; |
| |
| for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) { |
| for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr_ptr;n_str++) { |
| mem_base = xmlMemBlocks(); |
| ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0); |
| str = gen_const_xmlChar_ptr_ptr(n_str, 1); |
| |
| ret_val = htmlParseEntityRef(ctxt, str); |
| desret_const_htmlEntityDesc_ptr(ret_val); |
| call_tests++; |
| des_htmlParserCtxtPtr(n_ctxt, ctxt, 0); |
| des_const_xmlChar_ptr_ptr(n_str, str, 1); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in htmlParseEntityRef", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctxt); |
| printf(" %d", n_str); |
| printf("\n"); |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_htmlParseFile(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_HTML_ENABLED) |
| htmlDocPtr ret_val; |
| const char * filename; /* the filename */ |
| int n_filename; |
| const char * encoding; /* encoding (optional) */ |
| int n_encoding; |
| |
| for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { |
| for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { |
| filename = gen_filepath(n_filename, 0); |
| encoding = gen_const_char_ptr(n_encoding, 1); |
| |
| ret_val = htmlParseFile(filename, encoding); |
| desret_htmlDocPtr(ret_val); |
| call_tests++; |
| des_filepath(n_filename, filename, 0); |
| des_const_char_ptr(n_encoding, encoding, 1); |
| xmlResetLastError(); |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_htmlReadDoc(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_HTML_ENABLED) |
| int mem_base; |
| htmlDocPtr ret_val; |
| const xmlChar * str; /* a pointer to a zero terminated string */ |
| int n_str; |
| const char * url; /* only used for error reporting (optoinal) */ |
| int n_url; |
| const char * encoding; /* the document encoding (optional) */ |
| int n_encoding; |
| int options; /* a combination of htmlParserOptions */ |
| int n_options; |
| |
| for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) { |
| for (n_url = 0;n_url < gen_nb_const_char_ptr;n_url++) { |
| for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { |
| for (n_options = 0;n_options < gen_nb_int;n_options++) { |
| mem_base = xmlMemBlocks(); |
| str = gen_const_xmlChar_ptr(n_str, 0); |
| url = gen_const_char_ptr(n_url, 1); |
| encoding = gen_const_char_ptr(n_encoding, 2); |
| options = gen_int(n_options, 3); |
| |
| ret_val = htmlReadDoc(str, url, encoding, options); |
| desret_htmlDocPtr(ret_val); |
| call_tests++; |
| des_const_xmlChar_ptr(n_str, str, 0); |
| des_const_char_ptr(n_url, url, 1); |
| des_const_char_ptr(n_encoding, encoding, 2); |
| des_int(n_options, options, 3); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in htmlReadDoc", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_str); |
| printf(" %d", n_url); |
| printf(" %d", n_encoding); |
| printf(" %d", n_options); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_htmlReadFile(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_HTML_ENABLED) |
| int mem_base; |
| htmlDocPtr ret_val; |
| const char * filename; /* a file or URL */ |
| int n_filename; |
| const char * encoding; /* the document encoding (optional) */ |
| int n_encoding; |
| int options; /* a combination of htmlParserOptions */ |
| int n_options; |
| |
| for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { |
| for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { |
| for (n_options = 0;n_options < gen_nb_int;n_options++) { |
| mem_base = xmlMemBlocks(); |
| filename = gen_filepath(n_filename, 0); |
| encoding = gen_const_char_ptr(n_encoding, 1); |
| options = gen_int(n_options, 2); |
| |
| ret_val = htmlReadFile(filename, encoding, options); |
| desret_htmlDocPtr(ret_val); |
| call_tests++; |
| des_filepath(n_filename, filename, 0); |
| des_const_char_ptr(n_encoding, encoding, 1); |
| des_int(n_options, options, 2); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in htmlReadFile", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_filename); |
| printf(" %d", n_encoding); |
| printf(" %d", n_options); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_htmlReadMemory(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_HTML_ENABLED) |
| int mem_base; |
| htmlDocPtr ret_val; |
| const char * buffer; /* a pointer to a char array */ |
| int n_buffer; |
| int size; /* the size of the array */ |
| int n_size; |
| const char * url; /* only used for error reporting (optional) */ |
| int n_url; |
| const char * encoding; /* the document encoding, or NULL */ |
| int n_encoding; |
| int options; /* a combination of htmlParserOption(s) */ |
| int n_options; |
| |
| for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) { |
| for (n_size = 0;n_size < gen_nb_int;n_size++) { |
| for (n_url = 0;n_url < gen_nb_const_char_ptr;n_url++) { |
| for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { |
| for (n_options = 0;n_options < gen_nb_int;n_options++) { |
| mem_base = xmlMemBlocks(); |
| buffer = gen_const_char_ptr(n_buffer, 0); |
| size = gen_int(n_size, 1); |
| url = gen_const_char_ptr(n_url, 2); |
| encoding = gen_const_char_ptr(n_encoding, 3); |
| options = gen_int(n_options, 4); |
| if ((buffer != NULL) && |
| (size > xmlStrlen(BAD_CAST buffer))) |
| size = 0; |
| |
| ret_val = htmlReadMemory(buffer, size, url, encoding, options); |
| desret_htmlDocPtr(ret_val); |
| call_tests++; |
| des_const_char_ptr(n_buffer, buffer, 0); |
| des_int(n_size, size, 1); |
| des_const_char_ptr(n_url, url, 2); |
| des_const_char_ptr(n_encoding, encoding, 3); |
| des_int(n_options, options, 4); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in htmlReadMemory", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_buffer); |
| printf(" %d", n_size); |
| printf(" %d", n_url); |
| printf(" %d", n_encoding); |
| printf(" %d", n_options); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_htmlSAXParseDoc(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_HTML_ENABLED) |
| int mem_base; |
| htmlDocPtr ret_val; |
| const xmlChar * cur; /* a pointer to an array of xmlChar */ |
| int n_cur; |
| const char * encoding; /* a free form C string describing the HTML document encoding, or NULL */ |
| int n_encoding; |
| htmlSAXHandlerPtr sax; /* the SAX handler block */ |
| int n_sax; |
| void * userData; /* if using SAX, this pointer will be provided on callbacks. */ |
| int n_userData; |
| |
| for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) { |
| for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { |
| for (n_sax = 0;n_sax < gen_nb_htmlSAXHandlerPtr;n_sax++) { |
| for (n_userData = 0;n_userData < gen_nb_userdata;n_userData++) { |
| mem_base = xmlMemBlocks(); |
| cur = gen_const_xmlChar_ptr(n_cur, 0); |
| encoding = gen_const_char_ptr(n_encoding, 1); |
| sax = gen_htmlSAXHandlerPtr(n_sax, 2); |
| userData = gen_userdata(n_userData, 3); |
| |
| ret_val = htmlSAXParseDoc(cur, encoding, sax, userData); |
| desret_htmlDocPtr(ret_val); |
| call_tests++; |
| des_const_xmlChar_ptr(n_cur, cur, 0); |
| des_const_char_ptr(n_encoding, encoding, 1); |
| des_htmlSAXHandlerPtr(n_sax, sax, 2); |
| des_userdata(n_userData, userData, 3); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in htmlSAXParseDoc", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_cur); |
| printf(" %d", n_encoding); |
| printf(" %d", n_sax); |
| printf(" %d", n_userData); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_htmlSAXParseFile(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_HTML_ENABLED) |
| int mem_base; |
| htmlDocPtr ret_val; |
| const char * filename; /* the filename */ |
| int n_filename; |
| const char * encoding; /* encoding (optional) */ |
| int n_encoding; |
| htmlSAXHandlerPtr sax; /* the SAX handler block */ |
| int n_sax; |
| void * userData; /* if using SAX, this pointer will be provided on callbacks. */ |
| int n_userData; |
| |
| for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { |
| for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { |
| for (n_sax = 0;n_sax < gen_nb_htmlSAXHandlerPtr;n_sax++) { |
| for (n_userData = 0;n_userData < gen_nb_userdata;n_userData++) { |
| mem_base = xmlMemBlocks(); |
| filename = gen_filepath(n_filename, 0); |
| encoding = gen_const_char_ptr(n_encoding, 1); |
| sax = gen_htmlSAXHandlerPtr(n_sax, 2); |
| userData = gen_userdata(n_userData, 3); |
| |
| ret_val = htmlSAXParseFile(filename, encoding, sax, userData); |
| desret_htmlDocPtr(ret_val); |
| call_tests++; |
| des_filepath(n_filename, filename, 0); |
| des_const_char_ptr(n_encoding, encoding, 1); |
| des_htmlSAXHandlerPtr(n_sax, sax, 2); |
| des_userdata(n_userData, userData, 3); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in htmlSAXParseFile", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_filename); |
| printf(" %d", n_encoding); |
| printf(" %d", n_sax); |
| printf(" %d", n_userData); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_htmlTagLookup(void) { |
| int test_ret = 0; |
| |
| |
| /* missing type support */ |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_htmlUTF8ToHtml(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_HTML_ENABLED) |
| int mem_base; |
| int ret_val; |
| unsigned char * out; /* a pointer to an array of bytes to store the result */ |
| int n_out; |
| int * outlen; /* the length of @out */ |
| int n_outlen; |
| const unsigned char * in; /* a pointer to an array of UTF-8 chars */ |
| int n_in; |
| int * inlen; /* the length of @in */ |
| int n_inlen; |
| |
| for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) { |
| for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) { |
| for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) { |
| for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) { |
| mem_base = xmlMemBlocks(); |
| out = gen_unsigned_char_ptr(n_out, 0); |
| outlen = gen_int_ptr(n_outlen, 1); |
| in = gen_const_unsigned_char_ptr(n_in, 2); |
| inlen = gen_int_ptr(n_inlen, 3); |
| |
| ret_val = htmlUTF8ToHtml(out, outlen, in, inlen); |
| desret_int(ret_val); |
| call_tests++; |
| des_unsigned_char_ptr(n_out, out, 0); |
| des_int_ptr(n_outlen, outlen, 1); |
| des_const_unsigned_char_ptr(n_in, in, 2); |
| des_int_ptr(n_inlen, inlen, 3); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in htmlUTF8ToHtml", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_out); |
| printf(" %d", n_outlen); |
| printf(" %d", n_in); |
| printf(" %d", n_inlen); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| static int |
| test_HTMLparser(void) { |
| int test_ret = 0; |
| |
| if (quiet == 0) printf("Testing HTMLparser : 37 of 43 functions ...\n"); |
| test_ret += test_htmlAttrAllowed(); |
| test_ret += test_htmlAutoCloseTag(); |
| test_ret += test_htmlCreateFileParserCtxt(); |
| test_ret += test_htmlCreateMemoryParserCtxt(); |
| test_ret += test_htmlCreatePushParserCtxt(); |
| test_ret += test_htmlCtxtParseDocument(); |
| test_ret += test_htmlCtxtReadDoc(); |
| test_ret += test_htmlCtxtReadFile(); |
| test_ret += test_htmlCtxtReadMemory(); |
| test_ret += test_htmlCtxtReset(); |
| test_ret += test_htmlCtxtSetOptions(); |
| test_ret += test_htmlCtxtUseOptions(); |
| test_ret += test_htmlElementAllowedHere(); |
| test_ret += test_htmlElementStatusHere(); |
| test_ret += test_htmlEncodeEntities(); |
| test_ret += test_htmlEntityLookup(); |
| test_ret += test_htmlEntityValueLookup(); |
| test_ret += test_htmlHandleOmittedElem(); |
| test_ret += test_htmlInitAutoClose(); |
| test_ret += test_htmlIsAutoClosed(); |
| test_ret += test_htmlIsScriptAttribute(); |
| test_ret += test_htmlNewParserCtxt(); |
| test_ret += test_htmlNewSAXParserCtxt(); |
| test_ret += test_htmlNodeStatus(); |
| test_ret += test_htmlParseCharRef(); |
| test_ret += test_htmlParseChunk(); |
| test_ret += test_htmlParseDoc(); |
| test_ret += test_htmlParseDocument(); |
| test_ret += test_htmlParseElement(); |
| test_ret += test_htmlParseEntityRef(); |
| test_ret += test_htmlParseFile(); |
| test_ret += test_htmlReadDoc(); |
| test_ret += test_htmlReadFile(); |
| test_ret += test_htmlReadMemory(); |
| test_ret += test_htmlSAXParseDoc(); |
| test_ret += test_htmlSAXParseFile(); |
| test_ret += test_htmlTagLookup(); |
| test_ret += test_htmlUTF8ToHtml(); |
| |
| if (test_ret != 0) |
| printf("Module HTMLparser: %d errors\n", test_ret); |
| return(test_ret); |
| } |
| |
| static int |
| test_htmlDocContentDumpFormatOutput(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) |
| int mem_base; |
| xmlOutputBufferPtr buf; /* the HTML buffer output */ |
| int n_buf; |
| xmlDocPtr cur; /* the document */ |
| int n_cur; |
| const char * encoding; /* the encoding string (unused) */ |
| int n_encoding; |
| int format; /* should formatting spaces been added */ |
| int n_format; |
| |
| for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) { |
| for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) { |
| for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { |
| for (n_format = 0;n_format < gen_nb_int;n_format++) { |
| mem_base = xmlMemBlocks(); |
| buf = gen_xmlOutputBufferPtr(n_buf, 0); |
| cur = gen_xmlDocPtr(n_cur, 1); |
| encoding = gen_const_char_ptr(n_encoding, 2); |
| format = gen_int(n_format, 3); |
| |
| htmlDocContentDumpFormatOutput(buf, cur, encoding, format); |
| call_tests++; |
| des_xmlOutputBufferPtr(n_buf, buf, 0); |
| des_xmlDocPtr(n_cur, cur, 1); |
| des_const_char_ptr(n_encoding, encoding, 2); |
| des_int(n_format, format, 3); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in htmlDocContentDumpFormatOutput", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_buf); |
| printf(" %d", n_cur); |
| printf(" %d", n_encoding); |
| printf(" %d", n_format); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_htmlDocContentDumpOutput(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) |
| int mem_base; |
| xmlOutputBufferPtr buf; /* the HTML buffer output */ |
| int n_buf; |
| xmlDocPtr cur; /* the document */ |
| int n_cur; |
| const char * encoding; /* the encoding string (unused) */ |
| int n_encoding; |
| |
| for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) { |
| for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) { |
| for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { |
| mem_base = xmlMemBlocks(); |
| buf = gen_xmlOutputBufferPtr(n_buf, 0); |
| cur = gen_xmlDocPtr(n_cur, 1); |
| encoding = gen_const_char_ptr(n_encoding, 2); |
| |
| htmlDocContentDumpOutput(buf, cur, encoding); |
| call_tests++; |
| des_xmlOutputBufferPtr(n_buf, buf, 0); |
| des_xmlDocPtr(n_cur, cur, 1); |
| des_const_char_ptr(n_encoding, encoding, 2); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in htmlDocContentDumpOutput", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_buf); |
| printf(" %d", n_cur); |
| printf(" %d", n_encoding); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_htmlDocDump(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) |
| int mem_base; |
| int ret_val; |
| FILE * f; /* the FILE* */ |
| int n_f; |
| xmlDocPtr cur; /* the document */ |
| int n_cur; |
| |
| for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) { |
| for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) { |
| mem_base = xmlMemBlocks(); |
| f = gen_FILE_ptr(n_f, 0); |
| cur = gen_xmlDocPtr(n_cur, 1); |
| |
| ret_val = htmlDocDump(f, cur); |
| desret_int(ret_val); |
| call_tests++; |
| des_FILE_ptr(n_f, f, 0); |
| des_xmlDocPtr(n_cur, cur, 1); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in htmlDocDump", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_f); |
| printf(" %d", n_cur); |
| printf("\n"); |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| #define gen_nb_xmlChar_ptr_ptr 1 |
| #define gen_xmlChar_ptr_ptr(no, nr) NULL |
| #define des_xmlChar_ptr_ptr(no, val, nr) |
| |
| static int |
| test_htmlDocDumpMemory(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) |
| int mem_base; |
| xmlDocPtr cur; /* the document */ |
| int n_cur; |
| xmlChar ** mem; /* OUT: the memory pointer */ |
| int n_mem; |
| int * size; /* OUT: the memory length */ |
| int n_size; |
| |
| for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) { |
| for (n_mem = 0;n_mem < gen_nb_xmlChar_ptr_ptr;n_mem++) { |
| for (n_size = 0;n_size < gen_nb_int_ptr;n_size++) { |
| mem_base = xmlMemBlocks(); |
| cur = gen_xmlDocPtr(n_cur, 0); |
| mem = gen_xmlChar_ptr_ptr(n_mem, 1); |
| size = gen_int_ptr(n_size, 2); |
| |
| htmlDocDumpMemory(cur, mem, size); |
| call_tests++; |
| des_xmlDocPtr(n_cur, cur, 0); |
| des_xmlChar_ptr_ptr(n_mem, mem, 1); |
| des_int_ptr(n_size, size, 2); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in htmlDocDumpMemory", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_cur); |
| printf(" %d", n_mem); |
| printf(" %d", n_size); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_htmlDocDumpMemoryFormat(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) |
| int mem_base; |
| xmlDocPtr cur; /* the document */ |
| int n_cur; |
| xmlChar ** mem; /* OUT: the memory pointer */ |
| int n_mem; |
| int * size; /* OUT: the memory length */ |
| int n_size; |
| int format; /* should formatting spaces been added */ |
| int n_format; |
| |
| for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) { |
| for (n_mem = 0;n_mem < gen_nb_xmlChar_ptr_ptr;n_mem++) { |
| for (n_size = 0;n_size < gen_nb_int_ptr;n_size++) { |
| for (n_format = 0;n_format < gen_nb_int;n_format++) { |
| mem_base = xmlMemBlocks(); |
| cur = gen_xmlDocPtr(n_cur, 0); |
| mem = gen_xmlChar_ptr_ptr(n_mem, 1); |
| size = gen_int_ptr(n_size, 2); |
| format = gen_int(n_format, 3); |
| |
| htmlDocDumpMemoryFormat(cur, mem, size, format); |
| call_tests++; |
| des_xmlDocPtr(n_cur, cur, 0); |
| des_xmlChar_ptr_ptr(n_mem, mem, 1); |
| des_int_ptr(n_size, size, 2); |
| des_int(n_format, format, 3); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in htmlDocDumpMemoryFormat", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_cur); |
| printf(" %d", n_mem); |
| printf(" %d", n_size); |
| printf(" %d", n_format); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_htmlGetMetaEncoding(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_HTML_ENABLED) |
| int mem_base; |
| const xmlChar * ret_val; |
| htmlDocPtr doc; /* the document */ |
| int n_doc; |
| |
| for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) { |
| mem_base = xmlMemBlocks(); |
| doc = gen_htmlDocPtr(n_doc, 0); |
| |
| ret_val = htmlGetMetaEncoding(doc); |
| desret_const_xmlChar_ptr(ret_val); |
| call_tests++; |
| des_htmlDocPtr(n_doc, doc, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in htmlGetMetaEncoding", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_doc); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_htmlIsBooleanAttr(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_HTML_ENABLED) |
| int mem_base; |
| int ret_val; |
| const xmlChar * name; /* the name of the attribute to check */ |
| int n_name; |
| |
| for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { |
| mem_base = xmlMemBlocks(); |
| name = gen_const_xmlChar_ptr(n_name, 0); |
| |
| ret_val = htmlIsBooleanAttr(name); |
| desret_int(ret_val); |
| call_tests++; |
| des_const_xmlChar_ptr(n_name, name, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in htmlIsBooleanAttr", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_name); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_htmlNewDoc(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_HTML_ENABLED) |
| int mem_base; |
| htmlDocPtr ret_val; |
| const xmlChar * URI; /* URI for the dtd, or NULL */ |
| int n_URI; |
| const xmlChar * ExternalID; /* the external ID of the DTD, or NULL */ |
| int n_ExternalID; |
| |
| for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) { |
| for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) { |
| mem_base = xmlMemBlocks(); |
| URI = gen_const_xmlChar_ptr(n_URI, 0); |
| ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 1); |
| |
| ret_val = htmlNewDoc(URI, ExternalID); |
| desret_htmlDocPtr(ret_val); |
| call_tests++; |
| des_const_xmlChar_ptr(n_URI, URI, 0); |
| des_const_xmlChar_ptr(n_ExternalID, ExternalID, 1); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in htmlNewDoc", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_URI); |
| printf(" %d", n_ExternalID); |
| printf("\n"); |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_htmlNewDocNoDtD(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_HTML_ENABLED) |
| int mem_base; |
| htmlDocPtr ret_val; |
| const xmlChar * URI; /* URI for the dtd, or NULL */ |
| int n_URI; |
| const xmlChar * ExternalID; /* the external ID of the DTD, or NULL */ |
| int n_ExternalID; |
| |
| for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) { |
| for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) { |
| mem_base = xmlMemBlocks(); |
| URI = gen_const_xmlChar_ptr(n_URI, 0); |
| ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 1); |
| |
| ret_val = htmlNewDocNoDtD(URI, ExternalID); |
| desret_htmlDocPtr(ret_val); |
| call_tests++; |
| des_const_xmlChar_ptr(n_URI, URI, 0); |
| des_const_xmlChar_ptr(n_ExternalID, ExternalID, 1); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in htmlNewDocNoDtD", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_URI); |
| printf(" %d", n_ExternalID); |
| printf("\n"); |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_htmlNodeDump(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) |
| int mem_base; |
| int ret_val; |
| xmlBufferPtr buf; /* the HTML buffer output */ |
| int n_buf; |
| xmlDocPtr doc; /* the document */ |
| int n_doc; |
| xmlNodePtr cur; /* the current node */ |
| int n_cur; |
| |
| for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) { |
| for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { |
| for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { |
| mem_base = xmlMemBlocks(); |
| buf = gen_xmlBufferPtr(n_buf, 0); |
| doc = gen_xmlDocPtr(n_doc, 1); |
| cur = gen_xmlNodePtr(n_cur, 2); |
| |
| ret_val = htmlNodeDump(buf, doc, cur); |
| desret_int(ret_val); |
| call_tests++; |
| des_xmlBufferPtr(n_buf, buf, 0); |
| des_xmlDocPtr(n_doc, doc, 1); |
| des_xmlNodePtr(n_cur, cur, 2); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in htmlNodeDump", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_buf); |
| printf(" %d", n_doc); |
| printf(" %d", n_cur); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_htmlNodeDumpFile(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) |
| int mem_base; |
| FILE * out; /* the FILE pointer */ |
| int n_out; |
| xmlDocPtr doc; /* the document */ |
| int n_doc; |
| xmlNodePtr cur; /* the current node */ |
| int n_cur; |
| |
| for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) { |
| for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { |
| for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { |
| mem_base = xmlMemBlocks(); |
| out = gen_FILE_ptr(n_out, 0); |
| doc = gen_xmlDocPtr(n_doc, 1); |
| cur = gen_xmlNodePtr(n_cur, 2); |
| |
| htmlNodeDumpFile(out, doc, cur); |
| call_tests++; |
| des_FILE_ptr(n_out, out, 0); |
| des_xmlDocPtr(n_doc, doc, 1); |
| des_xmlNodePtr(n_cur, cur, 2); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in htmlNodeDumpFile", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_out); |
| printf(" %d", n_doc); |
| printf(" %d", n_cur); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_htmlNodeDumpFileFormat(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) |
| int mem_base; |
| int ret_val; |
| FILE * out; /* the FILE pointer */ |
| int n_out; |
| xmlDocPtr doc; /* the document */ |
| int n_doc; |
| xmlNodePtr cur; /* the current node */ |
| int n_cur; |
| const char * encoding; /* the document encoding */ |
| int n_encoding; |
| int format; /* should formatting spaces been added */ |
| int n_format; |
| |
| for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) { |
| for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { |
| for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { |
| for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { |
| for (n_format = 0;n_format < gen_nb_int;n_format++) { |
| mem_base = xmlMemBlocks(); |
| out = gen_FILE_ptr(n_out, 0); |
| doc = gen_xmlDocPtr(n_doc, 1); |
| cur = gen_xmlNodePtr(n_cur, 2); |
| encoding = gen_const_char_ptr(n_encoding, 3); |
| format = gen_int(n_format, 4); |
| |
| ret_val = htmlNodeDumpFileFormat(out, doc, cur, encoding, format); |
| desret_int(ret_val); |
| call_tests++; |
| des_FILE_ptr(n_out, out, 0); |
| des_xmlDocPtr(n_doc, doc, 1); |
| des_xmlNodePtr(n_cur, cur, 2); |
| des_const_char_ptr(n_encoding, encoding, 3); |
| des_int(n_format, format, 4); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in htmlNodeDumpFileFormat", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_out); |
| printf(" %d", n_doc); |
| printf(" %d", n_cur); |
| printf(" %d", n_encoding); |
| printf(" %d", n_format); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_htmlNodeDumpFormatOutput(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) |
| int mem_base; |
| xmlOutputBufferPtr buf; /* the HTML buffer output */ |
| int n_buf; |
| xmlDocPtr doc; /* the document */ |
| int n_doc; |
| xmlNodePtr cur; /* the current node */ |
| int n_cur; |
| const char * encoding; /* the encoding string (unused) */ |
| int n_encoding; |
| int format; /* should formatting spaces been added */ |
| int n_format; |
| |
| for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) { |
| for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { |
| for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { |
| for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { |
| for (n_format = 0;n_format < gen_nb_int;n_format++) { |
| mem_base = xmlMemBlocks(); |
| buf = gen_xmlOutputBufferPtr(n_buf, 0); |
| doc = gen_xmlDocPtr(n_doc, 1); |
| cur = gen_xmlNodePtr(n_cur, 2); |
| encoding = gen_const_char_ptr(n_encoding, 3); |
| format = gen_int(n_format, 4); |
| |
| htmlNodeDumpFormatOutput(buf, doc, cur, encoding, format); |
| call_tests++; |
| des_xmlOutputBufferPtr(n_buf, buf, 0); |
| des_xmlDocPtr(n_doc, doc, 1); |
| des_xmlNodePtr(n_cur, cur, 2); |
| des_const_char_ptr(n_encoding, encoding, 3); |
| des_int(n_format, format, 4); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in htmlNodeDumpFormatOutput", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_buf); |
| printf(" %d", n_doc); |
| printf(" %d", n_cur); |
| printf(" %d", n_encoding); |
| printf(" %d", n_format); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_htmlNodeDumpOutput(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) |
| int mem_base; |
| xmlOutputBufferPtr buf; /* the HTML buffer output */ |
| int n_buf; |
| xmlDocPtr doc; /* the document */ |
| int n_doc; |
| xmlNodePtr cur; /* the current node */ |
| int n_cur; |
| const char * encoding; /* the encoding string (unused) */ |
| int n_encoding; |
| |
| for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) { |
| for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { |
| for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { |
| for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { |
| mem_base = xmlMemBlocks(); |
| buf = gen_xmlOutputBufferPtr(n_buf, 0); |
| doc = gen_xmlDocPtr(n_doc, 1); |
| cur = gen_xmlNodePtr(n_cur, 2); |
| encoding = gen_const_char_ptr(n_encoding, 3); |
| |
| htmlNodeDumpOutput(buf, doc, cur, encoding); |
| call_tests++; |
| des_xmlOutputBufferPtr(n_buf, buf, 0); |
| des_xmlDocPtr(n_doc, doc, 1); |
| des_xmlNodePtr(n_cur, cur, 2); |
| des_const_char_ptr(n_encoding, encoding, 3); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in htmlNodeDumpOutput", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_buf); |
| printf(" %d", n_doc); |
| printf(" %d", n_cur); |
| printf(" %d", n_encoding); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_htmlSaveFile(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) |
| int mem_base; |
| int ret_val; |
| const char * filename; /* the filename (or URL) */ |
| int n_filename; |
| xmlDocPtr cur; /* the document */ |
| int n_cur; |
| |
| for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) { |
| for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) { |
| mem_base = xmlMemBlocks(); |
| filename = gen_fileoutput(n_filename, 0); |
| cur = gen_xmlDocPtr(n_cur, 1); |
| |
| ret_val = htmlSaveFile(filename, cur); |
| desret_int(ret_val); |
| call_tests++; |
| des_fileoutput(n_filename, filename, 0); |
| des_xmlDocPtr(n_cur, cur, 1); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in htmlSaveFile", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_filename); |
| printf(" %d", n_cur); |
| printf("\n"); |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_htmlSaveFileEnc(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) |
| int mem_base; |
| int ret_val; |
| const char * filename; /* the filename */ |
| int n_filename; |
| xmlDocPtr cur; /* the document */ |
| int n_cur; |
| const char * encoding; /* the document encoding */ |
| int n_encoding; |
| |
| for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) { |
| for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) { |
| for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { |
| mem_base = xmlMemBlocks(); |
| filename = gen_fileoutput(n_filename, 0); |
| cur = gen_xmlDocPtr(n_cur, 1); |
| encoding = gen_const_char_ptr(n_encoding, 2); |
| |
| ret_val = htmlSaveFileEnc(filename, cur, encoding); |
| desret_int(ret_val); |
| call_tests++; |
| des_fileoutput(n_filename, filename, 0); |
| des_xmlDocPtr(n_cur, cur, 1); |
| des_const_char_ptr(n_encoding, encoding, 2); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in htmlSaveFileEnc", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_filename); |
| printf(" %d", n_cur); |
| printf(" %d", n_encoding); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_htmlSaveFileFormat(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) |
| int mem_base; |
| int ret_val; |
| const char * filename; /* the filename */ |
| int n_filename; |
| xmlDocPtr cur; /* the document */ |
| int n_cur; |
| const char * encoding; /* the document encoding */ |
| int n_encoding; |
| int format; /* should formatting spaces been added */ |
| int n_format; |
| |
| for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) { |
| for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) { |
| for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { |
| for (n_format = 0;n_format < gen_nb_int;n_format++) { |
| mem_base = xmlMemBlocks(); |
| filename = gen_fileoutput(n_filename, 0); |
| cur = gen_xmlDocPtr(n_cur, 1); |
| encoding = gen_const_char_ptr(n_encoding, 2); |
| format = gen_int(n_format, 3); |
| |
| ret_val = htmlSaveFileFormat(filename, cur, encoding, format); |
| desret_int(ret_val); |
| call_tests++; |
| des_fileoutput(n_filename, filename, 0); |
| des_xmlDocPtr(n_cur, cur, 1); |
| des_const_char_ptr(n_encoding, encoding, 2); |
| des_int(n_format, format, 3); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in htmlSaveFileFormat", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_filename); |
| printf(" %d", n_cur); |
| printf(" %d", n_encoding); |
| printf(" %d", n_format); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_htmlSetMetaEncoding(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_HTML_ENABLED) |
| int mem_base; |
| int ret_val; |
| htmlDocPtr doc; /* the document */ |
| int n_doc; |
| const xmlChar * encoding; /* the encoding string */ |
| int n_encoding; |
| |
| for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) { |
| for (n_encoding = 0;n_encoding < gen_nb_const_xmlChar_ptr;n_encoding++) { |
| mem_base = xmlMemBlocks(); |
| doc = gen_htmlDocPtr(n_doc, 0); |
| encoding = gen_const_xmlChar_ptr(n_encoding, 1); |
| |
| ret_val = htmlSetMetaEncoding(doc, encoding); |
| desret_int(ret_val); |
| call_tests++; |
| des_htmlDocPtr(n_doc, doc, 0); |
| des_const_xmlChar_ptr(n_encoding, encoding, 1); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in htmlSetMetaEncoding", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_doc); |
| printf(" %d", n_encoding); |
| printf("\n"); |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| static int |
| test_HTMLtree(void) { |
| int test_ret = 0; |
| |
| if (quiet == 0) printf("Testing HTMLtree : 18 of 18 functions ...\n"); |
| test_ret += test_htmlDocContentDumpFormatOutput(); |
| test_ret += test_htmlDocContentDumpOutput(); |
| test_ret += test_htmlDocDump(); |
| test_ret += test_htmlDocDumpMemory(); |
| test_ret += test_htmlDocDumpMemoryFormat(); |
| test_ret += test_htmlGetMetaEncoding(); |
| test_ret += test_htmlIsBooleanAttr(); |
| test_ret += test_htmlNewDoc(); |
| test_ret += test_htmlNewDocNoDtD(); |
| test_ret += test_htmlNodeDump(); |
| test_ret += test_htmlNodeDumpFile(); |
| test_ret += test_htmlNodeDumpFileFormat(); |
| test_ret += test_htmlNodeDumpFormatOutput(); |
| test_ret += test_htmlNodeDumpOutput(); |
| test_ret += test_htmlSaveFile(); |
| test_ret += test_htmlSaveFileEnc(); |
| test_ret += test_htmlSaveFileFormat(); |
| test_ret += test_htmlSetMetaEncoding(); |
| |
| if (test_ret != 0) |
| printf("Module HTMLtree: %d errors\n", test_ret); |
| return(test_ret); |
| } |
| |
| static int |
| test_htmlDefaultSAXHandlerInit(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_HTML_ENABLED) |
| #ifdef LIBXML_HTML_ENABLED |
| int mem_base; |
| |
| mem_base = xmlMemBlocks(); |
| |
| htmlDefaultSAXHandlerInit(); |
| call_tests++; |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in htmlDefaultSAXHandlerInit", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf("\n"); |
| } |
| function_tests++; |
| #endif |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlDefaultSAXHandlerInit(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| |
| mem_base = xmlMemBlocks(); |
| |
| xmlDefaultSAXHandlerInit(); |
| call_tests++; |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlDefaultSAXHandlerInit", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf("\n"); |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| #define gen_nb_xmlEnumerationPtr 1 |
| #define gen_xmlEnumerationPtr(no, nr) NULL |
| #define des_xmlEnumerationPtr(no, val, nr) |
| |
| static int |
| test_xmlSAX2AttributeDecl(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| void * ctx; /* the user data (XML parser context) */ |
| int n_ctx; |
| const xmlChar * elem; /* the name of the element */ |
| int n_elem; |
| const xmlChar * fullname; /* the attribute name */ |
| int n_fullname; |
| int type; /* the attribute type */ |
| int n_type; |
| int def; /* the type of default value */ |
| int n_def; |
| const xmlChar * defaultValue; /* the attribute default value */ |
| int n_defaultValue; |
| xmlEnumerationPtr tree; /* the tree of enumerated value set */ |
| int n_tree; |
| |
| for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { |
| for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) { |
| for (n_fullname = 0;n_fullname < gen_nb_const_xmlChar_ptr;n_fullname++) { |
| for (n_type = 0;n_type < gen_nb_int;n_type++) { |
| for (n_def = 0;n_def < gen_nb_int;n_def++) { |
| for (n_defaultValue = 0;n_defaultValue < gen_nb_const_xmlChar_ptr;n_defaultValue++) { |
| for (n_tree = 0;n_tree < gen_nb_xmlEnumerationPtr;n_tree++) { |
| mem_base = xmlMemBlocks(); |
| ctx = gen_void_ptr(n_ctx, 0); |
| elem = gen_const_xmlChar_ptr(n_elem, 1); |
| fullname = gen_const_xmlChar_ptr(n_fullname, 2); |
| type = gen_int(n_type, 3); |
| def = gen_int(n_def, 4); |
| defaultValue = gen_const_xmlChar_ptr(n_defaultValue, 5); |
| tree = gen_xmlEnumerationPtr(n_tree, 6); |
| |
| xmlSAX2AttributeDecl(ctx, elem, fullname, type, def, defaultValue, tree); |
| call_tests++; |
| des_void_ptr(n_ctx, ctx, 0); |
| des_const_xmlChar_ptr(n_elem, elem, 1); |
| des_const_xmlChar_ptr(n_fullname, fullname, 2); |
| des_int(n_type, type, 3); |
| des_int(n_def, def, 4); |
| des_const_xmlChar_ptr(n_defaultValue, defaultValue, 5); |
| des_xmlEnumerationPtr(n_tree, tree, 6); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlSAX2AttributeDecl", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctx); |
| printf(" %d", n_elem); |
| printf(" %d", n_fullname); |
| printf(" %d", n_type); |
| printf(" %d", n_def); |
| printf(" %d", n_defaultValue); |
| printf(" %d", n_tree); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlSAX2CDataBlock(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| void * ctx; /* the user data (XML parser context) */ |
| int n_ctx; |
| const xmlChar * value; /* The pcdata content */ |
| int n_value; |
| int len; /* the block length */ |
| int n_len; |
| |
| for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { |
| for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { |
| for (n_len = 0;n_len < gen_nb_int;n_len++) { |
| mem_base = xmlMemBlocks(); |
| ctx = gen_void_ptr(n_ctx, 0); |
| value = gen_const_xmlChar_ptr(n_value, 1); |
| len = gen_int(n_len, 2); |
| if ((value != NULL) && |
| (len > xmlStrlen(BAD_CAST value))) |
| len = 0; |
| |
| xmlSAX2CDataBlock(ctx, value, len); |
| call_tests++; |
| des_void_ptr(n_ctx, ctx, 0); |
| des_const_xmlChar_ptr(n_value, value, 1); |
| des_int(n_len, len, 2); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlSAX2CDataBlock", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctx); |
| printf(" %d", n_value); |
| printf(" %d", n_len); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlSAX2Characters(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| void * ctx; /* the user data (XML parser context) */ |
| int n_ctx; |
| const xmlChar * ch; /* a xmlChar string */ |
| int n_ch; |
| int len; /* the number of xmlChar */ |
| int n_len; |
| |
| for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { |
| for (n_ch = 0;n_ch < gen_nb_const_xmlChar_ptr;n_ch++) { |
| for (n_len = 0;n_len < gen_nb_int;n_len++) { |
| mem_base = xmlMemBlocks(); |
| ctx = gen_void_ptr(n_ctx, 0); |
| ch = gen_const_xmlChar_ptr(n_ch, 1); |
| len = gen_int(n_len, 2); |
| if ((ch != NULL) && |
| (len > xmlStrlen(BAD_CAST ch))) |
| len = 0; |
| |
| xmlSAX2Characters(ctx, ch, len); |
| call_tests++; |
| des_void_ptr(n_ctx, ctx, 0); |
| des_const_xmlChar_ptr(n_ch, ch, 1); |
| des_int(n_len, len, 2); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlSAX2Characters", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctx); |
| printf(" %d", n_ch); |
| printf(" %d", n_len); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlSAX2Comment(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| void * ctx; /* the user data (XML parser context) */ |
| int n_ctx; |
| const xmlChar * value; /* the xmlSAX2Comment content */ |
| int n_value; |
| |
| for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { |
| for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { |
| mem_base = xmlMemBlocks(); |
| ctx = gen_void_ptr(n_ctx, 0); |
| value = gen_const_xmlChar_ptr(n_value, 1); |
| |
| xmlSAX2Comment(ctx, value); |
| call_tests++; |
| des_void_ptr(n_ctx, ctx, 0); |
| des_const_xmlChar_ptr(n_value, value, 1); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlSAX2Comment", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctx); |
| printf(" %d", n_value); |
| printf("\n"); |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlSAX2ElementDecl(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| void * ctx; /* the user data (XML parser context) */ |
| int n_ctx; |
| const xmlChar * name; /* the element name */ |
| int n_name; |
| int type; /* the element type */ |
| int n_type; |
| xmlElementContentPtr content; /* the element value tree */ |
| int n_content; |
| |
| for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { |
| for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { |
| for (n_type = 0;n_type < gen_nb_int;n_type++) { |
| for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) { |
| mem_base = xmlMemBlocks(); |
| ctx = gen_void_ptr(n_ctx, 0); |
| name = gen_const_xmlChar_ptr(n_name, 1); |
| type = gen_int(n_type, 2); |
| content = gen_xmlElementContentPtr(n_content, 3); |
| |
| xmlSAX2ElementDecl(ctx, name, type, content); |
| call_tests++; |
| des_void_ptr(n_ctx, ctx, 0); |
| des_const_xmlChar_ptr(n_name, name, 1); |
| des_int(n_type, type, 2); |
| des_xmlElementContentPtr(n_content, content, 3); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlSAX2ElementDecl", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctx); |
| printf(" %d", n_name); |
| printf(" %d", n_type); |
| printf(" %d", n_content); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlSAX2EndDocument(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| void * ctx; /* the user data (XML parser context) */ |
| int n_ctx; |
| |
| for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { |
| mem_base = xmlMemBlocks(); |
| ctx = gen_void_ptr(n_ctx, 0); |
| |
| xmlSAX2EndDocument(ctx); |
| call_tests++; |
| des_void_ptr(n_ctx, ctx, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlSAX2EndDocument", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctx); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlSAX2EndElement(void) { |
| int test_ret = 0; |
| |
| #ifdef LIBXML_SAX1_ENABLED |
| int mem_base; |
| void * ctx; /* the user data (XML parser context) */ |
| int n_ctx; |
| const xmlChar * name; /* The element name */ |
| int n_name; |
| |
| for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { |
| for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { |
| mem_base = xmlMemBlocks(); |
| ctx = gen_void_ptr(n_ctx, 0); |
| name = gen_const_xmlChar_ptr(n_name, 1); |
| |
| xmlSAX2EndElement(ctx, name); |
| call_tests++; |
| des_void_ptr(n_ctx, ctx, 0); |
| des_const_xmlChar_ptr(n_name, name, 1); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlSAX2EndElement", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctx); |
| printf(" %d", n_name); |
| printf("\n"); |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlSAX2EndElementNs(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| void * ctx; /* the user data (XML parser context) */ |
| int n_ctx; |
| const xmlChar * localname; /* the local name of the element */ |
| int n_localname; |
| const xmlChar * prefix; /* the element namespace prefix if available */ |
| int n_prefix; |
| const xmlChar * URI; /* the element namespace name if available */ |
| int n_URI; |
| |
| for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { |
| for (n_localname = 0;n_localname < gen_nb_const_xmlChar_ptr;n_localname++) { |
| for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) { |
| for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) { |
| mem_base = xmlMemBlocks(); |
| ctx = gen_void_ptr(n_ctx, 0); |
| localname = gen_const_xmlChar_ptr(n_localname, 1); |
| prefix = gen_const_xmlChar_ptr(n_prefix, 2); |
| URI = gen_const_xmlChar_ptr(n_URI, 3); |
| |
| xmlSAX2EndElementNs(ctx, localname, prefix, URI); |
| call_tests++; |
| des_void_ptr(n_ctx, ctx, 0); |
| des_const_xmlChar_ptr(n_localname, localname, 1); |
| des_const_xmlChar_ptr(n_prefix, prefix, 2); |
| des_const_xmlChar_ptr(n_URI, URI, 3); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlSAX2EndElementNs", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctx); |
| printf(" %d", n_localname); |
| printf(" %d", n_prefix); |
| printf(" %d", n_URI); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlSAX2EntityDecl(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| void * ctx; /* the user data (XML parser context) */ |
| int n_ctx; |
| const xmlChar * name; /* the entity name */ |
| int n_name; |
| int type; /* the entity type */ |
| int n_type; |
| const xmlChar * publicId; /* The public ID of the entity */ |
| int n_publicId; |
| const xmlChar * systemId; /* The system ID of the entity */ |
| int n_systemId; |
| xmlChar * content; /* the entity value (without processing). */ |
| int n_content; |
| |
| for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { |
| for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { |
| for (n_type = 0;n_type < gen_nb_int;n_type++) { |
| for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) { |
| for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) { |
| for (n_content = 0;n_content < gen_nb_xmlChar_ptr;n_content++) { |
| mem_base = xmlMemBlocks(); |
| ctx = gen_void_ptr(n_ctx, 0); |
| name = gen_const_xmlChar_ptr(n_name, 1); |
| type = gen_int(n_type, 2); |
| publicId = gen_const_xmlChar_ptr(n_publicId, 3); |
| systemId = gen_const_xmlChar_ptr(n_systemId, 4); |
| content = gen_xmlChar_ptr(n_content, 5); |
| |
| xmlSAX2EntityDecl(ctx, name, type, publicId, systemId, content); |
| call_tests++; |
| des_void_ptr(n_ctx, ctx, 0); |
| des_const_xmlChar_ptr(n_name, name, 1); |
| des_int(n_type, type, 2); |
| des_const_xmlChar_ptr(n_publicId, publicId, 3); |
| des_const_xmlChar_ptr(n_systemId, systemId, 4); |
| des_xmlChar_ptr(n_content, content, 5); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlSAX2EntityDecl", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctx); |
| printf(" %d", n_name); |
| printf(" %d", n_type); |
| printf(" %d", n_publicId); |
| printf(" %d", n_systemId); |
| printf(" %d", n_content); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlSAX2ExternalSubset(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| void * ctx; /* the user data (XML parser context) */ |
| int n_ctx; |
| const xmlChar * name; /* the root element name */ |
| int n_name; |
| const xmlChar * ExternalID; /* the external ID */ |
| int n_ExternalID; |
| const xmlChar * SystemID; /* the SYSTEM ID (e.g. filename or URL) */ |
| int n_SystemID; |
| |
| for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { |
| for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { |
| for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) { |
| for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) { |
| mem_base = xmlMemBlocks(); |
| ctx = gen_void_ptr(n_ctx, 0); |
| name = gen_const_xmlChar_ptr(n_name, 1); |
| ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2); |
| SystemID = gen_const_xmlChar_ptr(n_SystemID, 3); |
| |
| xmlSAX2ExternalSubset(ctx, name, ExternalID, SystemID); |
| call_tests++; |
| des_void_ptr(n_ctx, ctx, 0); |
| des_const_xmlChar_ptr(n_name, name, 1); |
| des_const_xmlChar_ptr(n_ExternalID, ExternalID, 2); |
| des_const_xmlChar_ptr(n_SystemID, SystemID, 3); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlSAX2ExternalSubset", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctx); |
| printf(" %d", n_name); |
| printf(" %d", n_ExternalID); |
| printf(" %d", n_SystemID); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlSAX2GetColumnNumber(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| int ret_val; |
| void * ctx; /* the user data (XML parser context) */ |
| int n_ctx; |
| |
| for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { |
| mem_base = xmlMemBlocks(); |
| ctx = gen_void_ptr(n_ctx, 0); |
| |
| ret_val = xmlSAX2GetColumnNumber(ctx); |
| desret_int(ret_val); |
| call_tests++; |
| des_void_ptr(n_ctx, ctx, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlSAX2GetColumnNumber", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctx); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlSAX2GetEntity(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| xmlEntityPtr ret_val; |
| void * ctx; /* the user data (XML parser context) */ |
| int n_ctx; |
| const xmlChar * name; /* The entity name */ |
| int n_name; |
| |
| for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { |
| for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { |
| mem_base = xmlMemBlocks(); |
| ctx = gen_void_ptr(n_ctx, 0); |
| name = gen_const_xmlChar_ptr(n_name, 1); |
| |
| ret_val = xmlSAX2GetEntity(ctx, name); |
| desret_xmlEntityPtr(ret_val); |
| call_tests++; |
| des_void_ptr(n_ctx, ctx, 0); |
| des_const_xmlChar_ptr(n_name, name, 1); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlSAX2GetEntity", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctx); |
| printf(" %d", n_name); |
| printf("\n"); |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlSAX2GetLineNumber(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| int ret_val; |
| void * ctx; /* the user data (XML parser context) */ |
| int n_ctx; |
| |
| for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { |
| mem_base = xmlMemBlocks(); |
| ctx = gen_void_ptr(n_ctx, 0); |
| |
| ret_val = xmlSAX2GetLineNumber(ctx); |
| desret_int(ret_val); |
| call_tests++; |
| des_void_ptr(n_ctx, ctx, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlSAX2GetLineNumber", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctx); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlSAX2GetParameterEntity(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| xmlEntityPtr ret_val; |
| void * ctx; /* the user data (XML parser context) */ |
| int n_ctx; |
| const xmlChar * name; /* The entity name */ |
| int n_name; |
| |
| for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { |
| for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { |
| mem_base = xmlMemBlocks(); |
| ctx = gen_void_ptr(n_ctx, 0); |
| name = gen_const_xmlChar_ptr(n_name, 1); |
| |
| ret_val = xmlSAX2GetParameterEntity(ctx, name); |
| desret_xmlEntityPtr(ret_val); |
| call_tests++; |
| des_void_ptr(n_ctx, ctx, 0); |
| des_const_xmlChar_ptr(n_name, name, 1); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlSAX2GetParameterEntity", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctx); |
| printf(" %d", n_name); |
| printf("\n"); |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlSAX2GetPublicId(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| const xmlChar * ret_val; |
| void * ctx; /* the user data (XML parser context) */ |
| int n_ctx; |
| |
| for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { |
| mem_base = xmlMemBlocks(); |
| ctx = gen_void_ptr(n_ctx, 0); |
| |
| ret_val = xmlSAX2GetPublicId(ctx); |
| desret_const_xmlChar_ptr(ret_val); |
| call_tests++; |
| des_void_ptr(n_ctx, ctx, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlSAX2GetPublicId", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctx); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlSAX2GetSystemId(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| const xmlChar * ret_val; |
| void * ctx; /* the user data (XML parser context) */ |
| int n_ctx; |
| |
| for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { |
| mem_base = xmlMemBlocks(); |
| ctx = gen_void_ptr(n_ctx, 0); |
| |
| ret_val = xmlSAX2GetSystemId(ctx); |
| desret_const_xmlChar_ptr(ret_val); |
| call_tests++; |
| des_void_ptr(n_ctx, ctx, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlSAX2GetSystemId", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctx); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlSAX2HasExternalSubset(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| int ret_val; |
| void * ctx; /* the user data (XML parser context) */ |
| int n_ctx; |
| |
| for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { |
| mem_base = xmlMemBlocks(); |
| ctx = gen_void_ptr(n_ctx, 0); |
| |
| ret_val = xmlSAX2HasExternalSubset(ctx); |
| desret_int(ret_val); |
| call_tests++; |
| des_void_ptr(n_ctx, ctx, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlSAX2HasExternalSubset", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctx); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlSAX2HasInternalSubset(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| int ret_val; |
| void * ctx; /* the user data (XML parser context) */ |
| int n_ctx; |
| |
| for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { |
| mem_base = xmlMemBlocks(); |
| ctx = gen_void_ptr(n_ctx, 0); |
| |
| ret_val = xmlSAX2HasInternalSubset(ctx); |
| desret_int(ret_val); |
| call_tests++; |
| des_void_ptr(n_ctx, ctx, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlSAX2HasInternalSubset", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctx); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlSAX2IgnorableWhitespace(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| void * ctx; /* the user data (XML parser context) */ |
| int n_ctx; |
| const xmlChar * ch; /* a xmlChar string */ |
| int n_ch; |
| int len; /* the number of xmlChar */ |
| int n_len; |
| |
| for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { |
| for (n_ch = 0;n_ch < gen_nb_const_xmlChar_ptr;n_ch++) { |
| for (n_len = 0;n_len < gen_nb_int;n_len++) { |
| mem_base = xmlMemBlocks(); |
| ctx = gen_void_ptr(n_ctx, 0); |
| ch = gen_const_xmlChar_ptr(n_ch, 1); |
| len = gen_int(n_len, 2); |
| if ((ch != NULL) && |
| (len > xmlStrlen(BAD_CAST ch))) |
| len = 0; |
| |
| xmlSAX2IgnorableWhitespace(ctx, ch, len); |
| call_tests++; |
| des_void_ptr(n_ctx, ctx, 0); |
| des_const_xmlChar_ptr(n_ch, ch, 1); |
| des_int(n_len, len, 2); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlSAX2IgnorableWhitespace", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctx); |
| printf(" %d", n_ch); |
| printf(" %d", n_len); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| #define gen_nb_xmlSAXHandler_ptr 1 |
| #define gen_xmlSAXHandler_ptr(no, nr) NULL |
| #define des_xmlSAXHandler_ptr(no, val, nr) |
| |
| static int |
| test_xmlSAX2InitDefaultSAXHandler(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| xmlSAXHandler * hdlr; /* the SAX handler */ |
| int n_hdlr; |
| int warning; /* flag if non-zero sets the handler warning procedure */ |
| int n_warning; |
| |
| for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) { |
| for (n_warning = 0;n_warning < gen_nb_int;n_warning++) { |
| mem_base = xmlMemBlocks(); |
| hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0); |
| warning = gen_int(n_warning, 1); |
| |
| xmlSAX2InitDefaultSAXHandler(hdlr, warning); |
| call_tests++; |
| des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0); |
| des_int(n_warning, warning, 1); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlSAX2InitDefaultSAXHandler", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_hdlr); |
| printf(" %d", n_warning); |
| printf("\n"); |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlSAX2InitHtmlDefaultSAXHandler(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_HTML_ENABLED) |
| int mem_base; |
| xmlSAXHandler * hdlr; /* the SAX handler */ |
| int n_hdlr; |
| |
| for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) { |
| mem_base = xmlMemBlocks(); |
| hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0); |
| |
| xmlSAX2InitHtmlDefaultSAXHandler(hdlr); |
| call_tests++; |
| des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlSAX2InitHtmlDefaultSAXHandler", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_hdlr); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlSAX2InternalSubset(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| void * ctx; /* the user data (XML parser context) */ |
| int n_ctx; |
| const xmlChar * name; /* the root element name */ |
| int n_name; |
| const xmlChar * ExternalID; /* the external ID */ |
| int n_ExternalID; |
| const xmlChar * SystemID; /* the SYSTEM ID (e.g. filename or URL) */ |
| int n_SystemID; |
| |
| for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { |
| for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { |
| for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) { |
| for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) { |
| mem_base = xmlMemBlocks(); |
| ctx = gen_void_ptr(n_ctx, 0); |
| name = gen_const_xmlChar_ptr(n_name, 1); |
| ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2); |
| SystemID = gen_const_xmlChar_ptr(n_SystemID, 3); |
| |
| xmlSAX2InternalSubset(ctx, name, ExternalID, SystemID); |
| call_tests++; |
| des_void_ptr(n_ctx, ctx, 0); |
| des_const_xmlChar_ptr(n_name, name, 1); |
| des_const_xmlChar_ptr(n_ExternalID, ExternalID, 2); |
| des_const_xmlChar_ptr(n_SystemID, SystemID, 3); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlSAX2InternalSubset", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctx); |
| printf(" %d", n_name); |
| printf(" %d", n_ExternalID); |
| printf(" %d", n_SystemID); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlSAX2IsStandalone(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| int ret_val; |
| void * ctx; /* the user data (XML parser context) */ |
| int n_ctx; |
| |
| for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { |
| mem_base = xmlMemBlocks(); |
| ctx = gen_void_ptr(n_ctx, 0); |
| |
| ret_val = xmlSAX2IsStandalone(ctx); |
| desret_int(ret_val); |
| call_tests++; |
| des_void_ptr(n_ctx, ctx, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlSAX2IsStandalone", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctx); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlSAX2NotationDecl(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| void * ctx; /* the user data (XML parser context) */ |
| int n_ctx; |
| const xmlChar * name; /* The name of the notation */ |
| int n_name; |
| const xmlChar * publicId; /* The public ID of the entity */ |
| int n_publicId; |
| const xmlChar * systemId; /* The system ID of the entity */ |
| int n_systemId; |
| |
| for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { |
| for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { |
| for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) { |
| for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) { |
| mem_base = xmlMemBlocks(); |
| ctx = gen_void_ptr(n_ctx, 0); |
| name = gen_const_xmlChar_ptr(n_name, 1); |
| publicId = gen_const_xmlChar_ptr(n_publicId, 2); |
| systemId = gen_const_xmlChar_ptr(n_systemId, 3); |
| |
| xmlSAX2NotationDecl(ctx, name, publicId, systemId); |
| call_tests++; |
| des_void_ptr(n_ctx, ctx, 0); |
| des_const_xmlChar_ptr(n_name, name, 1); |
| des_const_xmlChar_ptr(n_publicId, publicId, 2); |
| des_const_xmlChar_ptr(n_systemId, systemId, 3); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlSAX2NotationDecl", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctx); |
| printf(" %d", n_name); |
| printf(" %d", n_publicId); |
| printf(" %d", n_systemId); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlSAX2ProcessingInstruction(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| void * ctx; /* the user data (XML parser context) */ |
| int n_ctx; |
| const xmlChar * target; /* the target name */ |
| int n_target; |
| const xmlChar * data; /* the PI data's */ |
| int n_data; |
| |
| for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { |
| for (n_target = 0;n_target < gen_nb_const_xmlChar_ptr;n_target++) { |
| for (n_data = 0;n_data < gen_nb_const_xmlChar_ptr;n_data++) { |
| mem_base = xmlMemBlocks(); |
| ctx = gen_void_ptr(n_ctx, 0); |
| target = gen_const_xmlChar_ptr(n_target, 1); |
| data = gen_const_xmlChar_ptr(n_data, 2); |
| |
| xmlSAX2ProcessingInstruction(ctx, target, data); |
| call_tests++; |
| des_void_ptr(n_ctx, ctx, 0); |
| des_const_xmlChar_ptr(n_target, target, 1); |
| des_const_xmlChar_ptr(n_data, data, 2); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlSAX2ProcessingInstruction", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctx); |
| printf(" %d", n_target); |
| printf(" %d", n_data); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlSAX2Reference(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| void * ctx; /* the user data (XML parser context) */ |
| int n_ctx; |
| const xmlChar * name; /* The entity name */ |
| int n_name; |
| |
| for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { |
| for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { |
| mem_base = xmlMemBlocks(); |
| ctx = gen_void_ptr(n_ctx, 0); |
| name = gen_const_xmlChar_ptr(n_name, 1); |
| |
| xmlSAX2Reference(ctx, name); |
| call_tests++; |
| des_void_ptr(n_ctx, ctx, 0); |
| des_const_xmlChar_ptr(n_name, name, 1); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlSAX2Reference", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctx); |
| printf(" %d", n_name); |
| printf("\n"); |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlSAX2ResolveEntity(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| xmlParserInputPtr ret_val; |
| void * ctx; /* the user data (XML parser context) */ |
| int n_ctx; |
| const xmlChar * publicId; /* The public ID of the entity */ |
| int n_publicId; |
| const xmlChar * systemId; /* The system ID of the entity */ |
| int n_systemId; |
| |
| for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { |
| for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) { |
| for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) { |
| mem_base = xmlMemBlocks(); |
| ctx = gen_void_ptr(n_ctx, 0); |
| publicId = gen_const_xmlChar_ptr(n_publicId, 1); |
| systemId = gen_const_xmlChar_ptr(n_systemId, 2); |
| |
| ret_val = xmlSAX2ResolveEntity(ctx, publicId, systemId); |
| desret_xmlParserInputPtr(ret_val); |
| call_tests++; |
| des_void_ptr(n_ctx, ctx, 0); |
| des_const_xmlChar_ptr(n_publicId, publicId, 1); |
| des_const_xmlChar_ptr(n_systemId, systemId, 2); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlSAX2ResolveEntity", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctx); |
| printf(" %d", n_publicId); |
| printf(" %d", n_systemId); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| #define gen_nb_xmlSAXLocatorPtr 1 |
| #define gen_xmlSAXLocatorPtr(no, nr) NULL |
| #define des_xmlSAXLocatorPtr(no, val, nr) |
| |
| static int |
| test_xmlSAX2SetDocumentLocator(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| void * ctx; /* the user data (XML parser context) */ |
| int n_ctx; |
| xmlSAXLocatorPtr loc; /* A SAX Locator */ |
| int n_loc; |
| |
| for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { |
| for (n_loc = 0;n_loc < gen_nb_xmlSAXLocatorPtr;n_loc++) { |
| mem_base = xmlMemBlocks(); |
| ctx = gen_void_ptr(n_ctx, 0); |
| loc = gen_xmlSAXLocatorPtr(n_loc, 1); |
| |
| xmlSAX2SetDocumentLocator(ctx, loc); |
| call_tests++; |
| des_void_ptr(n_ctx, ctx, 0); |
| des_xmlSAXLocatorPtr(n_loc, loc, 1); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlSAX2SetDocumentLocator", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctx); |
| printf(" %d", n_loc); |
| printf("\n"); |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlSAX2StartDocument(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| void * ctx; /* the user data (XML parser context) */ |
| int n_ctx; |
| |
| for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { |
| mem_base = xmlMemBlocks(); |
| ctx = gen_void_ptr(n_ctx, 0); |
| |
| xmlSAX2StartDocument(ctx); |
| call_tests++; |
| des_void_ptr(n_ctx, ctx, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlSAX2StartDocument", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctx); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlSAX2StartElement(void) { |
| int test_ret = 0; |
| |
| #ifdef LIBXML_SAX1_ENABLED |
| int mem_base; |
| void * ctx; /* the user data (XML parser context) */ |
| int n_ctx; |
| const xmlChar * fullname; /* The element name, including namespace prefix */ |
| int n_fullname; |
| const xmlChar ** atts; /* An array of name/value attributes pairs, NULL terminated */ |
| int n_atts; |
| |
| for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { |
| for (n_fullname = 0;n_fullname < gen_nb_const_xmlChar_ptr;n_fullname++) { |
| for (n_atts = 0;n_atts < gen_nb_const_xmlChar_ptr_ptr;n_atts++) { |
| mem_base = xmlMemBlocks(); |
| ctx = gen_void_ptr(n_ctx, 0); |
| fullname = gen_const_xmlChar_ptr(n_fullname, 1); |
| atts = gen_const_xmlChar_ptr_ptr(n_atts, 2); |
| |
| xmlSAX2StartElement(ctx, fullname, atts); |
| call_tests++; |
| des_void_ptr(n_ctx, ctx, 0); |
| des_const_xmlChar_ptr(n_fullname, fullname, 1); |
| des_const_xmlChar_ptr_ptr(n_atts, atts, 2); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlSAX2StartElement", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctx); |
| printf(" %d", n_fullname); |
| printf(" %d", n_atts); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlSAX2StartElementNs(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| void * ctx; /* the user data (XML parser context) */ |
| int n_ctx; |
| const xmlChar * localname; /* the local name of the element */ |
| int n_localname; |
| const xmlChar * prefix; /* the element namespace prefix if available */ |
| int n_prefix; |
| const xmlChar * URI; /* the element namespace name if available */ |
| int n_URI; |
| int nb_namespaces; /* number of namespace definitions on that node */ |
| int n_nb_namespaces; |
| const xmlChar ** namespaces; /* pointer to the array of prefix/URI pairs namespace definitions */ |
| int n_namespaces; |
| int nb_attributes; /* the number of attributes on that node */ |
| int n_nb_attributes; |
| int nb_defaulted; /* the number of defaulted attributes. */ |
| int n_nb_defaulted; |
| const xmlChar ** attributes; /* pointer to the array of (localname/prefix/URI/value/end) attribute values. */ |
| int n_attributes; |
| |
| for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { |
| for (n_localname = 0;n_localname < gen_nb_const_xmlChar_ptr;n_localname++) { |
| for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) { |
| for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) { |
| for (n_nb_namespaces = 0;n_nb_namespaces < gen_nb_int;n_nb_namespaces++) { |
| for (n_namespaces = 0;n_namespaces < gen_nb_const_xmlChar_ptr_ptr;n_namespaces++) { |
| for (n_nb_attributes = 0;n_nb_attributes < gen_nb_int;n_nb_attributes++) { |
| for (n_nb_defaulted = 0;n_nb_defaulted < gen_nb_int;n_nb_defaulted++) { |
| for (n_attributes = 0;n_attributes < gen_nb_const_xmlChar_ptr_ptr;n_attributes++) { |
| mem_base = xmlMemBlocks(); |
| ctx = gen_void_ptr(n_ctx, 0); |
| localname = gen_const_xmlChar_ptr(n_localname, 1); |
| prefix = gen_const_xmlChar_ptr(n_prefix, 2); |
| URI = gen_const_xmlChar_ptr(n_URI, 3); |
| nb_namespaces = gen_int(n_nb_namespaces, 4); |
| namespaces = gen_const_xmlChar_ptr_ptr(n_namespaces, 5); |
| nb_attributes = gen_int(n_nb_attributes, 6); |
| nb_defaulted = gen_int(n_nb_defaulted, 7); |
| attributes = gen_const_xmlChar_ptr_ptr(n_attributes, 8); |
| |
| xmlSAX2StartElementNs(ctx, localname, prefix, URI, nb_namespaces, namespaces, nb_attributes, nb_defaulted, attributes); |
| call_tests++; |
| des_void_ptr(n_ctx, ctx, 0); |
| des_const_xmlChar_ptr(n_localname, localname, 1); |
| des_const_xmlChar_ptr(n_prefix, prefix, 2); |
| des_const_xmlChar_ptr(n_URI, URI, 3); |
| des_int(n_nb_namespaces, nb_namespaces, 4); |
| des_const_xmlChar_ptr_ptr(n_namespaces, namespaces, 5); |
| des_int(n_nb_attributes, nb_attributes, 6); |
| des_int(n_nb_defaulted, nb_defaulted, 7); |
| des_const_xmlChar_ptr_ptr(n_attributes, attributes, 8); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlSAX2StartElementNs", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctx); |
| printf(" %d", n_localname); |
| printf(" %d", n_prefix); |
| printf(" %d", n_URI); |
| printf(" %d", n_nb_namespaces); |
| printf(" %d", n_namespaces); |
| printf(" %d", n_nb_attributes); |
| printf(" %d", n_nb_defaulted); |
| printf(" %d", n_attributes); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlSAX2UnparsedEntityDecl(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| void * ctx; /* the user data (XML parser context) */ |
| int n_ctx; |
| const xmlChar * name; /* The name of the entity */ |
| int n_name; |
| const xmlChar * publicId; /* The public ID of the entity */ |
| int n_publicId; |
| const xmlChar * systemId; /* The system ID of the entity */ |
| int n_systemId; |
| const xmlChar * notationName; /* the name of the notation */ |
| int n_notationName; |
| |
| for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { |
| for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { |
| for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) { |
| for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) { |
| for (n_notationName = 0;n_notationName < gen_nb_const_xmlChar_ptr;n_notationName++) { |
| mem_base = xmlMemBlocks(); |
| ctx = gen_void_ptr(n_ctx, 0); |
| name = gen_const_xmlChar_ptr(n_name, 1); |
| publicId = gen_const_xmlChar_ptr(n_publicId, 2); |
| systemId = gen_const_xmlChar_ptr(n_systemId, 3); |
| notationName = gen_const_xmlChar_ptr(n_notationName, 4); |
| |
| xmlSAX2UnparsedEntityDecl(ctx, name, publicId, systemId, notationName); |
| call_tests++; |
| des_void_ptr(n_ctx, ctx, 0); |
| des_const_xmlChar_ptr(n_name, name, 1); |
| des_const_xmlChar_ptr(n_publicId, publicId, 2); |
| des_const_xmlChar_ptr(n_systemId, systemId, 3); |
| des_const_xmlChar_ptr(n_notationName, notationName, 4); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlSAX2UnparsedEntityDecl", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctx); |
| printf(" %d", n_name); |
| printf(" %d", n_publicId); |
| printf(" %d", n_systemId); |
| printf(" %d", n_notationName); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlSAXDefaultVersion(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_SAX1_ENABLED) |
| #ifdef LIBXML_SAX1_ENABLED |
| int mem_base; |
| int ret_val; |
| int version; /* the version, must be 2 */ |
| int n_version; |
| |
| for (n_version = 0;n_version < gen_nb_int;n_version++) { |
| mem_base = xmlMemBlocks(); |
| version = gen_int(n_version, 0); |
| |
| { |
| int original_version = xmlSAXDefaultVersion(2); |
| |
| |
| ret_val = xmlSAXDefaultVersion(version); |
| |
| (void)xmlSAXDefaultVersion(original_version); |
| } |
| |
| desret_int(ret_val); |
| call_tests++; |
| des_int(n_version, version, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlSAXDefaultVersion", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_version); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| #endif |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlSAXVersion(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| int ret_val; |
| xmlSAXHandler * hdlr; /* the SAX handler */ |
| int n_hdlr; |
| int version; /* the version, 1 or 2 */ |
| int n_version; |
| |
| for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) { |
| for (n_version = 0;n_version < gen_nb_int;n_version++) { |
| mem_base = xmlMemBlocks(); |
| hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0); |
| version = gen_int(n_version, 1); |
| |
| ret_val = xmlSAXVersion(hdlr, version); |
| desret_int(ret_val); |
| call_tests++; |
| des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0); |
| des_int(n_version, version, 1); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlSAXVersion", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_hdlr); |
| printf(" %d", n_version); |
| printf("\n"); |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| static int |
| test_SAX2(void) { |
| int test_ret = 0; |
| |
| if (quiet == 0) printf("Testing SAX2 : 36 of 36 functions ...\n"); |
| test_ret += test_htmlDefaultSAXHandlerInit(); |
| test_ret += test_xmlDefaultSAXHandlerInit(); |
| test_ret += test_xmlSAX2AttributeDecl(); |
| test_ret += test_xmlSAX2CDataBlock(); |
| test_ret += test_xmlSAX2Characters(); |
| test_ret += test_xmlSAX2Comment(); |
| test_ret += test_xmlSAX2ElementDecl(); |
| test_ret += test_xmlSAX2EndDocument(); |
| test_ret += test_xmlSAX2EndElement(); |
| test_ret += test_xmlSAX2EndElementNs(); |
| test_ret += test_xmlSAX2EntityDecl(); |
| test_ret += test_xmlSAX2ExternalSubset(); |
| test_ret += test_xmlSAX2GetColumnNumber(); |
| test_ret += test_xmlSAX2GetEntity(); |
| test_ret += test_xmlSAX2GetLineNumber(); |
| test_ret += test_xmlSAX2GetParameterEntity(); |
| test_ret += test_xmlSAX2GetPublicId(); |
| test_ret += test_xmlSAX2GetSystemId(); |
| test_ret += test_xmlSAX2HasExternalSubset(); |
| test_ret += test_xmlSAX2HasInternalSubset(); |
| test_ret += test_xmlSAX2IgnorableWhitespace(); |
| test_ret += test_xmlSAX2InitDefaultSAXHandler(); |
| test_ret += test_xmlSAX2InitHtmlDefaultSAXHandler(); |
| test_ret += test_xmlSAX2InternalSubset(); |
| test_ret += test_xmlSAX2IsStandalone(); |
| test_ret += test_xmlSAX2NotationDecl(); |
| test_ret += test_xmlSAX2ProcessingInstruction(); |
| test_ret += test_xmlSAX2Reference(); |
| test_ret += test_xmlSAX2ResolveEntity(); |
| test_ret += test_xmlSAX2SetDocumentLocator(); |
| test_ret += test_xmlSAX2StartDocument(); |
| test_ret += test_xmlSAX2StartElement(); |
| test_ret += test_xmlSAX2StartElementNs(); |
| test_ret += test_xmlSAX2UnparsedEntityDecl(); |
| test_ret += test_xmlSAXDefaultVersion(); |
| test_ret += test_xmlSAXVersion(); |
| |
| if (test_ret != 0) |
| printf("Module SAX2: %d errors\n", test_ret); |
| return(test_ret); |
| } |
| |
| static int |
| test_xmlC14NDocDumpMemory(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_C14N_ENABLED) |
| int mem_base; |
| int ret_val; |
| xmlDocPtr doc; /* the XML document for canonization */ |
| int n_doc; |
| xmlNodeSetPtr nodes; /* the nodes set to be included in the canonized image or NULL if all document nodes should be included */ |
| int n_nodes; |
| int mode; /* the c14n mode (see @xmlC14NMode) */ |
| int n_mode; |
| 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) */ |
| int n_inclusive_ns_prefixes; |
| int with_comments; /* include comments in the result (!=0) or not (==0) */ |
| int n_with_comments; |
| 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 */ |
| int n_doc_txt_ptr; |
| |
| for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { |
| for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) { |
| for (n_mode = 0;n_mode < gen_nb_int;n_mode++) { |
| for (n_inclusive_ns_prefixes = 0;n_inclusive_ns_prefixes < gen_nb_xmlChar_ptr_ptr;n_inclusive_ns_prefixes++) { |
| for (n_with_comments = 0;n_with_comments < gen_nb_int;n_with_comments++) { |
| for (n_doc_txt_ptr = 0;n_doc_txt_ptr < gen_nb_xmlChar_ptr_ptr;n_doc_txt_ptr++) { |
| mem_base = xmlMemBlocks(); |
| doc = gen_xmlDocPtr(n_doc, 0); |
| nodes = gen_xmlNodeSetPtr(n_nodes, 1); |
| mode = gen_int(n_mode, 2); |
| inclusive_ns_prefixes = gen_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, 3); |
| with_comments = gen_int(n_with_comments, 4); |
| doc_txt_ptr = gen_xmlChar_ptr_ptr(n_doc_txt_ptr, 5); |
| |
| ret_val = xmlC14NDocDumpMemory(doc, nodes, mode, inclusive_ns_prefixes, with_comments, doc_txt_ptr); |
| desret_int(ret_val); |
| call_tests++; |
| des_xmlDocPtr(n_doc, doc, 0); |
| des_xmlNodeSetPtr(n_nodes, nodes, 1); |
| des_int(n_mode, mode, 2); |
| des_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, inclusive_ns_prefixes, 3); |
| des_int(n_with_comments, with_comments, 4); |
| des_xmlChar_ptr_ptr(n_doc_txt_ptr, doc_txt_ptr, 5); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlC14NDocDumpMemory", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_doc); |
| printf(" %d", n_nodes); |
| printf(" %d", n_mode); |
| printf(" %d", n_inclusive_ns_prefixes); |
| printf(" %d", n_with_comments); |
| printf(" %d", n_doc_txt_ptr); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlC14NDocSave(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_C14N_ENABLED) |
| int mem_base; |
| int ret_val; |
| xmlDocPtr doc; /* the XML document for canonization */ |
| int n_doc; |
| xmlNodeSetPtr nodes; /* the nodes set to be included in the canonized image or NULL if all document nodes should be included */ |
| int n_nodes; |
| int mode; /* the c14n mode (see @xmlC14NMode) */ |
| int n_mode; |
| 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) */ |
| int n_inclusive_ns_prefixes; |
| int with_comments; /* include comments in the result (!=0) or not (==0) */ |
| int n_with_comments; |
| const char * filename; /* the filename to store canonical XML image */ |
| int n_filename; |
| int compression; /* the compression level (zlib required): -1 - libxml default, 0 - uncompressed, >0 - compression level */ |
| int n_compression; |
| |
| for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { |
| for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) { |
| for (n_mode = 0;n_mode < gen_nb_int;n_mode++) { |
| for (n_inclusive_ns_prefixes = 0;n_inclusive_ns_prefixes < gen_nb_xmlChar_ptr_ptr;n_inclusive_ns_prefixes++) { |
| for (n_with_comments = 0;n_with_comments < gen_nb_int;n_with_comments++) { |
| for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) { |
| for (n_compression = 0;n_compression < gen_nb_int;n_compression++) { |
| mem_base = xmlMemBlocks(); |
| doc = gen_xmlDocPtr(n_doc, 0); |
| nodes = gen_xmlNodeSetPtr(n_nodes, 1); |
| mode = gen_int(n_mode, 2); |
| inclusive_ns_prefixes = gen_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, 3); |
| with_comments = gen_int(n_with_comments, 4); |
| filename = gen_fileoutput(n_filename, 5); |
| compression = gen_int(n_compression, 6); |
| |
| ret_val = xmlC14NDocSave(doc, nodes, mode, inclusive_ns_prefixes, with_comments, filename, compression); |
| desret_int(ret_val); |
| call_tests++; |
| des_xmlDocPtr(n_doc, doc, 0); |
| des_xmlNodeSetPtr(n_nodes, nodes, 1); |
| des_int(n_mode, mode, 2); |
| des_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, inclusive_ns_prefixes, 3); |
| des_int(n_with_comments, with_comments, 4); |
| des_fileoutput(n_filename, filename, 5); |
| des_int(n_compression, compression, 6); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlC14NDocSave", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_doc); |
| printf(" %d", n_nodes); |
| printf(" %d", n_mode); |
| printf(" %d", n_inclusive_ns_prefixes); |
| printf(" %d", n_with_comments); |
| printf(" %d", n_filename); |
| printf(" %d", n_compression); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlC14NDocSaveTo(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_C14N_ENABLED) |
| int mem_base; |
| int ret_val; |
| xmlDocPtr doc; /* the XML document for canonization */ |
| int n_doc; |
| xmlNodeSetPtr nodes; /* the nodes set to be included in the canonized image or NULL if all document nodes should be included */ |
| int n_nodes; |
| int mode; /* the c14n mode (see @xmlC14NMode) */ |
| int n_mode; |
| 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) */ |
| int n_inclusive_ns_prefixes; |
| int with_comments; /* include comments in the result (!=0) or not (==0) */ |
| int n_with_comments; |
| xmlOutputBufferPtr buf; /* the output buffer to store canonical XML; this buffer MUST have encoder==NULL because C14N requires UTF-8 output */ |
| int n_buf; |
| |
| for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { |
| for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) { |
| for (n_mode = 0;n_mode < gen_nb_int;n_mode++) { |
| for (n_inclusive_ns_prefixes = 0;n_inclusive_ns_prefixes < gen_nb_xmlChar_ptr_ptr;n_inclusive_ns_prefixes++) { |
| for (n_with_comments = 0;n_with_comments < gen_nb_int;n_with_comments++) { |
| for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) { |
| mem_base = xmlMemBlocks(); |
| doc = gen_xmlDocPtr(n_doc, 0); |
| nodes = gen_xmlNodeSetPtr(n_nodes, 1); |
| mode = gen_int(n_mode, 2); |
| inclusive_ns_prefixes = gen_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, 3); |
| with_comments = gen_int(n_with_comments, 4); |
| buf = gen_xmlOutputBufferPtr(n_buf, 5); |
| |
| ret_val = xmlC14NDocSaveTo(doc, nodes, mode, inclusive_ns_prefixes, with_comments, buf); |
| desret_int(ret_val); |
| call_tests++; |
| des_xmlDocPtr(n_doc, doc, 0); |
| des_xmlNodeSetPtr(n_nodes, nodes, 1); |
| des_int(n_mode, mode, 2); |
| des_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, inclusive_ns_prefixes, 3); |
| des_int(n_with_comments, with_comments, 4); |
| des_xmlOutputBufferPtr(n_buf, buf, 5); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlC14NDocSaveTo", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_doc); |
| printf(" %d", n_nodes); |
| printf(" %d", n_mode); |
| printf(" %d", n_inclusive_ns_prefixes); |
| printf(" %d", n_with_comments); |
| printf(" %d", n_buf); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlC14NExecute(void) { |
| int test_ret = 0; |
| |
| |
| /* missing type support */ |
| return(test_ret); |
| } |
| |
| static int |
| test_c14n(void) { |
| int test_ret = 0; |
| |
| if (quiet == 0) printf("Testing c14n : 3 of 4 functions ...\n"); |
| test_ret += test_xmlC14NDocDumpMemory(); |
| test_ret += test_xmlC14NDocSave(); |
| test_ret += test_xmlC14NDocSaveTo(); |
| test_ret += test_xmlC14NExecute(); |
| |
| if (test_ret != 0) |
| printf("Module c14n: %d errors\n", test_ret); |
| return(test_ret); |
| } |
| #ifdef LIBXML_CATALOG_ENABLED |
| |
| #define gen_nb_xmlCatalogPtr 1 |
| #define gen_xmlCatalogPtr(no, nr) NULL |
| #define des_xmlCatalogPtr(no, val, nr) |
| #endif |
| |
| |
| static int |
| test_xmlACatalogAdd(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_CATALOG_ENABLED) |
| int mem_base; |
| int ret_val; |
| xmlCatalogPtr catal; /* a Catalog */ |
| int n_catal; |
| const xmlChar * type; /* the type of record to add to the catalog */ |
| int n_type; |
| const xmlChar * orig; /* the system, public or prefix to match */ |
| int n_orig; |
| const xmlChar * replace; /* the replacement value for the match */ |
| int n_replace; |
| |
| for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) { |
| for (n_type = 0;n_type < gen_nb_const_xmlChar_ptr;n_type++) { |
| for (n_orig = 0;n_orig < gen_nb_const_xmlChar_ptr;n_orig++) { |
| for (n_replace = 0;n_replace < gen_nb_const_xmlChar_ptr;n_replace++) { |
| mem_base = xmlMemBlocks(); |
| catal = gen_xmlCatalogPtr(n_catal, 0); |
| type = gen_const_xmlChar_ptr(n_type, 1); |
| orig = gen_const_xmlChar_ptr(n_orig, 2); |
| replace = gen_const_xmlChar_ptr(n_replace, 3); |
| |
| ret_val = xmlACatalogAdd(catal, type, orig, replace); |
| desret_int(ret_val); |
| call_tests++; |
| des_xmlCatalogPtr(n_catal, catal, 0); |
| des_const_xmlChar_ptr(n_type, type, 1); |
| des_const_xmlChar_ptr(n_orig, orig, 2); |
| des_const_xmlChar_ptr(n_replace, replace, 3); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlACatalogAdd", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_catal); |
| printf(" %d", n_type); |
| printf(" %d", n_orig); |
| printf(" %d", n_replace); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlACatalogDump(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_CATALOG_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) |
| int mem_base; |
| xmlCatalogPtr catal; /* a Catalog */ |
| int n_catal; |
| FILE * out; /* the file. */ |
| int n_out; |
| |
| for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) { |
| for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) { |
| mem_base = xmlMemBlocks(); |
| catal = gen_xmlCatalogPtr(n_catal, 0); |
| out = gen_FILE_ptr(n_out, 1); |
| |
| xmlACatalogDump(catal, out); |
| call_tests++; |
| des_xmlCatalogPtr(n_catal, catal, 0); |
| des_FILE_ptr(n_out, out, 1); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlACatalogDump", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_catal); |
| printf(" %d", n_out); |
| printf("\n"); |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlACatalogRemove(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_CATALOG_ENABLED) |
| int mem_base; |
| int ret_val; |
| xmlCatalogPtr catal; /* a Catalog */ |
| int n_catal; |
| const xmlChar * value; /* the value to remove */ |
| int n_value; |
| |
| for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) { |
| for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { |
| mem_base = xmlMemBlocks(); |
| catal = gen_xmlCatalogPtr(n_catal, 0); |
| value = gen_const_xmlChar_ptr(n_value, 1); |
| |
| ret_val = xmlACatalogRemove(catal, value); |
| desret_int(ret_val); |
| call_tests++; |
| des_xmlCatalogPtr(n_catal, catal, 0); |
| des_const_xmlChar_ptr(n_value, value, 1); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlACatalogRemove", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_catal); |
| printf(" %d", n_value); |
| printf("\n"); |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlACatalogResolve(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_CATALOG_ENABLED) |
| int mem_base; |
| xmlChar * ret_val; |
| xmlCatalogPtr catal; /* a Catalog */ |
| int n_catal; |
| const xmlChar * pubID; /* the public ID string */ |
| int n_pubID; |
| const xmlChar * sysID; /* the system ID string */ |
| int n_sysID; |
| |
| for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) { |
| for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) { |
| for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) { |
| mem_base = xmlMemBlocks(); |
| catal = gen_xmlCatalogPtr(n_catal, 0); |
| pubID = gen_const_xmlChar_ptr(n_pubID, 1); |
| sysID = gen_const_xmlChar_ptr(n_sysID, 2); |
| |
| ret_val = xmlACatalogResolve(catal, pubID, sysID); |
| desret_xmlChar_ptr(ret_val); |
| call_tests++; |
| des_xmlCatalogPtr(n_catal, catal, 0); |
| des_const_xmlChar_ptr(n_pubID, pubID, 1); |
| des_const_xmlChar_ptr(n_sysID, sysID, 2); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlACatalogResolve", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_catal); |
| printf(" %d", n_pubID); |
| printf(" %d", n_sysID); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlACatalogResolvePublic(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_CATALOG_ENABLED) |
| int mem_base; |
| xmlChar * ret_val; |
| xmlCatalogPtr catal; /* a Catalog */ |
| int n_catal; |
| const xmlChar * pubID; /* the public ID string */ |
| int n_pubID; |
| |
| for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) { |
| for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) { |
| mem_base = xmlMemBlocks(); |
| catal = gen_xmlCatalogPtr(n_catal, 0); |
| pubID = gen_const_xmlChar_ptr(n_pubID, 1); |
| |
| ret_val = xmlACatalogResolvePublic(catal, pubID); |
| desret_xmlChar_ptr(ret_val); |
| call_tests++; |
| des_xmlCatalogPtr(n_catal, catal, 0); |
| des_const_xmlChar_ptr(n_pubID, pubID, 1); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlACatalogResolvePublic", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_catal); |
| printf(" %d", n_pubID); |
| printf("\n"); |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlACatalogResolveSystem(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_CATALOG_ENABLED) |
| int mem_base; |
| xmlChar * ret_val; |
| xmlCatalogPtr catal; /* a Catalog */ |
| int n_catal; |
| const xmlChar * sysID; /* the system ID string */ |
| int n_sysID; |
| |
| for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) { |
| for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) { |
| mem_base = xmlMemBlocks(); |
| catal = gen_xmlCatalogPtr(n_catal, 0); |
| sysID = gen_const_xmlChar_ptr(n_sysID, 1); |
| |
| ret_val = xmlACatalogResolveSystem(catal, sysID); |
| desret_xmlChar_ptr(ret_val); |
| call_tests++; |
| des_xmlCatalogPtr(n_catal, catal, 0); |
| des_const_xmlChar_ptr(n_sysID, sysID, 1); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlACatalogResolveSystem", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_catal); |
| printf(" %d", n_sysID); |
| printf("\n"); |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlACatalogResolveURI(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_CATALOG_ENABLED) |
| int mem_base; |
| xmlChar * ret_val; |
| xmlCatalogPtr catal; /* a Catalog */ |
| int n_catal; |
| const xmlChar * URI; /* the URI */ |
| int n_URI; |
| |
| for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) { |
| for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) { |
| mem_base = xmlMemBlocks(); |
| catal = gen_xmlCatalogPtr(n_catal, 0); |
| URI = gen_const_xmlChar_ptr(n_URI, 1); |
| |
| ret_val = xmlACatalogResolveURI(catal, URI); |
| desret_xmlChar_ptr(ret_val); |
| call_tests++; |
| des_xmlCatalogPtr(n_catal, catal, 0); |
| des_const_xmlChar_ptr(n_URI, URI, 1); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlACatalogResolveURI", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_catal); |
| printf(" %d", n_URI); |
| printf("\n"); |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlCatalogAdd(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_CATALOG_ENABLED) |
| int mem_base; |
| int ret_val; |
| const xmlChar * type; /* the type of record to add to the catalog */ |
| int n_type; |
| const xmlChar * orig; /* the system, public or prefix to match */ |
| int n_orig; |
| const xmlChar * replace; /* the replacement value for the match */ |
| int n_replace; |
| |
| for (n_type = 0;n_type < gen_nb_const_xmlChar_ptr;n_type++) { |
| for (n_orig = 0;n_orig < gen_nb_const_xmlChar_ptr;n_orig++) { |
| for (n_replace = 0;n_replace < gen_nb_const_xmlChar_ptr;n_replace++) { |
| mem_base = xmlMemBlocks(); |
| type = gen_const_xmlChar_ptr(n_type, 0); |
| orig = gen_const_xmlChar_ptr(n_orig, 1); |
| replace = gen_const_xmlChar_ptr(n_replace, 2); |
| |
| ret_val = xmlCatalogAdd(type, orig, replace); |
| desret_int(ret_val); |
| call_tests++; |
| des_const_xmlChar_ptr(n_type, type, 0); |
| des_const_xmlChar_ptr(n_orig, orig, 1); |
| des_const_xmlChar_ptr(n_replace, replace, 2); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlCatalogAdd", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_type); |
| printf(" %d", n_orig); |
| printf(" %d", n_replace); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlCatalogCleanup(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_CATALOG_ENABLED) |
| |
| |
| xmlCatalogCleanup(); |
| call_tests++; |
| xmlResetLastError(); |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlCatalogConvert(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_CATALOG_ENABLED) |
| int ret_val; |
| |
| |
| ret_val = xmlCatalogConvert(); |
| desret_int(ret_val); |
| call_tests++; |
| xmlResetLastError(); |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlCatalogDump(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_CATALOG_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) |
| int mem_base; |
| FILE * out; /* the file. */ |
| int n_out; |
| |
| for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) { |
| mem_base = xmlMemBlocks(); |
| out = gen_FILE_ptr(n_out, 0); |
| |
| xmlCatalogDump(out); |
| call_tests++; |
| des_FILE_ptr(n_out, out, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlCatalogDump", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_out); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlCatalogGetDefaults(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_CATALOG_ENABLED) |
| int mem_base; |
| xmlCatalogAllow ret_val; |
| |
| mem_base = xmlMemBlocks(); |
| |
| ret_val = xmlCatalogGetDefaults(); |
| desret_xmlCatalogAllow(ret_val); |
| call_tests++; |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlCatalogGetDefaults", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf("\n"); |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlCatalogIsEmpty(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_CATALOG_ENABLED) |
| int mem_base; |
| int ret_val; |
| xmlCatalogPtr catal; /* should this create an SGML catalog */ |
| int n_catal; |
| |
| for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) { |
| mem_base = xmlMemBlocks(); |
| catal = gen_xmlCatalogPtr(n_catal, 0); |
| |
| ret_val = xmlCatalogIsEmpty(catal); |
| desret_int(ret_val); |
| call_tests++; |
| des_xmlCatalogPtr(n_catal, catal, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlCatalogIsEmpty", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_catal); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlCatalogLocalResolve(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_CATALOG_ENABLED) |
| int mem_base; |
| xmlChar * ret_val; |
| void * catalogs; /* a document's list of catalogs */ |
| int n_catalogs; |
| const xmlChar * pubID; /* the public ID string */ |
| int n_pubID; |
| const xmlChar * sysID; /* the system ID string */ |
| int n_sysID; |
| |
| for (n_catalogs = 0;n_catalogs < gen_nb_void_ptr;n_catalogs++) { |
| for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) { |
| for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) { |
| mem_base = xmlMemBlocks(); |
| catalogs = gen_void_ptr(n_catalogs, 0); |
| pubID = gen_const_xmlChar_ptr(n_pubID, 1); |
| sysID = gen_const_xmlChar_ptr(n_sysID, 2); |
| |
| ret_val = xmlCatalogLocalResolve(catalogs, pubID, sysID); |
| desret_xmlChar_ptr(ret_val); |
| call_tests++; |
| des_void_ptr(n_catalogs, catalogs, 0); |
| des_const_xmlChar_ptr(n_pubID, pubID, 1); |
| des_const_xmlChar_ptr(n_sysID, sysID, 2); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlCatalogLocalResolve", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_catalogs); |
| printf(" %d", n_pubID); |
| printf(" %d", n_sysID); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlCatalogLocalResolveURI(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_CATALOG_ENABLED) |
| int mem_base; |
| xmlChar * ret_val; |
| void * catalogs; /* a document's list of catalogs */ |
| int n_catalogs; |
| const xmlChar * URI; /* the URI */ |
| int n_URI; |
| |
| for (n_catalogs = 0;n_catalogs < gen_nb_void_ptr;n_catalogs++) { |
| for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) { |
| mem_base = xmlMemBlocks(); |
| catalogs = gen_void_ptr(n_catalogs, 0); |
| URI = gen_const_xmlChar_ptr(n_URI, 1); |
| |
| ret_val = xmlCatalogLocalResolveURI(catalogs, URI); |
| desret_xmlChar_ptr(ret_val); |
| call_tests++; |
| des_void_ptr(n_catalogs, catalogs, 0); |
| des_const_xmlChar_ptr(n_URI, URI, 1); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlCatalogLocalResolveURI", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_catalogs); |
| printf(" %d", n_URI); |
| printf("\n"); |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlCatalogRemove(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_CATALOG_ENABLED) |
| int ret_val; |
| const xmlChar * value; /* the value to remove */ |
| int n_value; |
| |
| for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { |
| value = gen_const_xmlChar_ptr(n_value, 0); |
| |
| ret_val = xmlCatalogRemove(value); |
| desret_int(ret_val); |
| call_tests++; |
| des_const_xmlChar_ptr(n_value, value, 0); |
| xmlResetLastError(); |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlCatalogResolve(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_CATALOG_ENABLED) |
| xmlChar * ret_val; |
| const xmlChar * pubID; /* the public ID string */ |
| int n_pubID; |
| const xmlChar * sysID; /* the system ID string */ |
| int n_sysID; |
| |
| for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) { |
| for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) { |
| pubID = gen_const_xmlChar_ptr(n_pubID, 0); |
| sysID = gen_const_xmlChar_ptr(n_sysID, 1); |
| |
| ret_val = xmlCatalogResolve(pubID, sysID); |
| desret_xmlChar_ptr(ret_val); |
| call_tests++; |
| des_const_xmlChar_ptr(n_pubID, pubID, 0); |
| des_const_xmlChar_ptr(n_sysID, sysID, 1); |
| xmlResetLastError(); |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlCatalogResolvePublic(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_CATALOG_ENABLED) |
| int mem_base; |
| xmlChar * ret_val; |
| const xmlChar * pubID; /* the public ID string */ |
| int n_pubID; |
| |
| for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) { |
| mem_base = xmlMemBlocks(); |
| pubID = gen_const_xmlChar_ptr(n_pubID, 0); |
| |
| ret_val = xmlCatalogResolvePublic(pubID); |
| desret_xmlChar_ptr(ret_val); |
| call_tests++; |
| des_const_xmlChar_ptr(n_pubID, pubID, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlCatalogResolvePublic", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_pubID); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlCatalogResolveSystem(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_CATALOG_ENABLED) |
| int mem_base; |
| xmlChar * ret_val; |
| const xmlChar * sysID; /* the system ID string */ |
| int n_sysID; |
| |
| for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) { |
| mem_base = xmlMemBlocks(); |
| sysID = gen_const_xmlChar_ptr(n_sysID, 0); |
| |
| ret_val = xmlCatalogResolveSystem(sysID); |
| desret_xmlChar_ptr(ret_val); |
| call_tests++; |
| des_const_xmlChar_ptr(n_sysID, sysID, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlCatalogResolveSystem", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_sysID); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlCatalogResolveURI(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_CATALOG_ENABLED) |
| int mem_base; |
| xmlChar * ret_val; |
| const xmlChar * URI; /* the URI */ |
| int n_URI; |
| |
| for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) { |
| mem_base = xmlMemBlocks(); |
| URI = gen_const_xmlChar_ptr(n_URI, 0); |
| |
| ret_val = xmlCatalogResolveURI(URI); |
| desret_xmlChar_ptr(ret_val); |
| call_tests++; |
| des_const_xmlChar_ptr(n_URI, URI, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlCatalogResolveURI", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_URI); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlCatalogSetDefaultPrefer(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_CATALOG_ENABLED) |
| int mem_base; |
| xmlCatalogPrefer ret_val; |
| xmlCatalogPrefer prefer; /* the default preference for delegation */ |
| int n_prefer; |
| |
| for (n_prefer = 0;n_prefer < gen_nb_xmlCatalogPrefer;n_prefer++) { |
| mem_base = xmlMemBlocks(); |
| prefer = gen_xmlCatalogPrefer(n_prefer, 0); |
| |
| ret_val = xmlCatalogSetDefaultPrefer(prefer); |
| desret_xmlCatalogPrefer(ret_val); |
| call_tests++; |
| des_xmlCatalogPrefer(n_prefer, prefer, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlCatalogSetDefaultPrefer", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_prefer); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlCatalogSetDefaults(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_CATALOG_ENABLED) |
| int mem_base; |
| xmlCatalogAllow allow; /* what catalogs should be accepted */ |
| int n_allow; |
| |
| for (n_allow = 0;n_allow < gen_nb_xmlCatalogAllow;n_allow++) { |
| mem_base = xmlMemBlocks(); |
| allow = gen_xmlCatalogAllow(n_allow, 0); |
| |
| xmlCatalogSetDefaults(allow); |
| call_tests++; |
| des_xmlCatalogAllow(n_allow, allow, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlCatalogSetDefaults", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_allow); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlConvertSGMLCatalog(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_CATALOG_ENABLED) |
| int mem_base; |
| int ret_val; |
| xmlCatalogPtr catal; /* the catalog */ |
| int n_catal; |
| |
| for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) { |
| mem_base = xmlMemBlocks(); |
| catal = gen_xmlCatalogPtr(n_catal, 0); |
| |
| ret_val = xmlConvertSGMLCatalog(catal); |
| desret_int(ret_val); |
| call_tests++; |
| des_xmlCatalogPtr(n_catal, catal, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlConvertSGMLCatalog", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_catal); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlInitializeCatalog(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_CATALOG_ENABLED) |
| int mem_base; |
| |
| mem_base = xmlMemBlocks(); |
| |
| xmlInitializeCatalog(); |
| call_tests++; |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlInitializeCatalog", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf("\n"); |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlLoadACatalog(void) { |
| int test_ret = 0; |
| |
| |
| /* missing type support */ |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlLoadCatalog(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_CATALOG_ENABLED) |
| int ret_val; |
| const char * filename; /* a file path */ |
| int n_filename; |
| |
| for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { |
| filename = gen_filepath(n_filename, 0); |
| |
| ret_val = xmlLoadCatalog(filename); |
| desret_int(ret_val); |
| call_tests++; |
| des_filepath(n_filename, filename, 0); |
| xmlResetLastError(); |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlLoadCatalogs(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_CATALOG_ENABLED) |
| const char * pathss; /* a list of directories separated by a colon or a space. */ |
| int n_pathss; |
| |
| for (n_pathss = 0;n_pathss < gen_nb_const_char_ptr;n_pathss++) { |
| pathss = gen_const_char_ptr(n_pathss, 0); |
| |
| xmlLoadCatalogs(pathss); |
| call_tests++; |
| des_const_char_ptr(n_pathss, pathss, 0); |
| xmlResetLastError(); |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlLoadSGMLSuperCatalog(void) { |
| int test_ret = 0; |
| |
| |
| /* missing type support */ |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlNewCatalog(void) { |
| int test_ret = 0; |
| |
| |
| /* missing type support */ |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlParseCatalogFile(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_CATALOG_ENABLED) |
| int mem_base; |
| xmlDocPtr ret_val; |
| const char * filename; /* the filename */ |
| int n_filename; |
| |
| for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { |
| mem_base = xmlMemBlocks(); |
| filename = gen_filepath(n_filename, 0); |
| |
| ret_val = xmlParseCatalogFile(filename); |
| desret_xmlDocPtr(ret_val); |
| call_tests++; |
| des_filepath(n_filename, filename, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlParseCatalogFile", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_filename); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| static int |
| test_catalog(void) { |
| int test_ret = 0; |
| |
| if (quiet == 0) printf("Testing catalog : 27 of 36 functions ...\n"); |
| test_ret += test_xmlACatalogAdd(); |
| test_ret += test_xmlACatalogDump(); |
| test_ret += test_xmlACatalogRemove(); |
| test_ret += test_xmlACatalogResolve(); |
| test_ret += test_xmlACatalogResolvePublic(); |
| test_ret += test_xmlACatalogResolveSystem(); |
| test_ret += test_xmlACatalogResolveURI(); |
| test_ret += test_xmlCatalogAdd(); |
| test_ret += test_xmlCatalogCleanup(); |
| test_ret += test_xmlCatalogConvert(); |
| test_ret += test_xmlCatalogDump(); |
| test_ret += test_xmlCatalogGetDefaults(); |
| test_ret += test_xmlCatalogIsEmpty(); |
| test_ret += test_xmlCatalogLocalResolve(); |
| test_ret += test_xmlCatalogLocalResolveURI(); |
| test_ret += test_xmlCatalogRemove(); |
| test_ret += test_xmlCatalogResolve(); |
| test_ret += test_xmlCatalogResolvePublic(); |
| test_ret += test_xmlCatalogResolveSystem(); |
| test_ret += test_xmlCatalogResolveURI(); |
| test_ret += test_xmlCatalogSetDefaultPrefer(); |
| test_ret += test_xmlCatalogSetDefaults(); |
| test_ret += test_xmlConvertSGMLCatalog(); |
| test_ret += test_xmlInitializeCatalog(); |
| test_ret += test_xmlLoadACatalog(); |
| test_ret += test_xmlLoadCatalog(); |
| test_ret += test_xmlLoadCatalogs(); |
| test_ret += test_xmlLoadSGMLSuperCatalog(); |
| test_ret += test_xmlNewCatalog(); |
| test_ret += test_xmlParseCatalogFile(); |
| |
| if (test_ret != 0) |
| printf("Module catalog: %d errors\n", test_ret); |
| return(test_ret); |
| } |
| |
| #define gen_nb_const_xmlChRangeGroup_ptr 1 |
| #define gen_const_xmlChRangeGroup_ptr(no, nr) NULL |
| #define des_const_xmlChRangeGroup_ptr(no, val, nr) |
| |
| static int |
| test_xmlCharInRange(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| int ret_val; |
| unsigned int val; /* character to be validated */ |
| int n_val; |
| const xmlChRangeGroup * rptr; /* pointer to range to be used to validate */ |
| int n_rptr; |
| |
| for (n_val = 0;n_val < gen_nb_unsigned_int;n_val++) { |
| for (n_rptr = 0;n_rptr < gen_nb_const_xmlChRangeGroup_ptr;n_rptr++) { |
| mem_base = xmlMemBlocks(); |
| val = gen_unsigned_int(n_val, 0); |
| rptr = gen_const_xmlChRangeGroup_ptr(n_rptr, 1); |
| |
| ret_val = xmlCharInRange(val, rptr); |
| desret_int(ret_val); |
| call_tests++; |
| des_unsigned_int(n_val, val, 0); |
| des_const_xmlChRangeGroup_ptr(n_rptr, rptr, 1); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlCharInRange", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_val); |
| printf(" %d", n_rptr); |
| printf("\n"); |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlIsBaseChar(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| int ret_val; |
| unsigned int ch; /* character to validate */ |
| int n_ch; |
| |
| for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) { |
| mem_base = xmlMemBlocks(); |
| ch = gen_unsigned_int(n_ch, 0); |
| |
| ret_val = xmlIsBaseChar(ch); |
| desret_int(ret_val); |
| call_tests++; |
| des_unsigned_int(n_ch, ch, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlIsBaseChar", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ch); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlIsBlank(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| int ret_val; |
| unsigned int ch; /* character to validate */ |
| int n_ch; |
| |
| for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) { |
| mem_base = xmlMemBlocks(); |
| ch = gen_unsigned_int(n_ch, 0); |
| |
| ret_val = xmlIsBlank(ch); |
| desret_int(ret_val); |
| call_tests++; |
| des_unsigned_int(n_ch, ch, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlIsBlank", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ch); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlIsChar(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| int ret_val; |
| unsigned int ch; /* character to validate */ |
| int n_ch; |
| |
| for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) { |
| mem_base = xmlMemBlocks(); |
| ch = gen_unsigned_int(n_ch, 0); |
| |
| ret_val = xmlIsChar(ch); |
| desret_int(ret_val); |
| call_tests++; |
| des_unsigned_int(n_ch, ch, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlIsChar", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ch); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlIsCombining(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| int ret_val; |
| unsigned int ch; /* character to validate */ |
| int n_ch; |
| |
| for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) { |
| mem_base = xmlMemBlocks(); |
| ch = gen_unsigned_int(n_ch, 0); |
| |
| ret_val = xmlIsCombining(ch); |
| desret_int(ret_val); |
| call_tests++; |
| des_unsigned_int(n_ch, ch, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlIsCombining", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ch); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlIsDigit(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| int ret_val; |
| unsigned int ch; /* character to validate */ |
| int n_ch; |
| |
| for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) { |
| mem_base = xmlMemBlocks(); |
| ch = gen_unsigned_int(n_ch, 0); |
| |
| ret_val = xmlIsDigit(ch); |
| desret_int(ret_val); |
| call_tests++; |
| des_unsigned_int(n_ch, ch, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlIsDigit", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ch); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlIsExtender(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| int ret_val; |
| unsigned int ch; /* character to validate */ |
| int n_ch; |
| |
| for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) { |
| mem_base = xmlMemBlocks(); |
| ch = gen_unsigned_int(n_ch, 0); |
| |
| ret_val = xmlIsExtender(ch); |
| desret_int(ret_val); |
| call_tests++; |
| des_unsigned_int(n_ch, ch, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlIsExtender", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ch); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlIsIdeographic(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| int ret_val; |
| unsigned int ch; /* character to validate */ |
| int n_ch; |
| |
| for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) { |
| mem_base = xmlMemBlocks(); |
| ch = gen_unsigned_int(n_ch, 0); |
| |
| ret_val = xmlIsIdeographic(ch); |
| desret_int(ret_val); |
| call_tests++; |
| des_unsigned_int(n_ch, ch, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlIsIdeographic", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ch); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlIsPubidChar(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| int ret_val; |
| unsigned int ch; /* character to validate */ |
| int n_ch; |
| |
| for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) { |
| mem_base = xmlMemBlocks(); |
| ch = gen_unsigned_int(n_ch, 0); |
| |
| ret_val = xmlIsPubidChar(ch); |
| desret_int(ret_val); |
| call_tests++; |
| des_unsigned_int(n_ch, ch, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlIsPubidChar", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ch); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| static int |
| test_chvalid(void) { |
| int test_ret = 0; |
| |
| if (quiet == 0) printf("Testing chvalid : 9 of 9 functions ...\n"); |
| test_ret += test_xmlCharInRange(); |
| test_ret += test_xmlIsBaseChar(); |
| test_ret += test_xmlIsBlank(); |
| test_ret += test_xmlIsChar(); |
| test_ret += test_xmlIsCombining(); |
| test_ret += test_xmlIsDigit(); |
| test_ret += test_xmlIsExtender(); |
| test_ret += test_xmlIsIdeographic(); |
| test_ret += test_xmlIsPubidChar(); |
| |
| if (test_ret != 0) |
| printf("Module chvalid: %d errors\n", test_ret); |
| return(test_ret); |
| } |
| |
| static int |
| test_xmlDebugCheckDocument(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_DEBUG_ENABLED) |
| int mem_base; |
| int ret_val; |
| FILE * output; /* the FILE * for the output */ |
| int n_output; |
| xmlDocPtr doc; /* the document */ |
| int n_doc; |
| |
| for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) { |
| for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { |
| mem_base = xmlMemBlocks(); |
| output = gen_debug_FILE_ptr(n_output, 0); |
| doc = gen_xmlDocPtr(n_doc, 1); |
| |
| ret_val = xmlDebugCheckDocument(output, doc); |
| desret_int(ret_val); |
| call_tests++; |
| des_debug_FILE_ptr(n_output, output, 0); |
| des_xmlDocPtr(n_doc, doc, 1); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlDebugCheckDocument", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_output); |
| printf(" %d", n_doc); |
| printf("\n"); |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlDebugDumpAttr(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_DEBUG_ENABLED) |
| int mem_base; |
| FILE * output; /* the FILE * for the output */ |
| int n_output; |
| xmlAttrPtr attr; /* the attribute */ |
| int n_attr; |
| int depth; /* the indentation level. */ |
| int n_depth; |
| |
| for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) { |
| for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) { |
| for (n_depth = 0;n_depth < gen_nb_int;n_depth++) { |
| mem_base = xmlMemBlocks(); |
| output = gen_debug_FILE_ptr(n_output, 0); |
| attr = gen_xmlAttrPtr(n_attr, 1); |
| depth = gen_int(n_depth, 2); |
| |
| xmlDebugDumpAttr(output, attr, depth); |
| call_tests++; |
| des_debug_FILE_ptr(n_output, output, 0); |
| des_xmlAttrPtr(n_attr, attr, 1); |
| des_int(n_depth, depth, 2); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlDebugDumpAttr", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_output); |
| printf(" %d", n_attr); |
| printf(" %d", n_depth); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlDebugDumpAttrList(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_DEBUG_ENABLED) |
| int mem_base; |
| FILE * output; /* the FILE * for the output */ |
| int n_output; |
| xmlAttrPtr attr; /* the attribute list */ |
| int n_attr; |
| int depth; /* the indentation level. */ |
| int n_depth; |
| |
| for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) { |
| for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) { |
| for (n_depth = 0;n_depth < gen_nb_int;n_depth++) { |
| mem_base = xmlMemBlocks(); |
| output = gen_debug_FILE_ptr(n_output, 0); |
| attr = gen_xmlAttrPtr(n_attr, 1); |
| depth = gen_int(n_depth, 2); |
| |
| xmlDebugDumpAttrList(output, attr, depth); |
| call_tests++; |
| des_debug_FILE_ptr(n_output, output, 0); |
| des_xmlAttrPtr(n_attr, attr, 1); |
| des_int(n_depth, depth, 2); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlDebugDumpAttrList", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_output); |
| printf(" %d", n_attr); |
| printf(" %d", n_depth); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlDebugDumpDTD(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_DEBUG_ENABLED) |
| int mem_base; |
| FILE * output; /* the FILE * for the output */ |
| int n_output; |
| xmlDtdPtr dtd; /* the DTD */ |
| int n_dtd; |
| |
| for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) { |
| for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) { |
| mem_base = xmlMemBlocks(); |
| output = gen_debug_FILE_ptr(n_output, 0); |
| dtd = gen_xmlDtdPtr(n_dtd, 1); |
| |
| xmlDebugDumpDTD(output, dtd); |
| call_tests++; |
| des_debug_FILE_ptr(n_output, output, 0); |
| des_xmlDtdPtr(n_dtd, dtd, 1); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlDebugDumpDTD", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_output); |
| printf(" %d", n_dtd); |
| printf("\n"); |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlDebugDumpDocument(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_DEBUG_ENABLED) |
| int mem_base; |
| FILE * output; /* the FILE * for the output */ |
| int n_output; |
| xmlDocPtr doc; /* the document */ |
| int n_doc; |
| |
| for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) { |
| for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { |
| mem_base = xmlMemBlocks(); |
| output = gen_debug_FILE_ptr(n_output, 0); |
| doc = gen_xmlDocPtr(n_doc, 1); |
| |
| xmlDebugDumpDocument(output, doc); |
| call_tests++; |
| des_debug_FILE_ptr(n_output, output, 0); |
| des_xmlDocPtr(n_doc, doc, 1); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlDebugDumpDocument", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_output); |
| printf(" %d", n_doc); |
| printf("\n"); |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlDebugDumpDocumentHead(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_DEBUG_ENABLED) |
| int mem_base; |
| FILE * output; /* the FILE * for the output */ |
| int n_output; |
| xmlDocPtr doc; /* the document */ |
| int n_doc; |
| |
| for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) { |
| for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { |
| mem_base = xmlMemBlocks(); |
| output = gen_debug_FILE_ptr(n_output, 0); |
| doc = gen_xmlDocPtr(n_doc, 1); |
| |
| xmlDebugDumpDocumentHead(output, doc); |
| call_tests++; |
| des_debug_FILE_ptr(n_output, output, 0); |
| des_xmlDocPtr(n_doc, doc, 1); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlDebugDumpDocumentHead", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_output); |
| printf(" %d", n_doc); |
| printf("\n"); |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlDebugDumpEntities(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_DEBUG_ENABLED) |
| int mem_base; |
| FILE * output; /* the FILE * for the output */ |
| int n_output; |
| xmlDocPtr doc; /* the document */ |
| int n_doc; |
| |
| for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) { |
| for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { |
| mem_base = xmlMemBlocks(); |
| output = gen_debug_FILE_ptr(n_output, 0); |
| doc = gen_xmlDocPtr(n_doc, 1); |
| |
| xmlDebugDumpEntities(output, doc); |
| call_tests++; |
| des_debug_FILE_ptr(n_output, output, 0); |
| des_xmlDocPtr(n_doc, doc, 1); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlDebugDumpEntities", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_output); |
| printf(" %d", n_doc); |
| printf("\n"); |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlDebugDumpNode(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_DEBUG_ENABLED) |
| int mem_base; |
| FILE * output; /* the FILE * for the output */ |
| int n_output; |
| xmlNodePtr node; /* the node */ |
| int n_node; |
| int depth; /* the indentation level. */ |
| int n_depth; |
| |
| for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) { |
| for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { |
| for (n_depth = 0;n_depth < gen_nb_int;n_depth++) { |
| mem_base = xmlMemBlocks(); |
| output = gen_debug_FILE_ptr(n_output, 0); |
| node = gen_xmlNodePtr(n_node, 1); |
| depth = gen_int(n_depth, 2); |
| |
| xmlDebugDumpNode(output, node, depth); |
| call_tests++; |
| des_debug_FILE_ptr(n_output, output, 0); |
| des_xmlNodePtr(n_node, node, 1); |
| des_int(n_depth, depth, 2); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlDebugDumpNode", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_output); |
| printf(" %d", n_node); |
| printf(" %d", n_depth); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlDebugDumpNodeList(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_DEBUG_ENABLED) |
| int mem_base; |
| FILE * output; /* the FILE * for the output */ |
| int n_output; |
| xmlNodePtr node; /* the node list */ |
| int n_node; |
| int depth; /* the indentation level. */ |
| int n_depth; |
| |
| for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) { |
| for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { |
| for (n_depth = 0;n_depth < gen_nb_int;n_depth++) { |
| mem_base = xmlMemBlocks(); |
| output = gen_debug_FILE_ptr(n_output, 0); |
| node = gen_xmlNodePtr(n_node, 1); |
| depth = gen_int(n_depth, 2); |
| |
| xmlDebugDumpNodeList(output, node, depth); |
| call_tests++; |
| des_debug_FILE_ptr(n_output, output, 0); |
| des_xmlNodePtr(n_node, node, 1); |
| des_int(n_depth, depth, 2); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlDebugDumpNodeList", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_output); |
| printf(" %d", n_node); |
| printf(" %d", n_depth); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlDebugDumpOneNode(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_DEBUG_ENABLED) |
| int mem_base; |
| FILE * output; /* the FILE * for the output */ |
| int n_output; |
| xmlNodePtr node; /* the node */ |
| int n_node; |
| int depth; /* the indentation level. */ |
| int n_depth; |
| |
| for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) { |
| for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { |
| for (n_depth = 0;n_depth < gen_nb_int;n_depth++) { |
| mem_base = xmlMemBlocks(); |
| output = gen_debug_FILE_ptr(n_output, 0); |
| node = gen_xmlNodePtr(n_node, 1); |
| depth = gen_int(n_depth, 2); |
| |
| xmlDebugDumpOneNode(output, node, depth); |
| call_tests++; |
| des_debug_FILE_ptr(n_output, output, 0); |
| des_xmlNodePtr(n_node, node, 1); |
| des_int(n_depth, depth, 2); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlDebugDumpOneNode", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_output); |
| printf(" %d", n_node); |
| printf(" %d", n_depth); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlDebugDumpString(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_DEBUG_ENABLED) |
| int mem_base; |
| FILE * output; /* the FILE * for the output */ |
| int n_output; |
| const xmlChar * str; /* the string */ |
| int n_str; |
| |
| for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) { |
| for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) { |
| mem_base = xmlMemBlocks(); |
| output = gen_debug_FILE_ptr(n_output, 0); |
| str = gen_const_xmlChar_ptr(n_str, 1); |
| |
| xmlDebugDumpString(output, str); |
| call_tests++; |
| des_debug_FILE_ptr(n_output, output, 0); |
| des_const_xmlChar_ptr(n_str, str, 1); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlDebugDumpString", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_output); |
| printf(" %d", n_str); |
| printf("\n"); |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| static int |
| test_debugXML(void) { |
| int test_ret = 0; |
| |
| if (quiet == 0) printf("Testing debugXML : 11 of 11 functions ...\n"); |
| test_ret += test_xmlDebugCheckDocument(); |
| test_ret += test_xmlDebugDumpAttr(); |
| test_ret += test_xmlDebugDumpAttrList(); |
| test_ret += test_xmlDebugDumpDTD(); |
| test_ret += test_xmlDebugDumpDocument(); |
| test_ret += test_xmlDebugDumpDocumentHead(); |
| test_ret += test_xmlDebugDumpEntities(); |
| test_ret += test_xmlDebugDumpNode(); |
| test_ret += test_xmlDebugDumpNodeList(); |
| test_ret += test_xmlDebugDumpOneNode(); |
| test_ret += test_xmlDebugDumpString(); |
| |
| if (test_ret != 0) |
| printf("Module debugXML: %d errors\n", test_ret); |
| return(test_ret); |
| } |
| |
| static int |
| test_xmlDictCleanup(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| |
| mem_base = xmlMemBlocks(); |
| |
| xmlDictCleanup(); |
| call_tests++; |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlDictCleanup", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf("\n"); |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlDictCreate(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| xmlDictPtr ret_val; |
| |
| mem_base = xmlMemBlocks(); |
| |
| ret_val = xmlDictCreate(); |
| desret_xmlDictPtr(ret_val); |
| call_tests++; |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlDictCreate", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf("\n"); |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlDictCreateSub(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| xmlDictPtr ret_val; |
| xmlDictPtr sub; /* an existing dictionary */ |
| int n_sub; |
| |
| for (n_sub = 0;n_sub < gen_nb_xmlDictPtr;n_sub++) { |
| mem_base = xmlMemBlocks(); |
| sub = gen_xmlDictPtr(n_sub, 0); |
| |
| ret_val = xmlDictCreateSub(sub); |
| desret_xmlDictPtr(ret_val); |
| call_tests++; |
| des_xmlDictPtr(n_sub, sub, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlDictCreateSub", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_sub); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlDictExists(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| const xmlChar * ret_val; |
| xmlDictPtr dict; /* the dictionary */ |
| int n_dict; |
| const xmlChar * name; /* the name of the userdata */ |
| int n_name; |
| int len; /* the length of the name, if -1 it is recomputed */ |
| int n_len; |
| |
| for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) { |
| for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { |
| for (n_len = 0;n_len < gen_nb_int;n_len++) { |
| mem_base = xmlMemBlocks(); |
| dict = gen_xmlDictPtr(n_dict, 0); |
| name = gen_const_xmlChar_ptr(n_name, 1); |
| len = gen_int(n_len, 2); |
| if ((name != NULL) && |
| (len > xmlStrlen(BAD_CAST name))) |
| len = 0; |
| |
| ret_val = xmlDictExists(dict, name, len); |
| desret_const_xmlChar_ptr(ret_val); |
| call_tests++; |
| des_xmlDictPtr(n_dict, dict, 0); |
| des_const_xmlChar_ptr(n_name, name, 1); |
| des_int(n_len, len, 2); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlDictExists", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_dict); |
| printf(" %d", n_name); |
| printf(" %d", n_len); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlDictGetUsage(void) { |
| int test_ret = 0; |
| |
| |
| /* missing type support */ |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlDictLookup(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| const xmlChar * ret_val; |
| xmlDictPtr dict; /* dictionary */ |
| int n_dict; |
| const xmlChar * name; /* string key */ |
| int n_name; |
| int len; /* length of the key, if -1 it is recomputed */ |
| int n_len; |
| |
| for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) { |
| for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { |
| for (n_len = 0;n_len < gen_nb_int;n_len++) { |
| mem_base = xmlMemBlocks(); |
| dict = gen_xmlDictPtr(n_dict, 0); |
| name = gen_const_xmlChar_ptr(n_name, 1); |
| len = gen_int(n_len, 2); |
| if ((name != NULL) && |
| (len > xmlStrlen(BAD_CAST name))) |
| len = 0; |
| |
| ret_val = xmlDictLookup(dict, name, len); |
| desret_const_xmlChar_ptr(ret_val); |
| call_tests++; |
| des_xmlDictPtr(n_dict, dict, 0); |
| des_const_xmlChar_ptr(n_name, name, 1); |
| des_int(n_len, len, 2); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlDictLookup", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_dict); |
| printf(" %d", n_name); |
| printf(" %d", n_len); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlDictOwns(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| int ret_val; |
| xmlDictPtr dict; /* the dictionary */ |
| int n_dict; |
| const xmlChar * str; /* the string */ |
| int n_str; |
| |
| for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) { |
| for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) { |
| mem_base = xmlMemBlocks(); |
| dict = gen_xmlDictPtr(n_dict, 0); |
| str = gen_const_xmlChar_ptr(n_str, 1); |
| |
| ret_val = xmlDictOwns(dict, str); |
| desret_int(ret_val); |
| call_tests++; |
| des_xmlDictPtr(n_dict, dict, 0); |
| des_const_xmlChar_ptr(n_str, str, 1); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlDictOwns", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_dict); |
| printf(" %d", n_str); |
| printf("\n"); |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlDictQLookup(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| const xmlChar * ret_val; |
| xmlDictPtr dict; /* the dictionary */ |
| int n_dict; |
| const xmlChar * prefix; /* the prefix */ |
| int n_prefix; |
| const xmlChar * name; /* the name */ |
| int n_name; |
| |
| for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) { |
| for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) { |
| for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { |
| mem_base = xmlMemBlocks(); |
| dict = gen_xmlDictPtr(n_dict, 0); |
| prefix = gen_const_xmlChar_ptr(n_prefix, 1); |
| name = gen_const_xmlChar_ptr(n_name, 2); |
| |
| ret_val = xmlDictQLookup(dict, prefix, name); |
| desret_const_xmlChar_ptr(ret_val); |
| call_tests++; |
| des_xmlDictPtr(n_dict, dict, 0); |
| des_const_xmlChar_ptr(n_prefix, prefix, 1); |
| des_const_xmlChar_ptr(n_name, name, 2); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlDictQLookup", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_dict); |
| printf(" %d", n_prefix); |
| printf(" %d", n_name); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlDictReference(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| int ret_val; |
| xmlDictPtr dict; /* the dictionary */ |
| int n_dict; |
| |
| for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) { |
| mem_base = xmlMemBlocks(); |
| dict = gen_xmlDictPtr(n_dict, 0); |
| |
| ret_val = xmlDictReference(dict); |
| xmlDictFree(dict); |
| desret_int(ret_val); |
| call_tests++; |
| des_xmlDictPtr(n_dict, dict, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlDictReference", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_dict); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlDictSetLimit(void) { |
| int test_ret = 0; |
| |
| |
| /* missing type support */ |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlDictSize(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| int ret_val; |
| xmlDictPtr dict; /* the dictionary */ |
| int n_dict; |
| |
| for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) { |
| mem_base = xmlMemBlocks(); |
| dict = gen_xmlDictPtr(n_dict, 0); |
| |
| ret_val = xmlDictSize(dict); |
| desret_int(ret_val); |
| call_tests++; |
| des_xmlDictPtr(n_dict, dict, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlDictSize", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_dict); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlInitializeDict(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| int ret_val; |
| |
| mem_base = xmlMemBlocks(); |
| |
| ret_val = xmlInitializeDict(); |
| desret_int(ret_val); |
| call_tests++; |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlInitializeDict", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf("\n"); |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| static int |
| test_dict(void) { |
| int test_ret = 0; |
| |
| if (quiet == 0) printf("Testing dict : 10 of 13 functions ...\n"); |
| test_ret += test_xmlDictCleanup(); |
| test_ret += test_xmlDictCreate(); |
| test_ret += test_xmlDictCreateSub(); |
| test_ret += test_xmlDictExists(); |
| test_ret += test_xmlDictGetUsage(); |
| test_ret += test_xmlDictLookup(); |
| test_ret += test_xmlDictOwns(); |
| test_ret += test_xmlDictQLookup(); |
| test_ret += test_xmlDictReference(); |
| test_ret += test_xmlDictSetLimit(); |
| test_ret += test_xmlDictSize(); |
| test_ret += test_xmlInitializeDict(); |
| |
| if (test_ret != 0) |
| printf("Module dict: %d errors\n", test_ret); |
| return(test_ret); |
| } |
| |
| static int |
| test_xmlAddEncodingAlias(void) { |
| int test_ret = 0; |
| |
| int ret_val; |
| const char * name; /* the encoding name as parsed, in UTF-8 format (ASCII actually) */ |
| int n_name; |
| const char * alias; /* the alias name as parsed, in UTF-8 format (ASCII actually) */ |
| int n_alias; |
| |
| for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) { |
| for (n_alias = 0;n_alias < gen_nb_const_char_ptr;n_alias++) { |
| name = gen_const_char_ptr(n_name, 0); |
| alias = gen_const_char_ptr(n_alias, 1); |
| |
| ret_val = xmlAddEncodingAlias(name, alias); |
| desret_int(ret_val); |
| call_tests++; |
| des_const_char_ptr(n_name, name, 0); |
| des_const_char_ptr(n_alias, alias, 1); |
| xmlResetLastError(); |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| #define gen_nb_xmlCharEncodingHandler_ptr 1 |
| #define gen_xmlCharEncodingHandler_ptr(no, nr) NULL |
| #define des_xmlCharEncodingHandler_ptr(no, val, nr) |
| |
| static int |
| test_xmlCharEncCloseFunc(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| int ret_val; |
| xmlCharEncodingHandler * handler; /* char encoding transformation data structure */ |
| int n_handler; |
| |
| for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) { |
| mem_base = xmlMemBlocks(); |
| handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0); |
| |
| ret_val = xmlCharEncCloseFunc(handler); |
| desret_int(ret_val); |
| call_tests++; |
| des_xmlCharEncodingHandler_ptr(n_handler, handler, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlCharEncCloseFunc", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_handler); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlCharEncFirstLine(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| int ret_val; |
| xmlCharEncodingHandler * handler; /* char encoding transformation data structure */ |
| int n_handler; |
| xmlBufferPtr out; /* an xmlBuffer for the output. */ |
| int n_out; |
| xmlBufferPtr in; /* an xmlBuffer for the input */ |
| int n_in; |
| |
| for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) { |
| for (n_out = 0;n_out < gen_nb_xmlBufferPtr;n_out++) { |
| for (n_in = 0;n_in < gen_nb_xmlBufferPtr;n_in++) { |
| mem_base = xmlMemBlocks(); |
| handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0); |
| out = gen_xmlBufferPtr(n_out, 1); |
| in = gen_xmlBufferPtr(n_in, 2); |
| |
| ret_val = xmlCharEncFirstLine(handler, out, in); |
| desret_int(ret_val); |
| call_tests++; |
| des_xmlCharEncodingHandler_ptr(n_handler, handler, 0); |
| des_xmlBufferPtr(n_out, out, 1); |
| des_xmlBufferPtr(n_in, in, 2); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlCharEncFirstLine", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_handler); |
| printf(" %d", n_out); |
| printf(" %d", n_in); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlCharEncInFunc(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| int ret_val; |
| xmlCharEncodingHandler * handler; /* char encoding transformation data structure */ |
| int n_handler; |
| xmlBufferPtr out; /* an xmlBuffer for the output. */ |
| int n_out; |
| xmlBufferPtr in; /* an xmlBuffer for the input */ |
| int n_in; |
| |
| for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) { |
| for (n_out = 0;n_out < gen_nb_xmlBufferPtr;n_out++) { |
| for (n_in = 0;n_in < gen_nb_xmlBufferPtr;n_in++) { |
| mem_base = xmlMemBlocks(); |
| handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0); |
| out = gen_xmlBufferPtr(n_out, 1); |
| in = gen_xmlBufferPtr(n_in, 2); |
| |
| ret_val = xmlCharEncInFunc(handler, out, in); |
| desret_int(ret_val); |
| call_tests++; |
| des_xmlCharEncodingHandler_ptr(n_handler, handler, 0); |
| des_xmlBufferPtr(n_out, out, 1); |
| des_xmlBufferPtr(n_in, in, 2); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlCharEncInFunc", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_handler); |
| printf(" %d", n_out); |
| printf(" %d", n_in); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlCharEncNewCustomHandler(void) { |
| int test_ret = 0; |
| |
| |
| /* missing type support */ |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlCharEncOutFunc(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| int ret_val; |
| xmlCharEncodingHandler * handler; /* char encoding transformation data structure */ |
| int n_handler; |
| xmlBufferPtr out; /* an xmlBuffer for the output. */ |
| int n_out; |
| xmlBufferPtr in; /* an xmlBuffer for the input */ |
| int n_in; |
| |
| for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) { |
| for (n_out = 0;n_out < gen_nb_xmlBufferPtr;n_out++) { |
| for (n_in = 0;n_in < gen_nb_xmlBufferPtr;n_in++) { |
| mem_base = xmlMemBlocks(); |
| handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0); |
| out = gen_xmlBufferPtr(n_out, 1); |
| in = gen_xmlBufferPtr(n_in, 2); |
| |
| ret_val = xmlCharEncOutFunc(handler, out, in); |
| desret_int(ret_val); |
| call_tests++; |
| des_xmlCharEncodingHandler_ptr(n_handler, handler, 0); |
| des_xmlBufferPtr(n_out, out, 1); |
| des_xmlBufferPtr(n_in, in, 2); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlCharEncOutFunc", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_handler); |
| printf(" %d", n_out); |
| printf(" %d", n_in); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlCleanupCharEncodingHandlers(void) { |
| int test_ret = 0; |
| |
| |
| |
| xmlCleanupCharEncodingHandlers(); |
| call_tests++; |
| xmlResetLastError(); |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlCleanupEncodingAliases(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| |
| mem_base = xmlMemBlocks(); |
| |
| xmlCleanupEncodingAliases(); |
| call_tests++; |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlCleanupEncodingAliases", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf("\n"); |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlCreateCharEncodingHandler(void) { |
| int test_ret = 0; |
| |
| |
| /* missing type support */ |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlDelEncodingAlias(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| int ret_val; |
| const char * alias; /* the alias name as parsed, in UTF-8 format (ASCII actually) */ |
| int n_alias; |
| |
| for (n_alias = 0;n_alias < gen_nb_const_char_ptr;n_alias++) { |
| mem_base = xmlMemBlocks(); |
| alias = gen_const_char_ptr(n_alias, 0); |
| |
| ret_val = xmlDelEncodingAlias(alias); |
| desret_int(ret_val); |
| call_tests++; |
| des_const_char_ptr(n_alias, alias, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlDelEncodingAlias", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_alias); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlDetectCharEncoding(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| xmlCharEncoding ret_val; |
| const unsigned char * in; /* a pointer to the first bytes of the XML entity, must be at least 2 bytes long (at least 4 if encoding is UTF4 variant). */ |
| int n_in; |
| int len; /* pointer to the length of the buffer */ |
| int n_len; |
| |
| for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) { |
| for (n_len = 0;n_len < gen_nb_int;n_len++) { |
| mem_base = xmlMemBlocks(); |
| in = gen_const_unsigned_char_ptr(n_in, 0); |
| len = gen_int(n_len, 1); |
| |
| ret_val = xmlDetectCharEncoding(in, len); |
| desret_xmlCharEncoding(ret_val); |
| call_tests++; |
| des_const_unsigned_char_ptr(n_in, in, 0); |
| des_int(n_len, len, 1); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlDetectCharEncoding", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_in); |
| printf(" %d", n_len); |
| printf("\n"); |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlFindCharEncodingHandler(void) { |
| int test_ret = 0; |
| |
| |
| /* missing type support */ |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlGetCharEncodingHandler(void) { |
| int test_ret = 0; |
| |
| |
| /* missing type support */ |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlGetCharEncodingName(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| const char * ret_val; |
| xmlCharEncoding enc; /* the encoding */ |
| int n_enc; |
| |
| for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) { |
| mem_base = xmlMemBlocks(); |
| enc = gen_xmlCharEncoding(n_enc, 0); |
| |
| ret_val = xmlGetCharEncodingName(enc); |
| desret_const_char_ptr(ret_val); |
| call_tests++; |
| des_xmlCharEncoding(n_enc, enc, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlGetCharEncodingName", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_enc); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlGetEncodingAlias(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| const char * ret_val; |
| const char * alias; /* the alias name as parsed, in UTF-8 format (ASCII actually) */ |
| int n_alias; |
| |
| for (n_alias = 0;n_alias < gen_nb_const_char_ptr;n_alias++) { |
| mem_base = xmlMemBlocks(); |
| alias = gen_const_char_ptr(n_alias, 0); |
| |
| ret_val = xmlGetEncodingAlias(alias); |
| desret_const_char_ptr(ret_val); |
| call_tests++; |
| des_const_char_ptr(n_alias, alias, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlGetEncodingAlias", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_alias); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlInitCharEncodingHandlers(void) { |
| int test_ret = 0; |
| |
| |
| |
| xmlInitCharEncodingHandlers(); |
| call_tests++; |
| xmlResetLastError(); |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlIsolat1ToUTF8(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| int ret_val; |
| unsigned char * out; /* a pointer to an array of bytes to store the result */ |
| int n_out; |
| int * outlen; /* the length of @out */ |
| int n_outlen; |
| const unsigned char * in; /* a pointer to an array of ISO Latin 1 chars */ |
| int n_in; |
| int * inlen; /* the length of @in */ |
| int n_inlen; |
| |
| for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) { |
| for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) { |
| for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) { |
| for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) { |
| mem_base = xmlMemBlocks(); |
| out = gen_unsigned_char_ptr(n_out, 0); |
| outlen = gen_int_ptr(n_outlen, 1); |
| in = gen_const_unsigned_char_ptr(n_in, 2); |
| inlen = gen_int_ptr(n_inlen, 3); |
| |
| ret_val = xmlIsolat1ToUTF8(out, outlen, in, inlen); |
| desret_int(ret_val); |
| call_tests++; |
| des_unsigned_char_ptr(n_out, out, 0); |
| des_int_ptr(n_outlen, outlen, 1); |
| des_const_unsigned_char_ptr(n_in, in, 2); |
| des_int_ptr(n_inlen, inlen, 3); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlIsolat1ToUTF8", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_out); |
| printf(" %d", n_outlen); |
| printf(" %d", n_in); |
| printf(" %d", n_inlen); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlLookupCharEncodingHandler(void) { |
| int test_ret = 0; |
| |
| |
| /* missing type support */ |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlNewCharEncodingHandler(void) { |
| int test_ret = 0; |
| |
| |
| /* missing type support */ |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlOpenCharEncodingHandler(void) { |
| int test_ret = 0; |
| |
| |
| /* missing type support */ |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlParseCharEncoding(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| xmlCharEncoding ret_val; |
| const char * name; /* the encoding name as parsed, in UTF-8 format (ASCII actually) */ |
| int n_name; |
| |
| for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) { |
| mem_base = xmlMemBlocks(); |
| name = gen_const_char_ptr(n_name, 0); |
| |
| ret_val = xmlParseCharEncoding(name); |
| desret_xmlCharEncoding(ret_val); |
| call_tests++; |
| des_const_char_ptr(n_name, name, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlParseCharEncoding", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_name); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| #define gen_nb_xmlCharEncodingHandlerPtr 1 |
| #define gen_xmlCharEncodingHandlerPtr(no, nr) NULL |
| #define des_xmlCharEncodingHandlerPtr(no, val, nr) |
| |
| static int |
| test_xmlRegisterCharEncodingHandler(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| xmlCharEncodingHandlerPtr handler; /* the xmlCharEncodingHandlerPtr handler block */ |
| int n_handler; |
| |
| for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandlerPtr;n_handler++) { |
| mem_base = xmlMemBlocks(); |
| handler = gen_xmlCharEncodingHandlerPtr(n_handler, 0); |
| |
| xmlRegisterCharEncodingHandler(handler); |
| call_tests++; |
| des_xmlCharEncodingHandlerPtr(n_handler, handler, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlRegisterCharEncodingHandler", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_handler); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlUTF8ToIsolat1(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_OUTPUT_ENABLED) |
| int mem_base; |
| int ret_val; |
| unsigned char * out; /* a pointer to an array of bytes to store the result */ |
| int n_out; |
| int * outlen; /* the length of @out */ |
| int n_outlen; |
| const unsigned char * in; /* a pointer to an array of UTF-8 chars */ |
| int n_in; |
| int * inlen; /* the length of @in */ |
| int n_inlen; |
| |
| for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) { |
| for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) { |
| for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) { |
| for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) { |
| mem_base = xmlMemBlocks(); |
| out = gen_unsigned_char_ptr(n_out, 0); |
| outlen = gen_int_ptr(n_outlen, 1); |
| in = gen_const_unsigned_char_ptr(n_in, 2); |
| inlen = gen_int_ptr(n_inlen, 3); |
| |
| ret_val = xmlUTF8ToIsolat1(out, outlen, in, inlen); |
| desret_int(ret_val); |
| call_tests++; |
| des_unsigned_char_ptr(n_out, out, 0); |
| des_int_ptr(n_outlen, outlen, 1); |
| des_const_unsigned_char_ptr(n_in, in, 2); |
| des_int_ptr(n_inlen, inlen, 3); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlUTF8ToIsolat1", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_out); |
| printf(" %d", n_outlen); |
| printf(" %d", n_in); |
| printf(" %d", n_inlen); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| static int |
| test_encoding(void) { |
| int test_ret = 0; |
| |
| if (quiet == 0) printf("Testing encoding : 16 of 23 functions ...\n"); |
| test_ret += test_xmlAddEncodingAlias(); |
| test_ret += test_xmlCharEncCloseFunc(); |
| test_ret += test_xmlCharEncFirstLine(); |
| test_ret += test_xmlCharEncInFunc(); |
| test_ret += test_xmlCharEncNewCustomHandler(); |
| test_ret += test_xmlCharEncOutFunc(); |
| test_ret += test_xmlCleanupCharEncodingHandlers(); |
| test_ret += test_xmlCleanupEncodingAliases(); |
| test_ret += test_xmlCreateCharEncodingHandler(); |
| test_ret += test_xmlDelEncodingAlias(); |
| test_ret += test_xmlDetectCharEncoding(); |
| test_ret += test_xmlFindCharEncodingHandler(); |
| test_ret += test_xmlGetCharEncodingHandler(); |
| test_ret += test_xmlGetCharEncodingName(); |
| test_ret += test_xmlGetEncodingAlias(); |
| test_ret += test_xmlInitCharEncodingHandlers(); |
| test_ret += test_xmlIsolat1ToUTF8(); |
| test_ret += test_xmlLookupCharEncodingHandler(); |
| test_ret += test_xmlNewCharEncodingHandler(); |
| test_ret += test_xmlOpenCharEncodingHandler(); |
| test_ret += test_xmlParseCharEncoding(); |
| test_ret += test_xmlRegisterCharEncodingHandler(); |
| test_ret += test_xmlUTF8ToIsolat1(); |
| |
| if (test_ret != 0) |
| printf("Module encoding: %d errors\n", test_ret); |
| return(test_ret); |
| } |
| |
| static int |
| test_xmlAddDocEntity(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| xmlEntityPtr ret_val; |
| xmlDocPtr doc; /* the document */ |
| int n_doc; |
| const xmlChar * name; /* the entity name */ |
| int n_name; |
| int type; /* the entity type XML_xxx_yyy_ENTITY */ |
| int n_type; |
| const xmlChar * ExternalID; /* the entity external ID if available */ |
| int n_ExternalID; |
| const xmlChar * SystemID; /* the entity system ID if available */ |
| int n_SystemID; |
| const xmlChar * content; /* the entity content */ |
| int n_content; |
| |
| for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { |
| for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { |
| for (n_type = 0;n_type < gen_nb_int;n_type++) { |
| for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) { |
| for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) { |
| for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) { |
| mem_base = xmlMemBlocks(); |
| doc = gen_xmlDocPtr(n_doc, 0); |
| name = gen_const_xmlChar_ptr(n_name, 1); |
| type = gen_int(n_type, 2); |
| ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 3); |
| SystemID = gen_const_xmlChar_ptr(n_SystemID, 4); |
| content = gen_const_xmlChar_ptr(n_content, 5); |
| |
| ret_val = xmlAddDocEntity(doc, name, type, ExternalID, SystemID, content); |
| desret_xmlEntityPtr(ret_val); |
| call_tests++; |
| des_xmlDocPtr(n_doc, doc, 0); |
| des_const_xmlChar_ptr(n_name, name, 1); |
| des_int(n_type, type, 2); |
| des_const_xmlChar_ptr(n_ExternalID, ExternalID, 3); |
| des_const_xmlChar_ptr(n_SystemID, SystemID, 4); |
| des_const_xmlChar_ptr(n_content, content, 5); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlAddDocEntity", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_doc); |
| printf(" %d", n_name); |
| printf(" %d", n_type); |
| printf(" %d", n_ExternalID); |
| printf(" %d", n_SystemID); |
| printf(" %d", n_content); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlAddDtdEntity(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| xmlEntityPtr ret_val; |
| xmlDocPtr doc; /* the document */ |
| int n_doc; |
| const xmlChar * name; /* the entity name */ |
| int n_name; |
| int type; /* the entity type XML_xxx_yyy_ENTITY */ |
| int n_type; |
| const xmlChar * ExternalID; /* the entity external ID if available */ |
| int n_ExternalID; |
| const xmlChar * SystemID; /* the entity system ID if available */ |
| int n_SystemID; |
| const xmlChar * content; /* the entity content */ |
| int n_content; |
| |
| for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { |
| for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { |
| for (n_type = 0;n_type < gen_nb_int;n_type++) { |
| for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) { |
| for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) { |
| for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) { |
| mem_base = xmlMemBlocks(); |
| doc = gen_xmlDocPtr(n_doc, 0); |
| name = gen_const_xmlChar_ptr(n_name, 1); |
| type = gen_int(n_type, 2); |
| ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 3); |
| SystemID = gen_const_xmlChar_ptr(n_SystemID, 4); |
| content = gen_const_xmlChar_ptr(n_content, 5); |
| |
| ret_val = xmlAddDtdEntity(doc, name, type, ExternalID, SystemID, content); |
| desret_xmlEntityPtr(ret_val); |
| call_tests++; |
| des_xmlDocPtr(n_doc, doc, 0); |
| des_const_xmlChar_ptr(n_name, name, 1); |
| des_int(n_type, type, 2); |
| des_const_xmlChar_ptr(n_ExternalID, ExternalID, 3); |
| des_const_xmlChar_ptr(n_SystemID, SystemID, 4); |
| des_const_xmlChar_ptr(n_content, content, 5); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlAddDtdEntity", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_doc); |
| printf(" %d", n_name); |
| printf(" %d", n_type); |
| printf(" %d", n_ExternalID); |
| printf(" %d", n_SystemID); |
| printf(" %d", n_content); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| #define gen_nb_xmlEntityPtr_ptr 1 |
| #define gen_xmlEntityPtr_ptr(no, nr) NULL |
| #define des_xmlEntityPtr_ptr(no, val, nr) |
| |
| static int |
| test_xmlAddEntity(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| int ret_val; |
| xmlDocPtr doc; /* the document */ |
| int n_doc; |
| int extSubset; /* add to the external or internal subset */ |
| int n_extSubset; |
| const xmlChar * name; /* the entity name */ |
| int n_name; |
| int type; /* the entity type XML_xxx_yyy_ENTITY */ |
| int n_type; |
| const xmlChar * ExternalID; /* the entity external ID if available */ |
| int n_ExternalID; |
| const xmlChar * SystemID; /* the entity system ID if available */ |
| int n_SystemID; |
| const xmlChar * content; /* the entity content */ |
| int n_content; |
| xmlEntityPtr * out; /* pointer to resulting entity (optional) */ |
| int n_out; |
| |
| for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { |
| for (n_extSubset = 0;n_extSubset < gen_nb_int;n_extSubset++) { |
| for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { |
| for (n_type = 0;n_type < gen_nb_int;n_type++) { |
| for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) { |
| for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) { |
| for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) { |
| for (n_out = 0;n_out < gen_nb_xmlEntityPtr_ptr;n_out++) { |
| mem_base = xmlMemBlocks(); |
| doc = gen_xmlDocPtr(n_doc, 0); |
| extSubset = gen_int(n_extSubset, 1); |
| name = gen_const_xmlChar_ptr(n_name, 2); |
| type = gen_int(n_type, 3); |
| ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 4); |
| SystemID = gen_const_xmlChar_ptr(n_SystemID, 5); |
| content = gen_const_xmlChar_ptr(n_content, 6); |
| out = gen_xmlEntityPtr_ptr(n_out, 7); |
| |
| ret_val = xmlAddEntity(doc, extSubset, name, type, ExternalID, SystemID, content, out); |
| desret_int(ret_val); |
| call_tests++; |
| des_xmlDocPtr(n_doc, doc, 0); |
| des_int(n_extSubset, extSubset, 1); |
| des_const_xmlChar_ptr(n_name, name, 2); |
| des_int(n_type, type, 3); |
| des_const_xmlChar_ptr(n_ExternalID, ExternalID, 4); |
| des_const_xmlChar_ptr(n_SystemID, SystemID, 5); |
| des_const_xmlChar_ptr(n_content, content, 6); |
| des_xmlEntityPtr_ptr(n_out, out, 7); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlAddEntity", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_doc); |
| printf(" %d", n_extSubset); |
| printf(" %d", n_name); |
| printf(" %d", n_type); |
| printf(" %d", n_ExternalID); |
| printf(" %d", n_SystemID); |
| printf(" %d", n_content); |
| printf(" %d", n_out); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlCopyEntitiesTable(void) { |
| int test_ret = 0; |
| |
| |
| /* missing type support */ |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlCreateEntitiesTable(void) { |
| int test_ret = 0; |
| |
| |
| /* missing type support */ |
| return(test_ret); |
| } |
| |
| |
| #define gen_nb_xmlEntitiesTablePtr 1 |
| #define gen_xmlEntitiesTablePtr(no, nr) NULL |
| #define des_xmlEntitiesTablePtr(no, val, nr) |
| |
| static int |
| test_xmlDumpEntitiesTable(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_OUTPUT_ENABLED) |
| int mem_base; |
| xmlBufferPtr buf; /* An XML buffer. */ |
| int n_buf; |
| xmlEntitiesTablePtr table; /* An entity table */ |
| int n_table; |
| |
| for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) { |
| for (n_table = 0;n_table < gen_nb_xmlEntitiesTablePtr;n_table++) { |
| mem_base = xmlMemBlocks(); |
| buf = gen_xmlBufferPtr(n_buf, 0); |
| table = gen_xmlEntitiesTablePtr(n_table, 1); |
| |
| xmlDumpEntitiesTable(buf, table); |
| call_tests++; |
| des_xmlBufferPtr(n_buf, buf, 0); |
| des_xmlEntitiesTablePtr(n_table, table, 1); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlDumpEntitiesTable", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_buf); |
| printf(" %d", n_table); |
| printf("\n"); |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| #define gen_nb_xmlEntityPtr 1 |
| #define gen_xmlEntityPtr(no, nr) NULL |
| #define des_xmlEntityPtr(no, val, nr) |
| |
| static int |
| test_xmlDumpEntityDecl(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_OUTPUT_ENABLED) |
| int mem_base; |
| xmlBufferPtr buf; /* An XML buffer. */ |
| int n_buf; |
| xmlEntityPtr ent; /* An entity table */ |
| int n_ent; |
| |
| for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) { |
| for (n_ent = 0;n_ent < gen_nb_xmlEntityPtr;n_ent++) { |
| mem_base = xmlMemBlocks(); |
| buf = gen_xmlBufferPtr(n_buf, 0); |
| ent = gen_xmlEntityPtr(n_ent, 1); |
| |
| xmlDumpEntityDecl(buf, ent); |
| call_tests++; |
| des_xmlBufferPtr(n_buf, buf, 0); |
| des_xmlEntityPtr(n_ent, ent, 1); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlDumpEntityDecl", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_buf); |
| printf(" %d", n_ent); |
| printf("\n"); |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlEncodeEntitiesReentrant(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| xmlChar * ret_val; |
| xmlDocPtr doc; /* the document containing the string */ |
| int n_doc; |
| const xmlChar * input; /* A string to convert to XML. */ |
| int n_input; |
| |
| for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { |
| for (n_input = 0;n_input < gen_nb_const_xmlChar_ptr;n_input++) { |
| mem_base = xmlMemBlocks(); |
| doc = gen_xmlDocPtr(n_doc, 0); |
| input = gen_const_xmlChar_ptr(n_input, 1); |
| |
| ret_val = xmlEncodeEntitiesReentrant(doc, input); |
| desret_xmlChar_ptr(ret_val); |
| call_tests++; |
| des_xmlDocPtr(n_doc, doc, 0); |
| des_const_xmlChar_ptr(n_input, input, 1); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlEncodeEntitiesReentrant", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_doc); |
| printf(" %d", n_input); |
| printf("\n"); |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| #define gen_nb_const_xmlDoc_ptr 1 |
| #define gen_const_xmlDoc_ptr(no, nr) NULL |
| #define des_const_xmlDoc_ptr(no, val, nr) |
| |
| static int |
| test_xmlEncodeSpecialChars(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| xmlChar * ret_val; |
| const xmlDoc * doc; /* unused */ |
| int n_doc; |
| const xmlChar * input; /* A string to convert to XML. */ |
| int n_input; |
| |
| for (n_doc = 0;n_doc < gen_nb_const_xmlDoc_ptr;n_doc++) { |
| for (n_input = 0;n_input < gen_nb_const_xmlChar_ptr;n_input++) { |
| mem_base = xmlMemBlocks(); |
| doc = gen_const_xmlDoc_ptr(n_doc, 0); |
| input = gen_const_xmlChar_ptr(n_input, 1); |
| |
| ret_val = xmlEncodeSpecialChars(doc, input); |
| desret_xmlChar_ptr(ret_val); |
| call_tests++; |
| des_const_xmlDoc_ptr(n_doc, doc, 0); |
| des_const_xmlChar_ptr(n_input, input, 1); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlEncodeSpecialChars", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_doc); |
| printf(" %d", n_input); |
| printf("\n"); |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlGetDocEntity(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| xmlEntityPtr ret_val; |
| const xmlDoc * doc; /* the document referencing the entity */ |
| int n_doc; |
| const xmlChar * name; /* the entity name */ |
| int n_name; |
| |
| for (n_doc = 0;n_doc < gen_nb_const_xmlDoc_ptr;n_doc++) { |
| for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { |
| mem_base = xmlMemBlocks(); |
| doc = gen_const_xmlDoc_ptr(n_doc, 0); |
| name = gen_const_xmlChar_ptr(n_name, 1); |
| |
| ret_val = xmlGetDocEntity(doc, name); |
| desret_xmlEntityPtr(ret_val); |
| call_tests++; |
| des_const_xmlDoc_ptr(n_doc, doc, 0); |
| des_const_xmlChar_ptr(n_name, name, 1); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlGetDocEntity", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_doc); |
| printf(" %d", n_name); |
| printf("\n"); |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlGetDtdEntity(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| xmlEntityPtr ret_val; |
| xmlDocPtr doc; /* the document referencing the entity */ |
| int n_doc; |
| const xmlChar * name; /* the entity name */ |
| int n_name; |
| |
| for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { |
| for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { |
| mem_base = xmlMemBlocks(); |
| doc = gen_xmlDocPtr(n_doc, 0); |
| name = gen_const_xmlChar_ptr(n_name, 1); |
| |
| ret_val = xmlGetDtdEntity(doc, name); |
| desret_xmlEntityPtr(ret_val); |
| call_tests++; |
| des_xmlDocPtr(n_doc, doc, 0); |
| des_const_xmlChar_ptr(n_name, name, 1); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlGetDtdEntity", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_doc); |
| printf(" %d", n_name); |
| printf("\n"); |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlGetParameterEntity(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| xmlEntityPtr ret_val; |
| xmlDocPtr doc; /* the document referencing the entity */ |
| int n_doc; |
| const xmlChar * name; /* the entity name */ |
| int n_name; |
| |
| for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { |
| for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { |
| mem_base = xmlMemBlocks(); |
| doc = gen_xmlDocPtr(n_doc, 0); |
| name = gen_const_xmlChar_ptr(n_name, 1); |
| |
| ret_val = xmlGetParameterEntity(doc, name); |
| desret_xmlEntityPtr(ret_val); |
| call_tests++; |
| des_xmlDocPtr(n_doc, doc, 0); |
| des_const_xmlChar_ptr(n_name, name, 1); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlGetParameterEntity", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_doc); |
| printf(" %d", n_name); |
| printf("\n"); |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlGetPredefinedEntity(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| xmlEntityPtr ret_val; |
| const xmlChar * name; /* the entity name */ |
| int n_name; |
| |
| for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { |
| mem_base = xmlMemBlocks(); |
| name = gen_const_xmlChar_ptr(n_name, 0); |
| |
| ret_val = xmlGetPredefinedEntity(name); |
| desret_xmlEntityPtr(ret_val); |
| call_tests++; |
| des_const_xmlChar_ptr(n_name, name, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlGetPredefinedEntity", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_name); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlNewEntity(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| xmlEntityPtr ret_val; |
| xmlDocPtr doc; /* the document */ |
| int n_doc; |
| const xmlChar * name; /* the entity name */ |
| int n_name; |
| int type; /* the entity type XML_xxx_yyy_ENTITY */ |
| int n_type; |
| const xmlChar * ExternalID; /* the entity external ID if available */ |
| int n_ExternalID; |
| const xmlChar * SystemID; /* the entity system ID if available */ |
| int n_SystemID; |
| const xmlChar * content; /* the entity content */ |
| int n_content; |
| |
| for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { |
| for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { |
| for (n_type = 0;n_type < gen_nb_int;n_type++) { |
| for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) { |
| for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) { |
| for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) { |
| mem_base = xmlMemBlocks(); |
| doc = gen_xmlDocPtr(n_doc, 0); |
| name = gen_const_xmlChar_ptr(n_name, 1); |
| type = gen_int(n_type, 2); |
| ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 3); |
| SystemID = gen_const_xmlChar_ptr(n_SystemID, 4); |
| content = gen_const_xmlChar_ptr(n_content, 5); |
| |
| ret_val = xmlNewEntity(doc, name, type, ExternalID, SystemID, content); |
| desret_xmlEntityPtr(ret_val); |
| call_tests++; |
| des_xmlDocPtr(n_doc, doc, 0); |
| des_const_xmlChar_ptr(n_name, name, 1); |
| des_int(n_type, type, 2); |
| des_const_xmlChar_ptr(n_ExternalID, ExternalID, 3); |
| des_const_xmlChar_ptr(n_SystemID, SystemID, 4); |
| des_const_xmlChar_ptr(n_content, content, 5); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlNewEntity", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_doc); |
| printf(" %d", n_name); |
| printf(" %d", n_type); |
| printf(" %d", n_ExternalID); |
| printf(" %d", n_SystemID); |
| printf(" %d", n_content); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| static int |
| test_entities(void) { |
| int test_ret = 0; |
| |
| if (quiet == 0) printf("Testing entities : 12 of 16 functions ...\n"); |
| test_ret += test_xmlAddDocEntity(); |
| test_ret += test_xmlAddDtdEntity(); |
| test_ret += test_xmlAddEntity(); |
| test_ret += test_xmlCopyEntitiesTable(); |
| test_ret += test_xmlCreateEntitiesTable(); |
| test_ret += test_xmlDumpEntitiesTable(); |
| test_ret += test_xmlDumpEntityDecl(); |
| test_ret += test_xmlEncodeEntitiesReentrant(); |
| test_ret += test_xmlEncodeSpecialChars(); |
| test_ret += test_xmlGetDocEntity(); |
| test_ret += test_xmlGetDtdEntity(); |
| test_ret += test_xmlGetParameterEntity(); |
| test_ret += test_xmlGetPredefinedEntity(); |
| test_ret += test_xmlNewEntity(); |
| |
| if (test_ret != 0) |
| printf("Module entities: %d errors\n", test_ret); |
| return(test_ret); |
| } |
| |
| static int |
| test_xmlHashAdd(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| int ret_val; |
| xmlHashTablePtr hash; /* hash table */ |
| int n_hash; |
| const xmlChar * key; /* string key */ |
| int n_key; |
| void * payload; /* pointer to the payload */ |
| int n_payload; |
| |
| for (n_hash = 0;n_hash < gen_nb_xmlHashTablePtr;n_hash++) { |
| for (n_key = 0;n_key < gen_nb_const_xmlChar_ptr;n_key++) { |
| for (n_payload = 0;n_payload < gen_nb_void_ptr;n_payload++) { |
| mem_base = xmlMemBlocks(); |
| hash = gen_xmlHashTablePtr(n_hash, 0); |
| key = gen_const_xmlChar_ptr(n_key, 1); |
| payload = gen_void_ptr(n_payload, 2); |
| |
| ret_val = xmlHashAdd(hash, key, payload); |
| desret_int(ret_val); |
| call_tests++; |
| des_xmlHashTablePtr(n_hash, hash, 0); |
| des_const_xmlChar_ptr(n_key, key, 1); |
| des_void_ptr(n_payload, payload, 2); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlHashAdd", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_hash); |
| printf(" %d", n_key); |
| printf(" %d", n_payload); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlHashAdd2(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| int ret_val; |
| xmlHashTablePtr hash; /* hash table */ |
| int n_hash; |
| const xmlChar * key; /* first string key */ |
| int n_key; |
| const xmlChar * key2; /* second string key */ |
| int n_key2; |
| void * payload; /* pointer to the payload */ |
| int n_payload; |
| |
| for (n_hash = 0;n_hash < gen_nb_xmlHashTablePtr;n_hash++) { |
| for (n_key = 0;n_key < gen_nb_const_xmlChar_ptr;n_key++) { |
| for (n_key2 = 0;n_key2 < gen_nb_const_xmlChar_ptr;n_key2++) { |
| for (n_payload = 0;n_payload < gen_nb_void_ptr;n_payload++) { |
| mem_base = xmlMemBlocks(); |
| hash = gen_xmlHashTablePtr(n_hash, 0); |
| key = gen_const_xmlChar_ptr(n_key, 1); |
| key2 = gen_const_xmlChar_ptr(n_key2, 2); |
| payload = gen_void_ptr(n_payload, 3); |
| |
| ret_val = xmlHashAdd2(hash, key, key2, payload); |
| desret_int(ret_val); |
| call_tests++; |
| des_xmlHashTablePtr(n_hash, hash, 0); |
| des_const_xmlChar_ptr(n_key, key, 1); |
| des_const_xmlChar_ptr(n_key2, key2, 2); |
| des_void_ptr(n_payload, payload, 3); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlHashAdd2", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_hash); |
| printf(" %d", n_key); |
| printf(" %d", n_key2); |
| printf(" %d", n_payload); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlHashAdd3(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| int ret_val; |
| xmlHashTablePtr hash; /* hash table */ |
| int n_hash; |
| const xmlChar * key; /* first string key */ |
| int n_key; |
| const xmlChar * key2; /* second string key */ |
| int n_key2; |
| const xmlChar * key3; /* third string key */ |
| int n_key3; |
| void * payload; /* pointer to the payload */ |
| int n_payload; |
| |
| for (n_hash = 0;n_hash < gen_nb_xmlHashTablePtr;n_hash++) { |
| for (n_key = 0;n_key < gen_nb_const_xmlChar_ptr;n_key++) { |
| for (n_key2 = 0;n_key2 < gen_nb_const_xmlChar_ptr;n_key2++) { |
| for (n_key3 = 0;n_key3 < gen_nb_const_xmlChar_ptr;n_key3++) { |
| for (n_payload = 0;n_payload < gen_nb_void_ptr;n_payload++) { |
| mem_base = xmlMemBlocks(); |
| hash = gen_xmlHashTablePtr(n_hash, 0); |
| key = gen_const_xmlChar_ptr(n_key, 1); |
| key2 = gen_const_xmlChar_ptr(n_key2, 2); |
| key3 = gen_const_xmlChar_ptr(n_key3, 3); |
| payload = gen_void_ptr(n_payload, 4); |
| |
| ret_val = xmlHashAdd3(hash, key, key2, key3, payload); |
| desret_int(ret_val); |
| call_tests++; |
| des_xmlHashTablePtr(n_hash, hash, 0); |
| des_const_xmlChar_ptr(n_key, key, 1); |
| des_const_xmlChar_ptr(n_key2, key2, 2); |
| des_const_xmlChar_ptr(n_key3, key3, 3); |
| des_void_ptr(n_payload, payload, 4); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlHashAdd3", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_hash); |
| printf(" %d", n_key); |
| printf(" %d", n_key2); |
| printf(" %d", n_key3); |
| printf(" %d", n_payload); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlHashAddEntry(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| int ret_val; |
| xmlHashTablePtr hash; /* hash table */ |
| int n_hash; |
| const xmlChar * key; /* string key */ |
| int n_key; |
| void * payload; /* pointer to the payload */ |
| int n_payload; |
| |
| for (n_hash = 0;n_hash < gen_nb_xmlHashTablePtr;n_hash++) { |
| for (n_key = 0;n_key < gen_nb_const_xmlChar_ptr;n_key++) { |
| for (n_payload = 0;n_payload < gen_nb_void_ptr;n_payload++) { |
| mem_base = xmlMemBlocks(); |
| hash = gen_xmlHashTablePtr(n_hash, 0); |
| key = gen_const_xmlChar_ptr(n_key, 1); |
| payload = gen_void_ptr(n_payload, 2); |
| |
| ret_val = xmlHashAddEntry(hash, key, payload); |
| desret_int(ret_val); |
| call_tests++; |
| des_xmlHashTablePtr(n_hash, hash, 0); |
| des_const_xmlChar_ptr(n_key, key, 1); |
| des_void_ptr(n_payload, payload, 2); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlHashAddEntry", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_hash); |
| printf(" %d", n_key); |
| printf(" %d", n_payload); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlHashAddEntry2(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| int ret_val; |
| xmlHashTablePtr hash; /* hash table */ |
| int n_hash; |
| const xmlChar * key; /* first string key */ |
| int n_key; |
| const xmlChar * key2; /* second string key */ |
| int n_key2; |
| void * payload; /* pointer to the payload */ |
| int n_payload; |
| |
| for (n_hash = 0;n_hash < gen_nb_xmlHashTablePtr;n_hash++) { |
| for (n_key = 0;n_key < gen_nb_const_xmlChar_ptr;n_key++) { |
| for (n_key2 = 0;n_key2 < gen_nb_const_xmlChar_ptr;n_key2++) { |
| for (n_payload = 0;n_payload < gen_nb_void_ptr;n_payload++) { |
| mem_base = xmlMemBlocks(); |
| hash = gen_xmlHashTablePtr(n_hash, 0); |
| key = gen_const_xmlChar_ptr(n_key, 1); |
| key2 = gen_const_xmlChar_ptr(n_key2, 2); |
| payload = gen_void_ptr(n_payload, 3); |
| |
| ret_val = xmlHashAddEntry2(hash, key, key2, payload); |
| desret_int(ret_val); |
| call_tests++; |
| des_xmlHashTablePtr(n_hash, hash, 0); |
| des_const_xmlChar_ptr(n_key, key, 1); |
| des_const_xmlChar_ptr(n_key2, key2, 2); |
| des_void_ptr(n_payload, payload, 3); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlHashAddEntry2", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_hash); |
| printf(" %d", n_key); |
| printf(" %d", n_key2); |
| printf(" %d", n_payload); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlHashAddEntry3(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| int ret_val; |
| xmlHashTablePtr hash; /* hash table */ |
| int n_hash; |
| const xmlChar * key; /* first string key */ |
| int n_key; |
| const xmlChar * key2; /* second string key */ |
| int n_key2; |
| const xmlChar * key3; /* third string key */ |
| int n_key3; |
| void * payload; /* pointer to the payload */ |
| int n_payload; |
| |
| for (n_hash = 0;n_hash < gen_nb_xmlHashTablePtr;n_hash++) { |
| for (n_key = 0;n_key < gen_nb_const_xmlChar_ptr;n_key++) { |
| for (n_key2 = 0;n_key2 < gen_nb_const_xmlChar_ptr;n_key2++) { |
| for (n_key3 = 0;n_key3 < gen_nb_const_xmlChar_ptr;n_key3++) { |
| for (n_payload = 0;n_payload < gen_nb_void_ptr;n_payload++) { |
| mem_base = xmlMemBlocks(); |
| hash = gen_xmlHashTablePtr(n_hash, 0); |
| key = gen_const_xmlChar_ptr(n_key, 1); |
| key2 = gen_const_xmlChar_ptr(n_key2, 2); |
| key3 = gen_const_xmlChar_ptr(n_key3, 3); |
| payload = gen_void_ptr(n_payload, 4); |
| |
| ret_val = xmlHashAddEntry3(hash, key, key2, key3, payload); |
| desret_int(ret_val); |
| call_tests++; |
| des_xmlHashTablePtr(n_hash, hash, 0); |
| des_const_xmlChar_ptr(n_key, key, 1); |
| des_const_xmlChar_ptr(n_key2, key2, 2); |
| des_const_xmlChar_ptr(n_key3, key3, 3); |
| des_void_ptr(n_payload, payload, 4); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlHashAddEntry3", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_hash); |
| printf(" %d", n_key); |
| printf(" %d", n_key2); |
| printf(" %d", n_key3); |
| printf(" %d", n_payload); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlHashCopy(void) { |
| int test_ret = 0; |
| |
| |
| /* missing type support */ |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlHashCopySafe(void) { |
| int test_ret = 0; |
| |
| |
| /* missing type support */ |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlHashCreate(void) { |
| int test_ret = 0; |
| |
| |
| /* missing type support */ |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlHashCreateDict(void) { |
| int test_ret = 0; |
| |
| |
| /* missing type support */ |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlHashDefaultDeallocator(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| void * entry; /* hash table entry */ |
| int n_entry; |
| const xmlChar * key; /* the entry's string key */ |
| int n_key; |
| |
| for (n_entry = 0;n_entry < gen_nb_void_ptr;n_entry++) { |
| for (n_key = 0;n_key < gen_nb_const_xmlChar_ptr;n_key++) { |
| mem_base = xmlMemBlocks(); |
| entry = gen_void_ptr(n_entry, 0); |
| key = gen_const_xmlChar_ptr(n_key, 1); |
| |
| xmlHashDefaultDeallocator(entry, key); |
| call_tests++; |
| des_void_ptr(n_entry, entry, 0); |
| des_const_xmlChar_ptr(n_key, key, 1); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlHashDefaultDeallocator", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_entry); |
| printf(" %d", n_key); |
| printf("\n"); |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlHashLookup(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| void * ret_val; |
| xmlHashTablePtr hash; /* hash table */ |
| int n_hash; |
| const xmlChar * key; /* string key */ |
| int n_key; |
| |
| for (n_hash = 0;n_hash < gen_nb_xmlHashTablePtr;n_hash++) { |
| for (n_key = 0;n_key < gen_nb_const_xmlChar_ptr;n_key++) { |
| mem_base = xmlMemBlocks(); |
| hash = gen_xmlHashTablePtr(n_hash, 0); |
| key = gen_const_xmlChar_ptr(n_key, 1); |
| |
| ret_val = xmlHashLookup(hash, key); |
| desret_void_ptr(ret_val); |
| call_tests++; |
| des_xmlHashTablePtr(n_hash, hash, 0); |
| des_const_xmlChar_ptr(n_key, key, 1); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlHashLookup", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_hash); |
| printf(" %d", n_key); |
| printf("\n"); |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlHashLookup2(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| void * ret_val; |
| xmlHashTablePtr hash; /* hash table */ |
| int n_hash; |
| const xmlChar * key; /* first string key */ |
| int n_key; |
| const xmlChar * key2; /* second string key */ |
| int n_key2; |
| |
| for (n_hash = 0;n_hash < gen_nb_xmlHashTablePtr;n_hash++) { |
| for (n_key = 0;n_key < gen_nb_const_xmlChar_ptr;n_key++) { |
| for (n_key2 = 0;n_key2 < gen_nb_const_xmlChar_ptr;n_key2++) { |
| mem_base = xmlMemBlocks(); |
| hash = gen_xmlHashTablePtr(n_hash, 0); |
| key = gen_const_xmlChar_ptr(n_key, 1); |
| key2 = gen_const_xmlChar_ptr(n_key2, 2); |
| |
| ret_val = xmlHashLookup2(hash, key, key2); |
| desret_void_ptr(ret_val); |
| call_tests++; |
| des_xmlHashTablePtr(n_hash, hash, 0); |
| des_const_xmlChar_ptr(n_key, key, 1); |
| des_const_xmlChar_ptr(n_key2, key2, 2); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlHashLookup2", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_hash); |
| printf(" %d", n_key); |
| printf(" %d", n_key2); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlHashLookup3(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| void * ret_val; |
| xmlHashTablePtr hash; /* hash table */ |
| int n_hash; |
| const xmlChar * key; /* first string key */ |
| int n_key; |
| const xmlChar * key2; /* second string key */ |
| int n_key2; |
| const xmlChar * key3; /* third string key */ |
| int n_key3; |
| |
| for (n_hash = 0;n_hash < gen_nb_xmlHashTablePtr;n_hash++) { |
| for (n_key = 0;n_key < gen_nb_const_xmlChar_ptr;n_key++) { |
| for (n_key2 = 0;n_key2 < gen_nb_const_xmlChar_ptr;n_key2++) { |
| for (n_key3 = 0;n_key3 < gen_nb_const_xmlChar_ptr;n_key3++) { |
| mem_base = xmlMemBlocks(); |
| hash = gen_xmlHashTablePtr(n_hash, 0); |
| key = gen_const_xmlChar_ptr(n_key, 1); |
| key2 = gen_const_xmlChar_ptr(n_key2, 2); |
| key3 = gen_const_xmlChar_ptr(n_key3, 3); |
| |
| ret_val = xmlHashLookup3(hash, key, key2, key3); |
| desret_void_ptr(ret_val); |
| call_tests++; |
| des_xmlHashTablePtr(n_hash, hash, 0); |
| des_const_xmlChar_ptr(n_key, key, 1); |
| des_const_xmlChar_ptr(n_key2, key2, 2); |
| des_const_xmlChar_ptr(n_key3, key3, 3); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlHashLookup3", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_hash); |
| printf(" %d", n_key); |
| printf(" %d", n_key2); |
| printf(" %d", n_key3); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlHashQLookup(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| void * ret_val; |
| xmlHashTablePtr hash; /* hash table */ |
| int n_hash; |
| const xmlChar * prefix; /* prefix of the string key */ |
| int n_prefix; |
| const xmlChar * name; /* local name of the string key */ |
| int n_name; |
| |
| for (n_hash = 0;n_hash < gen_nb_xmlHashTablePtr;n_hash++) { |
| for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) { |
| for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { |
| mem_base = xmlMemBlocks(); |
| hash = gen_xmlHashTablePtr(n_hash, 0); |
| prefix = gen_const_xmlChar_ptr(n_prefix, 1); |
| name = gen_const_xmlChar_ptr(n_name, 2); |
| |
| ret_val = xmlHashQLookup(hash, prefix, name); |
| desret_void_ptr(ret_val); |
| call_tests++; |
| des_xmlHashTablePtr(n_hash, hash, 0); |
| des_const_xmlChar_ptr(n_prefix, prefix, 1); |
| des_const_xmlChar_ptr(n_name, name, 2); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlHashQLookup", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_hash); |
| printf(" %d", n_prefix); |
| printf(" %d", n_name); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlHashQLookup2(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| void * ret_val; |
| xmlHashTablePtr hash; /* hash table */ |
| int n_hash; |
| const xmlChar * prefix; /* first prefix */ |
| int n_prefix; |
| const xmlChar * name; /* first local name */ |
| int n_name; |
| const xmlChar * prefix2; /* second prefix */ |
| int n_prefix2; |
| const xmlChar * name2; /* second local name */ |
| int n_name2; |
| |
| for (n_hash = 0;n_hash < gen_nb_xmlHashTablePtr;n_hash++) { |
| for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) { |
| for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { |
| for (n_prefix2 = 0;n_prefix2 < gen_nb_const_xmlChar_ptr;n_prefix2++) { |
| for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) { |
| mem_base = xmlMemBlocks(); |
| hash = gen_xmlHashTablePtr(n_hash, 0); |
| prefix = gen_const_xmlChar_ptr(n_prefix, 1); |
| name = gen_const_xmlChar_ptr(n_name, 2); |
| prefix2 = gen_const_xmlChar_ptr(n_prefix2, 3); |
| name2 = gen_const_xmlChar_ptr(n_name2, 4); |
| |
| ret_val = xmlHashQLookup2(hash, prefix, name, prefix2, name2); |
| desret_void_ptr(ret_val); |
| call_tests++; |
| des_xmlHashTablePtr(n_hash, hash, 0); |
| des_const_xmlChar_ptr(n_prefix, prefix, 1); |
| des_const_xmlChar_ptr(n_name, name, 2); |
| des_const_xmlChar_ptr(n_prefix2, prefix2, 3); |
| des_const_xmlChar_ptr(n_name2, name2, 4); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlHashQLookup2", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_hash); |
| printf(" %d", n_prefix); |
| printf(" %d", n_name); |
| printf(" %d", n_prefix2); |
| printf(" %d", n_name2); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlHashQLookup3(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| void * ret_val; |
| xmlHashTablePtr hash; /* hash table */ |
| int n_hash; |
| const xmlChar * prefix; /* first prefix */ |
| int n_prefix; |
| const xmlChar * name; /* first local name */ |
| int n_name; |
| const xmlChar * prefix2; /* second prefix */ |
| int n_prefix2; |
| const xmlChar * name2; /* second local name */ |
| int n_name2; |
| const xmlChar * prefix3; /* third prefix */ |
| int n_prefix3; |
| const xmlChar * name3; /* third local name */ |
| int n_name3; |
| |
| for (n_hash = 0;n_hash < gen_nb_xmlHashTablePtr;n_hash++) { |
| for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) { |
| for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { |
| for (n_prefix2 = 0;n_prefix2 < gen_nb_const_xmlChar_ptr;n_prefix2++) { |
| for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) { |
| for (n_prefix3 = 0;n_prefix3 < gen_nb_const_xmlChar_ptr;n_prefix3++) { |
| for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) { |
| mem_base = xmlMemBlocks(); |
| hash = gen_xmlHashTablePtr(n_hash, 0); |
| prefix = gen_const_xmlChar_ptr(n_prefix, 1); |
| name = gen_const_xmlChar_ptr(n_name, 2); |
| prefix2 = gen_const_xmlChar_ptr(n_prefix2, 3); |
| name2 = gen_const_xmlChar_ptr(n_name2, 4); |
| prefix3 = gen_const_xmlChar_ptr(n_prefix3, 5); |
| name3 = gen_const_xmlChar_ptr(n_name3, 6); |
| |
| ret_val = xmlHashQLookup3(hash, prefix, name, prefix2, name2, prefix3, name3); |
| desret_void_ptr(ret_val); |
| call_tests++; |
| des_xmlHashTablePtr(n_hash, hash, 0); |
| des_const_xmlChar_ptr(n_prefix, prefix, 1); |
| des_const_xmlChar_ptr(n_name, name, 2); |
| des_const_xmlChar_ptr(n_prefix2, prefix2, 3); |
| des_const_xmlChar_ptr(n_name2, name2, 4); |
| des_const_xmlChar_ptr(n_prefix3, prefix3, 5); |
| des_const_xmlChar_ptr(n_name3, name3, 6); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlHashQLookup3", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_hash); |
| printf(" %d", n_prefix); |
| printf(" %d", n_name); |
| printf(" %d", n_prefix2); |
| printf(" %d", n_name2); |
| printf(" %d", n_prefix3); |
| printf(" %d", n_name3); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlHashRemoveEntry(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| int ret_val; |
| xmlHashTablePtr hash; /* hash table */ |
| int n_hash; |
| const xmlChar * key; /* string key */ |
| int n_key; |
| xmlHashDeallocator dealloc; /* deallocator function for removed item or NULL */ |
| int n_dealloc; |
| |
| for (n_hash = 0;n_hash < gen_nb_xmlHashTablePtr;n_hash++) { |
| for (n_key = 0;n_key < gen_nb_const_xmlChar_ptr;n_key++) { |
| for (n_dealloc = 0;n_dealloc < gen_nb_xmlHashDeallocator;n_dealloc++) { |
| mem_base = xmlMemBlocks(); |
| hash = gen_xmlHashTablePtr(n_hash, 0); |
| key = gen_const_xmlChar_ptr(n_key, 1); |
| dealloc = gen_xmlHashDeallocator(n_dealloc, 2); |
| |
| ret_val = xmlHashRemoveEntry(hash, key, dealloc); |
| desret_int(ret_val); |
| call_tests++; |
| des_xmlHashTablePtr(n_hash, hash, 0); |
| des_const_xmlChar_ptr(n_key, key, 1); |
| des_xmlHashDeallocator(n_dealloc, dealloc, 2); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlHashRemoveEntry", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_hash); |
| printf(" %d", n_key); |
| printf(" %d", n_dealloc); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlHashRemoveEntry2(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| int ret_val; |
| xmlHashTablePtr hash; /* hash table */ |
| int n_hash; |
| const xmlChar * key; /* first string key */ |
| int n_key; |
| const xmlChar * key2; /* second string key */ |
| int n_key2; |
| xmlHashDeallocator dealloc; /* deallocator function for removed item or NULL */ |
| int n_dealloc; |
| |
| for (n_hash = 0;n_hash < gen_nb_xmlHashTablePtr;n_hash++) { |
| for (n_key = 0;n_key < gen_nb_const_xmlChar_ptr;n_key++) { |
| for (n_key2 = 0;n_key2 < gen_nb_const_xmlChar_ptr;n_key2++) { |
| for (n_dealloc = 0;n_dealloc < gen_nb_xmlHashDeallocator;n_dealloc++) { |
| mem_base = xmlMemBlocks(); |
| hash = gen_xmlHashTablePtr(n_hash, 0); |
| key = gen_const_xmlChar_ptr(n_key, 1); |
| key2 = gen_const_xmlChar_ptr(n_key2, 2); |
| dealloc = gen_xmlHashDeallocator(n_dealloc, 3); |
| |
| ret_val = xmlHashRemoveEntry2(hash, key, key2, dealloc); |
| desret_int(ret_val); |
| call_tests++; |
| des_xmlHashTablePtr(n_hash, hash, 0); |
| des_const_xmlChar_ptr(n_key, key, 1); |
| des_const_xmlChar_ptr(n_key2, key2, 2); |
| des_xmlHashDeallocator(n_dealloc, dealloc, 3); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlHashRemoveEntry2", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_hash); |
| printf(" %d", n_key); |
| printf(" %d", n_key2); |
| printf(" %d", n_dealloc); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlHashRemoveEntry3(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| int ret_val; |
| xmlHashTablePtr hash; /* hash table */ |
| int n_hash; |
| const xmlChar * key; /* first string key */ |
| int n_key; |
| const xmlChar * key2; /* second string key */ |
| int n_key2; |
| const xmlChar * key3; /* third string key */ |
| int n_key3; |
| xmlHashDeallocator dealloc; /* deallocator function for removed item or NULL */ |
| int n_dealloc; |
| |
| for (n_hash = 0;n_hash < gen_nb_xmlHashTablePtr;n_hash++) { |
| for (n_key = 0;n_key < gen_nb_const_xmlChar_ptr;n_key++) { |
| for (n_key2 = 0;n_key2 < gen_nb_const_xmlChar_ptr;n_key2++) { |
| for (n_key3 = 0;n_key3 < gen_nb_const_xmlChar_ptr;n_key3++) { |
| for (n_dealloc = 0;n_dealloc < gen_nb_xmlHashDeallocator;n_dealloc++) { |
| mem_base = xmlMemBlocks(); |
| hash = gen_xmlHashTablePtr(n_hash, 0); |
| key = gen_const_xmlChar_ptr(n_key, 1); |
| key2 = gen_const_xmlChar_ptr(n_key2, 2); |
| key3 = gen_const_xmlChar_ptr(n_key3, 3); |
| dealloc = gen_xmlHashDeallocator(n_dealloc, 4); |
| |
| ret_val = xmlHashRemoveEntry3(hash, key, key2, key3, dealloc); |
| desret_int(ret_val); |
| call_tests++; |
| des_xmlHashTablePtr(n_hash, hash, 0); |
| des_const_xmlChar_ptr(n_key, key, 1); |
| des_const_xmlChar_ptr(n_key2, key2, 2); |
| des_const_xmlChar_ptr(n_key3, key3, 3); |
| des_xmlHashDeallocator(n_dealloc, dealloc, 4); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlHashRemoveEntry3", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_hash); |
| printf(" %d", n_key); |
| printf(" %d", n_key2); |
| printf(" %d", n_key3); |
| printf(" %d", n_dealloc); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlHashScan(void) { |
| int test_ret = 0; |
| |
| |
| /* missing type support */ |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlHashScan3(void) { |
| int test_ret = 0; |
| |
| |
| /* missing type support */ |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlHashScanFull(void) { |
| int test_ret = 0; |
| |
| |
| /* missing type support */ |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlHashScanFull3(void) { |
| int test_ret = 0; |
| |
| |
| /* missing type support */ |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlHashSize(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| int ret_val; |
| xmlHashTablePtr hash; /* hash table */ |
| int n_hash; |
| |
| for (n_hash = 0;n_hash < gen_nb_xmlHashTablePtr;n_hash++) { |
| mem_base = xmlMemBlocks(); |
| hash = gen_xmlHashTablePtr(n_hash, 0); |
| |
| ret_val = xmlHashSize(hash); |
| desret_int(ret_val); |
| call_tests++; |
| des_xmlHashTablePtr(n_hash, hash, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlHashSize", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_hash); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlHashUpdateEntry(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| int ret_val; |
| xmlHashTablePtr hash; /* hash table */ |
| int n_hash; |
| const xmlChar * key; /* string key */ |
| int n_key; |
| void * payload; /* pointer to the payload */ |
| int n_payload; |
| xmlHashDeallocator dealloc; /* deallocator function for replaced item or NULL */ |
| int n_dealloc; |
| |
| for (n_hash = 0;n_hash < gen_nb_xmlHashTablePtr;n_hash++) { |
| for (n_key = 0;n_key < gen_nb_const_xmlChar_ptr;n_key++) { |
| for (n_payload = 0;n_payload < gen_nb_void_ptr;n_payload++) { |
| for (n_dealloc = 0;n_dealloc < gen_nb_xmlHashDeallocator;n_dealloc++) { |
| mem_base = xmlMemBlocks(); |
| hash = gen_xmlHashTablePtr(n_hash, 0); |
| key = gen_const_xmlChar_ptr(n_key, 1); |
| payload = gen_void_ptr(n_payload, 2); |
| dealloc = gen_xmlHashDeallocator(n_dealloc, 3); |
| |
| ret_val = xmlHashUpdateEntry(hash, key, payload, dealloc); |
| desret_int(ret_val); |
| call_tests++; |
| des_xmlHashTablePtr(n_hash, hash, 0); |
| des_const_xmlChar_ptr(n_key, key, 1); |
| des_void_ptr(n_payload, payload, 2); |
| des_xmlHashDeallocator(n_dealloc, dealloc, 3); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlHashUpdateEntry", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_hash); |
| printf(" %d", n_key); |
| printf(" %d", n_payload); |
| printf(" %d", n_dealloc); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlHashUpdateEntry2(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| int ret_val; |
| xmlHashTablePtr hash; /* hash table */ |
| int n_hash; |
| const xmlChar * key; /* first string key */ |
| int n_key; |
| const xmlChar * key2; /* second string key */ |
| int n_key2; |
| void * payload; /* pointer to the payload */ |
| int n_payload; |
| xmlHashDeallocator dealloc; /* deallocator function for replaced item or NULL */ |
| int n_dealloc; |
| |
| for (n_hash = 0;n_hash < gen_nb_xmlHashTablePtr;n_hash++) { |
| for (n_key = 0;n_key < gen_nb_const_xmlChar_ptr;n_key++) { |
| for (n_key2 = 0;n_key2 < gen_nb_const_xmlChar_ptr;n_key2++) { |
| for (n_payload = 0;n_payload < gen_nb_void_ptr;n_payload++) { |
| for (n_dealloc = 0;n_dealloc < gen_nb_xmlHashDeallocator;n_dealloc++) { |
| mem_base = xmlMemBlocks(); |
| hash = gen_xmlHashTablePtr(n_hash, 0); |
| key = gen_const_xmlChar_ptr(n_key, 1); |
| key2 = gen_const_xmlChar_ptr(n_key2, 2); |
| payload = gen_void_ptr(n_payload, 3); |
| dealloc = gen_xmlHashDeallocator(n_dealloc, 4); |
| |
| ret_val = xmlHashUpdateEntry2(hash, key, key2, payload, dealloc); |
| desret_int(ret_val); |
| call_tests++; |
| des_xmlHashTablePtr(n_hash, hash, 0); |
| des_const_xmlChar_ptr(n_key, key, 1); |
| des_const_xmlChar_ptr(n_key2, key2, 2); |
| des_void_ptr(n_payload, payload, 3); |
| des_xmlHashDeallocator(n_dealloc, dealloc, 4); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlHashUpdateEntry2", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_hash); |
| printf(" %d", n_key); |
| printf(" %d", n_key2); |
| printf(" %d", n_payload); |
| printf(" %d", n_dealloc); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlHashUpdateEntry3(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| int ret_val; |
| xmlHashTablePtr hash; /* hash table */ |
| int n_hash; |
| const xmlChar * key; /* first string key */ |
| int n_key; |
| const xmlChar * key2; /* second string key */ |
| int n_key2; |
| const xmlChar * key3; /* third string key */ |
| int n_key3; |
| void * payload; /* pointer to the payload */ |
| int n_payload; |
| xmlHashDeallocator dealloc; /* deallocator function for replaced item or NULL */ |
| int n_dealloc; |
| |
| for (n_hash = 0;n_hash < gen_nb_xmlHashTablePtr;n_hash++) { |
| for (n_key = 0;n_key < gen_nb_const_xmlChar_ptr;n_key++) { |
| for (n_key2 = 0;n_key2 < gen_nb_const_xmlChar_ptr;n_key2++) { |
| for (n_key3 = 0;n_key3 < gen_nb_const_xmlChar_ptr;n_key3++) { |
| for (n_payload = 0;n_payload < gen_nb_void_ptr;n_payload++) { |
| for (n_dealloc = 0;n_dealloc < gen_nb_xmlHashDeallocator;n_dealloc++) { |
| mem_base = xmlMemBlocks(); |
| hash = gen_xmlHashTablePtr(n_hash, 0); |
| key = gen_const_xmlChar_ptr(n_key, 1); |
| key2 = gen_const_xmlChar_ptr(n_key2, 2); |
| key3 = gen_const_xmlChar_ptr(n_key3, 3); |
| payload = gen_void_ptr(n_payload, 4); |
| dealloc = gen_xmlHashDeallocator(n_dealloc, 5); |
| |
| ret_val = xmlHashUpdateEntry3(hash, key, key2, key3, payload, dealloc); |
| desret_int(ret_val); |
| call_tests++; |
| des_xmlHashTablePtr(n_hash, hash, 0); |
| des_const_xmlChar_ptr(n_key, key, 1); |
| des_const_xmlChar_ptr(n_key2, key2, 2); |
| des_const_xmlChar_ptr(n_key3, key3, 3); |
| des_void_ptr(n_payload, payload, 4); |
| des_xmlHashDeallocator(n_dealloc, dealloc, 5); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlHashUpdateEntry3", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_hash); |
| printf(" %d", n_key); |
| printf(" %d", n_key2); |
| printf(" %d", n_key3); |
| printf(" %d", n_payload); |
| printf(" %d", n_dealloc); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| static int |
| test_hash(void) { |
| int test_ret = 0; |
| |
| if (quiet == 0) printf("Testing hash : 20 of 29 functions ...\n"); |
| test_ret += test_xmlHashAdd(); |
| test_ret += test_xmlHashAdd2(); |
| test_ret += test_xmlHashAdd3(); |
| test_ret += test_xmlHashAddEntry(); |
| test_ret += test_xmlHashAddEntry2(); |
| test_ret += test_xmlHashAddEntry3(); |
| test_ret += test_xmlHashCopy(); |
| test_ret += test_xmlHashCopySafe(); |
| test_ret += test_xmlHashCreate(); |
| test_ret += test_xmlHashCreateDict(); |
| test_ret += test_xmlHashDefaultDeallocator(); |
| test_ret += test_xmlHashLookup(); |
| test_ret += test_xmlHashLookup2(); |
| test_ret += test_xmlHashLookup3(); |
| test_ret += test_xmlHashQLookup(); |
| test_ret += test_xmlHashQLookup2(); |
| test_ret += test_xmlHashQLookup3(); |
| test_ret += test_xmlHashRemoveEntry(); |
| test_ret += test_xmlHashRemoveEntry2(); |
| test_ret += test_xmlHashRemoveEntry3(); |
| test_ret += test_xmlHashScan(); |
| test_ret += test_xmlHashScan3(); |
| test_ret += test_xmlHashScanFull(); |
| test_ret += test_xmlHashScanFull3(); |
| test_ret += test_xmlHashSize(); |
| test_ret += test_xmlHashUpdateEntry(); |
| test_ret += test_xmlHashUpdateEntry2(); |
| test_ret += test_xmlHashUpdateEntry3(); |
| |
| if (test_ret != 0) |
| printf("Module hash: %d errors\n", test_ret); |
| return(test_ret); |
| } |
| |
| #define gen_nb_xmlLinkPtr 1 |
| #define gen_xmlLinkPtr(no, nr) NULL |
| #define des_xmlLinkPtr(no, val, nr) |
| |
| static int |
| test_xmlLinkGetData(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| void * ret_val; |
| xmlLinkPtr lk; /* a link */ |
| int n_lk; |
| |
| for (n_lk = 0;n_lk < gen_nb_xmlLinkPtr;n_lk++) { |
| mem_base = xmlMemBlocks(); |
| lk = gen_xmlLinkPtr(n_lk, 0); |
| |
| ret_val = xmlLinkGetData(lk); |
| desret_void_ptr(ret_val); |
| call_tests++; |
| des_xmlLinkPtr(n_lk, lk, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlLinkGetData", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_lk); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlListAppend(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| int ret_val; |
| xmlListPtr l; /* a list */ |
| int n_l; |
| void * data; /* the data */ |
| int n_data; |
| |
| for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) { |
| for (n_data = 0;n_data < gen_nb_userdata;n_data++) { |
| mem_base = xmlMemBlocks(); |
| l = gen_xmlListPtr(n_l, 0); |
| data = gen_userdata(n_data, 1); |
| |
| ret_val = xmlListAppend(l, data); |
| desret_int(ret_val); |
| call_tests++; |
| des_xmlListPtr(n_l, l, 0); |
| des_userdata(n_data, data, 1); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlListAppend", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_l); |
| printf(" %d", n_data); |
| printf("\n"); |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlListClear(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| xmlListPtr l; /* a list */ |
| int n_l; |
| |
| for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) { |
| mem_base = xmlMemBlocks(); |
| l = gen_xmlListPtr(n_l, 0); |
| |
| xmlListClear(l); |
| call_tests++; |
| des_xmlListPtr(n_l, l, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlListClear", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_l); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlListCopy(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| int ret_val; |
| xmlListPtr cur; /* the new list */ |
| int n_cur; |
| xmlListPtr old; /* the old list */ |
| int n_old; |
| |
| for (n_cur = 0;n_cur < gen_nb_xmlListPtr;n_cur++) { |
| for (n_old = 0;n_old < gen_nb_xmlListPtr;n_old++) { |
| mem_base = xmlMemBlocks(); |
| cur = gen_xmlListPtr(n_cur, 0); |
| old = gen_xmlListPtr(n_old, 1); |
| |
| ret_val = xmlListCopy(cur, old); |
| desret_int(ret_val); |
| call_tests++; |
| des_xmlListPtr(n_cur, cur, 0); |
| des_xmlListPtr(n_old, old, 1); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlListCopy", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_cur); |
| printf(" %d", n_old); |
| printf("\n"); |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlListCreate(void) { |
| int test_ret = 0; |
| |
| |
| /* missing type support */ |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlListDup(void) { |
| int test_ret = 0; |
| |
| |
| /* missing type support */ |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlListEmpty(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| int ret_val; |
| xmlListPtr l; /* a list */ |
| int n_l; |
| |
| for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) { |
| mem_base = xmlMemBlocks(); |
| l = gen_xmlListPtr(n_l, 0); |
| |
| ret_val = xmlListEmpty(l); |
| desret_int(ret_val); |
| call_tests++; |
| des_xmlListPtr(n_l, l, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlListEmpty", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_l); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlListEnd(void) { |
| int test_ret = 0; |
| |
| |
| /* missing type support */ |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlListFront(void) { |
| int test_ret = 0; |
| |
| |
| /* missing type support */ |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlListInsert(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| int ret_val; |
| xmlListPtr l; /* a list */ |
| int n_l; |
| void * data; /* the data */ |
| int n_data; |
| |
| for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) { |
| for (n_data = 0;n_data < gen_nb_userdata;n_data++) { |
| mem_base = xmlMemBlocks(); |
| l = gen_xmlListPtr(n_l, 0); |
| data = gen_userdata(n_data, 1); |
| |
| ret_val = xmlListInsert(l, data); |
| desret_int(ret_val); |
| call_tests++; |
| des_xmlListPtr(n_l, l, 0); |
| des_userdata(n_data, data, 1); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlListInsert", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_l); |
| printf(" %d", n_data); |
| printf("\n"); |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlListMerge(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| xmlListPtr l1; /* the original list */ |
| int n_l1; |
| xmlListPtr l2; /* the new list */ |
| int n_l2; |
| |
| for (n_l1 = 0;n_l1 < gen_nb_xmlListPtr;n_l1++) { |
| for (n_l2 = 0;n_l2 < gen_nb_xmlListPtr;n_l2++) { |
| mem_base = xmlMemBlocks(); |
| l1 = gen_xmlListPtr(n_l1, 0); |
| l2 = gen_xmlListPtr(n_l2, 1); |
| |
| xmlListMerge(l1, l2); |
| call_tests++; |
| des_xmlListPtr(n_l1, l1, 0); |
| des_xmlListPtr(n_l2, l2, 1); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlListMerge", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_l1); |
| printf(" %d", n_l2); |
| printf("\n"); |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlListPopBack(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| xmlListPtr l; /* a list */ |
| int n_l; |
| |
| for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) { |
| mem_base = xmlMemBlocks(); |
| l = gen_xmlListPtr(n_l, 0); |
| |
| xmlListPopBack(l); |
| call_tests++; |
| des_xmlListPtr(n_l, l, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlListPopBack", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_l); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlListPopFront(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| xmlListPtr l; /* a list */ |
| int n_l; |
| |
| for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) { |
| mem_base = xmlMemBlocks(); |
| l = gen_xmlListPtr(n_l, 0); |
| |
| xmlListPopFront(l); |
| call_tests++; |
| des_xmlListPtr(n_l, l, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlListPopFront", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_l); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlListPushBack(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| int ret_val; |
| xmlListPtr l; /* a list */ |
| int n_l; |
| void * data; /* new data */ |
| int n_data; |
| |
| for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) { |
| for (n_data = 0;n_data < gen_nb_userdata;n_data++) { |
| mem_base = xmlMemBlocks(); |
| l = gen_xmlListPtr(n_l, 0); |
| data = gen_userdata(n_data, 1); |
| |
| ret_val = xmlListPushBack(l, data); |
| desret_int(ret_val); |
| call_tests++; |
| des_xmlListPtr(n_l, l, 0); |
| des_userdata(n_data, data, 1); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlListPushBack", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_l); |
| printf(" %d", n_data); |
| printf("\n"); |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlListPushFront(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| int ret_val; |
| xmlListPtr l; /* a list */ |
| int n_l; |
| void * data; /* new data */ |
| int n_data; |
| |
| for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) { |
| for (n_data = 0;n_data < gen_nb_userdata;n_data++) { |
| mem_base = xmlMemBlocks(); |
| l = gen_xmlListPtr(n_l, 0); |
| data = gen_userdata(n_data, 1); |
| |
| ret_val = xmlListPushFront(l, data); |
| desret_int(ret_val); |
| call_tests++; |
| des_xmlListPtr(n_l, l, 0); |
| des_userdata(n_data, data, 1); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlListPushFront", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_l); |
| printf(" %d", n_data); |
| printf("\n"); |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlListRemoveAll(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| int ret_val; |
| xmlListPtr l; /* a list */ |
| int n_l; |
| void * data; /* list data */ |
| int n_data; |
| |
| for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) { |
| for (n_data = 0;n_data < gen_nb_userdata;n_data++) { |
| mem_base = xmlMemBlocks(); |
| l = gen_xmlListPtr(n_l, 0); |
| data = gen_userdata(n_data, 1); |
| |
| ret_val = xmlListRemoveAll(l, data); |
| desret_int(ret_val); |
| call_tests++; |
| des_xmlListPtr(n_l, l, 0); |
| des_userdata(n_data, data, 1); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlListRemoveAll", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_l); |
| printf(" %d", n_data); |
| printf("\n"); |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlListRemoveFirst(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| int ret_val; |
| xmlListPtr l; /* a list */ |
| int n_l; |
| void * data; /* list data */ |
| int n_data; |
| |
| for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) { |
| for (n_data = 0;n_data < gen_nb_userdata;n_data++) { |
| mem_base = xmlMemBlocks(); |
| l = gen_xmlListPtr(n_l, 0); |
| data = gen_userdata(n_data, 1); |
| |
| ret_val = xmlListRemoveFirst(l, data); |
| desret_int(ret_val); |
| call_tests++; |
| des_xmlListPtr(n_l, l, 0); |
| des_userdata(n_data, data, 1); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlListRemoveFirst", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_l); |
| printf(" %d", n_data); |
| printf("\n"); |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlListRemoveLast(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| int ret_val; |
| xmlListPtr l; /* a list */ |
| int n_l; |
| void * data; /* list data */ |
| int n_data; |
| |
| for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) { |
| for (n_data = 0;n_data < gen_nb_userdata;n_data++) { |
| mem_base = xmlMemBlocks(); |
| l = gen_xmlListPtr(n_l, 0); |
| data = gen_userdata(n_data, 1); |
| |
| ret_val = xmlListRemoveLast(l, data); |
| desret_int(ret_val); |
| call_tests++; |
| des_xmlListPtr(n_l, l, 0); |
| des_userdata(n_data, data, 1); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlListRemoveLast", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_l); |
| printf(" %d", n_data); |
| printf("\n"); |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlListReverse(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| xmlListPtr l; /* a list */ |
| int n_l; |
| |
| for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) { |
| mem_base = xmlMemBlocks(); |
| l = gen_xmlListPtr(n_l, 0); |
| |
| xmlListReverse(l); |
| call_tests++; |
| des_xmlListPtr(n_l, l, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlListReverse", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_l); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlListReverseSearch(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| void * ret_val; |
| xmlListPtr l; /* a list */ |
| int n_l; |
| void * data; /* a search value */ |
| int n_data; |
| |
| for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) { |
| for (n_data = 0;n_data < gen_nb_userdata;n_data++) { |
| mem_base = xmlMemBlocks(); |
| l = gen_xmlListPtr(n_l, 0); |
| data = gen_userdata(n_data, 1); |
| |
| ret_val = xmlListReverseSearch(l, data); |
| desret_void_ptr(ret_val); |
| call_tests++; |
| des_xmlListPtr(n_l, l, 0); |
| des_userdata(n_data, data, 1); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlListReverseSearch", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_l); |
| printf(" %d", n_data); |
| printf("\n"); |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlListReverseWalk(void) { |
| int test_ret = 0; |
| |
| |
| /* missing type support */ |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlListSearch(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| void * ret_val; |
| xmlListPtr l; /* a list */ |
| int n_l; |
| void * data; /* a search value */ |
| int n_data; |
| |
| for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) { |
| for (n_data = 0;n_data < gen_nb_userdata;n_data++) { |
| mem_base = xmlMemBlocks(); |
| l = gen_xmlListPtr(n_l, 0); |
| data = gen_userdata(n_data, 1); |
| |
| ret_val = xmlListSearch(l, data); |
| desret_void_ptr(ret_val); |
| call_tests++; |
| des_xmlListPtr(n_l, l, 0); |
| des_userdata(n_data, data, 1); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlListSearch", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_l); |
| printf(" %d", n_data); |
| printf("\n"); |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlListSize(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| int ret_val; |
| xmlListPtr l; /* a list */ |
| int n_l; |
| |
| for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) { |
| mem_base = xmlMemBlocks(); |
| l = gen_xmlListPtr(n_l, 0); |
| |
| ret_val = xmlListSize(l); |
| desret_int(ret_val); |
| call_tests++; |
| des_xmlListPtr(n_l, l, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlListSize", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_l); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlListSort(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| xmlListPtr l; /* a list */ |
| int n_l; |
| |
| for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) { |
| mem_base = xmlMemBlocks(); |
| l = gen_xmlListPtr(n_l, 0); |
| |
| xmlListSort(l); |
| call_tests++; |
| des_xmlListPtr(n_l, l, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlListSort", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_l); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlListWalk(void) { |
| int test_ret = 0; |
| |
| |
| /* missing type support */ |
| return(test_ret); |
| } |
| |
| static int |
| test_list(void) { |
| int test_ret = 0; |
| |
| if (quiet == 0) printf("Testing list : 19 of 26 functions ...\n"); |
| test_ret += test_xmlLinkGetData(); |
| test_ret += test_xmlListAppend(); |
| test_ret += test_xmlListClear(); |
| test_ret += test_xmlListCopy(); |
| test_ret += test_xmlListCreate(); |
| test_ret += test_xmlListDup(); |
| test_ret += test_xmlListEmpty(); |
| test_ret += test_xmlListEnd(); |
| test_ret += test_xmlListFront(); |
| test_ret += test_xmlListInsert(); |
| test_ret += test_xmlListMerge(); |
| test_ret += test_xmlListPopBack(); |
| test_ret += test_xmlListPopFront(); |
| test_ret += test_xmlListPushBack(); |
| test_ret += test_xmlListPushFront(); |
| test_ret += test_xmlListRemoveAll(); |
| test_ret += test_xmlListRemoveFirst(); |
| test_ret += test_xmlListRemoveLast(); |
| test_ret += test_xmlListReverse(); |
| test_ret += test_xmlListReverseSearch(); |
| test_ret += test_xmlListReverseWalk(); |
| test_ret += test_xmlListSearch(); |
| test_ret += test_xmlListSize(); |
| test_ret += test_xmlListSort(); |
| test_ret += test_xmlListWalk(); |
| |
| if (test_ret != 0) |
| printf("Module list: %d errors\n", test_ret); |
| return(test_ret); |
| } |
| |
| static int |
| test_xmlNanoHTTPAuthHeader(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_HTTP_ENABLED) |
| int mem_base; |
| const char * ret_val; |
| void * ctx; /* the HTTP context */ |
| int n_ctx; |
| |
| for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) { |
| mem_base = xmlMemBlocks(); |
| ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0); |
| |
| ret_val = xmlNanoHTTPAuthHeader(ctx); |
| desret_const_char_ptr(ret_val); |
| call_tests++; |
| des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlNanoHTTPAuthHeader", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctx); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlNanoHTTPCleanup(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_HTTP_ENABLED) |
| int mem_base; |
| |
| mem_base = xmlMemBlocks(); |
| |
| xmlNanoHTTPCleanup(); |
| call_tests++; |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlNanoHTTPCleanup", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf("\n"); |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlNanoHTTPContentLength(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_HTTP_ENABLED) |
| int mem_base; |
| int ret_val; |
| void * ctx; /* the HTTP context */ |
| int n_ctx; |
| |
| for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) { |
| mem_base = xmlMemBlocks(); |
| ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0); |
| |
| ret_val = xmlNanoHTTPContentLength(ctx); |
| desret_int(ret_val); |
| call_tests++; |
| des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlNanoHTTPContentLength", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctx); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlNanoHTTPEncoding(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_HTTP_ENABLED) |
| int mem_base; |
| const char * ret_val; |
| void * ctx; /* the HTTP context */ |
| int n_ctx; |
| |
| for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) { |
| mem_base = xmlMemBlocks(); |
| ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0); |
| |
| ret_val = xmlNanoHTTPEncoding(ctx); |
| desret_const_char_ptr(ret_val); |
| call_tests++; |
| des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlNanoHTTPEncoding", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctx); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| #define gen_nb_char_ptr_ptr 1 |
| #define gen_char_ptr_ptr(no, nr) NULL |
| #define des_char_ptr_ptr(no, val, nr) |
| |
| static int |
| test_xmlNanoHTTPFetch(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_HTTP_ENABLED) |
| int mem_base; |
| int ret_val; |
| const char * URL; /* The URL to load */ |
| int n_URL; |
| const char * filename; /* the filename where the content should be saved */ |
| int n_filename; |
| char ** contentType; /* if available the Content-Type information will be returned at that location */ |
| int n_contentType; |
| |
| for (n_URL = 0;n_URL < gen_nb_fileoutput;n_URL++) { |
| for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) { |
| for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) { |
| mem_base = xmlMemBlocks(); |
| URL = gen_fileoutput(n_URL, 0); |
| filename = gen_fileoutput(n_filename, 1); |
| contentType = gen_char_ptr_ptr(n_contentType, 2); |
| |
| ret_val = xmlNanoHTTPFetch(URL, filename, contentType); |
| desret_int(ret_val); |
| call_tests++; |
| des_fileoutput(n_URL, URL, 0); |
| des_fileoutput(n_filename, filename, 1); |
| des_char_ptr_ptr(n_contentType, contentType, 2); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlNanoHTTPFetch", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_URL); |
| printf(" %d", n_filename); |
| printf(" %d", n_contentType); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlNanoHTTPInit(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_HTTP_ENABLED) |
| int mem_base; |
| |
| mem_base = xmlMemBlocks(); |
| |
| xmlNanoHTTPInit(); |
| call_tests++; |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlNanoHTTPInit", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf("\n"); |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlNanoHTTPMimeType(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_HTTP_ENABLED) |
| int mem_base; |
| const char * ret_val; |
| void * ctx; /* the HTTP context */ |
| int n_ctx; |
| |
| for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) { |
| mem_base = xmlMemBlocks(); |
| ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0); |
| |
| ret_val = xmlNanoHTTPMimeType(ctx); |
| desret_const_char_ptr(ret_val); |
| call_tests++; |
| des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlNanoHTTPMimeType", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctx); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlNanoHTTPOpen(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_HTTP_ENABLED) |
| int mem_base; |
| void * ret_val; |
| const char * URL; /* The URL to load */ |
| int n_URL; |
| char ** contentType; /* if available the Content-Type information will be returned at that location */ |
| int n_contentType; |
| |
| for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) { |
| for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) { |
| mem_base = xmlMemBlocks(); |
| URL = gen_filepath(n_URL, 0); |
| contentType = gen_char_ptr_ptr(n_contentType, 1); |
| |
| ret_val = xmlNanoHTTPOpen(URL, contentType); |
| desret_xmlNanoHTTPCtxtPtr(ret_val); |
| call_tests++; |
| des_filepath(n_URL, URL, 0); |
| des_char_ptr_ptr(n_contentType, contentType, 1); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlNanoHTTPOpen", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_URL); |
| printf(" %d", n_contentType); |
| printf("\n"); |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlNanoHTTPOpenRedir(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_HTTP_ENABLED) |
| int mem_base; |
| void * ret_val; |
| const char * URL; /* The URL to load */ |
| int n_URL; |
| char ** contentType; /* if available the Content-Type information will be returned at that location */ |
| int n_contentType; |
| char ** redir; /* if available the redirected URL will be returned */ |
| int n_redir; |
| |
| for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) { |
| for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) { |
| for (n_redir = 0;n_redir < gen_nb_char_ptr_ptr;n_redir++) { |
| mem_base = xmlMemBlocks(); |
| URL = gen_filepath(n_URL, 0); |
| contentType = gen_char_ptr_ptr(n_contentType, 1); |
| redir = gen_char_ptr_ptr(n_redir, 2); |
| |
| ret_val = xmlNanoHTTPOpenRedir(URL, contentType, redir); |
| desret_xmlNanoHTTPCtxtPtr(ret_val); |
| call_tests++; |
| des_filepath(n_URL, URL, 0); |
| des_char_ptr_ptr(n_contentType, contentType, 1); |
| des_char_ptr_ptr(n_redir, redir, 2); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlNanoHTTPOpenRedir", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_URL); |
| printf(" %d", n_contentType); |
| printf(" %d", n_redir); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlNanoHTTPRead(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_HTTP_ENABLED) |
| int mem_base; |
| int ret_val; |
| void * ctx; /* the HTTP context */ |
| int n_ctx; |
| void * dest; /* a buffer */ |
| int n_dest; |
| int len; /* the buffer length */ |
| int n_len; |
| |
| for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) { |
| for (n_dest = 0;n_dest < gen_nb_void_ptr;n_dest++) { |
| for (n_len = 0;n_len < gen_nb_int;n_len++) { |
| mem_base = xmlMemBlocks(); |
| ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0); |
| dest = gen_void_ptr(n_dest, 1); |
| len = gen_int(n_len, 2); |
| |
| ret_val = xmlNanoHTTPRead(ctx, dest, len); |
| desret_int(ret_val); |
| call_tests++; |
| des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0); |
| des_void_ptr(n_dest, dest, 1); |
| des_int(n_len, len, 2); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlNanoHTTPRead", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctx); |
| printf(" %d", n_dest); |
| printf(" %d", n_len); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlNanoHTTPRedir(void) { |
| int test_ret = 0; |
| |
| |
| /* missing type support */ |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlNanoHTTPReturnCode(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_HTTP_ENABLED) |
| int mem_base; |
| int ret_val; |
| void * ctx; /* the HTTP context */ |
| int n_ctx; |
| |
| for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) { |
| mem_base = xmlMemBlocks(); |
| ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0); |
| |
| ret_val = xmlNanoHTTPReturnCode(ctx); |
| desret_int(ret_val); |
| call_tests++; |
| des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlNanoHTTPReturnCode", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctx); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlNanoHTTPSave(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_HTTP_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) |
| int mem_base; |
| int ret_val; |
| void * ctxt; /* the HTTP context */ |
| int n_ctxt; |
| const char * filename; /* the filename where the content should be saved */ |
| int n_filename; |
| |
| for (n_ctxt = 0;n_ctxt < gen_nb_void_ptr;n_ctxt++) { |
| for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) { |
| mem_base = xmlMemBlocks(); |
| ctxt = gen_void_ptr(n_ctxt, 0); |
| filename = gen_fileoutput(n_filename, 1); |
| |
| ret_val = xmlNanoHTTPSave(ctxt, filename); |
| desret_int(ret_val); |
| call_tests++; |
| des_void_ptr(n_ctxt, ctxt, 0); |
| des_fileoutput(n_filename, filename, 1); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlNanoHTTPSave", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctxt); |
| printf(" %d", n_filename); |
| printf("\n"); |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlNanoHTTPScanProxy(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_HTTP_ENABLED) |
| const char * URL; /* The proxy URL used to initialize the proxy context */ |
| int n_URL; |
| |
| for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) { |
| URL = gen_filepath(n_URL, 0); |
| |
| xmlNanoHTTPScanProxy(URL); |
| call_tests++; |
| des_filepath(n_URL, URL, 0); |
| xmlResetLastError(); |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| static int |
| test_nanohttp(void) { |
| int test_ret = 0; |
| |
| if (quiet == 0) printf("Testing nanohttp : 13 of 17 functions ...\n"); |
| test_ret += test_xmlNanoHTTPAuthHeader(); |
| test_ret += test_xmlNanoHTTPCleanup(); |
| test_ret += test_xmlNanoHTTPContentLength(); |
| test_ret += test_xmlNanoHTTPEncoding(); |
| test_ret += test_xmlNanoHTTPFetch(); |
| test_ret += test_xmlNanoHTTPInit(); |
| test_ret += test_xmlNanoHTTPMimeType(); |
| test_ret += test_xmlNanoHTTPOpen(); |
| test_ret += test_xmlNanoHTTPOpenRedir(); |
| test_ret += test_xmlNanoHTTPRead(); |
| test_ret += test_xmlNanoHTTPRedir(); |
| test_ret += test_xmlNanoHTTPReturnCode(); |
| test_ret += test_xmlNanoHTTPSave(); |
| test_ret += test_xmlNanoHTTPScanProxy(); |
| |
| if (test_ret != 0) |
| printf("Module nanohttp: %d errors\n", test_ret); |
| return(test_ret); |
| } |
| |
| static int |
| test_xmlByteConsumed(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| long ret_val; |
| xmlParserCtxtPtr ctxt; /* an XML parser context */ |
| int n_ctxt; |
| |
| for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { |
| mem_base = xmlMemBlocks(); |
| ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); |
| |
| ret_val = xmlByteConsumed(ctxt); |
| desret_long(ret_val); |
| call_tests++; |
| des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlByteConsumed", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctxt); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlCleanupGlobals(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| |
| mem_base = xmlMemBlocks(); |
| |
| xmlCleanupGlobals(); |
| call_tests++; |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlCleanupGlobals", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf("\n"); |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlClearNodeInfoSeq(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| xmlParserNodeInfoSeqPtr seq; /* a node info sequence pointer */ |
| int n_seq; |
| |
| for (n_seq = 0;n_seq < gen_nb_xmlParserNodeInfoSeqPtr;n_seq++) { |
| mem_base = xmlMemBlocks(); |
| seq = gen_xmlParserNodeInfoSeqPtr(n_seq, 0); |
| |
| xmlClearNodeInfoSeq(seq); |
| call_tests++; |
| des_xmlParserNodeInfoSeqPtr(n_seq, seq, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlClearNodeInfoSeq", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_seq); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlClearParserCtxt(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| xmlParserCtxtPtr ctxt; /* an XML parser context */ |
| int n_ctxt; |
| |
| for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { |
| mem_base = xmlMemBlocks(); |
| ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); |
| |
| xmlClearParserCtxt(ctxt); |
| call_tests++; |
| des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlClearParserCtxt", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctxt); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlCreateDocParserCtxt(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| xmlParserCtxtPtr ret_val; |
| const xmlChar * str; /* a pointer to an array of xmlChar */ |
| int n_str; |
| |
| for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) { |
| mem_base = xmlMemBlocks(); |
| str = gen_const_xmlChar_ptr(n_str, 0); |
| |
| ret_val = xmlCreateDocParserCtxt(str); |
| desret_xmlParserCtxtPtr(ret_val); |
| call_tests++; |
| des_const_xmlChar_ptr(n_str, str, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlCreateDocParserCtxt", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_str); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlCreatePushParserCtxt(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_PUSH_ENABLED) |
| int mem_base; |
| xmlParserCtxtPtr ret_val; |
| xmlSAXHandlerPtr sax; /* a SAX handler (optional) */ |
| int n_sax; |
| void * user_data; /* user data for SAX callbacks (optional) */ |
| int n_user_data; |
| const char * chunk; /* initial chunk (optional, deprecated) */ |
| int n_chunk; |
| int size; /* size of initial chunk in bytes */ |
| int n_size; |
| const char * filename; /* file name or URI (optional) */ |
| int n_filename; |
| |
| for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) { |
| for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) { |
| for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) { |
| for (n_size = 0;n_size < gen_nb_int;n_size++) { |
| for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) { |
| mem_base = xmlMemBlocks(); |
| sax = gen_xmlSAXHandlerPtr(n_sax, 0); |
| user_data = gen_userdata(n_user_data, 1); |
| chunk = gen_const_char_ptr(n_chunk, 2); |
| size = gen_int(n_size, 3); |
| filename = gen_fileoutput(n_filename, 4); |
| if ((chunk != NULL) && |
| (size > xmlStrlen(BAD_CAST chunk))) |
| size = 0; |
| |
| ret_val = xmlCreatePushParserCtxt(sax, user_data, chunk, size, filename); |
| desret_xmlParserCtxtPtr(ret_val); |
| call_tests++; |
| des_xmlSAXHandlerPtr(n_sax, sax, 0); |
| des_userdata(n_user_data, user_data, 1); |
| des_const_char_ptr(n_chunk, chunk, 2); |
| des_int(n_size, size, 3); |
| des_fileoutput(n_filename, filename, 4); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlCreatePushParserCtxt", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_sax); |
| printf(" %d", n_user_data); |
| printf(" %d", n_chunk); |
| printf(" %d", n_size); |
| printf(" %d", n_filename); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlCtxtGetCatalogs(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| void * ret_val; |
| xmlParserCtxtPtr ctxt; /* parser context */ |
| int n_ctxt; |
| |
| for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { |
| mem_base = xmlMemBlocks(); |
| ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); |
| |
| ret_val = xmlCtxtGetCatalogs(ctxt); |
| desret_void_ptr(ret_val); |
| call_tests++; |
| des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlCtxtGetCatalogs", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctxt); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlCtxtGetDeclaredEncoding(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| const xmlChar * ret_val; |
| xmlParserCtxtPtr ctxt; /* parser context */ |
| int n_ctxt; |
| |
| for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { |
| mem_base = xmlMemBlocks(); |
| ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); |
| |
| ret_val = xmlCtxtGetDeclaredEncoding(ctxt); |
| desret_const_xmlChar_ptr(ret_val); |
| call_tests++; |
| des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlCtxtGetDeclaredEncoding", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctxt); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlCtxtGetDocument(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| xmlDocPtr ret_val; |
| xmlParserCtxtPtr ctxt; /* parser context */ |
| int n_ctxt; |
| |
| for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { |
| mem_base = xmlMemBlocks(); |
| ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); |
| |
| ret_val = xmlCtxtGetDocument(ctxt); |
| desret_xmlDocPtr(ret_val); |
| call_tests++; |
| des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlCtxtGetDocument", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctxt); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlCtxtGetOptions(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| int ret_val; |
| xmlParserCtxtPtr ctxt; /* an XML parser context */ |
| int n_ctxt; |
| |
| for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { |
| mem_base = xmlMemBlocks(); |
| ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); |
| |
| ret_val = xmlCtxtGetOptions(ctxt); |
| desret_int(ret_val); |
| call_tests++; |
| des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlCtxtGetOptions", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctxt); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlCtxtGetPrivate(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| void * ret_val; |
| xmlParserCtxtPtr ctxt; /* parser context */ |
| int n_ctxt; |
| |
| for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { |
| mem_base = xmlMemBlocks(); |
| ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); |
| |
| ret_val = xmlCtxtGetPrivate(ctxt); |
| desret_void_ptr(ret_val); |
| call_tests++; |
| des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlCtxtGetPrivate", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctxt); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlCtxtGetSaxHandler(void) { |
| int test_ret = 0; |
| |
| |
| /* missing type support */ |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlCtxtGetStandalone(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| int ret_val; |
| xmlParserCtxtPtr ctxt; /* parser context */ |
| int n_ctxt; |
| |
| for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { |
| mem_base = xmlMemBlocks(); |
| ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); |
| |
| ret_val = xmlCtxtGetStandalone(ctxt); |
| desret_int(ret_val); |
| call_tests++; |
| des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlCtxtGetStandalone", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctxt); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| #define gen_nb_xmlParserCtxt_ptr 1 |
| #define gen_xmlParserCtxt_ptr(no, nr) NULL |
| #define des_xmlParserCtxt_ptr(no, val, nr) |
| |
| static int |
| test_xmlCtxtGetStatus(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| xmlParserStatus ret_val; |
| xmlParserCtxt * ctxt; /* an XML parser context */ |
| int n_ctxt; |
| |
| for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxt_ptr;n_ctxt++) { |
| mem_base = xmlMemBlocks(); |
| ctxt = gen_xmlParserCtxt_ptr(n_ctxt, 0); |
| |
| ret_val = xmlCtxtGetStatus(ctxt); |
| desret_xmlParserStatus(ret_val); |
| call_tests++; |
| des_xmlParserCtxt_ptr(n_ctxt, ctxt, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlCtxtGetStatus", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctxt); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlCtxtGetValidCtxt(void) { |
| int test_ret = 0; |
| |
| |
| /* missing type support */ |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlCtxtGetVersion(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| const xmlChar * ret_val; |
| xmlParserCtxtPtr ctxt; /* parser context */ |
| int n_ctxt; |
| |
| for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { |
| mem_base = xmlMemBlocks(); |
| ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); |
| |
| ret_val = xmlCtxtGetVersion(ctxt); |
| desret_const_xmlChar_ptr(ret_val); |
| call_tests++; |
| des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlCtxtGetVersion", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctxt); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlCtxtIsHtml(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| int ret_val; |
| xmlParserCtxtPtr ctxt; /* parser context */ |
| int n_ctxt; |
| |
| for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { |
| mem_base = xmlMemBlocks(); |
| ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); |
| |
| ret_val = xmlCtxtIsHtml(ctxt); |
| desret_int(ret_val); |
| call_tests++; |
| des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlCtxtIsHtml", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctxt); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlCtxtIsStopped(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| int ret_val; |
| xmlParserCtxtPtr ctxt; /* parser context */ |
| int n_ctxt; |
| |
| for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { |
| mem_base = xmlMemBlocks(); |
| ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); |
| |
| ret_val = xmlCtxtIsStopped(ctxt); |
| desret_int(ret_val); |
| call_tests++; |
| des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlCtxtIsStopped", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctxt); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlCtxtParseContent(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| xmlNodePtr ret_val; |
| xmlParserCtxtPtr ctxt; /* parser context */ |
| int n_ctxt; |
| xmlParserInputPtr input; /* parser input */ |
| int n_input; |
| xmlNodePtr node; /* target node or document */ |
| int n_node; |
| int hasTextDecl; /* whether to parse text declaration */ |
| int n_hasTextDecl; |
| |
| for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { |
| for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) { |
| for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { |
| for (n_hasTextDecl = 0;n_hasTextDecl < gen_nb_int;n_hasTextDecl++) { |
| mem_base = xmlMemBlocks(); |
| ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); |
| input = gen_xmlParserInputPtr(n_input, 1); |
| node = gen_xmlNodePtr(n_node, 2); |
| hasTextDecl = gen_int(n_hasTextDecl, 3); |
| |
| ret_val = xmlCtxtParseContent(ctxt, input, node, hasTextDecl); |
| desret_xmlNodePtr(ret_val); |
| call_tests++; |
| des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); |
| des_xmlParserInputPtr(n_input, input, 1); |
| des_xmlNodePtr(n_node, node, 2); |
| des_int(n_hasTextDecl, hasTextDecl, 3); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlCtxtParseContent", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctxt); |
| printf(" %d", n_input); |
| printf(" %d", n_node); |
| printf(" %d", n_hasTextDecl); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlCtxtParseDocument(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| xmlDocPtr ret_val; |
| xmlParserCtxtPtr ctxt; /* an XML parser context */ |
| int n_ctxt; |
| xmlParserInputPtr input; /* parser input */ |
| int n_input; |
| |
| for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { |
| for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) { |
| mem_base = xmlMemBlocks(); |
| ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); |
| input = gen_xmlParserInputPtr(n_input, 1); |
| |
| ret_val = xmlCtxtParseDocument(ctxt, input); |
| desret_xmlDocPtr(ret_val); |
| call_tests++; |
| des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); |
| des_xmlParserInputPtr(n_input, input, 1); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlCtxtParseDocument", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctxt); |
| printf(" %d", n_input); |
| printf("\n"); |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlCtxtParseDtd(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_VALID_ENABLED) |
| int mem_base; |
| xmlDtdPtr ret_val; |
| xmlParserCtxtPtr ctxt; /* a parser context */ |
| int n_ctxt; |
| xmlParserInputPtr input; /* a parser input */ |
| int n_input; |
| const xmlChar * publicId; /* public ID of the DTD (optional) */ |
| int n_publicId; |
| const xmlChar * systemId; /* system ID of the DTD (optional) */ |
| int n_systemId; |
| |
| for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { |
| for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) { |
| for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) { |
| for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) { |
| mem_base = xmlMemBlocks(); |
| ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); |
| input = gen_xmlParserInputPtr(n_input, 1); |
| publicId = gen_const_xmlChar_ptr(n_publicId, 2); |
| systemId = gen_const_xmlChar_ptr(n_systemId, 3); |
| |
| ret_val = xmlCtxtParseDtd(ctxt, input, publicId, systemId); |
| desret_xmlDtdPtr(ret_val); |
| call_tests++; |
| des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); |
| des_xmlParserInputPtr(n_input, input, 1); |
| des_const_xmlChar_ptr(n_publicId, publicId, 2); |
| des_const_xmlChar_ptr(n_systemId, systemId, 3); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlCtxtParseDtd", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctxt); |
| printf(" %d", n_input); |
| printf(" %d", n_publicId); |
| printf(" %d", n_systemId); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlCtxtReadDoc(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| xmlDocPtr ret_val; |
| xmlParserCtxtPtr ctxt; /* an XML parser context */ |
| int n_ctxt; |
| const xmlChar * str; /* a pointer to a zero terminated string */ |
| int n_str; |
| const char * URL; /* base URL (optional) */ |
| int n_URL; |
| const char * encoding; /* the document encoding (optional) */ |
| int n_encoding; |
| int options; /* a combination of xmlParserOption */ |
| int n_options; |
| |
| for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { |
| for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) { |
| for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) { |
| for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { |
| for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) { |
| mem_base = xmlMemBlocks(); |
| ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); |
| str = gen_const_xmlChar_ptr(n_str, 1); |
| URL = gen_filepath(n_URL, 2); |
| encoding = gen_const_char_ptr(n_encoding, 3); |
| options = gen_parseroptions(n_options, 4); |
| |
| ret_val = xmlCtxtReadDoc(ctxt, str, URL, encoding, options); |
| desret_xmlDocPtr(ret_val); |
| call_tests++; |
| des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); |
| des_const_xmlChar_ptr(n_str, str, 1); |
| des_filepath(n_URL, URL, 2); |
| des_const_char_ptr(n_encoding, encoding, 3); |
| des_parseroptions(n_options, options, 4); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlCtxtReadDoc", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctxt); |
| printf(" %d", n_str); |
| printf(" %d", n_URL); |
| printf(" %d", n_encoding); |
| printf(" %d", n_options); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlCtxtReadFile(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| xmlDocPtr ret_val; |
| xmlParserCtxtPtr ctxt; /* an XML parser context */ |
| int n_ctxt; |
| const char * filename; /* a file or URL */ |
| int n_filename; |
| const char * encoding; /* the document encoding (optional) */ |
| int n_encoding; |
| int options; /* a combination of xmlParserOption */ |
| int n_options; |
| |
| for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { |
| for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { |
| for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { |
| for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) { |
| mem_base = xmlMemBlocks(); |
| ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); |
| filename = gen_filepath(n_filename, 1); |
| encoding = gen_const_char_ptr(n_encoding, 2); |
| options = gen_parseroptions(n_options, 3); |
| |
| ret_val = xmlCtxtReadFile(ctxt, filename, encoding, options); |
| desret_xmlDocPtr(ret_val); |
| call_tests++; |
| des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); |
| des_filepath(n_filename, filename, 1); |
| des_const_char_ptr(n_encoding, encoding, 2); |
| des_parseroptions(n_options, options, 3); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlCtxtReadFile", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctxt); |
| printf(" %d", n_filename); |
| printf(" %d", n_encoding); |
| printf(" %d", n_options); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlCtxtReadMemory(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| xmlDocPtr ret_val; |
| xmlParserCtxtPtr ctxt; /* an XML parser context */ |
| int n_ctxt; |
| const char * buffer; /* a pointer to a char array */ |
| int n_buffer; |
| int size; /* the size of the array */ |
| int n_size; |
| const char * URL; /* base URL (optional) */ |
| int n_URL; |
| const char * encoding; /* the document encoding (optional) */ |
| int n_encoding; |
| int options; /* a combination of xmlParserOption */ |
| int n_options; |
| |
| for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { |
| for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) { |
| for (n_size = 0;n_size < gen_nb_int;n_size++) { |
| for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) { |
| for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { |
| for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) { |
| mem_base = xmlMemBlocks(); |
| ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); |
| buffer = gen_const_char_ptr(n_buffer, 1); |
| size = gen_int(n_size, 2); |
| URL = gen_filepath(n_URL, 3); |
| encoding = gen_const_char_ptr(n_encoding, 4); |
| options = gen_parseroptions(n_options, 5); |
| if ((buffer != NULL) && |
| (size > xmlStrlen(BAD_CAST buffer))) |
| size = 0; |
| |
| ret_val = xmlCtxtReadMemory(ctxt, buffer, size, URL, encoding, options); |
| desret_xmlDocPtr(ret_val); |
| call_tests++; |
| des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); |
| des_const_char_ptr(n_buffer, buffer, 1); |
| des_int(n_size, size, 2); |
| des_filepath(n_URL, URL, 3); |
| des_const_char_ptr(n_encoding, encoding, 4); |
| des_parseroptions(n_options, options, 5); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlCtxtReadMemory", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctxt); |
| printf(" %d", n_buffer); |
| printf(" %d", n_size); |
| printf(" %d", n_URL); |
| printf(" %d", n_encoding); |
| printf(" %d", n_options); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlCtxtReset(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| xmlParserCtxtPtr ctxt; /* an XML parser context */ |
| int n_ctxt; |
| |
| for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { |
| mem_base = xmlMemBlocks(); |
| ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); |
| |
| xmlCtxtReset(ctxt); |
| call_tests++; |
| des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlCtxtReset", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctxt); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlCtxtResetPush(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| int ret_val; |
| xmlParserCtxtPtr ctxt; /* an XML parser context */ |
| int n_ctxt; |
| const char * chunk; /* a pointer to an array of chars */ |
| int n_chunk; |
| int size; /* number of chars in the array */ |
| int n_size; |
| const char * filename; /* an optional file name or URI */ |
| int n_filename; |
| const char * encoding; /* the document encoding, or NULL */ |
| int n_encoding; |
| |
| for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { |
| for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) { |
| for (n_size = 0;n_size < gen_nb_int;n_size++) { |
| for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { |
| for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { |
| mem_base = xmlMemBlocks(); |
| ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); |
| chunk = gen_const_char_ptr(n_chunk, 1); |
| size = gen_int(n_size, 2); |
| filename = gen_filepath(n_filename, 3); |
| encoding = gen_const_char_ptr(n_encoding, 4); |
| if ((chunk != NULL) && |
| (size > xmlStrlen(BAD_CAST chunk))) |
| size = 0; |
| |
| ret_val = xmlCtxtResetPush(ctxt, chunk, size, filename, encoding); |
| desret_int(ret_val); |
| call_tests++; |
| des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); |
| des_const_char_ptr(n_chunk, chunk, 1); |
| des_int(n_size, size, 2); |
| des_filepath(n_filename, filename, 3); |
| des_const_char_ptr(n_encoding, encoding, 4); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlCtxtResetPush", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctxt); |
| printf(" %d", n_chunk); |
| printf(" %d", n_size); |
| printf(" %d", n_filename); |
| printf(" %d", n_encoding); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlCtxtSetCatalogs(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| xmlParserCtxtPtr ctxt; /* parser context */ |
| int n_ctxt; |
| void * catalogs; /* catalogs pointer */ |
| int n_catalogs; |
| |
| for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { |
| for (n_catalogs = 0;n_catalogs < gen_nb_void_ptr;n_catalogs++) { |
| mem_base = xmlMemBlocks(); |
| ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); |
| catalogs = gen_void_ptr(n_catalogs, 1); |
| |
| xmlCtxtSetCatalogs(ctxt, catalogs); |
| call_tests++; |
| des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); |
| des_void_ptr(n_catalogs, catalogs, 1); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlCtxtSetCatalogs", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctxt); |
| printf(" %d", n_catalogs); |
| printf("\n"); |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlCtxtSetCharEncConvImpl(void) { |
| int test_ret = 0; |
| |
| |
| /* missing type support */ |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlCtxtSetDict(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| xmlParserCtxtPtr ctxt; /* parser context */ |
| int n_ctxt; |
| xmlDictPtr dict; /* dictionary */ |
| int n_dict; |
| |
| for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { |
| for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) { |
| mem_base = xmlMemBlocks(); |
| ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); |
| dict = gen_xmlDictPtr(n_dict, 1); |
| |
| xmlCtxtSetDict(ctxt, dict); |
| call_tests++; |
| des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); |
| des_xmlDictPtr(n_dict, dict, 1); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlCtxtSetDict", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctxt); |
| printf(" %d", n_dict); |
| printf("\n"); |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlCtxtSetErrorHandler(void) { |
| int test_ret = 0; |
| |
| |
| /* missing type support */ |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlCtxtSetMaxAmplification(void) { |
| int test_ret = 0; |
| |
| |
| /* missing type support */ |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlCtxtSetOptions(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| int ret_val; |
| xmlParserCtxtPtr ctxt; /* an XML parser context */ |
| int n_ctxt; |
| int options; /* a bitmask of xmlParserOption values */ |
| int n_options; |
| |
| for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { |
| for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) { |
| mem_base = xmlMemBlocks(); |
| ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); |
| options = gen_parseroptions(n_options, 1); |
| |
| ret_val = xmlCtxtSetOptions(ctxt, options); |
| desret_int(ret_val); |
| call_tests++; |
| des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); |
| des_parseroptions(n_options, options, 1); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlCtxtSetOptions", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctxt); |
| printf(" %d", n_options); |
| printf("\n"); |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlCtxtSetPrivate(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| xmlParserCtxtPtr ctxt; /* parser context */ |
| int n_ctxt; |
| void * priv; /* private application data */ |
| int n_priv; |
| |
| for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { |
| for (n_priv = 0;n_priv < gen_nb_void_ptr;n_priv++) { |
| mem_base = xmlMemBlocks(); |
| ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); |
| priv = gen_void_ptr(n_priv, 1); |
| |
| xmlCtxtSetPrivate(ctxt, priv); |
| call_tests++; |
| des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); |
| des_void_ptr(n_priv, priv, 1); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlCtxtSetPrivate", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctxt); |
| printf(" %d", n_priv); |
| printf("\n"); |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlCtxtSetResourceLoader(void) { |
| int test_ret = 0; |
| |
| |
| /* missing type support */ |
| return(test_ret); |
| } |
| |
| |
| #define gen_nb_const_xmlSAXHandler_ptr 1 |
| #define gen_const_xmlSAXHandler_ptr(no, nr) NULL |
| #define des_const_xmlSAXHandler_ptr(no, val, nr) |
| |
| static int |
| test_xmlCtxtSetSaxHandler(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| int ret_val; |
| xmlParserCtxtPtr ctxt; /* parser context */ |
| int n_ctxt; |
| const xmlSAXHandler * sax; /* SAX handler */ |
| int n_sax; |
| |
| for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { |
| for (n_sax = 0;n_sax < gen_nb_const_xmlSAXHandler_ptr;n_sax++) { |
| mem_base = xmlMemBlocks(); |
| ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); |
| sax = gen_const_xmlSAXHandler_ptr(n_sax, 1); |
| |
| ret_val = xmlCtxtSetSaxHandler(ctxt, sax); |
| desret_int(ret_val); |
| call_tests++; |
| des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); |
| des_const_xmlSAXHandler_ptr(n_sax, sax, 1); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlCtxtSetSaxHandler", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctxt); |
| printf(" %d", n_sax); |
| printf("\n"); |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlCtxtUseOptions(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| int ret_val; |
| xmlParserCtxtPtr ctxt; /* an XML parser context */ |
| int n_ctxt; |
| int options; /* a combination of xmlParserOption */ |
| int n_options; |
| |
| for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { |
| for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) { |
| mem_base = xmlMemBlocks(); |
| ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); |
| options = gen_parseroptions(n_options, 1); |
| |
| ret_val = xmlCtxtUseOptions(ctxt, options); |
| desret_int(ret_val); |
| call_tests++; |
| des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); |
| des_parseroptions(n_options, options, 1); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlCtxtUseOptions", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctxt); |
| printf(" %d", n_options); |
| printf("\n"); |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlCtxtValidateDocument(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_VALID_ENABLED) |
| int mem_base; |
| int ret_val; |
| xmlParserCtxtPtr ctxt; /* a parser context */ |
| int n_ctxt; |
| xmlDocPtr doc; /* a document instance */ |
| int n_doc; |
| |
| for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { |
| for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { |
| mem_base = xmlMemBlocks(); |
| ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); |
| doc = gen_xmlDocPtr(n_doc, 1); |
| |
| ret_val = xmlCtxtValidateDocument(ctxt, doc); |
| desret_int(ret_val); |
| call_tests++; |
| des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); |
| des_xmlDocPtr(n_doc, doc, 1); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlCtxtValidateDocument", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctxt); |
| printf(" %d", n_doc); |
| printf("\n"); |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlCtxtValidateDtd(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_VALID_ENABLED) |
| int mem_base; |
| int ret_val; |
| xmlParserCtxtPtr ctxt; /* a parser context */ |
| int n_ctxt; |
| xmlDocPtr doc; /* a document instance */ |
| int n_doc; |
| xmlDtdPtr dtd; /* a dtd instance */ |
| int n_dtd; |
| |
| for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { |
| for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { |
| for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) { |
| mem_base = xmlMemBlocks(); |
| ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); |
| doc = gen_xmlDocPtr(n_doc, 1); |
| dtd = gen_xmlDtdPtr(n_dtd, 2); |
| |
| ret_val = xmlCtxtValidateDtd(ctxt, doc, dtd); |
| desret_int(ret_val); |
| call_tests++; |
| des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); |
| des_xmlDocPtr(n_doc, doc, 1); |
| des_xmlDtdPtr(n_dtd, dtd, 2); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlCtxtValidateDtd", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctxt); |
| printf(" %d", n_doc); |
| printf(" %d", n_dtd); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlGetExternalEntityLoader(void) { |
| int test_ret = 0; |
| |
| |
| /* missing type support */ |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlHasFeature(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| int ret_val; |
| xmlFeature feature; /* the feature to be examined */ |
| int n_feature; |
| |
| for (n_feature = 0;n_feature < gen_nb_xmlFeature;n_feature++) { |
| mem_base = xmlMemBlocks(); |
| feature = gen_xmlFeature(n_feature, 0); |
| |
| ret_val = xmlHasFeature(feature); |
| desret_int(ret_val); |
| call_tests++; |
| des_xmlFeature(n_feature, feature, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlHasFeature", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_feature); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlIOParseDTD(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_VALID_ENABLED) |
| #ifdef LIBXML_VALID_ENABLED |
| xmlDtdPtr ret_val; |
| xmlSAXHandlerPtr sax; /* the SAX handler block or NULL */ |
| int n_sax; |
| xmlParserInputBufferPtr input; /* an Input Buffer */ |
| int n_input; |
| xmlCharEncoding enc; /* the charset encoding if known */ |
| int n_enc; |
| |
| for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) { |
| for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) { |
| for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) { |
| sax = gen_xmlSAXHandlerPtr(n_sax, 0); |
| input = gen_xmlParserInputBufferPtr(n_input, 1); |
| enc = gen_xmlCharEncoding(n_enc, 2); |
| |
| ret_val = xmlIOParseDTD(sax, input, enc); |
| input = NULL; |
| desret_xmlDtdPtr(ret_val); |
| call_tests++; |
| des_xmlSAXHandlerPtr(n_sax, sax, 0); |
| des_xmlParserInputBufferPtr(n_input, input, 1); |
| des_xmlCharEncoding(n_enc, enc, 2); |
| xmlResetLastError(); |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlInitGlobals(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| |
| mem_base = xmlMemBlocks(); |
| |
| xmlInitGlobals(); |
| call_tests++; |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlInitGlobals", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf("\n"); |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlInitNodeInfoSeq(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| xmlParserNodeInfoSeqPtr seq; /* a node info sequence pointer */ |
| int n_seq; |
| |
| for (n_seq = 0;n_seq < gen_nb_xmlParserNodeInfoSeqPtr;n_seq++) { |
| mem_base = xmlMemBlocks(); |
| seq = gen_xmlParserNodeInfoSeqPtr(n_seq, 0); |
| |
| xmlInitNodeInfoSeq(seq); |
| call_tests++; |
| des_xmlParserNodeInfoSeqPtr(n_seq, seq, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlInitNodeInfoSeq", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_seq); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlInitParser(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| |
| mem_base = xmlMemBlocks(); |
| |
| xmlInitParser(); |
| call_tests++; |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlInitParser", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf("\n"); |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlInitParserCtxt(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| int ret_val; |
| xmlParserCtxtPtr ctxt; /* an XML parser context */ |
| int n_ctxt; |
| |
| for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { |
| mem_base = xmlMemBlocks(); |
| ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); |
| |
| ret_val = xmlInitParserCtxt(ctxt); |
| desret_int(ret_val); |
| call_tests++; |
| des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlInitParserCtxt", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctxt); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlInputSetEncodingHandler(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| xmlParserErrors ret_val; |
| xmlParserInputPtr input; /* the input stream */ |
| int n_input; |
| xmlCharEncodingHandlerPtr handler; /* the encoding handler */ |
| int n_handler; |
| |
| for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) { |
| for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandlerPtr;n_handler++) { |
| mem_base = xmlMemBlocks(); |
| input = gen_xmlParserInputPtr(n_input, 0); |
| handler = gen_xmlCharEncodingHandlerPtr(n_handler, 1); |
| |
| ret_val = xmlInputSetEncodingHandler(input, handler); |
| desret_xmlParserErrors(ret_val); |
| call_tests++; |
| des_xmlParserInputPtr(n_input, input, 0); |
| des_xmlCharEncodingHandlerPtr(n_handler, handler, 1); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlInputSetEncodingHandler", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_input); |
| printf(" %d", n_handler); |
| printf("\n"); |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlKeepBlanksDefault(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| int ret_val; |
| int val; /* int 0 or 1 */ |
| int n_val; |
| |
| for (n_val = 0;n_val < gen_nb_int;n_val++) { |
| mem_base = xmlMemBlocks(); |
| val = gen_int(n_val, 0); |
| |
| ret_val = xmlKeepBlanksDefault(val); |
| desret_int(ret_val); |
| call_tests++; |
| des_int(n_val, val, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlKeepBlanksDefault", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_val); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlLineNumbersDefault(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| int ret_val; |
| int val; /* int 0 or 1 */ |
| int n_val; |
| |
| for (n_val = 0;n_val < gen_nb_int;n_val++) { |
| mem_base = xmlMemBlocks(); |
| val = gen_int(n_val, 0); |
| |
| ret_val = xmlLineNumbersDefault(val); |
| desret_int(ret_val); |
| call_tests++; |
| des_int(n_val, val, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlLineNumbersDefault", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_val); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlLoadExternalEntity(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| xmlParserInputPtr ret_val; |
| const char * URL; /* the URL for the entity to load */ |
| int n_URL; |
| const char * ID; /* the Public ID for the entity to load */ |
| int n_ID; |
| xmlParserCtxtPtr ctxt; /* the context in which the entity is called or NULL */ |
| int n_ctxt; |
| |
| for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) { |
| for (n_ID = 0;n_ID < gen_nb_const_char_ptr;n_ID++) { |
| for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { |
| mem_base = xmlMemBlocks(); |
| URL = gen_filepath(n_URL, 0); |
| ID = gen_const_char_ptr(n_ID, 1); |
| ctxt = gen_xmlParserCtxtPtr(n_ctxt, 2); |
| |
| ret_val = xmlLoadExternalEntity(URL, ID, ctxt); |
| desret_xmlParserInputPtr(ret_val); |
| call_tests++; |
| des_filepath(n_URL, URL, 0); |
| des_const_char_ptr(n_ID, ID, 1); |
| des_xmlParserCtxtPtr(n_ctxt, ctxt, 2); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlLoadExternalEntity", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_URL); |
| printf(" %d", n_ID); |
| printf(" %d", n_ctxt); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlNewIOInputStream(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| xmlParserInputPtr ret_val; |
| xmlParserCtxtPtr ctxt; /* an XML parser context */ |
| int n_ctxt; |
| xmlParserInputBufferPtr buf; /* an input buffer */ |
| int n_buf; |
| xmlCharEncoding enc; /* the charset encoding if known */ |
| int n_enc; |
| |
| for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { |
| for (n_buf = 0;n_buf < gen_nb_xmlParserInputBufferPtr;n_buf++) { |
| for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) { |
| mem_base = xmlMemBlocks(); |
| ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); |
| buf = gen_xmlParserInputBufferPtr(n_buf, 1); |
| enc = gen_xmlCharEncoding(n_enc, 2); |
| |
| ret_val = xmlNewIOInputStream(ctxt, buf, enc); |
| if (ret_val != NULL) buf = NULL; |
| desret_xmlParserInputPtr(ret_val); |
| call_tests++; |
| des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); |
| des_xmlParserInputBufferPtr(n_buf, buf, 1); |
| des_xmlCharEncoding(n_enc, enc, 2); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlNewIOInputStream", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctxt); |
| printf(" %d", n_buf); |
| printf(" %d", n_enc); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlNewInputFromFd(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| xmlParserInputPtr ret_val; |
| const char * url; /* base URL (optional) */ |
| int n_url; |
| int fd; /* file descriptor */ |
| int n_fd; |
| xmlParserInputFlags flags; /* input flags */ |
| int n_flags; |
| |
| for (n_url = 0;n_url < gen_nb_filepath;n_url++) { |
| for (n_fd = 0;n_fd < gen_nb_int;n_fd++) { |
| for (n_flags = 0;n_flags < gen_nb_xmlParserInputFlags;n_flags++) { |
| mem_base = xmlMemBlocks(); |
| url = gen_filepath(n_url, 0); |
| fd = gen_int(n_fd, 1); |
| flags = gen_xmlParserInputFlags(n_flags, 2); |
| |
| ret_val = xmlNewInputFromFd(url, fd, flags); |
| desret_xmlParserInputPtr(ret_val); |
| call_tests++; |
| des_filepath(n_url, url, 0); |
| des_int(n_fd, fd, 1); |
| des_xmlParserInputFlags(n_flags, flags, 2); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlNewInputFromFd", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_url); |
| printf(" %d", n_fd); |
| printf(" %d", n_flags); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlNewInputFromIO(void) { |
| int test_ret = 0; |
| |
| |
| /* missing type support */ |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlNewInputFromMemory(void) { |
| int test_ret = 0; |
| |
| |
| /* missing type support */ |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlNewInputFromString(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| xmlParserInputPtr ret_val; |
| const char * url; /* base URL (optional) */ |
| int n_url; |
| const char * str; /* zero-terminated string */ |
| int n_str; |
| xmlParserInputFlags flags; /* optimization hints */ |
| int n_flags; |
| |
| for (n_url = 0;n_url < gen_nb_filepath;n_url++) { |
| for (n_str = 0;n_str < gen_nb_const_char_ptr;n_str++) { |
| for (n_flags = 0;n_flags < gen_nb_xmlParserInputFlags;n_flags++) { |
| mem_base = xmlMemBlocks(); |
| url = gen_filepath(n_url, 0); |
| str = gen_const_char_ptr(n_str, 1); |
| flags = gen_xmlParserInputFlags(n_flags, 2); |
| |
| ret_val = xmlNewInputFromString(url, str, flags); |
| desret_xmlParserInputPtr(ret_val); |
| call_tests++; |
| des_filepath(n_url, url, 0); |
| des_const_char_ptr(n_str, str, 1); |
| des_xmlParserInputFlags(n_flags, flags, 2); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlNewInputFromString", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_url); |
| printf(" %d", n_str); |
| printf(" %d", n_flags); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| #define gen_nb_xmlParserInputPtr_ptr 1 |
| #define gen_xmlParserInputPtr_ptr(no, nr) NULL |
| #define des_xmlParserInputPtr_ptr(no, val, nr) |
| |
| static int |
| test_xmlNewInputFromUrl(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| xmlParserErrors ret_val; |
| const char * filename; /* the filename to use as entity */ |
| int n_filename; |
| xmlParserInputFlags flags; /* XML_INPUT flags */ |
| int n_flags; |
| xmlParserInputPtr * out; /* pointer to new parser input */ |
| int n_out; |
| |
| for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { |
| for (n_flags = 0;n_flags < gen_nb_xmlParserInputFlags;n_flags++) { |
| for (n_out = 0;n_out < gen_nb_xmlParserInputPtr_ptr;n_out++) { |
| mem_base = xmlMemBlocks(); |
| filename = gen_filepath(n_filename, 0); |
| flags = gen_xmlParserInputFlags(n_flags, 1); |
| out = gen_xmlParserInputPtr_ptr(n_out, 2); |
| |
| ret_val = xmlNewInputFromUrl(filename, flags, out); |
| desret_xmlParserErrors(ret_val); |
| call_tests++; |
| des_filepath(n_filename, filename, 0); |
| des_xmlParserInputFlags(n_flags, flags, 1); |
| des_xmlParserInputPtr_ptr(n_out, out, 2); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlNewInputFromUrl", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_filename); |
| printf(" %d", n_flags); |
| printf(" %d", n_out); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlNewParserCtxt(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| xmlParserCtxtPtr ret_val; |
| |
| mem_base = xmlMemBlocks(); |
| |
| ret_val = xmlNewParserCtxt(); |
| desret_xmlParserCtxtPtr(ret_val); |
| call_tests++; |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlNewParserCtxt", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf("\n"); |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlNewSAXParserCtxt(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| xmlParserCtxtPtr ret_val; |
| const xmlSAXHandler * sax; /* SAX handler */ |
| int n_sax; |
| void * userData; /* user data */ |
| int n_userData; |
| |
| for (n_sax = 0;n_sax < gen_nb_const_xmlSAXHandler_ptr;n_sax++) { |
| for (n_userData = 0;n_userData < gen_nb_userdata;n_userData++) { |
| mem_base = xmlMemBlocks(); |
| sax = gen_const_xmlSAXHandler_ptr(n_sax, 0); |
| userData = gen_userdata(n_userData, 1); |
| |
| ret_val = xmlNewSAXParserCtxt(sax, userData); |
| desret_xmlParserCtxtPtr(ret_val); |
| call_tests++; |
| des_const_xmlSAXHandler_ptr(n_sax, sax, 0); |
| des_userdata(n_userData, userData, 1); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlNewSAXParserCtxt", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_sax); |
| printf(" %d", n_userData); |
| printf("\n"); |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| #define gen_nb_xmlNodePtr_ptr 1 |
| #define gen_xmlNodePtr_ptr(no, nr) NULL |
| #define des_xmlNodePtr_ptr(no, val, nr) |
| |
| static int |
| test_xmlParseBalancedChunkMemory(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_SAX1_ENABLED) |
| #ifdef LIBXML_SAX1_ENABLED |
| int mem_base; |
| int ret_val; |
| xmlDocPtr doc; /* the document the chunk pertains to (must not be NULL) */ |
| int n_doc; |
| xmlSAXHandlerPtr sax; /* the SAX handler block (possibly NULL) */ |
| int n_sax; |
| void * user_data; /* The user data returned on SAX callbacks (possibly NULL) */ |
| int n_user_data; |
| int depth; /* Used for loop detection, use 0 */ |
| int n_depth; |
| const xmlChar * string; /* the input string in UTF8 or ISO-Latin (zero terminated) */ |
| int n_string; |
| xmlNodePtr * lst; /* the return value for the set of parsed nodes */ |
| int n_lst; |
| |
| for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { |
| for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) { |
| for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) { |
| for (n_depth = 0;n_depth < gen_nb_int;n_depth++) { |
| for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) { |
| for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) { |
| mem_base = xmlMemBlocks(); |
| doc = gen_xmlDocPtr(n_doc, 0); |
| sax = gen_xmlSAXHandlerPtr(n_sax, 1); |
| user_data = gen_userdata(n_user_data, 2); |
| depth = gen_int(n_depth, 3); |
| string = gen_const_xmlChar_ptr(n_string, 4); |
| lst = gen_xmlNodePtr_ptr(n_lst, 5); |
| |
| #ifdef LIBXML_SAX1_ENABLED |
| if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL; |
| #endif |
| |
| |
| ret_val = xmlParseBalancedChunkMemory(doc, sax, user_data, depth, string, lst); |
| desret_int(ret_val); |
| call_tests++; |
| des_xmlDocPtr(n_doc, doc, 0); |
| des_xmlSAXHandlerPtr(n_sax, sax, 1); |
| des_userdata(n_user_data, user_data, 2); |
| des_int(n_depth, depth, 3); |
| des_const_xmlChar_ptr(n_string, string, 4); |
| des_xmlNodePtr_ptr(n_lst, lst, 5); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlParseBalancedChunkMemory", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_doc); |
| printf(" %d", n_sax); |
| printf(" %d", n_user_data); |
| printf(" %d", n_depth); |
| printf(" %d", n_string); |
| printf(" %d", n_lst); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlParseBalancedChunkMemoryRecover(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_SAX1_ENABLED) |
| #ifdef LIBXML_SAX1_ENABLED |
| int mem_base; |
| int ret_val; |
| xmlDocPtr doc; /* the document the chunk pertains to (must not be NULL) */ |
| int n_doc; |
| xmlSAXHandlerPtr sax; /* the SAX handler block (possibly NULL) */ |
| int n_sax; |
| void * user_data; /* The user data returned on SAX callbacks (possibly NULL) */ |
| int n_user_data; |
| int depth; /* Used for loop detection, use 0 */ |
| int n_depth; |
| const xmlChar * string; /* the input string in UTF8 or ISO-Latin (zero terminated) */ |
| int n_string; |
| xmlNodePtr * listOut; /* the return value for the set of parsed nodes */ |
| int n_listOut; |
| int recover; /* return nodes even if the data is broken (use 0) */ |
| int n_recover; |
| |
| for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { |
| for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) { |
| for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) { |
| for (n_depth = 0;n_depth < gen_nb_int;n_depth++) { |
| for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) { |
| for (n_listOut = 0;n_listOut < gen_nb_xmlNodePtr_ptr;n_listOut++) { |
| for (n_recover = 0;n_recover < gen_nb_int;n_recover++) { |
| mem_base = xmlMemBlocks(); |
| doc = gen_xmlDocPtr(n_doc, 0); |
| sax = gen_xmlSAXHandlerPtr(n_sax, 1); |
| user_data = gen_userdata(n_user_data, 2); |
| depth = gen_int(n_depth, 3); |
| string = gen_const_xmlChar_ptr(n_string, 4); |
| listOut = gen_xmlNodePtr_ptr(n_listOut, 5); |
| recover = gen_int(n_recover, 6); |
| |
| #ifdef LIBXML_SAX1_ENABLED |
| if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL; |
| #endif |
| |
| |
| ret_val = xmlParseBalancedChunkMemoryRecover(doc, sax, user_data, depth, string, listOut, recover); |
| desret_int(ret_val); |
| call_tests++; |
| des_xmlDocPtr(n_doc, doc, 0); |
| des_xmlSAXHandlerPtr(n_sax, sax, 1); |
| des_userdata(n_user_data, user_data, 2); |
| des_int(n_depth, depth, 3); |
| des_const_xmlChar_ptr(n_string, string, 4); |
| des_xmlNodePtr_ptr(n_listOut, listOut, 5); |
| des_int(n_recover, recover, 6); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlParseBalancedChunkMemoryRecover", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_doc); |
| printf(" %d", n_sax); |
| printf(" %d", n_user_data); |
| printf(" %d", n_depth); |
| printf(" %d", n_string); |
| printf(" %d", n_listOut); |
| printf(" %d", n_recover); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlParseChunk(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_PUSH_ENABLED) |
| int mem_base; |
| int ret_val; |
| xmlParserCtxtPtr ctxt; /* an XML parser context */ |
| int n_ctxt; |
| const char * chunk; /* chunk of memory */ |
| int n_chunk; |
| int size; /* size of chunk in bytes */ |
| int n_size; |
| int terminate; /* last chunk indicator */ |
| int n_terminate; |
| |
| for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { |
| for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) { |
| for (n_size = 0;n_size < gen_nb_int;n_size++) { |
| for (n_terminate = 0;n_terminate < gen_nb_int;n_terminate++) { |
| mem_base = xmlMemBlocks(); |
| ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); |
| chunk = gen_const_char_ptr(n_chunk, 1); |
| size = gen_int(n_size, 2); |
| terminate = gen_int(n_terminate, 3); |
| if ((chunk != NULL) && |
| (size > xmlStrlen(BAD_CAST chunk))) |
| size = 0; |
| |
| ret_val = xmlParseChunk(ctxt, chunk, size, terminate); |
| if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;} |
| desret_int(ret_val); |
| call_tests++; |
| des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); |
| des_const_char_ptr(n_chunk, chunk, 1); |
| des_int(n_size, size, 2); |
| des_int(n_terminate, terminate, 3); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlParseChunk", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctxt); |
| printf(" %d", n_chunk); |
| printf(" %d", n_size); |
| printf(" %d", n_terminate); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlParseCtxtExternalEntity(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| int ret_val; |
| xmlParserCtxtPtr ctxt; /* the existing parsing context */ |
| int n_ctxt; |
| const xmlChar * URL; /* the URL for the entity to load */ |
| int n_URL; |
| const xmlChar * ID; /* the System ID for the entity to load */ |
| int n_ID; |
| xmlNodePtr * listOut; /* the return value for the set of parsed nodes */ |
| int n_listOut; |
| |
| for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { |
| for (n_URL = 0;n_URL < gen_nb_const_xmlChar_ptr;n_URL++) { |
| for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) { |
| for (n_listOut = 0;n_listOut < gen_nb_xmlNodePtr_ptr;n_listOut++) { |
| mem_base = xmlMemBlocks(); |
| ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); |
| URL = gen_const_xmlChar_ptr(n_URL, 1); |
| ID = gen_const_xmlChar_ptr(n_ID, 2); |
| listOut = gen_xmlNodePtr_ptr(n_listOut, 3); |
| |
| ret_val = xmlParseCtxtExternalEntity(ctxt, URL, ID, listOut); |
| desret_int(ret_val); |
| call_tests++; |
| des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); |
| des_const_xmlChar_ptr(n_URL, URL, 1); |
| des_const_xmlChar_ptr(n_ID, ID, 2); |
| des_xmlNodePtr_ptr(n_listOut, listOut, 3); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlParseCtxtExternalEntity", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctxt); |
| printf(" %d", n_URL); |
| printf(" %d", n_ID); |
| printf(" %d", n_listOut); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlParseDTD(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_VALID_ENABLED) |
| #ifdef LIBXML_VALID_ENABLED |
| int mem_base; |
| xmlDtdPtr ret_val; |
| const xmlChar * ExternalID; /* a NAME* containing the External ID of the DTD */ |
| int n_ExternalID; |
| const xmlChar * SystemID; /* a NAME* containing the URL to the DTD */ |
| int n_SystemID; |
| |
| for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) { |
| for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) { |
| mem_base = xmlMemBlocks(); |
| ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 0); |
| SystemID = gen_const_xmlChar_ptr(n_SystemID, 1); |
| |
| ret_val = xmlParseDTD(ExternalID, SystemID); |
| desret_xmlDtdPtr(ret_val); |
| call_tests++; |
| des_const_xmlChar_ptr(n_ExternalID, ExternalID, 0); |
| des_const_xmlChar_ptr(n_SystemID, SystemID, 1); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlParseDTD", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ExternalID); |
| printf(" %d", n_SystemID); |
| printf("\n"); |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlParseDoc(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_SAX1_ENABLED) |
| #ifdef LIBXML_SAX1_ENABLED |
| int mem_base; |
| xmlDocPtr ret_val; |
| const xmlChar * cur; /* a pointer to an array of xmlChar */ |
| int n_cur; |
| |
| for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) { |
| mem_base = xmlMemBlocks(); |
| cur = gen_const_xmlChar_ptr(n_cur, 0); |
| |
| ret_val = xmlParseDoc(cur); |
| desret_xmlDocPtr(ret_val); |
| call_tests++; |
| des_const_xmlChar_ptr(n_cur, cur, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlParseDoc", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_cur); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| #endif |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlParseDocument(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| int ret_val; |
| xmlParserCtxtPtr ctxt; /* an XML parser context */ |
| int n_ctxt; |
| |
| for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { |
| mem_base = xmlMemBlocks(); |
| ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); |
| |
| ret_val = xmlParseDocument(ctxt); |
| if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;} |
| desret_int(ret_val); |
| call_tests++; |
| des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlParseDocument", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctxt); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlParseEntity(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_SAX1_ENABLED) |
| #ifdef LIBXML_SAX1_ENABLED |
| int mem_base; |
| xmlDocPtr ret_val; |
| const char * filename; /* the filename */ |
| int n_filename; |
| |
| for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { |
| mem_base = xmlMemBlocks(); |
| filename = gen_filepath(n_filename, 0); |
| |
| ret_val = xmlParseEntity(filename); |
| desret_xmlDocPtr(ret_val); |
| call_tests++; |
| des_filepath(n_filename, filename, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlParseEntity", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_filename); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| #endif |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlParseExtParsedEnt(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| int ret_val; |
| xmlParserCtxtPtr ctxt; /* an XML parser context */ |
| int n_ctxt; |
| |
| for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { |
| mem_base = xmlMemBlocks(); |
| ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); |
| |
| ret_val = xmlParseExtParsedEnt(ctxt); |
| if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;} |
| desret_int(ret_val); |
| call_tests++; |
| des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlParseExtParsedEnt", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctxt); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlParseExternalEntity(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_SAX1_ENABLED) |
| #ifdef LIBXML_SAX1_ENABLED |
| int mem_base; |
| int ret_val; |
| xmlDocPtr doc; /* the document the chunk pertains to */ |
| int n_doc; |
| xmlSAXHandlerPtr sax; /* the SAX handler block (possibly NULL) */ |
| int n_sax; |
| void * user_data; /* The user data returned on SAX callbacks (possibly NULL) */ |
| int n_user_data; |
| int depth; /* Used for loop detection, use 0 */ |
| int n_depth; |
| const xmlChar * URL; /* the URL for the entity to load */ |
| int n_URL; |
| const xmlChar * ID; /* the System ID for the entity to load */ |
| int n_ID; |
| xmlNodePtr * list; /* the return value for the set of parsed nodes */ |
| int n_list; |
| |
| for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { |
| for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) { |
| for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) { |
| for (n_depth = 0;n_depth < gen_nb_int;n_depth++) { |
| for (n_URL = 0;n_URL < gen_nb_const_xmlChar_ptr;n_URL++) { |
| for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) { |
| for (n_list = 0;n_list < gen_nb_xmlNodePtr_ptr;n_list++) { |
| mem_base = xmlMemBlocks(); |
| doc = gen_xmlDocPtr(n_doc, 0); |
| sax = gen_xmlSAXHandlerPtr(n_sax, 1); |
| user_data = gen_userdata(n_user_data, 2); |
| depth = gen_int(n_depth, 3); |
| URL = gen_const_xmlChar_ptr(n_URL, 4); |
| ID = gen_const_xmlChar_ptr(n_ID, 5); |
| list = gen_xmlNodePtr_ptr(n_list, 6); |
| |
| ret_val = xmlParseExternalEntity(doc, sax, user_data, depth, URL, ID, list); |
| desret_int(ret_val); |
| call_tests++; |
| des_xmlDocPtr(n_doc, doc, 0); |
| des_xmlSAXHandlerPtr(n_sax, sax, 1); |
| des_userdata(n_user_data, user_data, 2); |
| des_int(n_depth, depth, 3); |
| des_const_xmlChar_ptr(n_URL, URL, 4); |
| des_const_xmlChar_ptr(n_ID, ID, 5); |
| des_xmlNodePtr_ptr(n_list, list, 6); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlParseExternalEntity", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_doc); |
| printf(" %d", n_sax); |
| printf(" %d", n_user_data); |
| printf(" %d", n_depth); |
| printf(" %d", n_URL); |
| printf(" %d", n_ID); |
| printf(" %d", n_list); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlParseFile(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_SAX1_ENABLED) |
| #ifdef LIBXML_SAX1_ENABLED |
| int mem_base; |
| xmlDocPtr ret_val; |
| const char * filename; /* the filename */ |
| int n_filename; |
| |
| for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { |
| mem_base = xmlMemBlocks(); |
| filename = gen_filepath(n_filename, 0); |
| |
| ret_val = xmlParseFile(filename); |
| desret_xmlDocPtr(ret_val); |
| call_tests++; |
| des_filepath(n_filename, filename, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlParseFile", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_filename); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| #endif |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlParseInNodeContext(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| xmlParserErrors ret_val; |
| xmlNodePtr node; /* the context node */ |
| int n_node; |
| const char * data; /* the input string */ |
| int n_data; |
| int datalen; /* the input string length in bytes */ |
| int n_datalen; |
| int options; /* a combination of xmlParserOption */ |
| int n_options; |
| xmlNodePtr * listOut; /* the return value for the set of parsed nodes */ |
| int n_listOut; |
| |
| for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { |
| for (n_data = 0;n_data < gen_nb_const_char_ptr;n_data++) { |
| for (n_datalen = 0;n_datalen < gen_nb_int;n_datalen++) { |
| for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) { |
| for (n_listOut = 0;n_listOut < gen_nb_xmlNodePtr_ptr;n_listOut++) { |
| mem_base = xmlMemBlocks(); |
| node = gen_xmlNodePtr(n_node, 0); |
| data = gen_const_char_ptr(n_data, 1); |
| datalen = gen_int(n_datalen, 2); |
| options = gen_parseroptions(n_options, 3); |
| listOut = gen_xmlNodePtr_ptr(n_listOut, 4); |
| |
| ret_val = xmlParseInNodeContext(node, data, datalen, options, listOut); |
| desret_xmlParserErrors(ret_val); |
| call_tests++; |
| des_xmlNodePtr(n_node, node, 0); |
| des_const_char_ptr(n_data, data, 1); |
| des_int(n_datalen, datalen, 2); |
| des_parseroptions(n_options, options, 3); |
| des_xmlNodePtr_ptr(n_listOut, listOut, 4); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlParseInNodeContext", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_node); |
| printf(" %d", n_data); |
| printf(" %d", n_datalen); |
| printf(" %d", n_options); |
| printf(" %d", n_listOut); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlParseMemory(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_SAX1_ENABLED) |
| #ifdef LIBXML_SAX1_ENABLED |
| int mem_base; |
| xmlDocPtr ret_val; |
| const char * buffer; /* an pointer to a char array */ |
| int n_buffer; |
| int size; /* the size of the array */ |
| int n_size; |
| |
| for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) { |
| for (n_size = 0;n_size < gen_nb_int;n_size++) { |
| mem_base = xmlMemBlocks(); |
| buffer = gen_const_char_ptr(n_buffer, 0); |
| size = gen_int(n_size, 1); |
| if ((buffer != NULL) && |
| (size > xmlStrlen(BAD_CAST buffer))) |
| size = 0; |
| |
| ret_val = xmlParseMemory(buffer, size); |
| desret_xmlDocPtr(ret_val); |
| call_tests++; |
| des_const_char_ptr(n_buffer, buffer, 0); |
| des_int(n_size, size, 1); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlParseMemory", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_buffer); |
| printf(" %d", n_size); |
| printf("\n"); |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| #define gen_nb_xmlParserNodeInfoPtr 1 |
| #define gen_xmlParserNodeInfoPtr(no, nr) NULL |
| #define des_xmlParserNodeInfoPtr(no, val, nr) |
| |
| static int |
| test_xmlParserAddNodeInfo(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| xmlParserCtxtPtr ctxt; /* an XML parser context */ |
| int n_ctxt; |
| xmlParserNodeInfoPtr info; /* a node info sequence pointer */ |
| int n_info; |
| |
| for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { |
| for (n_info = 0;n_info < gen_nb_xmlParserNodeInfoPtr;n_info++) { |
| mem_base = xmlMemBlocks(); |
| ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); |
| info = gen_xmlParserNodeInfoPtr(n_info, 1); |
| |
| xmlParserAddNodeInfo(ctxt, info); |
| call_tests++; |
| des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); |
| des_xmlParserNodeInfoPtr(n_info, info, 1); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlParserAddNodeInfo", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctxt); |
| printf(" %d", n_info); |
| printf("\n"); |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlParserFindNodeInfo(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| const xmlParserNodeInfo * ret_val; |
| xmlParserCtxtPtr ctx; /* an XML parser context */ |
| int n_ctx; |
| xmlNodePtr node; /* an XML node within the tree */ |
| int n_node; |
| |
| for (n_ctx = 0;n_ctx < gen_nb_xmlParserCtxtPtr;n_ctx++) { |
| for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { |
| mem_base = xmlMemBlocks(); |
| ctx = gen_xmlParserCtxtPtr(n_ctx, 0); |
| node = gen_xmlNodePtr(n_node, 1); |
| |
| ret_val = xmlParserFindNodeInfo(ctx, node); |
| desret_const_xmlParserNodeInfo_ptr(ret_val); |
| call_tests++; |
| des_xmlParserCtxtPtr(n_ctx, ctx, 0); |
| des_xmlNodePtr(n_node, node, 1); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlParserFindNodeInfo", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctx); |
| printf(" %d", n_node); |
| printf("\n"); |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlParserFindNodeInfoIndex(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| unsigned long ret_val; |
| xmlParserNodeInfoSeqPtr seq; /* a node info sequence pointer */ |
| int n_seq; |
| xmlNodePtr node; /* an XML node pointer */ |
| int n_node; |
| |
| for (n_seq = 0;n_seq < gen_nb_xmlParserNodeInfoSeqPtr;n_seq++) { |
| for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { |
| mem_base = xmlMemBlocks(); |
| seq = gen_xmlParserNodeInfoSeqPtr(n_seq, 0); |
| node = gen_xmlNodePtr(n_node, 1); |
| |
| ret_val = xmlParserFindNodeInfoIndex(seq, node); |
| desret_unsigned_long(ret_val); |
| call_tests++; |
| des_xmlParserNodeInfoSeqPtr(n_seq, seq, 0); |
| des_xmlNodePtr(n_node, node, 1); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlParserFindNodeInfoIndex", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_seq); |
| printf(" %d", n_node); |
| printf("\n"); |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlParserInputGrow(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| int ret_val; |
| xmlParserInputPtr in; /* an XML parser input */ |
| int n_in; |
| int len; /* an indicative size for the lookahead */ |
| int n_len; |
| |
| for (n_in = 0;n_in < gen_nb_xmlParserInputPtr;n_in++) { |
| for (n_len = 0;n_len < gen_nb_int;n_len++) { |
| mem_base = xmlMemBlocks(); |
| in = gen_xmlParserInputPtr(n_in, 0); |
| len = gen_int(n_len, 1); |
| |
| ret_val = xmlParserInputGrow(in, len); |
| desret_int(ret_val); |
| call_tests++; |
| des_xmlParserInputPtr(n_in, in, 0); |
| des_int(n_len, len, 1); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlParserInputGrow", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_in); |
| printf(" %d", n_len); |
| printf("\n"); |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlParserInputRead(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| int ret_val; |
| xmlParserInputPtr in; /* an XML parser input */ |
| int n_in; |
| int len; /* an indicative size for the lookahead */ |
| int n_len; |
| |
| for (n_in = 0;n_in < gen_nb_xmlParserInputPtr;n_in++) { |
| for (n_len = 0;n_len < gen_nb_int;n_len++) { |
| mem_base = xmlMemBlocks(); |
| in = gen_xmlParserInputPtr(n_in, 0); |
| len = gen_int(n_len, 1); |
| |
| ret_val = xmlParserInputRead(in, len); |
| desret_int(ret_val); |
| call_tests++; |
| des_xmlParserInputPtr(n_in, in, 0); |
| des_int(n_len, len, 1); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlParserInputRead", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_in); |
| printf(" %d", n_len); |
| printf("\n"); |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlPedanticParserDefault(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| int ret_val; |
| int val; /* int 0 or 1 */ |
| int n_val; |
| |
| for (n_val = 0;n_val < gen_nb_int;n_val++) { |
| mem_base = xmlMemBlocks(); |
| val = gen_int(n_val, 0); |
| |
| ret_val = xmlPedanticParserDefault(val); |
| desret_int(ret_val); |
| call_tests++; |
| des_int(n_val, val, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlPedanticParserDefault", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_val); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlReadDoc(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| xmlDocPtr ret_val; |
| const xmlChar * cur; /* a pointer to a zero terminated string */ |
| int n_cur; |
| const char * URL; /* base URL (optional) */ |
| int n_URL; |
| const char * encoding; /* the document encoding (optional) */ |
| int n_encoding; |
| int options; /* a combination of xmlParserOption */ |
| int n_options; |
| |
| for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) { |
| for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) { |
| for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { |
| for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) { |
| mem_base = xmlMemBlocks(); |
| cur = gen_const_xmlChar_ptr(n_cur, 0); |
| URL = gen_filepath(n_URL, 1); |
| encoding = gen_const_char_ptr(n_encoding, 2); |
| options = gen_parseroptions(n_options, 3); |
| |
| ret_val = xmlReadDoc(cur, URL, encoding, options); |
| desret_xmlDocPtr(ret_val); |
| call_tests++; |
| des_const_xmlChar_ptr(n_cur, cur, 0); |
| des_filepath(n_URL, URL, 1); |
| des_const_char_ptr(n_encoding, encoding, 2); |
| des_parseroptions(n_options, options, 3); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlReadDoc", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_cur); |
| printf(" %d", n_URL); |
| printf(" %d", n_encoding); |
| printf(" %d", n_options); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlReadFile(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| xmlDocPtr ret_val; |
| const char * filename; /* a file or URL */ |
| int n_filename; |
| const char * encoding; /* the document encoding (optional) */ |
| int n_encoding; |
| int options; /* a combination of xmlParserOption */ |
| int n_options; |
| |
| for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { |
| for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { |
| for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) { |
| mem_base = xmlMemBlocks(); |
| filename = gen_filepath(n_filename, 0); |
| encoding = gen_const_char_ptr(n_encoding, 1); |
| options = gen_parseroptions(n_options, 2); |
| |
| ret_val = xmlReadFile(filename, encoding, options); |
| desret_xmlDocPtr(ret_val); |
| call_tests++; |
| des_filepath(n_filename, filename, 0); |
| des_const_char_ptr(n_encoding, encoding, 1); |
| des_parseroptions(n_options, options, 2); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlReadFile", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_filename); |
| printf(" %d", n_encoding); |
| printf(" %d", n_options); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlReadMemory(void) { |
| int test_ret = 0; |
| |
| int mem_base; |
| xmlDocPtr ret_val; |
| const char * buffer; /* a pointer to a char array */ |
| int n_buffer; |
| int size; /* the size of the array */ |
| int n_size; |
| const char * url; /* base URL (optional) */ |
| int n_url; |
| const char * encoding; /* the document encoding (optional) */ |
| int n_encoding; |
| int options; /* a combination of xmlParserOption */ |
| int n_options; |
| |
| for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) { |
| for (n_size = 0;n_size < gen_nb_int;n_size++) { |
| for (n_url = 0;n_url < gen_nb_filepath;n_url++) { |
| for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { |
| for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) { |
| mem_base = xmlMemBlocks(); |
| buffer = gen_const_char_ptr(n_buffer, 0); |
| size = gen_int(n_size, 1); |
| url = gen_filepath(n_url, 2); |
| encoding = gen_const_char_ptr(n_encoding, 3); |
| options = gen_parseroptions(n_options, 4); |
| if ((buffer != NULL) && |
| (size > xmlStrlen(BAD_CAST buffer))) |
| size = 0; |
| |
| ret_val = xmlReadMemory(buffer, size, url, encoding, options); |
| desret_xmlDocPtr(ret_val); |
| call_tests++; |
| des_const_char_ptr(n_buffer, buffer, 0); |
| des_int(n_size, size, 1); |
| des_filepath(n_url, url, 2); |
| des_const_char_ptr(n_encoding, encoding, 3); |
| des_parseroptions(n_options, options, 4); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlReadMemory", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_buffer); |
| printf(" %d", n_size); |
| printf(" %d", n_url); |
| printf(" %d", n_encoding); |
| printf(" %d", n_options); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| } |
| } |
| function_tests++; |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlRecoverDoc(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_SAX1_ENABLED) |
| #ifdef LIBXML_SAX1_ENABLED |
| int mem_base; |
| xmlDocPtr ret_val; |
| const xmlChar * cur; /* a pointer to an array of xmlChar */ |
| int n_cur; |
| |
| for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) { |
| mem_base = xmlMemBlocks(); |
| cur = gen_const_xmlChar_ptr(n_cur, 0); |
| |
| ret_val = xmlRecoverDoc(cur); |
| desret_xmlDocPtr(ret_val); |
| call_tests++; |
| des_const_xmlChar_ptr(n_cur, cur, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlRecoverDoc", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_cur); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| #endif |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlRecoverFile(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_SAX1_ENABLED) |
| #ifdef LIBXML_SAX1_ENABLED |
| int mem_base; |
| xmlDocPtr ret_val; |
| const char * filename; /* the filename */ |
| int n_filename; |
| |
| for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { |
| mem_base = xmlMemBlocks(); |
| filename = gen_filepath(n_filename, 0); |
| |
| ret_val = xmlRecoverFile(filename); |
| desret_xmlDocPtr(ret_val); |
| call_tests++; |
| des_filepath(n_filename, filename, 0); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlRecoverFile", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_filename); |
| printf("\n"); |
| } |
| } |
| function_tests++; |
| #endif |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlRecoverMemory(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_SAX1_ENABLED) |
| #ifdef LIBXML_SAX1_ENABLED |
| int mem_base; |
| xmlDocPtr ret_val; |
| const char * buffer; /* an pointer to a char array */ |
| int n_buffer; |
| int size; /* the size of the array */ |
| int n_size; |
| |
| for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) { |
| for (n_size = 0;n_size < gen_nb_int;n_size++) { |
| mem_base = xmlMemBlocks(); |
| buffer = gen_const_char_ptr(n_buffer, 0); |
| size = gen_int(n_size, 1); |
| if ((buffer != NULL) && |
| (size > xmlStrlen(BAD_CAST buffer))) |
| size = 0; |
| |
| ret_val = xmlRecoverMemory(buffer, size); |
| desret_xmlDocPtr(ret_val); |
| call_tests++; |
| des_const_char_ptr(n_buffer, buffer, 0); |
| des_int(n_size, size, 1); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlRecoverMemory", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_buffer); |
| printf(" %d", n_size); |
| printf("\n"); |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlSAXParseDTD(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_VALID_ENABLED) |
| #ifdef LIBXML_SAX1_ENABLED |
| int mem_base; |
| xmlDtdPtr ret_val; |
| xmlSAXHandlerPtr sax; /* the SAX handler block */ |
| int n_sax; |
| const xmlChar * ExternalID; /* a NAME* containing the External ID of the DTD */ |
| int n_ExternalID; |
| const xmlChar * SystemID; /* a NAME* containing the URL to the DTD */ |
| int n_SystemID; |
| |
| for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) { |
| for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) { |
| for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) { |
| mem_base = xmlMemBlocks(); |
| sax = gen_xmlSAXHandlerPtr(n_sax, 0); |
| ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 1); |
| SystemID = gen_const_xmlChar_ptr(n_SystemID, 2); |
| |
| ret_val = xmlSAXParseDTD(sax, ExternalID, SystemID); |
| desret_xmlDtdPtr(ret_val); |
| call_tests++; |
| des_xmlSAXHandlerPtr(n_sax, sax, 0); |
| des_const_xmlChar_ptr(n_ExternalID, ExternalID, 1); |
| des_const_xmlChar_ptr(n_SystemID, SystemID, 2); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlSAXParseDTD", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_sax); |
| printf(" %d", n_ExternalID); |
| printf(" %d", n_SystemID); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlSAXParseDoc(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_SAX1_ENABLED) |
| #ifdef LIBXML_SAX1_ENABLED |
| int mem_base; |
| xmlDocPtr ret_val; |
| xmlSAXHandlerPtr sax; /* the SAX handler block */ |
| int n_sax; |
| const xmlChar * cur; /* a pointer to an array of xmlChar */ |
| int n_cur; |
| int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */ |
| int n_recovery; |
| |
| for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) { |
| for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) { |
| for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) { |
| mem_base = xmlMemBlocks(); |
| sax = gen_xmlSAXHandlerPtr(n_sax, 0); |
| cur = gen_const_xmlChar_ptr(n_cur, 1); |
| recovery = gen_int(n_recovery, 2); |
| |
| ret_val = xmlSAXParseDoc(sax, cur, recovery); |
| desret_xmlDocPtr(ret_val); |
| call_tests++; |
| des_xmlSAXHandlerPtr(n_sax, sax, 0); |
| des_const_xmlChar_ptr(n_cur, cur, 1); |
| des_int(n_recovery, recovery, 2); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlSAXParseDoc", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_sax); |
| printf(" %d", n_cur); |
| printf(" %d", n_recovery); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlSAXParseEntity(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_SAX1_ENABLED) |
| #ifdef LIBXML_SAX1_ENABLED |
| int mem_base; |
| xmlDocPtr ret_val; |
| xmlSAXHandlerPtr sax; /* the SAX handler block */ |
| int n_sax; |
| const char * filename; /* the filename */ |
| int n_filename; |
| |
| for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) { |
| for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { |
| mem_base = xmlMemBlocks(); |
| sax = gen_xmlSAXHandlerPtr(n_sax, 0); |
| filename = gen_filepath(n_filename, 1); |
| |
| ret_val = xmlSAXParseEntity(sax, filename); |
| desret_xmlDocPtr(ret_val); |
| call_tests++; |
| des_xmlSAXHandlerPtr(n_sax, sax, 0); |
| des_filepath(n_filename, filename, 1); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlSAXParseEntity", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_sax); |
| printf(" %d", n_filename); |
| printf("\n"); |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlSAXParseFile(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_SAX1_ENABLED) |
| #ifdef LIBXML_SAX1_ENABLED |
| int mem_base; |
| xmlDocPtr ret_val; |
| xmlSAXHandlerPtr sax; /* the SAX handler block */ |
| int n_sax; |
| const char * filename; /* the filename */ |
| int n_filename; |
| int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */ |
| int n_recovery; |
| |
| for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) { |
| for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { |
| for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) { |
| mem_base = xmlMemBlocks(); |
| sax = gen_xmlSAXHandlerPtr(n_sax, 0); |
| filename = gen_filepath(n_filename, 1); |
| recovery = gen_int(n_recovery, 2); |
| |
| ret_val = xmlSAXParseFile(sax, filename, recovery); |
| desret_xmlDocPtr(ret_val); |
| call_tests++; |
| des_xmlSAXHandlerPtr(n_sax, sax, 0); |
| des_filepath(n_filename, filename, 1); |
| des_int(n_recovery, recovery, 2); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlSAXParseFile", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_sax); |
| printf(" %d", n_filename); |
| printf(" %d", n_recovery); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlSAXParseFileWithData(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_SAX1_ENABLED) |
| #ifdef LIBXML_SAX1_ENABLED |
| int mem_base; |
| xmlDocPtr ret_val; |
| xmlSAXHandlerPtr sax; /* the SAX handler block */ |
| int n_sax; |
| const char * filename; /* the filename */ |
| int n_filename; |
| int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */ |
| int n_recovery; |
| void * data; /* the userdata */ |
| int n_data; |
| |
| for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) { |
| for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { |
| for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) { |
| for (n_data = 0;n_data < gen_nb_userdata;n_data++) { |
| mem_base = xmlMemBlocks(); |
| sax = gen_xmlSAXHandlerPtr(n_sax, 0); |
| filename = gen_filepath(n_filename, 1); |
| recovery = gen_int(n_recovery, 2); |
| data = gen_userdata(n_data, 3); |
| |
| ret_val = xmlSAXParseFileWithData(sax, filename, recovery, data); |
| desret_xmlDocPtr(ret_val); |
| call_tests++; |
| des_xmlSAXHandlerPtr(n_sax, sax, 0); |
| des_filepath(n_filename, filename, 1); |
| des_int(n_recovery, recovery, 2); |
| des_userdata(n_data, data, 3); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlSAXParseFileWithData", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_sax); |
| printf(" %d", n_filename); |
| printf(" %d", n_recovery); |
| printf(" %d", n_data); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlSAXParseMemory(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_SAX1_ENABLED) |
| #ifdef LIBXML_SAX1_ENABLED |
| int mem_base; |
| xmlDocPtr ret_val; |
| xmlSAXHandlerPtr sax; /* the SAX handler block */ |
| int n_sax; |
| const char * buffer; /* an pointer to a char array */ |
| int n_buffer; |
| int size; /* the size of the array */ |
| int n_size; |
| int recovery; /* work in recovery mode, i.e. tries to read not Well Formed documents */ |
| int n_recovery; |
| |
| for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) { |
| for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) { |
| for (n_size = 0;n_size < gen_nb_int;n_size++) { |
| for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) { |
| mem_base = xmlMemBlocks(); |
| sax = gen_xmlSAXHandlerPtr(n_sax, 0); |
| buffer = gen_const_char_ptr(n_buffer, 1); |
| size = gen_int(n_size, 2); |
| recovery = gen_int(n_recovery, 3); |
| if ((buffer != NULL) && |
| (size > xmlStrlen(BAD_CAST buffer))) |
| size = 0; |
| |
| ret_val = xmlSAXParseMemory(sax, buffer, size, recovery); |
| desret_xmlDocPtr(ret_val); |
| call_tests++; |
| des_xmlSAXHandlerPtr(n_sax, sax, 0); |
| des_const_char_ptr(n_buffer, buffer, 1); |
| des_int(n_size, size, 2); |
| des_int(n_recovery, recovery, 3); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlSAXParseMemory", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_sax); |
| printf(" %d", n_buffer); |
| printf(" %d", n_size); |
| printf(" %d", n_recovery); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlSAXParseMemoryWithData(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_SAX1_ENABLED) |
| #ifdef LIBXML_SAX1_ENABLED |
| int mem_base; |
| xmlDocPtr ret_val; |
| xmlSAXHandlerPtr sax; /* the SAX handler block */ |
| int n_sax; |
| const char * buffer; /* an pointer to a char array */ |
| int n_buffer; |
| int size; /* the size of the array */ |
| int n_size; |
| int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */ |
| int n_recovery; |
| void * data; /* the userdata */ |
| int n_data; |
| |
| for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) { |
| for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) { |
| for (n_size = 0;n_size < gen_nb_int;n_size++) { |
| for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) { |
| for (n_data = 0;n_data < gen_nb_userdata;n_data++) { |
| mem_base = xmlMemBlocks(); |
| sax = gen_xmlSAXHandlerPtr(n_sax, 0); |
| buffer = gen_const_char_ptr(n_buffer, 1); |
| size = gen_int(n_size, 2); |
| recovery = gen_int(n_recovery, 3); |
| data = gen_userdata(n_data, 4); |
| if ((buffer != NULL) && |
| (size > xmlStrlen(BAD_CAST buffer))) |
| size = 0; |
| |
| ret_val = xmlSAXParseMemoryWithData(sax, buffer, size, recovery, data); |
| desret_xmlDocPtr(ret_val); |
| call_tests++; |
| des_xmlSAXHandlerPtr(n_sax, sax, 0); |
| des_const_char_ptr(n_buffer, buffer, 1); |
| des_int(n_size, size, 2); |
| des_int(n_recovery, recovery, 3); |
| des_userdata(n_data, data, 4); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlSAXParseMemoryWithData", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_sax); |
| printf(" %d", n_buffer); |
| printf(" %d", n_size); |
| printf(" %d", n_recovery); |
| printf(" %d", n_data); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlSAXUserParseFile(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_SAX1_ENABLED) |
| #ifdef LIBXML_SAX1_ENABLED |
| int mem_base; |
| int ret_val; |
| xmlSAXHandlerPtr sax; /* a SAX handler */ |
| int n_sax; |
| void * user_data; /* The user data returned on SAX callbacks */ |
| int n_user_data; |
| const char * filename; /* a file name */ |
| int n_filename; |
| |
| for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) { |
| for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) { |
| for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { |
| mem_base = xmlMemBlocks(); |
| sax = gen_xmlSAXHandlerPtr(n_sax, 0); |
| user_data = gen_userdata(n_user_data, 1); |
| filename = gen_filepath(n_filename, 2); |
| |
| #ifdef LIBXML_SAX1_ENABLED |
| if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL; |
| #endif |
| |
| |
| ret_val = xmlSAXUserParseFile(sax, user_data, filename); |
| desret_int(ret_val); |
| call_tests++; |
| des_xmlSAXHandlerPtr(n_sax, sax, 0); |
| des_userdata(n_user_data, user_data, 1); |
| des_filepath(n_filename, filename, 2); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlSAXUserParseFile", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_sax); |
| printf(" %d", n_user_data); |
| printf(" %d", n_filename); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlSAXUserParseMemory(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_SAX1_ENABLED) |
| #ifdef LIBXML_SAX1_ENABLED |
| int mem_base; |
| int ret_val; |
| xmlSAXHandlerPtr sax; /* a SAX handler */ |
| int n_sax; |
| void * user_data; /* The user data returned on SAX callbacks */ |
| int n_user_data; |
| const char * buffer; /* an in-memory XML document input */ |
| int n_buffer; |
| int size; /* the length of the XML document in bytes */ |
| int n_size; |
| |
| for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) { |
| for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) { |
| for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) { |
| for (n_size = 0;n_size < gen_nb_int;n_size++) { |
| mem_base = xmlMemBlocks(); |
| sax = gen_xmlSAXHandlerPtr(n_sax, 0); |
| user_data = gen_userdata(n_user_data, 1); |
| buffer = gen_const_char_ptr(n_buffer, 2); |
| size = gen_int(n_size, 3); |
| if ((buffer != NULL) && |
| (size > xmlStrlen(BAD_CAST buffer))) |
| size = 0; |
| |
| #ifdef LIBXML_SAX1_ENABLED |
| if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL; |
| #endif |
| |
| |
| ret_val = xmlSAXUserParseMemory(sax, user_data, buffer, size); |
| desret_int(ret_val); |
| call_tests++; |
| des_xmlSAXHandlerPtr(n_sax, sax, 0); |
| des_userdata(n_user_data, user_data, 1); |
| des_const_char_ptr(n_buffer, buffer, 2); |
| des_int(n_size, size, 3); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlSAXUserParseMemory", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_sax); |
| printf(" %d", n_user_data); |
| printf(" %d", n_buffer); |
| printf(" %d", n_size); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlSetExternalEntityLoader(void) { |
| int test_ret = 0; |
| |
| |
| /* missing type support */ |
| return(test_ret); |
| } |
| |
| |
| static int |
| test_xmlSetupParserForBuffer(void) { |
| int test_ret = 0; |
| |
| #if defined(LIBXML_SAX1_ENABLED) |
| #ifdef LIBXML_SAX1_ENABLED |
| int mem_base; |
| xmlParserCtxtPtr ctxt; /* an XML parser context */ |
| int n_ctxt; |
| const xmlChar * buffer; /* a xmlChar * buffer */ |
| int n_buffer; |
| const char * filename; /* a file name */ |
| int n_filename; |
| |
| for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { |
| for (n_buffer = 0;n_buffer < gen_nb_const_xmlChar_ptr;n_buffer++) { |
| for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { |
| mem_base = xmlMemBlocks(); |
| ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); |
| buffer = gen_const_xmlChar_ptr(n_buffer, 1); |
| filename = gen_filepath(n_filename, 2); |
| |
| xmlSetupParserForBuffer(ctxt, buffer, filename); |
| call_tests++; |
| des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); |
| des_const_xmlChar_ptr(n_buffer, buffer, 1); |
| des_filepath(n_filename, filename, 2); |
| xmlResetLastError(); |
| if (mem_base != xmlMemBlocks()) { |
| printf("Leak of %d blocks found in xmlSetupParserForBuffer", |
| xmlMemBlocks() - mem_base); |
| test_ret++; |
| printf(" %d", n_ctxt); |
| printf(" %d", n_buffer); |
| printf(" %d", n_filename); |
| printf("\n"); |
| } |
| } |
| } |
| } |
| function_tests++; |
| #endif |
| #endif |
| |
| return(test_ret); |
| } |
| |
| |
|