blob: 60f4bddb7cae72550bbdde7f7387fd1d7f1e8bab [file] [log] [blame]
/*
* 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
*/
#include "libxml.h"
#include <stdio.h>
#include <stdlib.h> /* for putenv() */
#include <string.h>
#include <libxml/xmlerror.h>
#include <libxml/relaxng.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,
xmlErrorPtr 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;
#ifdef HAVE_PUTENV
/* access to the proxy can slow up regression tests a lot */
putenv((char *) "http_proxy=");
#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_SCHEMAS_ENABLED
xmlRelaxNGInitTypes();
#endif
LIBXML_TEST_VERSION
xmlSetStructuredErrorFunc(NULL, structured_errors);
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);
}
xmlMemoryDump();
return (ret != 0);
}
#include <libxml/HTMLparser.h>
#include <libxml/HTMLtree.h>
#include <libxml/catalog.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/nanoftp.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 manually define xmlErrMemory because it's normal declaration
is "hidden" by #ifdef IN_LIBXML
*/
void xmlErrMemory(xmlParserCtxtPtr ctxt, const char *extra);
/*
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) {
}
#if 0
#define gen_nb_const_void_ptr 2
static const void *gen_const_void_ptr(int no, int nr ATTRIBUTE_UNUSED) {
if (no == 0) return((const void *) "immutable string");
return(NULL);
}
static void des_const_void_ptr(int no ATTRIBUTE_UNUSED, const void *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
}
#endif
#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) {
}
#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_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) {
}
#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) {
}
#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 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);
}
#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);
}
#define gen_nb_const_xmlChar_ptr 5
static 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.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);
}
#define gen_nb_xmlSAXHandlerPtr 2
static xmlSAXHandlerPtr gen_xmlSAXHandlerPtr(int no, int nr ATTRIBUTE_UNUSED) {
#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) {
}
#define gen_nb_xmlValidCtxtPtr 2
static xmlValidCtxtPtr gen_xmlValidCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) {
#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) {
#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_FTP_ENABLED
#define gen_nb_xmlNanoFTPCtxtPtr 4
static void *gen_xmlNanoFTPCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) {
if (no == 0) return(xmlNanoFTPNewCtxt(REMOTE2GOOD));
if (no == 1) return(xmlNanoFTPNewCtxt(REMOTE1GOOD));
if (no == 2) return(xmlNanoFTPNewCtxt("foo"));
return(NULL);
}
static void des_xmlNanoFTPCtxtPtr(int no ATTRIBUTE_UNUSED, void *val, int nr ATTRIBUTE_UNUSED) {
if (val != NULL) {
xmlNanoFTPFreeCtxt(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, 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) {
}
static void desret_double(double val ATTRIBUTE_UNUSED) {
}
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) {
}
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
#ifdef LIBXML_FTP_ENABLED
static void desret_xmlNanoFTPCtxtPtr(void *val) {
xmlNanoFTPClose(val);
}
#endif
/* cut and pasted from autogenerated to avoid troubles */
#define gen_nb_const_xmlChar_ptr_ptr 1
static 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 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_const_htmlNodePtr 1
static htmlNodePtr gen_const_htmlNodePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
return(NULL);
}
static void des_const_htmlNodePtr(int no ATTRIBUTE_UNUSED, const htmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
}
#endif
#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_DEBUG_ENABLED
#ifdef LIBXML_XPATH_ENABLED
#define gen_nb_xmlShellCtxtPtr 1
static xmlShellCtxtPtr gen_xmlShellCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
return(NULL);
}
static void des_xmlShellCtxtPtr(int no ATTRIBUTE_UNUSED, xmlShellCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
}
#endif
#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) {
}
#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) {
}
/************************************************************************
* *
* 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) {
}
#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/nanoftp.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/xmlunicode.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_nanoftp(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_xmlunicode(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_nanoftp();
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_xmlunicode();
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);
}
static int
test_UTF8ToHtml(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;
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 = UTF8ToHtml(out, outlen, (const unsigned char *)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, (const unsigned char *)in, 2);
des_int_ptr(n_inlen, inlen, 3);
xmlResetLastError();
if (mem_base != xmlMemBlocks()) {
printf("Leak of %d blocks found in UTF8ToHtml",
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);
}
#ifdef LIBXML_HTML_ENABLED
#define gen_nb_const_htmlElemDesc_ptr 1
static htmlElemDesc * gen_const_htmlElemDesc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
return(NULL);
}
static void des_const_htmlElemDesc_ptr(int no ATTRIBUTE_UNUSED, const htmlElemDesc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
}
#endif
static int
test_htmlAttrAllowed(void) {
int test_ret = 0;
#if defined(LIBXML_HTML_ENABLED)
int mem_base;
htmlStatus ret_val;
htmlElemDesc * elt; /* HTML element */
int n_elt;
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((const htmlElemDesc *)elt, (const xmlChar *)attr, legacy);
desret_htmlStatus(ret_val);
call_tests++;
des_const_htmlElemDesc_ptr(n_elt, (const htmlElemDesc *)elt, 0);
des_const_xmlChar_ptr(n_attr, (const xmlChar *)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
static htmlNodePtr gen_htmlNodePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
return(NULL);
}
static void des_htmlNodePtr(int no ATTRIBUTE_UNUSED, htmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
}
#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;
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, (const xmlChar *)name, elem);
desret_int(ret_val);
call_tests++;
des_htmlDocPtr(n_doc, doc, 0);
des_const_xmlChar_ptr(n_name, (const xmlChar *)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_htmlCreateMemoryParserCtxt(void) {
int test_ret = 0;
#if defined(LIBXML_HTML_ENABLED)
int mem_base;
htmlParserCtxtPtr ret_val;
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);
ret_val = htmlCreateMemoryParserCtxt((const char *)buffer, size);
desret_htmlParserCtxtPtr(ret_val);
call_tests++;
des_const_char_ptr(n_buffer, (const char *)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
static htmlSAXHandlerPtr gen_htmlSAXHandlerPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
return(NULL);
}
static void des_htmlSAXHandlerPtr(int no ATTRIBUTE_UNUSED, htmlSAXHandlerPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
}
#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 */
int n_sax;
void * user_data; /* The user data returned on SAX callbacks */
int n_user_data;
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;
xmlCharEncoding enc; /* an optional encoding */
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);
ret_val = htmlCreatePushParserCtxt(sax, user_data, (const char *)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, (const char *)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_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;
xmlChar * cur; /* a pointer to a zero terminated string */
int n_cur;
const char * URL; /* the base URL to use for the document */
int n_URL;
char * encoding; /* the document encoding, or NULL */
int n_encoding;
int options; /* a combination of htmlParserOption(s) */
int n_options;
for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
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_int;n_options++) {
mem_base = xmlMemBlocks();
ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
cur = gen_const_xmlChar_ptr(n_cur, 1);
URL = gen_filepath(n_URL, 2);
encoding = gen_const_char_ptr(n_encoding, 3);
options = gen_int(n_options, 4);
ret_val = htmlCtxtReadDoc(ctxt, (const xmlChar *)cur, URL, (const char *)encoding, options);
desret_htmlDocPtr(ret_val);
call_tests++;
des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 1);
des_filepath(n_URL, URL, 2);
des_const_char_ptr(n_encoding, (const char *)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_cur);
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;
char * encoding; /* the document encoding, or NULL */
int n_encoding;
int options; /* a combination of htmlParserOption(s) */
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, (const char *)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, (const char *)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;
char * buffer; /* a pointer to a char array */
int n_buffer;
int size; /* the size of the array */
int n_size;
const char * URL; /* the base URL to use for the document */
int n_URL;
char * encoding; /* the document encoding, or NULL */
int n_encoding;
int options; /* a combination of htmlParserOption(s) */
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_filepath;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_filepath(n_URL, 3);
encoding = gen_const_char_ptr(n_encoding, 4);
options = gen_int(n_options, 5);
ret_val = htmlCtxtReadMemory(ctxt, (const char *)buffer, size, URL, (const char *)encoding, options);
desret_htmlDocPtr(ret_val);
call_tests++;
des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
des_const_char_ptr(n_buffer, (const char *)buffer, 1);
des_int(n_size, size, 2);
des_filepath(n_URL, URL, 3);
des_const_char_ptr(n_encoding, (const char *)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_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;
htmlElemDesc * parent; /* HTML parent element */
int n_parent;
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((const htmlElemDesc *)parent, (const xmlChar *)elt);
desret_int(ret_val);
call_tests++;
des_const_htmlElemDesc_ptr(n_parent, (const htmlElemDesc *)parent, 0);
des_const_xmlChar_ptr(n_elt, (const xmlChar *)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;
htmlElemDesc * parent; /* HTML parent element */
int n_parent;
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((const htmlElemDesc *)parent, (const htmlElemDesc *)elt);
desret_htmlStatus(ret_val);
call_tests++;
des_const_htmlElemDesc_ptr(n_parent, (const htmlElemDesc *)parent, 0);
des_const_htmlElemDesc_ptr(n_elt, (const htmlElemDesc *)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;
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, (const unsigned char *)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, (const unsigned char *)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;
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((const xmlChar *)name);
desret_const_htmlEntityDesc_ptr(ret_val);
call_tests++;
des_const_xmlChar_ptr(n_name, (const xmlChar *)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_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;
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((const xmlChar *)name);
desret_int(ret_val);
call_tests++;
des_const_xmlChar_ptr(n_name, (const xmlChar *)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);
}
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_const_htmlNodePtr;n_node++) {
for (n_legacy = 0;n_legacy < gen_nb_int;n_legacy++) {
mem_base = xmlMemBlocks();
node = gen_const_htmlNodePtr(n_node, 0);
legacy = gen_int(n_legacy, 1);
ret_val = htmlNodeStatus((const htmlNodePtr)node, legacy);
desret_htmlStatus(ret_val);
call_tests++;
des_const_htmlNodePtr(n_node, (const htmlNodePtr)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;
char * chunk; /* an char array */
int n_chunk;
int size; /* the size in byte of the chunk */
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);
ret_val = htmlParseChunk(ctxt, (const char *)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, (const char *)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;
xmlChar * cur; /* a pointer to an array of xmlChar */
int n_cur;
char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
int n_encoding;
for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
mem_base = xmlMemBlocks();
cur = gen_xmlChar_ptr(n_cur, 0);
encoding = gen_const_char_ptr(n_encoding, 1);
ret_val = htmlParseDoc(cur, (const char *)encoding);
desret_htmlDocPtr(ret_val);
call_tests++;
des_xmlChar_ptr(n_cur, cur, 0);
des_const_char_ptr(n_encoding, (const char *)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;
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, (const xmlChar **)str);
desret_const_htmlEntityDesc_ptr(ret_val);
call_tests++;
des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
des_const_xmlChar_ptr_ptr(n_str, (const xmlChar **)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;
char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
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, (const char *)encoding);
desret_htmlDocPtr(ret_val);
call_tests++;
des_filepath(n_filename, filename, 0);
des_const_char_ptr(n_encoding, (const char *)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;
xmlChar * cur; /* a pointer to a zero terminated string */
int n_cur;
const char * URL; /* the base URL to use for the document */
int n_URL;
char * encoding; /* the document encoding, or NULL */
int n_encoding;
int options; /* a combination of htmlParserOption(s) */
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_int;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_int(n_options, 3);
ret_val = htmlReadDoc((const xmlChar *)cur, URL, (const char *)encoding, options);
desret_htmlDocPtr(ret_val);
call_tests++;
des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
des_filepath(n_URL, URL, 1);
des_const_char_ptr(n_encoding, (const char *)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_cur);
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;
char * encoding; /* the document encoding, or NULL */
int n_encoding;
int options; /* a combination of htmlParserOption(s) */
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, (const char *)encoding, options);
desret_htmlDocPtr(ret_val);
call_tests++;
des_filepath(n_filename, filename, 0);
des_const_char_ptr(n_encoding, (const char *)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;
char * buffer; /* a pointer to a char array */
int n_buffer;
int size; /* the size of the array */
int n_size;
const char * URL; /* the base URL to use for the document */
int n_URL;
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_filepath;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_filepath(n_URL, 2);
encoding = gen_const_char_ptr(n_encoding, 3);
options = gen_int(n_options, 4);
ret_val = htmlReadMemory((const char *)buffer, size, URL, (const char *)encoding, options);
desret_htmlDocPtr(ret_val);
call_tests++;
des_const_char_ptr(n_buffer, (const char *)buffer, 0);
des_int(n_size, size, 1);
des_filepath(n_URL, URL, 2);
des_const_char_ptr(n_encoding, (const char *)encoding, 3);
des_int(n_options, options, 4);
xmlResetLastError();
if (mem_base != xmlMemBlocks()) {
printf("Leak of %d blocks found in htmlReadMemory"