testapi.c   [plain text]


/*
 * 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
 */

#ifdef HAVE_CONFIG_H
#include "libxml.h"
#else
#include <stdio.h>
#endif

#include <stdlib.h> /* for putenv() */
#include <string.h>
#include <libxml/xmlerror.h>
#include <libxml/relaxng.h>

#if defined(_WIN32) && !defined(__CYGWIN__)
#define snprintf _snprintf
#endif

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;

    /* access to the proxy can slow up regression tests a lot */
    putenv((char *) "http_proxy=");

    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) 'ø');
    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ø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 char *static_buf_content = "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) {
}

/************************************************************************
 *									*
 *   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_DOUBLEIT);
    if (no == 2) return(XML_BUFFER_ALLOC_EXACT);
    if (no == 3) return(XML_BUFFER_ALLOC_IMMUTABLE);
    if (no == 4) return(XML_BUFFER_ALLOC_IO);
    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",
	           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;
    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;
    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_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_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, (const char *)encoding, sax, userData);
        desret_htmlDocPtr(ret_val);
        call_tests++;
        des_xmlChar_ptr(n_cur, cur, 0);
        des_const_char_ptr(n_encoding, (const char *)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;
    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_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, (const char *)encoding, sax, userData);
        desret_htmlDocPtr(ret_val);
        call_tests++;
        des_filepath(n_filename, filename, 0);
        des_const_char_ptr(n_encoding, (const char *)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_HTMLparser(void) {
    int test_ret = 0;

    if (quiet == 0) printf("Testing HTMLparser : 32 of 38 functions ...\n");
    test_ret += test_UTF8ToHtml();
    test_ret += test_htmlAttrAllowed();
    test_ret += test_htmlAutoCloseTag();
    test_ret += test_htmlCreateMemoryParserCtxt();
    test_ret += test_htmlCreatePushParserCtxt();
    test_ret += test_htmlCtxtReadDoc();
    test_ret += test_htmlCtxtReadFile();
    test_ret += test_htmlCtxtReadMemory();
    test_ret += test_htmlCtxtReset();
    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_htmlIsAutoClosed();
    test_ret += test_htmlIsScriptAttribute();
    test_ret += test_htmlNewParserCtxt();
    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();

    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;
    char * encoding; /* the encoding string */
    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, (const char *)encoding, format);
        call_tests++;
        des_xmlOutputBufferPtr(n_buf, buf, 0);
        des_xmlDocPtr(n_cur, cur, 1);
        des_const_char_ptr(n_encoding, (const char *)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;
    char * encoding; /* the encoding string */
    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, (const char *)encoding);
        call_tests++;
        des_xmlOutputBufferPtr(n_buf, buf, 0);
        des_xmlDocPtr(n_cur, cur, 1);
        des_const_char_ptr(n_encoding, (const char *)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
static xmlChar ** gen_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    return(NULL);
}
static void des_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, xmlChar ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
}

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;
    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((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 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;
    xmlChar * URI; /* URI for the dtd, or NULL */
    int n_URI;
    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((const xmlChar *)URI, (const xmlChar *)ExternalID);
        desret_htmlDocPtr(ret_val);
        call_tests++;
        des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0);
        des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)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;
    xmlChar * URI; /* URI for the dtd, or NULL */
    int n_URI;
    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((const xmlChar *)URI, (const xmlChar *)ExternalID);
        desret_htmlDocPtr(ret_val);
        call_tests++;
        des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0);
        des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)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;
    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, (const char *)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, (const char *)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;
    char * encoding; /* the encoding string */
    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, (const char *)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, (const char *)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;
    char * encoding; /* the encoding string */
    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, (const char *)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, (const char *)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;
    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, (const char *)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, (const char *)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;
    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, (const char *)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, (const char *)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;
    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, (const xmlChar *)encoding);
        desret_int(ret_val);
        call_tests++;
        des_htmlDocPtr(n_doc, doc, 0);
        des_const_xmlChar_ptr(n_encoding, (const xmlChar *)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_docbDefaultSAXHandlerInit(void) {
    int test_ret = 0;

#if defined(LIBXML_DOCB_ENABLED)
#ifdef LIBXML_DOCB_ENABLED
    int mem_base;

        mem_base = xmlMemBlocks();

        docbDefaultSAXHandlerInit();
        call_tests++;
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in docbDefaultSAXHandlerInit",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf("\n");
        }
    function_tests++;
#endif
#endif

    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
static xmlEnumerationPtr gen_xmlEnumerationPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    return(NULL);
}
static void des_xmlEnumerationPtr(int no ATTRIBUTE_UNUSED, xmlEnumerationPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
}

static int
test_xmlSAX2AttributeDecl(void) {
    int test_ret = 0;

    int mem_base;
    void * ctx; /* the user data (XML parser context) */
    int n_ctx;
    xmlChar * elem; /* the name of the element */
    int n_elem;
    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;
    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, (const xmlChar *)elem, (const xmlChar *)fullname, type, def, (const xmlChar *)defaultValue, tree);
        call_tests++;
        des_void_ptr(n_ctx, ctx, 0);
        des_const_xmlChar_ptr(n_elem, (const xmlChar *)elem, 1);
        des_const_xmlChar_ptr(n_fullname, (const xmlChar *)fullname, 2);
        des_int(n_type, type, 3);
        des_int(n_def, def, 4);
        des_const_xmlChar_ptr(n_defaultValue, (const xmlChar *)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;
    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);

        xmlSAX2CDataBlock(ctx, (const xmlChar *)value, len);
        call_tests++;
        des_void_ptr(n_ctx, ctx, 0);
        des_const_xmlChar_ptr(n_value, (const xmlChar *)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;
    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);

        xmlSAX2Characters(ctx, (const xmlChar *)ch, len);
        call_tests++;
        des_void_ptr(n_ctx, ctx, 0);
        des_const_xmlChar_ptr(n_ch, (const xmlChar *)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;
    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, (const xmlChar *)value);
        call_tests++;
        des_void_ptr(n_ctx, ctx, 0);
        des_const_xmlChar_ptr(n_value, (const xmlChar *)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;
    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, (const xmlChar *)name, type, content);
        call_tests++;
        des_void_ptr(n_ctx, ctx, 0);
        des_const_xmlChar_ptr(n_name, (const xmlChar *)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;

#if defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_DOCB_ENABLED)
#ifdef LIBXML_SAX1_ENABLED
    int mem_base;
    void * ctx; /* the user data (XML parser context) */
    int n_ctx;
    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, (const xmlChar *)name);
        call_tests++;
        des_void_ptr(n_ctx, ctx, 0);
        des_const_xmlChar_ptr(n_name, (const xmlChar *)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
#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;
    xmlChar * localname; /* the local name of the element */
    int n_localname;
    xmlChar * prefix; /* the element namespace prefix if available */
    int n_prefix;
    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, (const xmlChar *)localname, (const xmlChar *)prefix, (const xmlChar *)URI);
        call_tests++;
        des_void_ptr(n_ctx, ctx, 0);
        des_const_xmlChar_ptr(n_localname, (const xmlChar *)localname, 1);
        des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 2);
        des_const_xmlChar_ptr(n_URI, (const xmlChar *)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;
    xmlChar * name; /* the entity name */
    int n_name;
    int type; /* the entity type */
    int n_type;
    xmlChar * publicId; /* The public ID of the entity */
    int n_publicId;
    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, (const xmlChar *)name, type, (const xmlChar *)publicId, (const xmlChar *)systemId, content);
        call_tests++;
        des_void_ptr(n_ctx, ctx, 0);
        des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
        des_int(n_type, type, 2);
        des_const_xmlChar_ptr(n_publicId, (const xmlChar *)publicId, 3);
        des_const_xmlChar_ptr(n_systemId, (const xmlChar *)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;
    xmlChar * name; /* the root element name */
    int n_name;
    xmlChar * ExternalID; /* the external ID */
    int n_ExternalID;
    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, (const xmlChar *)name, (const xmlChar *)ExternalID, (const xmlChar *)SystemID);
        call_tests++;
        des_void_ptr(n_ctx, ctx, 0);
        des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
        des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 2);
        des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)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;
    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, (const xmlChar *)name);
        desret_xmlEntityPtr(ret_val);
        call_tests++;
        des_void_ptr(n_ctx, ctx, 0);
        des_const_xmlChar_ptr(n_name, (const xmlChar *)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;
    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, (const xmlChar *)name);
        desret_xmlEntityPtr(ret_val);
        call_tests++;
        des_void_ptr(n_ctx, ctx, 0);
        des_const_xmlChar_ptr(n_name, (const xmlChar *)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;
    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);

        xmlSAX2IgnorableWhitespace(ctx, (const xmlChar *)ch, len);
        call_tests++;
        des_void_ptr(n_ctx, ctx, 0);
        des_const_xmlChar_ptr(n_ch, (const xmlChar *)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
static xmlSAXHandler * gen_xmlSAXHandler_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    return(NULL);
}
static void des_xmlSAXHandler_ptr(int no ATTRIBUTE_UNUSED, xmlSAXHandler * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
}

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_xmlSAX2InitDocbDefaultSAXHandler(void) {
    int test_ret = 0;

#if defined(LIBXML_DOCB_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);

        xmlSAX2InitDocbDefaultSAXHandler(hdlr);
        call_tests++;
        des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlSAX2InitDocbDefaultSAXHandler",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_hdlr);
            printf("\n");
        }
    }
    function_tests++;
#endif

    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;
    xmlChar * name; /* the root element name */
    int n_name;
    xmlChar * ExternalID; /* the external ID */
    int n_ExternalID;
    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, (const xmlChar *)name, (const xmlChar *)ExternalID, (const xmlChar *)SystemID);
        call_tests++;
        des_void_ptr(n_ctx, ctx, 0);
        des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
        des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 2);
        des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)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;
    xmlChar * name; /* The name of the notation */
    int n_name;
    xmlChar * publicId; /* The public ID of the entity */
    int n_publicId;
    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, (const xmlChar *)name, (const xmlChar *)publicId, (const xmlChar *)systemId);
        call_tests++;
        des_void_ptr(n_ctx, ctx, 0);
        des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
        des_const_xmlChar_ptr(n_publicId, (const xmlChar *)publicId, 2);
        des_const_xmlChar_ptr(n_systemId, (const xmlChar *)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;
    xmlChar * target; /* the target name */
    int n_target;
    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, (const xmlChar *)target, (const xmlChar *)data);
        call_tests++;
        des_void_ptr(n_ctx, ctx, 0);
        des_const_xmlChar_ptr(n_target, (const xmlChar *)target, 1);
        des_const_xmlChar_ptr(n_data, (const xmlChar *)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;
    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, (const xmlChar *)name);
        call_tests++;
        des_void_ptr(n_ctx, ctx, 0);
        des_const_xmlChar_ptr(n_name, (const xmlChar *)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;
    xmlChar * publicId; /* The public ID of the entity */
    int n_publicId;
    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, (const xmlChar *)publicId, (const xmlChar *)systemId);
        desret_xmlParserInputPtr(ret_val);
        call_tests++;
        des_void_ptr(n_ctx, ctx, 0);
        des_const_xmlChar_ptr(n_publicId, (const xmlChar *)publicId, 1);
        des_const_xmlChar_ptr(n_systemId, (const xmlChar *)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
static xmlSAXLocatorPtr gen_xmlSAXLocatorPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    return(NULL);
}
static void des_xmlSAXLocatorPtr(int no ATTRIBUTE_UNUSED, xmlSAXLocatorPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
}

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;

#if defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_DOCB_ENABLED)
#ifdef LIBXML_SAX1_ENABLED
    int mem_base;
    void * ctx; /* the user data (XML parser context) */
    int n_ctx;
    xmlChar * fullname; /* The element name, including namespace prefix */
    int n_fullname;
    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, (const xmlChar *)fullname, (const xmlChar **)atts);
        call_tests++;
        des_void_ptr(n_ctx, ctx, 0);
        des_const_xmlChar_ptr(n_fullname, (const xmlChar *)fullname, 1);
        des_const_xmlChar_ptr_ptr(n_atts, (const xmlChar **)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
#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;
    xmlChar * localname; /* the local name of the element */
    int n_localname;
    xmlChar * prefix; /* the element namespace prefix if available */
    int n_prefix;
    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;
    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;
    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, (const xmlChar *)localname, (const xmlChar *)prefix, (const xmlChar *)URI, nb_namespaces, (const xmlChar **)namespaces, nb_attributes, nb_defaulted, (const xmlChar **)attributes);
        call_tests++;
        des_void_ptr(n_ctx, ctx, 0);
        des_const_xmlChar_ptr(n_localname, (const xmlChar *)localname, 1);
        des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 2);
        des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 3);
        des_int(n_nb_namespaces, nb_namespaces, 4);
        des_const_xmlChar_ptr_ptr(n_namespaces, (const xmlChar **)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, (const xmlChar **)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;
    xmlChar * name; /* The name of the entity */
    int n_name;
    xmlChar * publicId; /* The public ID of the entity */
    int n_publicId;
    xmlChar * systemId; /* The system ID of the entity */
    int n_systemId;
    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, (const xmlChar *)name, (const xmlChar *)publicId, (const xmlChar *)systemId, (const xmlChar *)notationName);
        call_tests++;
        des_void_ptr(n_ctx, ctx, 0);
        des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
        des_const_xmlChar_ptr(n_publicId, (const xmlChar *)publicId, 2);
        des_const_xmlChar_ptr(n_systemId, (const xmlChar *)systemId, 3);
        des_const_xmlChar_ptr(n_notationName, (const xmlChar *)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, 1 or 2 */
    int n_version;

    for (n_version = 0;n_version < gen_nb_int;n_version++) {
        mem_base = xmlMemBlocks();
        version = gen_int(n_version, 0);

        ret_val = xmlSAXDefaultVersion(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 : 38 of 38 functions ...\n");
    test_ret += test_docbDefaultSAXHandlerInit();
    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_xmlSAX2InitDocbDefaultSAXHandler();
    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) && defined(LIBXML_OUTPUT_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 exclusive; /* the exclusive flag (0 - non-exclusive canonicalization; otherwise - exclusive canonicalization) */
    int n_exclusive;
    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_exclusive = 0;n_exclusive < gen_nb_int;n_exclusive++) {
    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);
        exclusive = gen_int(n_exclusive, 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, exclusive, 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_exclusive, exclusive, 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_exclusive);
            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) && defined(LIBXML_OUTPUT_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 exclusive; /* the exclusive flag (0 - non-exclusive canonicalization; otherwise - exclusive canonicalization) */
    int n_exclusive;
    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 requred): -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_exclusive = 0;n_exclusive < gen_nb_int;n_exclusive++) {
    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);
        exclusive = gen_int(n_exclusive, 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, exclusive, 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_exclusive, exclusive, 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_exclusive);
            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) && defined(LIBXML_OUTPUT_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 exclusive; /* the exclusive flag (0 - non-exclusive canonicalization; otherwise - exclusive canonicalization) */
    int n_exclusive;
    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_exclusive = 0;n_exclusive < gen_nb_int;n_exclusive++) {
    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);
        exclusive = gen_int(n_exclusive, 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, exclusive, 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_exclusive, exclusive, 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_exclusive);
            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
static xmlCatalogPtr gen_xmlCatalogPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    return(NULL);
}
static void des_xmlCatalogPtr(int no ATTRIBUTE_UNUSED, xmlCatalogPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
}
#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;
    xmlChar * type; /* the type of record to add to the catalog */
    int n_type;
    xmlChar * orig; /* the system, public or prefix to match */
    int n_orig;
    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, (const xmlChar *)type, (const xmlChar *)orig, (const xmlChar *)replace);
        desret_int(ret_val);
        call_tests++;
        des_xmlCatalogPtr(n_catal, catal, 0);
        des_const_xmlChar_ptr(n_type, (const xmlChar *)type, 1);
        des_const_xmlChar_ptr(n_orig, (const xmlChar *)orig, 2);
        des_const_xmlChar_ptr(n_replace, (const xmlChar *)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;
    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, (const xmlChar *)value);
        desret_int(ret_val);
        call_tests++;
        des_xmlCatalogPtr(n_catal, catal, 0);
        des_const_xmlChar_ptr(n_value, (const xmlChar *)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;
    xmlChar * pubID; /* the public ID string */
    int n_pubID;
    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, (const xmlChar *)pubID, (const xmlChar *)sysID);
        desret_xmlChar_ptr(ret_val);
        call_tests++;
        des_xmlCatalogPtr(n_catal, catal, 0);
        des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 1);
        des_const_xmlChar_ptr(n_sysID, (const xmlChar *)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;
    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, (const xmlChar *)pubID);
        desret_xmlChar_ptr(ret_val);
        call_tests++;
        des_xmlCatalogPtr(n_catal, catal, 0);
        des_const_xmlChar_ptr(n_pubID, (const xmlChar *)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;
    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, (const xmlChar *)sysID);
        desret_xmlChar_ptr(ret_val);
        call_tests++;
        des_xmlCatalogPtr(n_catal, catal, 0);
        des_const_xmlChar_ptr(n_sysID, (const xmlChar *)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;
    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, (const xmlChar *)URI);
        desret_xmlChar_ptr(ret_val);
        call_tests++;
        des_xmlCatalogPtr(n_catal, catal, 0);
        des_const_xmlChar_ptr(n_URI, (const xmlChar *)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;
    xmlChar * type; /* the type of record to add to the catalog */
    int n_type;
    xmlChar * orig; /* the system, public or prefix to match */
    int n_orig;
    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((const xmlChar *)type, (const xmlChar *)orig, (const xmlChar *)replace);
        desret_int(ret_val);
        call_tests++;
        des_const_xmlChar_ptr(n_type, (const xmlChar *)type, 0);
        des_const_xmlChar_ptr(n_orig, (const xmlChar *)orig, 1);
        des_const_xmlChar_ptr(n_replace, (const xmlChar *)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;
    xmlChar * pubID; /* the public ID string */
    int n_pubID;
    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, (const xmlChar *)pubID, (const xmlChar *)sysID);
        desret_xmlChar_ptr(ret_val);
        call_tests++;
        des_void_ptr(n_catalogs, catalogs, 0);
        des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 1);
        des_const_xmlChar_ptr(n_sysID, (const xmlChar *)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;
    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, (const xmlChar *)URI);
        desret_xmlChar_ptr(ret_val);
        call_tests++;
        des_void_ptr(n_catalogs, catalogs, 0);
        des_const_xmlChar_ptr(n_URI, (const xmlChar *)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;
    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((const xmlChar *)value);
        desret_int(ret_val);
        call_tests++;
        des_const_xmlChar_ptr(n_value, (const xmlChar *)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;
    xmlChar * pubID; /* the public ID string */
    int n_pubID;
    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((const xmlChar *)pubID, (const xmlChar *)sysID);
        desret_xmlChar_ptr(ret_val);
        call_tests++;
        des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 0);
        des_const_xmlChar_ptr(n_sysID, (const xmlChar *)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;
    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((const xmlChar *)pubID);
        desret_xmlChar_ptr(ret_val);
        call_tests++;
        des_const_xmlChar_ptr(n_pubID, (const xmlChar *)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;
    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((const xmlChar *)sysID);
        desret_xmlChar_ptr(ret_val);
        call_tests++;
        des_const_xmlChar_ptr(n_sysID, (const xmlChar *)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;
    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((const xmlChar *)URI);
        desret_xmlChar_ptr(ret_val);
        call_tests++;
        des_const_xmlChar_ptr(n_URI, (const xmlChar *)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)
    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((const char *)pathss);
        call_tests++;
        des_const_char_ptr(n_pathss, (const char *)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
static xmlChRangeGroup * gen_const_xmlChRangeGroup_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    return(NULL);
}
static void des_const_xmlChRangeGroup_ptr(int no ATTRIBUTE_UNUSED, const xmlChRangeGroup * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
}

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;
    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, (const xmlChRangeGroup *)rptr);
        desret_int(ret_val);
        call_tests++;
        des_unsigned_int(n_val, val, 0);
        des_const_xmlChRangeGroup_ptr(n_rptr, (const xmlChRangeGroup *)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_xmlBoolToText(void) {
    int test_ret = 0;

#if defined(LIBXML_DEBUG_ENABLED)
    int mem_base;
    const char * ret_val;
    int boolval; /* a bool to turn into text */
    int n_boolval;

    for (n_boolval = 0;n_boolval < gen_nb_int;n_boolval++) {
        mem_base = xmlMemBlocks();
        boolval = gen_int(n_boolval, 0);

        ret_val = xmlBoolToText(boolval);
        desret_const_char_ptr(ret_val);
        call_tests++;
        des_int(n_boolval, boolval, 0);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlBoolToText",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_boolval);
            printf("\n");
        }
    }
    function_tests++;
#endif

    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;
    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, (const xmlChar *)str);
        call_tests++;
        des_debug_FILE_ptr(n_output, output, 0);
        des_const_xmlChar_ptr(n_str, (const xmlChar *)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_xmlLsCountNode(void) {
    int test_ret = 0;

#if defined(LIBXML_DEBUG_ENABLED)
    int mem_base;
    int ret_val;
    xmlNodePtr node; /* the node to count */
    int n_node;

    for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
        mem_base = xmlMemBlocks();
        node = gen_xmlNodePtr(n_node, 0);

        ret_val = xmlLsCountNode(node);
        desret_int(ret_val);
        call_tests++;
        des_xmlNodePtr(n_node, node, 0);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlLsCountNode",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_node);
            printf("\n");
        }
    }
    function_tests++;
#endif

    return(test_ret);
}


static int
test_xmlLsOneNode(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 to dump */
    int n_node;

    for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
    for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
        mem_base = xmlMemBlocks();
        output = gen_debug_FILE_ptr(n_output, 0);
        node = gen_xmlNodePtr(n_node, 1);

        xmlLsOneNode(output, node);
        call_tests++;
        des_debug_FILE_ptr(n_output, output, 0);
        des_xmlNodePtr(n_node, node, 1);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlLsOneNode",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_output);
            printf(" %d", n_node);
            printf("\n");
        }
    }
    }
    function_tests++;
#endif

    return(test_ret);
}


#define gen_nb_char_ptr 1
static char * gen_char_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    return(NULL);
}
static void des_char_ptr(int no ATTRIBUTE_UNUSED, char * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
}

static int
test_xmlShell(void) {
    int test_ret = 0;


    /* missing type support */
    return(test_ret);
}


static int
test_xmlShellBase(void) {
    int test_ret = 0;

#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED)
    int mem_base;
    int ret_val;
    xmlShellCtxtPtr ctxt; /* the shell context */
    int n_ctxt;
    char * arg; /* unused */
    int n_arg;
    xmlNodePtr node; /* a node */
    int n_node;
    xmlNodePtr node2; /* unused */
    int n_node2;

    for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
    for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
    for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
    for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
        mem_base = xmlMemBlocks();
        ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
        arg = gen_char_ptr(n_arg, 1);
        node = gen_xmlNodePtr(n_node, 2);
        node2 = gen_xmlNodePtr(n_node2, 3);

        ret_val = xmlShellBase(ctxt, arg, node, node2);
        desret_int(ret_val);
        call_tests++;
        des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
        des_char_ptr(n_arg, arg, 1);
        des_xmlNodePtr(n_node, node, 2);
        des_xmlNodePtr(n_node2, node2, 3);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlShellBase",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_ctxt);
            printf(" %d", n_arg);
            printf(" %d", n_node);
            printf(" %d", n_node2);
            printf("\n");
        }
    }
    }
    }
    }
    function_tests++;
#endif

    return(test_ret);
}


static int
test_xmlShellCat(void) {
    int test_ret = 0;

#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
    int mem_base;
    int ret_val;
    xmlShellCtxtPtr ctxt; /* the shell context */
    int n_ctxt;
    char * arg; /* unused */
    int n_arg;
    xmlNodePtr node; /* a node */
    int n_node;
    xmlNodePtr node2; /* unused */
    int n_node2;

    for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
    for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
    for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
    for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
        mem_base = xmlMemBlocks();
        ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
        arg = gen_char_ptr(n_arg, 1);
        node = gen_xmlNodePtr(n_node, 2);
        node2 = gen_xmlNodePtr(n_node2, 3);

        ret_val = xmlShellCat(ctxt, arg, node, node2);
        desret_int(ret_val);
        call_tests++;
        des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
        des_char_ptr(n_arg, arg, 1);
        des_xmlNodePtr(n_node, node, 2);
        des_xmlNodePtr(n_node2, node2, 3);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlShellCat",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_ctxt);
            printf(" %d", n_arg);
            printf(" %d", n_node);
            printf(" %d", n_node2);
            printf("\n");
        }
    }
    }
    }
    }
    function_tests++;
#endif

    return(test_ret);
}


static int
test_xmlShellDir(void) {
    int test_ret = 0;

#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED)
    int mem_base;
    int ret_val;
    xmlShellCtxtPtr ctxt; /* the shell context */
    int n_ctxt;
    char * arg; /* unused */
    int n_arg;
    xmlNodePtr node; /* a node */
    int n_node;
    xmlNodePtr node2; /* unused */
    int n_node2;

    for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
    for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
    for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
    for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
        mem_base = xmlMemBlocks();
        ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
        arg = gen_char_ptr(n_arg, 1);
        node = gen_xmlNodePtr(n_node, 2);
        node2 = gen_xmlNodePtr(n_node2, 3);

        ret_val = xmlShellDir(ctxt, arg, node, node2);
        desret_int(ret_val);
        call_tests++;
        des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
        des_char_ptr(n_arg, arg, 1);
        des_xmlNodePtr(n_node, node, 2);
        des_xmlNodePtr(n_node2, node2, 3);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlShellDir",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_ctxt);
            printf(" %d", n_arg);
            printf(" %d", n_node);
            printf(" %d", n_node2);
            printf("\n");
        }
    }
    }
    }
    }
    function_tests++;
#endif

    return(test_ret);
}


static int
test_xmlShellDu(void) {
    int test_ret = 0;

#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED)
    int mem_base;
    int ret_val;
    xmlShellCtxtPtr ctxt; /* the shell context */
    int n_ctxt;
    char * arg; /* unused */
    int n_arg;
    xmlNodePtr tree; /* a node defining a subtree */
    int n_tree;
    xmlNodePtr node2; /* unused */
    int n_node2;

    for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
    for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
    for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) {
    for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
        mem_base = xmlMemBlocks();
        ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
        arg = gen_char_ptr(n_arg, 1);
        tree = gen_xmlNodePtr(n_tree, 2);
        node2 = gen_xmlNodePtr(n_node2, 3);

        ret_val = xmlShellDu(ctxt, arg, tree, node2);
        desret_int(ret_val);
        call_tests++;
        des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
        des_char_ptr(n_arg, arg, 1);
        des_xmlNodePtr(n_tree, tree, 2);
        des_xmlNodePtr(n_node2, node2, 3);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlShellDu",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_ctxt);
            printf(" %d", n_arg);
            printf(" %d", n_tree);
            printf(" %d", n_node2);
            printf("\n");
        }
    }
    }
    }
    }
    function_tests++;
#endif

    return(test_ret);
}


static int
test_xmlShellList(void) {
    int test_ret = 0;

#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED)
    int mem_base;
    int ret_val;
    xmlShellCtxtPtr ctxt; /* the shell context */
    int n_ctxt;
    char * arg; /* unused */
    int n_arg;
    xmlNodePtr node; /* a node */
    int n_node;
    xmlNodePtr node2; /* unused */
    int n_node2;

    for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
    for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
    for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
    for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
        mem_base = xmlMemBlocks();
        ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
        arg = gen_char_ptr(n_arg, 1);
        node = gen_xmlNodePtr(n_node, 2);
        node2 = gen_xmlNodePtr(n_node2, 3);

        ret_val = xmlShellList(ctxt, arg, node, node2);
        desret_int(ret_val);
        call_tests++;
        des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
        des_char_ptr(n_arg, arg, 1);
        des_xmlNodePtr(n_node, node, 2);
        des_xmlNodePtr(n_node2, node2, 3);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlShellList",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_ctxt);
            printf(" %d", n_arg);
            printf(" %d", n_node);
            printf(" %d", n_node2);
            printf("\n");
        }
    }
    }
    }
    }
    function_tests++;
#endif

    return(test_ret);
}


static int
test_xmlShellLoad(void) {
    int test_ret = 0;

#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED)
    int mem_base;
    int ret_val;
    xmlShellCtxtPtr ctxt; /* the shell context */
    int n_ctxt;
    char * filename; /* the file name */
    int n_filename;
    xmlNodePtr node; /* unused */
    int n_node;
    xmlNodePtr node2; /* unused */
    int n_node2;

    for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
    for (n_filename = 0;n_filename < gen_nb_char_ptr;n_filename++) {
    for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
    for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
        mem_base = xmlMemBlocks();
        ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
        filename = gen_char_ptr(n_filename, 1);
        node = gen_xmlNodePtr(n_node, 2);
        node2 = gen_xmlNodePtr(n_node2, 3);

        ret_val = xmlShellLoad(ctxt, filename, node, node2);
        desret_int(ret_val);
        call_tests++;
        des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
        des_char_ptr(n_filename, filename, 1);
        des_xmlNodePtr(n_node, node, 2);
        des_xmlNodePtr(n_node2, node2, 3);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlShellLoad",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_ctxt);
            printf(" %d", n_filename);
            printf(" %d", n_node);
            printf(" %d", n_node2);
            printf("\n");
        }
    }
    }
    }
    }
    function_tests++;
#endif

    return(test_ret);
}


static int
test_xmlShellPrintXPathResult(void) {
    int test_ret = 0;

#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED)
    int mem_base;
    xmlXPathObjectPtr list; /* a valid result generated by an xpath evaluation */
    int n_list;

    for (n_list = 0;n_list < gen_nb_xmlXPathObjectPtr;n_list++) {
        mem_base = xmlMemBlocks();
        list = gen_xmlXPathObjectPtr(n_list, 0);

        xmlShellPrintXPathResult(list);
        call_tests++;
        des_xmlXPathObjectPtr(n_list, list, 0);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlShellPrintXPathResult",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_list);
            printf("\n");
        }
    }
    function_tests++;
#endif

    return(test_ret);
}


static int
test_xmlShellPwd(void) {
    int test_ret = 0;

#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED)
    int mem_base;
    int ret_val;
    xmlShellCtxtPtr ctxt; /* the shell context */
    int n_ctxt;
    char * buffer; /* the output buffer */
    int n_buffer;
    xmlNodePtr node; /* a node */
    int n_node;
    xmlNodePtr node2; /* unused */
    int n_node2;

    for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
    for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) {
    for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
    for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
        mem_base = xmlMemBlocks();
        ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
        buffer = gen_char_ptr(n_buffer, 1);
        node = gen_xmlNodePtr(n_node, 2);
        node2 = gen_xmlNodePtr(n_node2, 3);

        ret_val = xmlShellPwd(ctxt, buffer, node, node2);
        desret_int(ret_val);
        call_tests++;
        des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
        des_char_ptr(n_buffer, buffer, 1);
        des_xmlNodePtr(n_node, node, 2);
        des_xmlNodePtr(n_node2, node2, 3);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlShellPwd",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_ctxt);
            printf(" %d", n_buffer);
            printf(" %d", n_node);
            printf(" %d", n_node2);
            printf("\n");
        }
    }
    }
    }
    }
    function_tests++;
#endif

    return(test_ret);
}


static int
test_xmlShellSave(void) {
    int test_ret = 0;

#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
    int mem_base;
    int ret_val;
    xmlShellCtxtPtr ctxt; /* the shell context */
    int n_ctxt;
    char * filename; /* the file name (optional) */
    int n_filename;
    xmlNodePtr node; /* unused */
    int n_node;
    xmlNodePtr node2; /* unused */
    int n_node2;

    for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
    for (n_filename = 0;n_filename < gen_nb_char_ptr;n_filename++) {
    for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
    for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
        mem_base = xmlMemBlocks();
        ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
        filename = gen_char_ptr(n_filename, 1);
        node = gen_xmlNodePtr(n_node, 2);
        node2 = gen_xmlNodePtr(n_node2, 3);

        ret_val = xmlShellSave(ctxt, filename, node, node2);
        desret_int(ret_val);
        call_tests++;
        des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
        des_char_ptr(n_filename, filename, 1);
        des_xmlNodePtr(n_node, node, 2);
        des_xmlNodePtr(n_node2, node2, 3);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlShellSave",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_ctxt);
            printf(" %d", n_filename);
            printf(" %d", n_node);
            printf(" %d", n_node2);
            printf("\n");
        }
    }
    }
    }
    }
    function_tests++;
#endif

    return(test_ret);
}


static int
test_xmlShellValidate(void) {
    int test_ret = 0;

#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_VALID_ENABLED)
    int mem_base;
    int ret_val;
    xmlShellCtxtPtr ctxt; /* the shell context */
    int n_ctxt;
    char * dtd; /* the DTD URI (optional) */
    int n_dtd;
    xmlNodePtr node; /* unused */
    int n_node;
    xmlNodePtr node2; /* unused */
    int n_node2;

    for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
    for (n_dtd = 0;n_dtd < gen_nb_char_ptr;n_dtd++) {
    for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
    for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
        mem_base = xmlMemBlocks();
        ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
        dtd = gen_char_ptr(n_dtd, 1);
        node = gen_xmlNodePtr(n_node, 2);
        node2 = gen_xmlNodePtr(n_node2, 3);

        ret_val = xmlShellValidate(ctxt, dtd, node, node2);
        desret_int(ret_val);
        call_tests++;
        des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
        des_char_ptr(n_dtd, dtd, 1);
        des_xmlNodePtr(n_node, node, 2);
        des_xmlNodePtr(n_node2, node2, 3);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlShellValidate",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_ctxt);
            printf(" %d", n_dtd);
            printf(" %d", n_node);
            printf(" %d", n_node2);
            printf("\n");
        }
    }
    }
    }
    }
    function_tests++;
#endif

    return(test_ret);
}


static int
test_xmlShellWrite(void) {
    int test_ret = 0;

#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
    int mem_base;
    int ret_val;
    xmlShellCtxtPtr ctxt; /* the shell context */
    int n_ctxt;
    char * filename; /* the file name */
    int n_filename;
    xmlNodePtr node; /* a node in the tree */
    int n_node;
    xmlNodePtr node2; /* unused */
    int n_node2;

    for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
    for (n_filename = 0;n_filename < gen_nb_char_ptr;n_filename++) {
    for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
    for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
        mem_base = xmlMemBlocks();
        ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
        filename = gen_char_ptr(n_filename, 1);
        node = gen_xmlNodePtr(n_node, 2);
        node2 = gen_xmlNodePtr(n_node2, 3);

        ret_val = xmlShellWrite(ctxt, filename, node, node2);
        desret_int(ret_val);
        call_tests++;
        des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
        des_char_ptr(n_filename, filename, 1);
        des_xmlNodePtr(n_node, node, 2);
        des_xmlNodePtr(n_node2, node2, 3);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlShellWrite",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_ctxt);
            printf(" %d", n_filename);
            printf(" %d", n_node);
            printf(" %d", n_node2);
            printf("\n");
        }
    }
    }
    }
    }
    function_tests++;
#endif

    return(test_ret);
}

static int
test_debugXML(void) {
    int test_ret = 0;

    if (quiet == 0) printf("Testing debugXML : 25 of 28 functions ...\n");
    test_ret += test_xmlBoolToText();
    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();
    test_ret += test_xmlLsCountNode();
    test_ret += test_xmlLsOneNode();
    test_ret += test_xmlShell();
    test_ret += test_xmlShellBase();
    test_ret += test_xmlShellCat();
    test_ret += test_xmlShellDir();
    test_ret += test_xmlShellDu();
    test_ret += test_xmlShellList();
    test_ret += test_xmlShellLoad();
    test_ret += test_xmlShellPrintXPathResult();
    test_ret += test_xmlShellPwd();
    test_ret += test_xmlShellSave();
    test_ret += test_xmlShellValidate();
    test_ret += test_xmlShellWrite();

    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 dictionnary */
    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 dictionnary */
    int n_dict;
    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);

        ret_val = xmlDictExists(dict, (const xmlChar *)name, len);
        desret_const_xmlChar_ptr(ret_val);
        call_tests++;
        des_xmlDictPtr(n_dict, dict, 0);
        des_const_xmlChar_ptr(n_name, (const xmlChar *)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_xmlDictLookup(void) {
    int test_ret = 0;

    int mem_base;
    const xmlChar * ret_val;
    xmlDictPtr dict; /* the dictionnary */
    int n_dict;
    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);

        ret_val = xmlDictLookup(dict, (const xmlChar *)name, len);
        desret_const_xmlChar_ptr(ret_val);
        call_tests++;
        des_xmlDictPtr(n_dict, dict, 0);
        des_const_xmlChar_ptr(n_name, (const xmlChar *)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 dictionnary */
    int n_dict;
    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, (const xmlChar *)str);
        desret_int(ret_val);
        call_tests++;
        des_xmlDictPtr(n_dict, dict, 0);
        des_const_xmlChar_ptr(n_str, (const xmlChar *)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 dictionnary */
    int n_dict;
    xmlChar * prefix; /* the prefix */
    int n_prefix;
    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, (const xmlChar *)prefix, (const xmlChar *)name);
        desret_const_xmlChar_ptr(ret_val);
        call_tests++;
        des_xmlDictPtr(n_dict, dict, 0);
        des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
        des_const_xmlChar_ptr(n_name, (const xmlChar *)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 dictionnary */
    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_xmlDictSize(void) {
    int test_ret = 0;

    int mem_base;
    int ret_val;
    xmlDictPtr dict; /* the dictionnary */
    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_dict(void) {
    int test_ret = 0;

    if (quiet == 0) printf("Testing dict : 9 of 10 functions ...\n");
    test_ret += test_xmlDictCleanup();
    test_ret += test_xmlDictCreate();
    test_ret += test_xmlDictCreateSub();
    test_ret += test_xmlDictExists();
    test_ret += test_xmlDictLookup();
    test_ret += test_xmlDictOwns();
    test_ret += test_xmlDictQLookup();
    test_ret += test_xmlDictReference();
    test_ret += test_xmlDictSize();

    if (test_ret != 0)
	printf("Module dict: %d errors\n", test_ret);
    return(test_ret);
}

static int
test_UTF8Toisolat1(void) {
    int test_ret = 0;

#if defined(LIBXML_OUTPUT_ENABLED)
#ifdef 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;
    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 = UTF8Toisolat1(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 UTF8Toisolat1",
	           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
#endif

    return(test_ret);
}


static int
test_isolat1ToUTF8(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;
    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 = isolat1ToUTF8(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 isolat1ToUTF8",
	           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_xmlAddEncodingAlias(void) {
    int test_ret = 0;

    int ret_val;
    char * name; /* the encoding name as parsed, in UTF-8 format (ASCII actually) */
    int n_name;
    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((const char *)name, (const char *)alias);
        desret_int(ret_val);
        call_tests++;
        des_const_char_ptr(n_name, (const char *)name, 0);
        des_const_char_ptr(n_alias, (const char *)alias, 1);
        xmlResetLastError();
    }
    }
    function_tests++;

    return(test_ret);
}


#define gen_nb_xmlCharEncodingHandler_ptr 1
static xmlCharEncodingHandler * gen_xmlCharEncodingHandler_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    return(NULL);
}
static void des_xmlCharEncodingHandler_ptr(int no ATTRIBUTE_UNUSED, xmlCharEncodingHandler * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
}

static int
test_xmlCharEncCloseFunc(void) {
    int test_ret = 0;

    int mem_base;
    int ret_val;
    xmlCharEncodingHandler * handler; /* char enconding 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 enconding 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_xmlCharEncOutFunc(void) {
    int test_ret = 0;

    int mem_base;
    int ret_val;
    xmlCharEncodingHandler * handler; /* char enconding 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_xmlDelEncodingAlias(void) {
    int test_ret = 0;

    int mem_base;
    int ret_val;
    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((const char *)alias);
        desret_int(ret_val);
        call_tests++;
        des_const_char_ptr(n_alias, (const char *)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;
    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((const unsigned char *)in, len);
        desret_xmlCharEncoding(ret_val);
        call_tests++;
        des_const_unsigned_char_ptr(n_in, (const unsigned char *)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;
    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((const char *)alias);
        desret_const_char_ptr(ret_val);
        call_tests++;
        des_const_char_ptr(n_alias, (const char *)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_xmlNewCharEncodingHandler(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;
    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((const char *)name);
        desret_xmlCharEncoding(ret_val);
        call_tests++;
        des_const_char_ptr(n_name, (const char *)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
static xmlCharEncodingHandlerPtr gen_xmlCharEncodingHandlerPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    return(NULL);
}
static void des_xmlCharEncodingHandlerPtr(int no ATTRIBUTE_UNUSED, xmlCharEncodingHandlerPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
}

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_encoding(void) {
    int test_ret = 0;

    if (quiet == 0) printf("Testing encoding : 16 of 19 functions ...\n");
    test_ret += test_UTF8Toisolat1();
    test_ret += test_isolat1ToUTF8();
    test_ret += test_xmlAddEncodingAlias();
    test_ret += test_xmlCharEncCloseFunc();
    test_ret += test_xmlCharEncFirstLine();
    test_ret += test_xmlCharEncInFunc();
    test_ret += test_xmlCharEncOutFunc();
    test_ret += test_xmlCleanupCharEncodingHandlers();
    test_ret += test_xmlCleanupEncodingAliases();
    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_xmlNewCharEncodingHandler();
    test_ret += test_xmlParseCharEncoding();
    test_ret += test_xmlRegisterCharEncodingHandler();

    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;
    xmlChar * name; /* the entity name */
    int n_name;
    int type; /* the entity type XML_xxx_yyy_ENTITY */
    int n_type;
    xmlChar * ExternalID; /* the entity external ID if available */
    int n_ExternalID;
    xmlChar * SystemID; /* the entity system ID if available */
    int n_SystemID;
    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, (const xmlChar *)name, type, (const xmlChar *)ExternalID, (const xmlChar *)SystemID, (const xmlChar *)content);
        desret_xmlEntityPtr(ret_val);
        call_tests++;
        des_xmlDocPtr(n_doc, doc, 0);
        des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
        des_int(n_type, type, 2);
        des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 3);
        des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 4);
        des_const_xmlChar_ptr(n_content, (const xmlChar *)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;
    xmlChar * name; /* the entity name */
    int n_name;
    int type; /* the entity type XML_xxx_yyy_ENTITY */
    int n_type;
    xmlChar * ExternalID; /* the entity external ID if available */
    int n_ExternalID;
    xmlChar * SystemID; /* the entity system ID if available */
    int n_SystemID;
    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, (const xmlChar *)name, type, (const xmlChar *)ExternalID, (const xmlChar *)SystemID, (const xmlChar *)content);
        desret_xmlEntityPtr(ret_val);
        call_tests++;
        des_xmlDocPtr(n_doc, doc, 0);
        des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
        des_int(n_type, type, 2);
        des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 3);
        des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 4);
        des_const_xmlChar_ptr(n_content, (const xmlChar *)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);
}


static int
test_xmlCleanupPredefinedEntities(void) {
    int test_ret = 0;

#if defined(LIBXML_LEGACY_ENABLED)
#ifdef LIBXML_LEGACY_ENABLED
    int mem_base;

        mem_base = xmlMemBlocks();

        xmlCleanupPredefinedEntities();
        call_tests++;
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlCleanupPredefinedEntities",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf("\n");
        }
    function_tests++;
#endif
#endif

    return(test_ret);
}


#define gen_nb_xmlEntitiesTablePtr 1
static xmlEntitiesTablePtr gen_xmlEntitiesTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    return(NULL);
}
static void des_xmlEntitiesTablePtr(int no ATTRIBUTE_UNUSED, xmlEntitiesTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
}

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);
}


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
static xmlEntityPtr gen_xmlEntityPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    return(NULL);
}
static void des_xmlEntityPtr(int no ATTRIBUTE_UNUSED, xmlEntityPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
}

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;
    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, (const xmlChar *)input);
        desret_xmlChar_ptr(ret_val);
        call_tests++;
        des_xmlDocPtr(n_doc, doc, 0);
        des_const_xmlChar_ptr(n_input, (const xmlChar *)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);
}


static int
test_xmlEncodeSpecialChars(void) {
    int test_ret = 0;

    int mem_base;
    xmlChar * ret_val;
    xmlDocPtr doc; /* the document containing the string */
    int n_doc;
    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 = xmlEncodeSpecialChars(doc, (const xmlChar *)input);
        desret_xmlChar_ptr(ret_val);
        call_tests++;
        des_xmlDocPtr(n_doc, doc, 0);
        des_const_xmlChar_ptr(n_input, (const xmlChar *)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;
    xmlDocPtr doc; /* the document referencing the entity */
    int n_doc;
    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 = xmlGetDocEntity(doc, (const xmlChar *)name);
        desret_xmlEntityPtr(ret_val);
        call_tests++;
        des_xmlDocPtr(n_doc, doc, 0);
        des_const_xmlChar_ptr(n_name, (const xmlChar *)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;
    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, (const xmlChar *)name);
        desret_xmlEntityPtr(ret_val);
        call_tests++;
        des_xmlDocPtr(n_doc, doc, 0);
        des_const_xmlChar_ptr(n_name, (const xmlChar *)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;
    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, (const xmlChar *)name);
        desret_xmlEntityPtr(ret_val);
        call_tests++;
        des_xmlDocPtr(n_doc, doc, 0);
        des_const_xmlChar_ptr(n_name, (const xmlChar *)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;
    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((const xmlChar *)name);
        desret_xmlEntityPtr(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 xmlGetPredefinedEntity",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_name);
            printf("\n");
        }
    }
    function_tests++;

    return(test_ret);
}


static int
test_xmlInitializePredefinedEntities(void) {
    int test_ret = 0;

#if defined(LIBXML_LEGACY_ENABLED)
#ifdef LIBXML_LEGACY_ENABLED
    int mem_base;

        mem_base = xmlMemBlocks();

        xmlInitializePredefinedEntities();
        call_tests++;
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlInitializePredefinedEntities",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf("\n");
        }
    function_tests++;
#endif
#endif

    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;
    xmlChar * name; /* the entity name */
    int n_name;
    int type; /* the entity type XML_xxx_yyy_ENTITY */
    int n_type;
    xmlChar * ExternalID; /* the entity external ID if available */
    int n_ExternalID;
    xmlChar * SystemID; /* the entity system ID if available */
    int n_SystemID;
    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, (const xmlChar *)name, type, (const xmlChar *)ExternalID, (const xmlChar *)SystemID, (const xmlChar *)content);
        desret_xmlEntityPtr(ret_val);
        call_tests++;
        des_xmlDocPtr(n_doc, doc, 0);
        des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
        des_int(n_type, type, 2);
        des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 3);
        des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 4);
        des_const_xmlChar_ptr(n_content, (const xmlChar *)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 : 13 of 17 functions ...\n");
    test_ret += test_xmlAddDocEntity();
    test_ret += test_xmlAddDtdEntity();
    test_ret += test_xmlCleanupPredefinedEntities();
    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_xmlInitializePredefinedEntities();
    test_ret += test_xmlNewEntity();

    if (test_ret != 0)
	printf("Module entities: %d errors\n", test_ret);
    return(test_ret);
}

static int
test_xmlHashAddEntry(void) {
    int test_ret = 0;

    int mem_base;
    int ret_val;
    xmlHashTablePtr table; /* the hash table */
    int n_table;
    xmlChar * name; /* the name of the userdata */
    int n_name;
    void * userdata; /* a pointer to the userdata */
    int n_userdata;

    for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
    for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
    for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
        mem_base = xmlMemBlocks();
        table = gen_xmlHashTablePtr(n_table, 0);
        name = gen_const_xmlChar_ptr(n_name, 1);
        userdata = gen_userdata(n_userdata, 2);

        ret_val = xmlHashAddEntry(table, (const xmlChar *)name, userdata);
        desret_int(ret_val);
        call_tests++;
        des_xmlHashTablePtr(n_table, table, 0);
        des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
        des_userdata(n_userdata, userdata, 2);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlHashAddEntry",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_table);
            printf(" %d", n_name);
            printf(" %d", n_userdata);
            printf("\n");
        }
    }
    }
    }
    function_tests++;

    return(test_ret);
}


static int
test_xmlHashAddEntry2(void) {
    int test_ret = 0;

    int mem_base;
    int ret_val;
    xmlHashTablePtr table; /* the hash table */
    int n_table;
    xmlChar * name; /* the name of the userdata */
    int n_name;
    xmlChar * name2; /* a second name of the userdata */
    int n_name2;
    void * userdata; /* a pointer to the userdata */
    int n_userdata;

    for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
    for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
    for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
    for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
        mem_base = xmlMemBlocks();
        table = gen_xmlHashTablePtr(n_table, 0);
        name = gen_const_xmlChar_ptr(n_name, 1);
        name2 = gen_const_xmlChar_ptr(n_name2, 2);
        userdata = gen_userdata(n_userdata, 3);

        ret_val = xmlHashAddEntry2(table, (const xmlChar *)name, (const xmlChar *)name2, userdata);
        desret_int(ret_val);
        call_tests++;
        des_xmlHashTablePtr(n_table, table, 0);
        des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
        des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
        des_userdata(n_userdata, userdata, 3);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlHashAddEntry2",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_table);
            printf(" %d", n_name);
            printf(" %d", n_name2);
            printf(" %d", n_userdata);
            printf("\n");
        }
    }
    }
    }
    }
    function_tests++;

    return(test_ret);
}


static int
test_xmlHashAddEntry3(void) {
    int test_ret = 0;

    int mem_base;
    int ret_val;
    xmlHashTablePtr table; /* the hash table */
    int n_table;
    xmlChar * name; /* the name of the userdata */
    int n_name;
    xmlChar * name2; /* a second name of the userdata */
    int n_name2;
    xmlChar * name3; /* a third name of the userdata */
    int n_name3;
    void * userdata; /* a pointer to the userdata */
    int n_userdata;

    for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
    for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
    for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
    for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
    for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
        mem_base = xmlMemBlocks();
        table = gen_xmlHashTablePtr(n_table, 0);
        name = gen_const_xmlChar_ptr(n_name, 1);
        name2 = gen_const_xmlChar_ptr(n_name2, 2);
        name3 = gen_const_xmlChar_ptr(n_name3, 3);
        userdata = gen_userdata(n_userdata, 4);

        ret_val = xmlHashAddEntry3(table, (const xmlChar *)name, (const xmlChar *)name2, (const xmlChar *)name3, userdata);
        desret_int(ret_val);
        call_tests++;
        des_xmlHashTablePtr(n_table, table, 0);
        des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
        des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
        des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 3);
        des_userdata(n_userdata, userdata, 4);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlHashAddEntry3",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_table);
            printf(" %d", n_name);
            printf(" %d", n_name2);
            printf(" %d", n_name3);
            printf(" %d", n_userdata);
            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_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_xmlHashLookup(void) {
    int test_ret = 0;

    int mem_base;
    void * ret_val;
    xmlHashTablePtr table; /* the hash table */
    int n_table;
    xmlChar * name; /* the name of the userdata */
    int n_name;

    for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
    for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
        mem_base = xmlMemBlocks();
        table = gen_xmlHashTablePtr(n_table, 0);
        name = gen_const_xmlChar_ptr(n_name, 1);

        ret_val = xmlHashLookup(table, (const xmlChar *)name);
        desret_void_ptr(ret_val);
        call_tests++;
        des_xmlHashTablePtr(n_table, table, 0);
        des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlHashLookup",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_table);
            printf(" %d", n_name);
            printf("\n");
        }
    }
    }
    function_tests++;

    return(test_ret);
}


static int
test_xmlHashLookup2(void) {
    int test_ret = 0;

    int mem_base;
    void * ret_val;
    xmlHashTablePtr table; /* the hash table */
    int n_table;
    xmlChar * name; /* the name of the userdata */
    int n_name;
    xmlChar * name2; /* a second name of the userdata */
    int n_name2;

    for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
    for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
    for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
        mem_base = xmlMemBlocks();
        table = gen_xmlHashTablePtr(n_table, 0);
        name = gen_const_xmlChar_ptr(n_name, 1);
        name2 = gen_const_xmlChar_ptr(n_name2, 2);

        ret_val = xmlHashLookup2(table, (const xmlChar *)name, (const xmlChar *)name2);
        desret_void_ptr(ret_val);
        call_tests++;
        des_xmlHashTablePtr(n_table, table, 0);
        des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
        des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlHashLookup2",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_table);
            printf(" %d", n_name);
            printf(" %d", n_name2);
            printf("\n");
        }
    }
    }
    }
    function_tests++;

    return(test_ret);
}


static int
test_xmlHashLookup3(void) {
    int test_ret = 0;

    int mem_base;
    void * ret_val;
    xmlHashTablePtr table; /* the hash table */
    int n_table;
    xmlChar * name; /* the name of the userdata */
    int n_name;
    xmlChar * name2; /* a second name of the userdata */
    int n_name2;
    xmlChar * name3; /* a third name of the userdata */
    int n_name3;

    for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
    for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
    for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
    for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
        mem_base = xmlMemBlocks();
        table = gen_xmlHashTablePtr(n_table, 0);
        name = gen_const_xmlChar_ptr(n_name, 1);
        name2 = gen_const_xmlChar_ptr(n_name2, 2);
        name3 = gen_const_xmlChar_ptr(n_name3, 3);

        ret_val = xmlHashLookup3(table, (const xmlChar *)name, (const xmlChar *)name2, (const xmlChar *)name3);
        desret_void_ptr(ret_val);
        call_tests++;
        des_xmlHashTablePtr(n_table, table, 0);
        des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
        des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
        des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 3);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlHashLookup3",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_table);
            printf(" %d", n_name);
            printf(" %d", n_name2);
            printf(" %d", n_name3);
            printf("\n");
        }
    }
    }
    }
    }
    function_tests++;

    return(test_ret);
}


static int
test_xmlHashQLookup(void) {
    int test_ret = 0;

    int mem_base;
    void * ret_val;
    xmlHashTablePtr table; /* the hash table */
    int n_table;
    xmlChar * prefix; /* the prefix of the userdata */
    int n_prefix;
    xmlChar * name; /* the name of the userdata */
    int n_name;

    for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
    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();
        table = gen_xmlHashTablePtr(n_table, 0);
        prefix = gen_const_xmlChar_ptr(n_prefix, 1);
        name = gen_const_xmlChar_ptr(n_name, 2);

        ret_val = xmlHashQLookup(table, (const xmlChar *)prefix, (const xmlChar *)name);
        desret_void_ptr(ret_val);
        call_tests++;
        des_xmlHashTablePtr(n_table, table, 0);
        des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
        des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlHashQLookup",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_table);
            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 table; /* the hash table */
    int n_table;
    xmlChar * prefix; /* the prefix of the userdata */
    int n_prefix;
    xmlChar * name; /* the name of the userdata */
    int n_name;
    xmlChar * prefix2; /* the second prefix of the userdata */
    int n_prefix2;
    xmlChar * name2; /* a second name of the userdata */
    int n_name2;

    for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
    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();
        table = gen_xmlHashTablePtr(n_table, 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(table, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)prefix2, (const xmlChar *)name2);
        desret_void_ptr(ret_val);
        call_tests++;
        des_xmlHashTablePtr(n_table, table, 0);
        des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
        des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
        des_const_xmlChar_ptr(n_prefix2, (const xmlChar *)prefix2, 3);
        des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 4);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlHashQLookup2",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_table);
            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 table; /* the hash table */
    int n_table;
    xmlChar * prefix; /* the prefix of the userdata */
    int n_prefix;
    xmlChar * name; /* the name of the userdata */
    int n_name;
    xmlChar * prefix2; /* the second prefix of the userdata */
    int n_prefix2;
    xmlChar * name2; /* a second name of the userdata */
    int n_name2;
    xmlChar * prefix3; /* the third prefix of the userdata */
    int n_prefix3;
    xmlChar * name3; /* a third name of the userdata */
    int n_name3;

    for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
    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();
        table = gen_xmlHashTablePtr(n_table, 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(table, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)prefix2, (const xmlChar *)name2, (const xmlChar *)prefix3, (const xmlChar *)name3);
        desret_void_ptr(ret_val);
        call_tests++;
        des_xmlHashTablePtr(n_table, table, 0);
        des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
        des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
        des_const_xmlChar_ptr(n_prefix2, (const xmlChar *)prefix2, 3);
        des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 4);
        des_const_xmlChar_ptr(n_prefix3, (const xmlChar *)prefix3, 5);
        des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 6);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlHashQLookup3",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_table);
            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 table; /* the hash table */
    int n_table;
    xmlChar * name; /* the name of the userdata */
    int n_name;
    xmlHashDeallocator f; /* the deallocator function for removed item (if any) */
    int n_f;

    for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
    for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
    for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
        mem_base = xmlMemBlocks();
        table = gen_xmlHashTablePtr(n_table, 0);
        name = gen_const_xmlChar_ptr(n_name, 1);
        f = gen_xmlHashDeallocator(n_f, 2);

        ret_val = xmlHashRemoveEntry(table, (const xmlChar *)name, f);
        desret_int(ret_val);
        call_tests++;
        des_xmlHashTablePtr(n_table, table, 0);
        des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
        des_xmlHashDeallocator(n_f, f, 2);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlHashRemoveEntry",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_table);
            printf(" %d", n_name);
            printf(" %d", n_f);
            printf("\n");
        }
    }
    }
    }
    function_tests++;

    return(test_ret);
}


static int
test_xmlHashRemoveEntry2(void) {
    int test_ret = 0;

    int mem_base;
    int ret_val;
    xmlHashTablePtr table; /* the hash table */
    int n_table;
    xmlChar * name; /* the name of the userdata */
    int n_name;
    xmlChar * name2; /* a second name of the userdata */
    int n_name2;
    xmlHashDeallocator f; /* the deallocator function for removed item (if any) */
    int n_f;

    for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
    for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
    for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
    for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
        mem_base = xmlMemBlocks();
        table = gen_xmlHashTablePtr(n_table, 0);
        name = gen_const_xmlChar_ptr(n_name, 1);
        name2 = gen_const_xmlChar_ptr(n_name2, 2);
        f = gen_xmlHashDeallocator(n_f, 3);

        ret_val = xmlHashRemoveEntry2(table, (const xmlChar *)name, (const xmlChar *)name2, f);
        desret_int(ret_val);
        call_tests++;
        des_xmlHashTablePtr(n_table, table, 0);
        des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
        des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
        des_xmlHashDeallocator(n_f, f, 3);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlHashRemoveEntry2",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_table);
            printf(" %d", n_name);
            printf(" %d", n_name2);
            printf(" %d", n_f);
            printf("\n");
        }
    }
    }
    }
    }
    function_tests++;

    return(test_ret);
}


static int
test_xmlHashRemoveEntry3(void) {
    int test_ret = 0;

    int mem_base;
    int ret_val;
    xmlHashTablePtr table; /* the hash table */
    int n_table;
    xmlChar * name; /* the name of the userdata */
    int n_name;
    xmlChar * name2; /* a second name of the userdata */
    int n_name2;
    xmlChar * name3; /* a third name of the userdata */
    int n_name3;
    xmlHashDeallocator f; /* the deallocator function for removed item (if any) */
    int n_f;

    for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
    for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
    for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
    for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
    for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
        mem_base = xmlMemBlocks();
        table = gen_xmlHashTablePtr(n_table, 0);
        name = gen_const_xmlChar_ptr(n_name, 1);
        name2 = gen_const_xmlChar_ptr(n_name2, 2);
        name3 = gen_const_xmlChar_ptr(n_name3, 3);
        f = gen_xmlHashDeallocator(n_f, 4);

        ret_val = xmlHashRemoveEntry3(table, (const xmlChar *)name, (const xmlChar *)name2, (const xmlChar *)name3, f);
        desret_int(ret_val);
        call_tests++;
        des_xmlHashTablePtr(n_table, table, 0);
        des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
        des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
        des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 3);
        des_xmlHashDeallocator(n_f, f, 4);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlHashRemoveEntry3",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_table);
            printf(" %d", n_name);
            printf(" %d", n_name2);
            printf(" %d", n_name3);
            printf(" %d", n_f);
            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 table; /* the hash table */
    int n_table;

    for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
        mem_base = xmlMemBlocks();
        table = gen_xmlHashTablePtr(n_table, 0);

        ret_val = xmlHashSize(table);
        desret_int(ret_val);
        call_tests++;
        des_xmlHashTablePtr(n_table, table, 0);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlHashSize",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_table);
            printf("\n");
        }
    }
    function_tests++;

    return(test_ret);
}


static int
test_xmlHashUpdateEntry(void) {
    int test_ret = 0;

    int mem_base;
    int ret_val;
    xmlHashTablePtr table; /* the hash table */
    int n_table;
    xmlChar * name; /* the name of the userdata */
    int n_name;
    void * userdata; /* a pointer to the userdata */
    int n_userdata;
    xmlHashDeallocator f; /* the deallocator function for replaced item (if any) */
    int n_f;

    for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
    for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
    for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
    for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
        mem_base = xmlMemBlocks();
        table = gen_xmlHashTablePtr(n_table, 0);
        name = gen_const_xmlChar_ptr(n_name, 1);
        userdata = gen_userdata(n_userdata, 2);
        f = gen_xmlHashDeallocator(n_f, 3);

        ret_val = xmlHashUpdateEntry(table, (const xmlChar *)name, userdata, f);
        desret_int(ret_val);
        call_tests++;
        des_xmlHashTablePtr(n_table, table, 0);
        des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
        des_userdata(n_userdata, userdata, 2);
        des_xmlHashDeallocator(n_f, f, 3);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlHashUpdateEntry",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_table);
            printf(" %d", n_name);
            printf(" %d", n_userdata);
            printf(" %d", n_f);
            printf("\n");
        }
    }
    }
    }
    }
    function_tests++;

    return(test_ret);
}


static int
test_xmlHashUpdateEntry2(void) {
    int test_ret = 0;

    int mem_base;
    int ret_val;
    xmlHashTablePtr table; /* the hash table */
    int n_table;
    xmlChar * name; /* the name of the userdata */
    int n_name;
    xmlChar * name2; /* a second name of the userdata */
    int n_name2;
    void * userdata; /* a pointer to the userdata */
    int n_userdata;
    xmlHashDeallocator f; /* the deallocator function for replaced item (if any) */
    int n_f;

    for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
    for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
    for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
    for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
    for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
        mem_base = xmlMemBlocks();
        table = gen_xmlHashTablePtr(n_table, 0);
        name = gen_const_xmlChar_ptr(n_name, 1);
        name2 = gen_const_xmlChar_ptr(n_name2, 2);
        userdata = gen_userdata(n_userdata, 3);
        f = gen_xmlHashDeallocator(n_f, 4);

        ret_val = xmlHashUpdateEntry2(table, (const xmlChar *)name, (const xmlChar *)name2, userdata, f);
        desret_int(ret_val);
        call_tests++;
        des_xmlHashTablePtr(n_table, table, 0);
        des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
        des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
        des_userdata(n_userdata, userdata, 3);
        des_xmlHashDeallocator(n_f, f, 4);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlHashUpdateEntry2",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_table);
            printf(" %d", n_name);
            printf(" %d", n_name2);
            printf(" %d", n_userdata);
            printf(" %d", n_f);
            printf("\n");
        }
    }
    }
    }
    }
    }
    function_tests++;

    return(test_ret);
}


static int
test_xmlHashUpdateEntry3(void) {
    int test_ret = 0;

    int mem_base;
    int ret_val;
    xmlHashTablePtr table; /* the hash table */
    int n_table;
    xmlChar * name; /* the name of the userdata */
    int n_name;
    xmlChar * name2; /* a second name of the userdata */
    int n_name2;
    xmlChar * name3; /* a third name of the userdata */
    int n_name3;
    void * userdata; /* a pointer to the userdata */
    int n_userdata;
    xmlHashDeallocator f; /* the deallocator function for replaced item (if any) */
    int n_f;

    for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
    for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
    for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
    for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
    for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
    for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
        mem_base = xmlMemBlocks();
        table = gen_xmlHashTablePtr(n_table, 0);
        name = gen_const_xmlChar_ptr(n_name, 1);
        name2 = gen_const_xmlChar_ptr(n_name2, 2);
        name3 = gen_const_xmlChar_ptr(n_name3, 3);
        userdata = gen_userdata(n_userdata, 4);
        f = gen_xmlHashDeallocator(n_f, 5);

        ret_val = xmlHashUpdateEntry3(table, (const xmlChar *)name, (const xmlChar *)name2, (const xmlChar *)name3, userdata, f);
        desret_int(ret_val);
        call_tests++;
        des_xmlHashTablePtr(n_table, table, 0);
        des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
        des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
        des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 3);
        des_userdata(n_userdata, userdata, 4);
        des_xmlHashDeallocator(n_f, f, 5);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlHashUpdateEntry3",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_table);
            printf(" %d", n_name);
            printf(" %d", n_name2);
            printf(" %d", n_name3);
            printf(" %d", n_userdata);
            printf(" %d", n_f);
            printf("\n");
        }
    }
    }
    }
    }
    }
    }
    function_tests++;

    return(test_ret);
}

static int
test_hash(void) {
    int test_ret = 0;

    if (quiet == 0) printf("Testing hash : 16 of 24 functions ...\n");
    test_ret += test_xmlHashAddEntry();
    test_ret += test_xmlHashAddEntry2();
    test_ret += test_xmlHashAddEntry3();
    test_ret += test_xmlHashCopy();
    test_ret += test_xmlHashCreate();
    test_ret += test_xmlHashCreateDict();
    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
static xmlLinkPtr gen_xmlLinkPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    return(NULL);
}
static void des_xmlLinkPtr(int no ATTRIBUTE_UNUSED, xmlLinkPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
}

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);
}


#define gen_nb_const_xmlListPtr 1
static xmlListPtr gen_const_xmlListPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    return(NULL);
}
static void des_const_xmlListPtr(int no ATTRIBUTE_UNUSED, const xmlListPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
}

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_const_xmlListPtr;n_old++) {
        mem_base = xmlMemBlocks();
        cur = gen_xmlListPtr(n_cur, 0);
        old = gen_const_xmlListPtr(n_old, 1);

        ret_val = xmlListCopy(cur, (const xmlListPtr)old);
        desret_int(ret_val);
        call_tests++;
        des_xmlListPtr(n_cur, cur, 0);
        des_const_xmlListPtr(n_old, (const xmlListPtr)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_xmlNanoFTPCheckResponse(void) {
    int test_ret = 0;

#if defined(LIBXML_FTP_ENABLED)
    int mem_base;
    int ret_val;
    void * ctx; /* an FTP context */
    int n_ctx;

    for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
        mem_base = xmlMemBlocks();
        ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);

        ret_val = xmlNanoFTPCheckResponse(ctx);
        desret_int(ret_val);
        call_tests++;
        des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlNanoFTPCheckResponse",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_ctx);
            printf("\n");
        }
    }
    function_tests++;
#endif

    return(test_ret);
}


static int
test_xmlNanoFTPCleanup(void) {
    int test_ret = 0;

#if defined(LIBXML_FTP_ENABLED)
    int mem_base;

        mem_base = xmlMemBlocks();

        xmlNanoFTPCleanup();
        call_tests++;
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlNanoFTPCleanup",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf("\n");
        }
    function_tests++;
#endif

    return(test_ret);
}


static int
test_xmlNanoFTPCloseConnection(void) {
    int test_ret = 0;

#if defined(LIBXML_FTP_ENABLED)
    int mem_base;
    int ret_val;
    void * ctx; /* an FTP context */
    int n_ctx;

    for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
        mem_base = xmlMemBlocks();
        ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);

        ret_val = xmlNanoFTPCloseConnection(ctx);
        desret_int(ret_val);
        call_tests++;
        des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlNanoFTPCloseConnection",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_ctx);
            printf("\n");
        }
    }
    function_tests++;
#endif

    return(test_ret);
}


static int
test_xmlNanoFTPCwd(void) {
    int test_ret = 0;

#if defined(LIBXML_FTP_ENABLED)
    int mem_base;
    int ret_val;
    void * ctx; /* an FTP context */
    int n_ctx;
    char * directory; /* a directory on the server */
    int n_directory;

    for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
    for (n_directory = 0;n_directory < gen_nb_const_char_ptr;n_directory++) {
        mem_base = xmlMemBlocks();
        ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
        directory = gen_const_char_ptr(n_directory, 1);

        ret_val = xmlNanoFTPCwd(ctx, (const char *)directory);
        desret_int(ret_val);
        call_tests++;
        des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
        des_const_char_ptr(n_directory, (const char *)directory, 1);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlNanoFTPCwd",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_ctx);
            printf(" %d", n_directory);
            printf("\n");
        }
    }
    }
    function_tests++;
#endif

    return(test_ret);
}


static int
test_xmlNanoFTPDele(void) {
    int test_ret = 0;

#if defined(LIBXML_FTP_ENABLED)
    int mem_base;
    int ret_val;
    void * ctx; /* an FTP context */
    int n_ctx;
    const char * file; /* a file or directory on the server */
    int n_file;

    for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
    for (n_file = 0;n_file < gen_nb_filepath;n_file++) {
        mem_base = xmlMemBlocks();
        ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
        file = gen_filepath(n_file, 1);

        ret_val = xmlNanoFTPDele(ctx, file);
        desret_int(ret_val);
        call_tests++;
        des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
        des_filepath(n_file, file, 1);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlNanoFTPDele",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_ctx);
            printf(" %d", n_file);
            printf("\n");
        }
    }
    }
    function_tests++;
#endif

    return(test_ret);
}


static int
test_xmlNanoFTPGet(void) {
    int test_ret = 0;


    /* missing type support */
    return(test_ret);
}


static int
test_xmlNanoFTPGetConnection(void) {
    int test_ret = 0;

#if defined(LIBXML_FTP_ENABLED)
    int mem_base;
    int ret_val;
    void * ctx; /* an FTP context */
    int n_ctx;

    for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
        mem_base = xmlMemBlocks();
        ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);

        ret_val = xmlNanoFTPGetConnection(ctx);
        desret_int(ret_val);
        call_tests++;
        des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlNanoFTPGetConnection",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_ctx);
            printf("\n");
        }
    }
    function_tests++;
#endif

    return(test_ret);
}


static int
test_xmlNanoFTPGetResponse(void) {
    int test_ret = 0;

#if defined(LIBXML_FTP_ENABLED)
    int mem_base;
    int ret_val;
    void * ctx; /* an FTP context */
    int n_ctx;

    for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
        mem_base = xmlMemBlocks();
        ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);

        ret_val = xmlNanoFTPGetResponse(ctx);
        desret_int(ret_val);
        call_tests++;
        des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlNanoFTPGetResponse",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_ctx);
            printf("\n");
        }
    }
    function_tests++;
#endif

    return(test_ret);
}


static int
test_xmlNanoFTPGetSocket(void) {
    int test_ret = 0;

#if defined(LIBXML_FTP_ENABLED)
    int mem_base;
    int ret_val;
    void * ctx; /* an FTP context */
    int n_ctx;
    const char * filename; /* the file to retrieve (or NULL if path is in context). */
    int n_filename;

    for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
    for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
        mem_base = xmlMemBlocks();
        ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
        filename = gen_filepath(n_filename, 1);

        ret_val = xmlNanoFTPGetSocket(ctx, filename);
        desret_int(ret_val);
        call_tests++;
        des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
        des_filepath(n_filename, filename, 1);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlNanoFTPGetSocket",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_ctx);
            printf(" %d", n_filename);
            printf("\n");
        }
    }
    }
    function_tests++;
#endif

    return(test_ret);
}


static int
test_xmlNanoFTPInit(void) {
    int test_ret = 0;

#if defined(LIBXML_FTP_ENABLED)
    int mem_base;

        mem_base = xmlMemBlocks();

        xmlNanoFTPInit();
        call_tests++;
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlNanoFTPInit",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf("\n");
        }
    function_tests++;
#endif

    return(test_ret);
}


static int
test_xmlNanoFTPList(void) {
    int test_ret = 0;


    /* missing type support */
    return(test_ret);
}


static int
test_xmlNanoFTPNewCtxt(void) {
    int test_ret = 0;

#if defined(LIBXML_FTP_ENABLED)
    int mem_base;
    void * ret_val;
    const char * URL; /* The URL used to initialize the context */
    int n_URL;

    for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
        mem_base = xmlMemBlocks();
        URL = gen_filepath(n_URL, 0);

        ret_val = xmlNanoFTPNewCtxt(URL);
        desret_xmlNanoFTPCtxtPtr(ret_val);
        call_tests++;
        des_filepath(n_URL, URL, 0);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlNanoFTPNewCtxt",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_URL);
            printf("\n");
        }
    }
    function_tests++;
#endif

    return(test_ret);
}


static int
test_xmlNanoFTPOpen(void) {
    int test_ret = 0;

#if defined(LIBXML_FTP_ENABLED)
    int mem_base;
    void * ret_val;
    const char * URL; /* the URL to the resource */
    int n_URL;

    for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
        mem_base = xmlMemBlocks();
        URL = gen_filepath(n_URL, 0);

        ret_val = xmlNanoFTPOpen(URL);
        desret_xmlNanoFTPCtxtPtr(ret_val);
        call_tests++;
        des_filepath(n_URL, URL, 0);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlNanoFTPOpen",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_URL);
            printf("\n");
        }
    }
    function_tests++;
#endif

    return(test_ret);
}


static int
test_xmlNanoFTPProxy(void) {
    int test_ret = 0;

#if defined(LIBXML_FTP_ENABLED)
    char * host; /* the proxy host name */
    int n_host;
    int port; /* the proxy port */
    int n_port;
    char * user; /* the proxy user name */
    int n_user;
    char * passwd; /* the proxy password */
    int n_passwd;
    int type; /* the type of proxy 1 for using SITE, 2 for USER a@b */
    int n_type;

    for (n_host = 0;n_host < gen_nb_const_char_ptr;n_host++) {
    for (n_port = 0;n_port < gen_nb_int;n_port++) {
    for (n_user = 0;n_user < gen_nb_const_char_ptr;n_user++) {
    for (n_passwd = 0;n_passwd < gen_nb_const_char_ptr;n_passwd++) {
    for (n_type = 0;n_type < gen_nb_int;n_type++) {
        host = gen_const_char_ptr(n_host, 0);
        port = gen_int(n_port, 1);
        user = gen_const_char_ptr(n_user, 2);
        passwd = gen_const_char_ptr(n_passwd, 3);
        type = gen_int(n_type, 4);

        xmlNanoFTPProxy((const char *)host, port, (const char *)user, (const char *)passwd, type);
        call_tests++;
        des_const_char_ptr(n_host, (const char *)host, 0);
        des_int(n_port, port, 1);
        des_const_char_ptr(n_user, (const char *)user, 2);
        des_const_char_ptr(n_passwd, (const char *)passwd, 3);
        des_int(n_type, type, 4);
        xmlResetLastError();
    }
    }
    }
    }
    }
    function_tests++;
#endif

    return(test_ret);
}


static int
test_xmlNanoFTPQuit(void) {
    int test_ret = 0;

#if defined(LIBXML_FTP_ENABLED)
    int mem_base;
    int ret_val;
    void * ctx; /* an FTP context */
    int n_ctx;

    for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
        mem_base = xmlMemBlocks();
        ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);

        ret_val = xmlNanoFTPQuit(ctx);
        desret_int(ret_val);
        call_tests++;
        des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlNanoFTPQuit",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_ctx);
            printf("\n");
        }
    }
    function_tests++;
#endif

    return(test_ret);
}


static int
test_xmlNanoFTPRead(void) {
    int test_ret = 0;

#if defined(LIBXML_FTP_ENABLED)
    int mem_base;
    int ret_val;
    void * ctx; /* the FTP 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_xmlNanoFTPCtxtPtr;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_xmlNanoFTPCtxtPtr(n_ctx, 0);
        dest = gen_void_ptr(n_dest, 1);
        len = gen_int(n_len, 2);

        ret_val = xmlNanoFTPRead(ctx, dest, len);
        desret_int(ret_val);
        call_tests++;
        des_xmlNanoFTPCtxtPtr(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 xmlNanoFTPRead",
	           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_xmlNanoFTPScanProxy(void) {
    int test_ret = 0;

#if defined(LIBXML_FTP_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);

        xmlNanoFTPScanProxy(URL);
        call_tests++;
        des_filepath(n_URL, URL, 0);
        xmlResetLastError();
    }
    function_tests++;
#endif

    return(test_ret);
}


static int
test_xmlNanoFTPUpdateURL(void) {
    int test_ret = 0;

#if defined(LIBXML_FTP_ENABLED)
    int mem_base;
    int ret_val;
    void * ctx; /* an FTP context */
    int n_ctx;
    const char * URL; /* The URL used to update the context */
    int n_URL;

    for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
    for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
        mem_base = xmlMemBlocks();
        ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
        URL = gen_filepath(n_URL, 1);

        ret_val = xmlNanoFTPUpdateURL(ctx, URL);
        desret_int(ret_val);
        call_tests++;
        des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
        des_filepath(n_URL, URL, 1);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlNanoFTPUpdateURL",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_ctx);
            printf(" %d", n_URL);
            printf("\n");
        }
    }
    }
    function_tests++;
#endif

    return(test_ret);
}

static int
test_nanoftp(void) {
    int test_ret = 0;

    if (quiet == 0) printf("Testing nanoftp : 16 of 22 functions ...\n");
    test_ret += test_xmlNanoFTPCheckResponse();
    test_ret += test_xmlNanoFTPCleanup();
    test_ret += test_xmlNanoFTPCloseConnection();
    test_ret += test_xmlNanoFTPCwd();
    test_ret += test_xmlNanoFTPDele();
    test_ret += test_xmlNanoFTPGet();
    test_ret += test_xmlNanoFTPGetConnection();
    test_ret += test_xmlNanoFTPGetResponse();
    test_ret += test_xmlNanoFTPGetSocket();
    test_ret += test_xmlNanoFTPInit();
    test_ret += test_xmlNanoFTPList();
    test_ret += test_xmlNanoFTPNewCtxt();
    test_ret += test_xmlNanoFTPOpen();
    test_ret += test_xmlNanoFTPProxy();
    test_ret += test_xmlNanoFTPQuit();
    test_ret += test_xmlNanoFTPRead();
    test_ret += test_xmlNanoFTPScanProxy();
    test_ret += test_xmlNanoFTPUpdateURL();

    if (test_ret != 0)
	printf("Module nanoftp: %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
static char ** gen_char_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    return(NULL);
}
static void des_char_ptr_ptr(int no ATTRIBUTE_UNUSED, char ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
}

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_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;
    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 = xmlCreateDocParserCtxt((const xmlChar *)cur);
        desret_xmlParserCtxtPtr(ret_val);
        call_tests++;
        des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlCreateDocParserCtxt",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_cur);
            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 */
    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;

    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);

        ret_val = xmlCreatePushParserCtxt(sax, user_data, (const char *)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, (const char *)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_xmlCtxtReadDoc(void) {
    int test_ret = 0;

    int mem_base;
    xmlDocPtr ret_val;
    xmlParserCtxtPtr ctxt; /* an XML 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 xmlParserOption */
    int n_options;

    for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;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_parseroptions;n_options++) {
        mem_base = xmlMemBlocks();
        ctxt = gen_xmlParserCtxtPtr(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_parseroptions(n_options, 4);

        ret_val = xmlCtxtReadDoc(ctxt, (const xmlChar *)cur, URL, (const char *)encoding, options);
        desret_xmlDocPtr(ret_val);
        call_tests++;
        des_xmlParserCtxtPtr(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_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_cur);
            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;
    char * encoding; /* the document encoding, or NULL */
    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, (const char *)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, (const char *)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;
    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 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);

        ret_val = xmlCtxtReadMemory(ctxt, (const char *)buffer, size, URL, (const char *)encoding, options);
        desret_xmlDocPtr(ret_val);
        call_tests++;
        des_xmlParserCtxtPtr(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_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;
    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;
    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);

        ret_val = xmlCtxtResetPush(ctxt, (const char *)chunk, size, filename, (const char *)encoding);
        desret_int(ret_val);
        call_tests++;
        des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
        des_const_char_ptr(n_chunk, (const char *)chunk, 1);
        des_int(n_size, size, 2);
        des_filepath(n_filename, filename, 3);
        des_const_char_ptr(n_encoding, (const char *)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_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_xmlGetExternalEntityLoader(void) {
    int test_ret = 0;


    /* missing type support */
    return(test_ret);
}


static int
test_xmlGetFeature(void) {
    int test_ret = 0;

#if defined(LIBXML_LEGACY_ENABLED)
#ifdef LIBXML_LEGACY_ENABLED
    int mem_base;
    int ret_val;
    xmlParserCtxtPtr ctxt; /* an XML/HTML parser context */
    int n_ctxt;
    char * name; /* the feature name */
    int n_name;
    void * result; /* location to store the result */
    int n_result;

    for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
    for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
    for (n_result = 0;n_result < gen_nb_void_ptr;n_result++) {
        mem_base = xmlMemBlocks();
        ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
        name = gen_const_char_ptr(n_name, 1);
        result = gen_void_ptr(n_result, 2);

        ret_val = xmlGetFeature(ctxt, (const char *)name, result);
        desret_int(ret_val);
        call_tests++;
        des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
        des_const_char_ptr(n_name, (const char *)name, 1);
        des_void_ptr(n_result, result, 2);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlGetFeature",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_ctxt);
            printf(" %d", n_name);
            printf(" %d", n_result);
            printf("\n");
        }
    }
    }
    }
    function_tests++;
#endif
#endif

    return(test_ret);
}


#define gen_nb_const_char_ptr_ptr 1
static char ** gen_const_char_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    return(NULL);
}
static void des_const_char_ptr_ptr(int no ATTRIBUTE_UNUSED, const char ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
}

static int
test_xmlGetFeaturesList(void) {
    int test_ret = 0;

#if defined(LIBXML_LEGACY_ENABLED)
#ifdef LIBXML_LEGACY_ENABLED
    int mem_base;
    int ret_val;
    int * len; /* the length of the features name array (input/output) */
    int n_len;
    char ** result; /* an array of string to be filled with the features name. */
    int n_result;

    for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
    for (n_result = 0;n_result < gen_nb_const_char_ptr_ptr;n_result++) {
        mem_base = xmlMemBlocks();
        len = gen_int_ptr(n_len, 0);
        result = gen_const_char_ptr_ptr(n_result, 1);

        ret_val = xmlGetFeaturesList(len, (const char **)result);
        desret_int(ret_val);
        call_tests++;
        des_int_ptr(n_len, len, 0);
        des_const_char_ptr_ptr(n_result, (const char **)result, 1);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlGetFeaturesList",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_len);
            printf(" %d", n_result);
            printf("\n");
        }
    }
    }
    function_tests++;
#endif
#endif

    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_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_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;
    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, (const char *)ID, ctxt);
        desret_xmlParserInputPtr(ret_val);
        call_tests++;
        des_filepath(n_URL, URL, 0);
        des_const_char_ptr(n_ID, (const char *)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 input; /* an I/O Input */
    int n_input;
    xmlCharEncoding enc; /* the charset encoding if known */
    int n_enc;

    for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
    for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
    for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
        mem_base = xmlMemBlocks();
        ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
        input = gen_xmlParserInputBufferPtr(n_input, 1);
        enc = gen_xmlCharEncoding(n_enc, 2);

        ret_val = xmlNewIOInputStream(ctxt, input, enc);
        if (ret_val != NULL) input = NULL;
        desret_xmlParserInputPtr(ret_val);
        call_tests++;
        des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
        des_xmlParserInputBufferPtr(n_input, input, 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_input);
            printf(" %d", n_enc);
            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);
}


#define gen_nb_xmlNodePtr_ptr 1
static xmlNodePtr * gen_xmlNodePtr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    return(NULL);
}
static void des_xmlNodePtr_ptr(int no ATTRIBUTE_UNUSED, xmlNodePtr * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
}

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 */
    int n_doc;
    xmlSAXHandlerPtr sax; /* the SAX handler bloc (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;
    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, (const xmlChar *)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, (const xmlChar *)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 */
    int n_doc;
    xmlSAXHandlerPtr sax; /* the SAX handler bloc (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;
    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;
    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_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
    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);
        lst = gen_xmlNodePtr_ptr(n_lst, 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, (const xmlChar *)string, lst, 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, (const xmlChar *)string, 4);
        des_xmlNodePtr_ptr(n_lst, lst, 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_lst);
            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;
    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_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);

        ret_val = xmlParseChunk(ctxt, (const char *)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, (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 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 ctx; /* the existing parsing context */
    int n_ctx;
    xmlChar * URL; /* the URL for the entity to load */
    int n_URL;
    xmlChar * ID; /* the System ID for the entity to load */
    int n_ID;
    xmlNodePtr * lst; /* the return value for the set of parsed nodes */
    int n_lst;

    for (n_ctx = 0;n_ctx < gen_nb_xmlParserCtxtPtr;n_ctx++) {
    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_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
        mem_base = xmlMemBlocks();
        ctx = gen_xmlParserCtxtPtr(n_ctx, 0);
        URL = gen_const_xmlChar_ptr(n_URL, 1);
        ID = gen_const_xmlChar_ptr(n_ID, 2);
        lst = gen_xmlNodePtr_ptr(n_lst, 3);

        ret_val = xmlParseCtxtExternalEntity(ctx, (const xmlChar *)URL, (const xmlChar *)ID, lst);
        desret_int(ret_val);
        call_tests++;
        des_xmlParserCtxtPtr(n_ctx, ctx, 0);
        des_const_xmlChar_ptr(n_URL, (const xmlChar *)URL, 1);
        des_const_xmlChar_ptr(n_ID, (const xmlChar *)ID, 2);
        des_xmlNodePtr_ptr(n_lst, lst, 3);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlParseCtxtExternalEntity",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_ctx);
            printf(" %d", n_URL);
            printf(" %d", n_ID);
            printf(" %d", n_lst);
            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;
    xmlChar * ExternalID; /* a NAME* containing the External ID of the DTD */
    int n_ExternalID;
    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((const xmlChar *)ExternalID, (const xmlChar *)SystemID);
        desret_xmlDtdPtr(ret_val);
        call_tests++;
        des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 0);
        des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)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;
    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((const xmlChar *)cur);
        desret_xmlDocPtr(ret_val);
        call_tests++;
        des_const_xmlChar_ptr(n_cur, (const xmlChar *)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 bloc (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;
    xmlChar * URL; /* the URL for the entity to load */
    int n_URL;
    xmlChar * ID; /* the System ID for the entity to load */
    int n_ID;
    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_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_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);
        URL = gen_const_xmlChar_ptr(n_URL, 4);
        ID = gen_const_xmlChar_ptr(n_ID, 5);
        lst = gen_xmlNodePtr_ptr(n_lst, 6);

        ret_val = xmlParseExternalEntity(doc, sax, user_data, depth, (const xmlChar *)URL, (const xmlChar *)ID, 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_URL, (const xmlChar *)URL, 4);
        des_const_xmlChar_ptr(n_ID, (const xmlChar *)ID, 5);
        des_xmlNodePtr_ptr(n_lst, lst, 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_lst);
            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;
    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 * lst; /* the return value for the set of parsed nodes */
    int n_lst;

    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_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
        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);
        lst = gen_xmlNodePtr_ptr(n_lst, 4);

        ret_val = xmlParseInNodeContext(node, (const char *)data, datalen, options, lst);
        desret_xmlParserErrors(ret_val);
        call_tests++;
        des_xmlNodePtr(n_node, node, 0);
        des_const_char_ptr(n_data, (const char *)data, 1);
        des_int(n_datalen, datalen, 2);
        des_parseroptions(n_options, options, 3);
        des_xmlNodePtr_ptr(n_lst, lst, 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_lst);
            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;
    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);

        ret_val = xmlParseMemory((const char *)buffer, size);
        desret_xmlDocPtr(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 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_const_xmlParserNodeInfoPtr 1
static xmlParserNodeInfoPtr gen_const_xmlParserNodeInfoPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    return(NULL);
}
static void des_const_xmlParserNodeInfoPtr(int no ATTRIBUTE_UNUSED, const xmlParserNodeInfoPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
}

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_const_xmlParserNodeInfoPtr;n_info++) {
        mem_base = xmlMemBlocks();
        ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
        info = gen_const_xmlParserNodeInfoPtr(n_info, 1);

        xmlParserAddNodeInfo(ctxt, (const xmlParserNodeInfoPtr)info);
        call_tests++;
        des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
        des_const_xmlParserNodeInfoPtr(n_info, (const xmlParserNodeInfoPtr)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);
}


#define gen_nb_const_xmlParserCtxtPtr 1
static xmlParserCtxtPtr gen_const_xmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    return(NULL);
}
static void des_const_xmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, const xmlParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
}

#define gen_nb_const_xmlNodePtr 1
static xmlNodePtr gen_const_xmlNodePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    return(NULL);
}
static void des_const_xmlNodePtr(int no ATTRIBUTE_UNUSED, const xmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
}

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_const_xmlParserCtxtPtr;n_ctx++) {
    for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
        mem_base = xmlMemBlocks();
        ctx = gen_const_xmlParserCtxtPtr(n_ctx, 0);
        node = gen_const_xmlNodePtr(n_node, 1);

        ret_val = xmlParserFindNodeInfo((const xmlParserCtxtPtr)ctx, (const xmlNodePtr)node);
        desret_const_xmlParserNodeInfo_ptr(ret_val);
        call_tests++;
        des_const_xmlParserCtxtPtr(n_ctx, (const xmlParserCtxtPtr)ctx, 0);
        des_const_xmlNodePtr(n_node, (const xmlNodePtr)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);
}


#define gen_nb_const_xmlParserNodeInfoSeqPtr 1
static xmlParserNodeInfoSeqPtr gen_const_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    return(NULL);
}
static void des_const_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, const xmlParserNodeInfoSeqPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
}

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_const_xmlParserNodeInfoSeqPtr;n_seq++) {
    for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
        mem_base = xmlMemBlocks();
        seq = gen_const_xmlParserNodeInfoSeqPtr(n_seq, 0);
        node = gen_const_xmlNodePtr(n_node, 1);

        ret_val = xmlParserFindNodeInfoIndex((const xmlParserNodeInfoSeqPtr)seq, (const xmlNodePtr)node);
        desret_unsigned_long(ret_val);
        call_tests++;
        des_const_xmlParserNodeInfoSeqPtr(n_seq, (const xmlParserNodeInfoSeqPtr)seq, 0);
        des_const_xmlNodePtr(n_node, (const xmlNodePtr)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);
}


#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) {
}

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;
    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 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((const xmlChar *)cur, URL, (const char *)encoding, options);
        desret_xmlDocPtr(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_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;
    char * encoding; /* the document encoding, or NULL */
    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, (const char *)encoding, options);
        desret_xmlDocPtr(ret_val);
        call_tests++;
        des_filepath(n_filename, filename, 0);
        des_const_char_ptr(n_encoding, (const char *)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;
    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 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);

        ret_val = xmlReadMemory((const char *)buffer, size, URL, (const char *)encoding, options);
        desret_xmlDocPtr(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_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;
    xmlChar * cur; /* a pointer to an array of xmlChar */
    int n_cur;

    for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
        mem_base = xmlMemBlocks();
        cur = gen_xmlChar_ptr(n_cur, 0);

        ret_val = xmlRecoverDoc(cur);
        desret_xmlDocPtr(ret_val);
        call_tests++;
        des_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;
    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);

        ret_val = xmlRecoverMemory((const char *)buffer, size);
        desret_xmlDocPtr(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 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;
    xmlChar * ExternalID; /* a NAME* containing the External ID of the DTD */
    int n_ExternalID;
    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, (const xmlChar *)ExternalID, (const xmlChar *)SystemID);
        desret_xmlDtdPtr(ret_val);
        call_tests++;
        des_xmlSAXHandlerPtr(n_sax, sax, 0);
        des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 1);
        des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)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;
    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, (const xmlChar *)cur, recovery);
        desret_xmlDocPtr(ret_val);
        call_tests++;
        des_xmlSAXHandlerPtr(n_sax, sax, 0);
        des_const_xmlChar_ptr(n_cur, (const xmlChar *)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;
    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);

        ret_val = xmlSAXParseMemory(sax, (const char *)buffer, size, recovery);
        desret_xmlDocPtr(ret_val);
        call_tests++;
        des_xmlSAXHandlerPtr(n_sax, sax, 0);
        des_const_char_ptr(n_buffer, (const char *)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;
    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);

        ret_val = xmlSAXParseMemoryWithData(sax, (const char *)buffer, size, recovery, data);
        desret_xmlDocPtr(ret_val);
        call_tests++;
        des_xmlSAXHandlerPtr(n_sax, sax, 0);
        des_const_char_ptr(n_buffer, (const char *)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;
    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);
        
#ifdef LIBXML_SAX1_ENABLED
        if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
#endif


        ret_val = xmlSAXUserParseMemory(sax, user_data, (const char *)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, (const char *)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_xmlSetFeature(void) {
    int test_ret = 0;

#if defined(LIBXML_LEGACY_ENABLED)
#ifdef LIBXML_LEGACY_ENABLED
    int mem_base;
    int ret_val;
    xmlParserCtxtPtr ctxt; /* an XML/HTML parser context */
    int n_ctxt;
    char * name; /* the feature name */
    int n_name;
    void * value; /* pointer to the location of the new value */
    int n_value;

    for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
    for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
    for (n_value = 0;n_value < gen_nb_void_ptr;n_value++) {
        mem_base = xmlMemBlocks();
        ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
        name = gen_const_char_ptr(n_name, 1);
        value = gen_void_ptr(n_value, 2);

        ret_val = xmlSetFeature(ctxt, (const char *)name, value);
        desret_int(ret_val);
        call_tests++;
        des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
        des_const_char_ptr(n_name, (const char *)name, 1);
        des_void_ptr(n_value, value, 2);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlSetFeature",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_ctxt);
            printf(" %d", n_name);
            printf(" %d", n_value);
            printf("\n");
        }
    }
    }
    }
    function_tests++;
#endif
#endif

    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;
    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, (const xmlChar *)buffer, filename);
        call_tests++;
        des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
        des_const_xmlChar_ptr(n_buffer, (const xmlChar *)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);
}


static int
test_xmlStopParser(void) {
    int test_ret = 0;

#ifdef LIBXML_PUSH_ENABLED
    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);

        xmlStopParser(ctxt);
        call_tests++;
        des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlStopParser",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_ctxt);
            printf("\n");
        }
    }
    function_tests++;
#endif

    return(test_ret);
}


static int
test_xmlSubstituteEntitiesDefault(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 = xmlSubstituteEntitiesDefault(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 xmlSubstituteEntitiesDefault",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_val);
            printf("\n");
        }
    }
    function_tests++;

    return(test_ret);
}

static int
test_parser(void) {
    int test_ret = 0;

    if (quiet == 0) printf("Testing parser : 61 of 70 functions ...\n");
    test_ret += test_xmlByteConsumed();
    test_ret += test_xmlClearNodeInfoSeq();
    test_ret += test_xmlClearParserCtxt();
    test_ret += test_xmlCreateDocParserCtxt();
    test_ret += test_xmlCreatePushParserCtxt();
    test_ret += test_xmlCtxtReadDoc();
    test_ret += test_xmlCtxtReadFile();
    test_ret += test_xmlCtxtReadMemory();
    test_ret += test_xmlCtxtReset();
    test_ret += test_xmlCtxtResetPush();
    test_ret += test_xmlCtxtUseOptions();
    test_ret += test_xmlGetExternalEntityLoader();
    test_ret += test_xmlGetFeature();
    test_ret += test_xmlGetFeaturesList();
    test_ret += test_xmlHasFeature();
    test_ret += test_xmlIOParseDTD();
    test_ret += test_xmlInitNodeInfoSeq();
    test_ret += test_xmlInitParser();
    test_ret += test_xmlInitParserCtxt();
    test_ret += test_xmlKeepBlanksDefault();
    test_ret += test_xmlLineNumbersDefault();
    test_ret += test_xmlLoadExternalEntity();
    test_ret += test_xmlNewIOInputStream();
    test_ret += test_xmlNewParserCtxt();
    test_ret += test_xmlParseBalancedChunkMemory();
    test_ret += test_xmlParseBalancedChunkMemoryRecover();
    test_ret += test_xmlParseChunk();
    test_ret += test_xmlParseCtxtExternalEntity();
    test_ret += test_xmlParseDTD();
    test_ret += test_xmlParseDoc();
    test_ret += test_xmlParseDocument();
    test_ret += test_xmlParseEntity();
    test_ret += test_xmlParseExtParsedEnt();
    test_ret += test_xmlParseExternalEntity();
    test_ret += test_xmlParseFile();
    test_ret += test_xmlParseInNodeContext();
    test_ret += test_xmlParseMemory();
    test_ret += test_xmlParserAddNodeInfo();
    test_ret += test_xmlParserFindNodeInfo();
    test_ret += test_xmlParserFindNodeInfoIndex();
    test_ret += test_xmlParserInputGrow();
    test_ret += test_xmlParserInputRead();
    test_ret += test_xmlPedanticParserDefault();
    test_ret += test_xmlReadDoc();
    test_ret += test_xmlReadFile();
    test_ret += test_xmlReadMemory();
    test_ret += test_xmlRecoverDoc();
    test_ret += test_xmlRecoverFile();
    test_ret += test_xmlRecoverMemory();
    test_ret += test_xmlSAXParseDTD();
    test_ret += test_xmlSAXParseDoc();
    test_ret += test_xmlSAXParseEntity();
    test_ret += test_xmlSAXParseFile();
    test_ret += test_xmlSAXParseFileWithData();
    test_ret += test_xmlSAXParseMemory();
    test_ret += test_xmlSAXParseMemoryWithData();
    test_ret += test_xmlSAXUserParseFile();
    test_ret += test_xmlSAXUserParseMemory();
    test_ret += test_xmlSetExternalEntityLoader();
    test_ret += test_xmlSetFeature();
    test_ret += test_xmlSetupParserForBuffer();
    test_ret += test_xmlStopParser();
    test_ret += test_xmlSubstituteEntitiesDefault();

    if (test_ret != 0)
	printf("Module parser: %d errors\n", test_ret);
    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;
    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_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, (const char *)encoding);
        desret_htmlParserCtxtPtr(ret_val);
        call_tests++;
        des_fileoutput(n_filename, filename, 0);
        des_const_char_ptr(n_encoding, (const char *)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_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_inputPop(void) {
    int test_ret = 0;

    int mem_base;
    xmlParserInputPtr 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 = inputPop(ctxt);
        desret_xmlParserInputPtr(ret_val);
        call_tests++;
        des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in inputPop",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_ctxt);
            printf("\n");
        }
    }
    function_tests++;

    return(test_ret);
}


static int
test_inputPush(void) {
    int test_ret = 0;

    int mem_base;
    int ret_val;
    xmlParserCtxtPtr ctxt; /* an XML parser context */
    int n_ctxt;
    xmlParserInputPtr value; /* the parser input */
    int n_value;

    for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
    for (n_value = 0;n_value < gen_nb_xmlParserInputPtr;n_value++) {
        mem_base = xmlMemBlocks();
        ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
        value = gen_xmlParserInputPtr(n_value, 1);

        ret_val = inputPush(ctxt, value);
        desret_int(ret_val);
        call_tests++;
        des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
        des_xmlParserInputPtr(n_value, value, 1);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in inputPush",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_ctxt);
            printf(" %d", n_value);
            printf("\n");
        }
    }
    }
    function_tests++;

    return(test_ret);
}


static int
test_namePop(void) {
    int test_ret = 0;

    int mem_base;
    const xmlChar * 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 = namePop(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 namePop",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_ctxt);
            printf("\n");
        }
    }
    function_tests++;

    return(test_ret);
}


static int
test_namePush(void) {
    int test_ret = 0;

    int mem_base;
    int ret_val;
    xmlParserCtxtPtr ctxt; /* an XML parser context */
    int n_ctxt;
    xmlChar * value; /* the element name */
    int n_value;

    for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
    for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
        mem_base = xmlMemBlocks();
        ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
        value = gen_const_xmlChar_ptr(n_value, 1);

        ret_val = namePush(ctxt, (const xmlChar *)value);
        desret_int(ret_val);
        call_tests++;
        des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
        des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in namePush",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_ctxt);
            printf(" %d", n_value);
            printf("\n");
        }
    }
    }
    function_tests++;

    return(test_ret);
}


static int
test_nodePop(void) {
    int test_ret = 0;

    int mem_base;
    xmlNodePtr 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 = nodePop(ctxt);
        desret_xmlNodePtr(ret_val);
        call_tests++;
        des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in nodePop",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_ctxt);
            printf("\n");
        }
    }
    function_tests++;

    return(test_ret);
}


static int
test_nodePush(void) {
    int test_ret = 0;

    int mem_base;
    int ret_val;
    xmlParserCtxtPtr ctxt; /* an XML parser context */
    int n_ctxt;
    xmlNodePtr value; /* the element node */
    int n_value;

    for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
    for (n_value = 0;n_value < gen_nb_xmlNodePtr;n_value++) {
        mem_base = xmlMemBlocks();
        ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
        value = gen_xmlNodePtr(n_value, 1);

        ret_val = nodePush(ctxt, value);
        desret_int(ret_val);
        call_tests++;
        des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
        des_xmlNodePtr(n_value, value, 1);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in nodePush",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_ctxt);
            printf(" %d", n_value);
            printf("\n");
        }
    }
    }
    function_tests++;

    return(test_ret);
}


static int
test_xmlCheckLanguageID(void) {
    int test_ret = 0;

    int mem_base;
    int ret_val;
    xmlChar * lang; /* pointer to the string value */
    int n_lang;

    for (n_lang = 0;n_lang < gen_nb_const_xmlChar_ptr;n_lang++) {
        mem_base = xmlMemBlocks();
        lang = gen_const_xmlChar_ptr(n_lang, 0);

        ret_val = xmlCheckLanguageID((const xmlChar *)lang);
        desret_int(ret_val);
        call_tests++;
        des_const_xmlChar_ptr(n_lang, (const xmlChar *)lang, 0);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlCheckLanguageID",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_lang);
            printf("\n");
        }
    }
    function_tests++;

    return(test_ret);
}


static int
test_xmlCopyChar(void) {
    int test_ret = 0;

    int mem_base;
    int ret_val;
    int len; /* Ignored, compatibility */
    int n_len;
    xmlChar * out; /* pointer to an array of xmlChar */
    int n_out;
    int val; /* the char value */
    int n_val;

    for (n_len = 0;n_len < gen_nb_int;n_len++) {
    for (n_out = 0;n_out < gen_nb_xmlChar_ptr;n_out++) {
    for (n_val = 0;n_val < gen_nb_int;n_val++) {
        mem_base = xmlMemBlocks();
        len = gen_int(n_len, 0);
        out = gen_xmlChar_ptr(n_out, 1);
        val = gen_int(n_val, 2);

        ret_val = xmlCopyChar(len, out, val);
        desret_int(ret_val);
        call_tests++;
        des_int(n_len, len, 0);
        des_xmlChar_ptr(n_out, out, 1);
        des_int(n_val, val, 2);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlCopyChar",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_len);
            printf(" %d", n_out);
            printf(" %d", n_val);
            printf("\n");
        }
    }
    }
    }
    function_tests++;

    return(test_ret);
}


static int
test_xmlCopyCharMultiByte(void) {
    int test_ret = 0;

    int mem_base;
    int ret_val;
    xmlChar * out; /* pointer to an array of xmlChar */
    int n_out;
    int val; /* the char value */
    int n_val;

    for (n_out = 0;n_out < gen_nb_xmlChar_ptr;n_out++) {
    for (n_val = 0;n_val < gen_nb_int;n_val++) {
        mem_base = xmlMemBlocks();
        out = gen_xmlChar_ptr(n_out, 0);
        val = gen_int(n_val, 1);

        ret_val = xmlCopyCharMultiByte(out, val);
        desret_int(ret_val);
        call_tests++;
        des_xmlChar_ptr(n_out, out, 0);
        des_int(n_val, val, 1);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlCopyCharMultiByte",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_out);
            printf(" %d", n_val);
            printf("\n");
        }
    }
    }
    function_tests++;

    return(test_ret);
}


static int
test_xmlCreateEntityParserCtxt(void) {
    int test_ret = 0;

    int mem_base;
    xmlParserCtxtPtr ret_val;
    xmlChar * URL; /* the entity URL */
    int n_URL;
    xmlChar * ID; /* the entity PUBLIC ID */
    int n_ID;
    xmlChar * base; /* a possible base for the target URI */
    int n_base;

    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_base = 0;n_base < gen_nb_const_xmlChar_ptr;n_base++) {
        mem_base = xmlMemBlocks();
        URL = gen_const_xmlChar_ptr(n_URL, 0);
        ID = gen_const_xmlChar_ptr(n_ID, 1);
        base = gen_const_xmlChar_ptr(n_base, 2);

        ret_val = xmlCreateEntityParserCtxt((const xmlChar *)URL, (const xmlChar *)ID, (const xmlChar *)base);
        desret_xmlParserCtxtPtr(ret_val);
        call_tests++;
        des_const_xmlChar_ptr(n_URL, (const xmlChar *)URL, 0);
        des_const_xmlChar_ptr(n_ID, (const xmlChar *)ID, 1);
        des_const_xmlChar_ptr(n_base, (const xmlChar *)base, 2);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlCreateEntityParserCtxt",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_URL);
            printf(" %d", n_ID);
            printf(" %d", n_base);
            printf("\n");
        }
    }
    }
    }
    function_tests++;

    return(test_ret);
}


static int
test_xmlCreateFileParserCtxt(void) {
    int test_ret = 0;

    int mem_base;
    xmlParserCtxtPtr ret_val;
    const char * filename; /* the filename */
    int n_filename;

    for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
        mem_base = xmlMemBlocks();
        filename = gen_fileoutput(n_filename, 0);

        ret_val = xmlCreateFileParserCtxt(filename);
        desret_xmlParserCtxtPtr(ret_val);
        call_tests++;
        des_fileoutput(n_filename, filename, 0);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlCreateFileParserCtxt",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_filename);
            printf("\n");
        }
    }
    function_tests++;

    return(test_ret);
}


static int
test_xmlCreateMemoryParserCtxt(void) {
    int test_ret = 0;

    int mem_base;
    xmlParserCtxtPtr 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 = xmlCreateMemoryParserCtxt((const char *)buffer, size);
        desret_xmlParserCtxtPtr(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 xmlCreateMemoryParserCtxt",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_buffer);
            printf(" %d", n_size);
            printf("\n");
        }
    }
    }
    function_tests++;

    return(test_ret);
}


static int
test_xmlCreateURLParserCtxt(void) {
    int test_ret = 0;

    int mem_base;
    xmlParserCtxtPtr ret_val;
    const char * filename; /* the filename or URL */
    int n_filename;
    int options; /* a combination of xmlParserOption */
    int n_options;

    for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
    for (n_options = 0;n_options < gen_nb_int;n_options++) {
        mem_base = xmlMemBlocks();
        filename = gen_fileoutput(n_filename, 0);
        options = gen_int(n_options, 1);

        ret_val = xmlCreateURLParserCtxt(filename, options);
        desret_xmlParserCtxtPtr(ret_val);
        call_tests++;
        des_fileoutput(n_filename, filename, 0);
        des_int(n_options, options, 1);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlCreateURLParserCtxt",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_filename);
            printf(" %d", n_options);
            printf("\n");
        }
    }
    }
    function_tests++;

    return(test_ret);
}


static int
test_xmlCurrentChar(void) {
    int test_ret = 0;

    int mem_base;
    int ret_val;
    xmlParserCtxtPtr ctxt; /* the XML parser context */
    int n_ctxt;
    int * len; /* pointer to the length of the char read */
    int n_len;

    for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
    for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
        mem_base = xmlMemBlocks();
        ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
        len = gen_int_ptr(n_len, 1);

        ret_val = xmlCurrentChar(ctxt, len);
        desret_int(ret_val);
        call_tests++;
        des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
        des_int_ptr(n_len, len, 1);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlCurrentChar",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_ctxt);
            printf(" %d", n_len);
            printf("\n");
        }
    }
    }
    function_tests++;

    return(test_ret);
}


static int
test_xmlErrMemory(void) {
    int test_ret = 0;

    int mem_base;
    xmlParserCtxtPtr ctxt; /* an XML parser context */
    int n_ctxt;
    char * extra; /* extra informations */
    int n_extra;

    for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
    for (n_extra = 0;n_extra < gen_nb_const_char_ptr;n_extra++) {
        mem_base = xmlMemBlocks();
        ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
        extra = gen_const_char_ptr(n_extra, 1);

        xmlErrMemory(ctxt, (const char *)extra);
        call_tests++;
        des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
        des_const_char_ptr(n_extra, (const char *)extra, 1);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlErrMemory",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_ctxt);
            printf(" %d", n_extra);
            printf("\n");
        }
    }
    }
    function_tests++;

    return(test_ret);
}


static int
test_xmlIsLetter(void) {
    int test_ret = 0;

    int mem_base;
    int ret_val;
    int c; /* an unicode character (int) */
    int n_c;

    for (n_c = 0;n_c < gen_nb_int;n_c++) {
        mem_base = xmlMemBlocks();
        c = gen_int(n_c, 0);

        ret_val = xmlIsLetter(c);
        desret_int(ret_val);
        call_tests++;
        des_int(n_c, c, 0);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlIsLetter",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_c);
            printf("\n");
        }
    }
    function_tests++;

    return(test_ret);
}


static int
test_xmlNewEntityInputStream(void) {
    int test_ret = 0;

    int mem_base;
    xmlParserInputPtr ret_val;
    xmlParserCtxtPtr ctxt; /* an XML parser context */
    int n_ctxt;
    xmlEntityPtr entity; /* an Entity pointer */
    int n_entity;

    for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
    for (n_entity = 0;n_entity < gen_nb_xmlEntityPtr;n_entity++) {
        mem_base = xmlMemBlocks();
        ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
        entity = gen_xmlEntityPtr(n_entity, 1);

        ret_val = xmlNewEntityInputStream(ctxt, entity);
        desret_xmlParserInputPtr(ret_val);
        call_tests++;
        des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
        des_xmlEntityPtr(n_entity, entity, 1);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlNewEntityInputStream",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_ctxt);
            printf(" %d", n_entity);
            printf("\n");
        }
    }
    }
    function_tests++;

    return(test_ret);
}


static int
test_xmlNewInputFromFile(void) {
    int test_ret = 0;

    int mem_base;
    xmlParserInputPtr ret_val;
    xmlParserCtxtPtr ctxt; /* an XML parser context */
    int n_ctxt;
    const char * filename; /* the filename to use as entity */
    int n_filename;

    for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
    for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
        mem_base = xmlMemBlocks();
        ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
        filename = gen_filepath(n_filename, 1);

        ret_val = xmlNewInputFromFile(ctxt, filename);
        desret_xmlParserInputPtr(ret_val);
        call_tests++;
        des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
        des_filepath(n_filename, filename, 1);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlNewInputFromFile",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_ctxt);
            printf(" %d", n_filename);
            printf("\n");
        }
    }
    }
    function_tests++;

    return(test_ret);
}


static int
test_xmlNewInputStream(void) {
    int test_ret = 0;

    int mem_base;
    xmlParserInputPtr 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 = xmlNewInputStream(ctxt);
        desret_xmlParserInputPtr(ret_val);
        call_tests++;
        des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlNewInputStream",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_ctxt);
            printf("\n");
        }
    }
    function_tests++;

    return(test_ret);
}


static int
test_xmlNewStringInputStream(void) {
    int test_ret = 0;

    int mem_base;
    xmlParserInputPtr ret_val;
    xmlParserCtxtPtr ctxt; /* an XML parser context */
    int n_ctxt;
    xmlChar * buffer; /* an memory buffer */
    int n_buffer;

    for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
    for (n_buffer = 0;n_buffer < gen_nb_const_xmlChar_ptr;n_buffer++) {
        mem_base = xmlMemBlocks();
        ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
        buffer = gen_const_xmlChar_ptr(n_buffer, 1);

        ret_val = xmlNewStringInputStream(ctxt, (const xmlChar *)buffer);
        desret_xmlParserInputPtr(ret_val);
        call_tests++;
        des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
        des_const_xmlChar_ptr(n_buffer, (const xmlChar *)buffer, 1);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlNewStringInputStream",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_ctxt);
            printf(" %d", n_buffer);
            printf("\n");
        }
    }
    }
    function_tests++;

    return(test_ret);
}


static int
test_xmlNextChar(void) {
    int test_ret = 0;

    int mem_base;
    xmlParserCtxtPtr ctxt; /* the 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);

        xmlNextChar(ctxt);
        call_tests++;
        des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlNextChar",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_ctxt);
            printf("\n");
        }
    }
    function_tests++;

    return(test_ret);
}


static int
test_xmlParserInputShrink(void) {
    int test_ret = 0;

    int mem_base;
    xmlParserInputPtr in; /* an XML parser input */
    int n_in;

    for (n_in = 0;n_in < gen_nb_xmlParserInputPtr;n_in++) {
        mem_base = xmlMemBlocks();
        in = gen_xmlParserInputPtr(n_in, 0);

        xmlParserInputShrink(in);
        call_tests++;
        des_xmlParserInputPtr(n_in, in, 0);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlParserInputShrink",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_in);
            printf("\n");
        }
    }
    function_tests++;

    return(test_ret);
}


static int
test_xmlPopInput(void) {
    int test_ret = 0;

    int mem_base;
    xmlChar 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 = xmlPopInput(ctxt);
        desret_xmlChar(ret_val);
        call_tests++;
        des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlPopInput",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_ctxt);
            printf("\n");
        }
    }
    function_tests++;

    return(test_ret);
}


static int
test_xmlPushInput(void) {
    int test_ret = 0;

    int mem_base;
    int ret_val;
    xmlParserCtxtPtr ctxt; /* an XML parser context */
    int n_ctxt;
    xmlParserInputPtr input; /* an XML parser input fragment (entity, XML fragment ...). */
    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 = xmlPushInput(ctxt, input);
        desret_int(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 xmlPushInput",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_ctxt);
            printf(" %d", n_input);
            printf("\n");
        }
    }
    }
    function_tests++;

    return(test_ret);
}


static int
test_xmlSetEntityReferenceFunc(void) {
    int test_ret = 0;


    /* missing type support */
    return(test_ret);
}


static int
test_xmlSplitQName(void) {
    int test_ret = 0;

    int mem_base;
    xmlChar * ret_val;
    xmlParserCtxtPtr ctxt; /* an XML parser context */
    int n_ctxt;
    xmlChar * name; /* an XML parser context */
    int n_name;
    xmlChar ** prefix; /* a xmlChar ** */
    int n_prefix;

    for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
    for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
    for (n_prefix = 0;n_prefix < gen_nb_xmlChar_ptr_ptr;n_prefix++) {
        mem_base = xmlMemBlocks();
        ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
        name = gen_const_xmlChar_ptr(n_name, 1);
        prefix = gen_xmlChar_ptr_ptr(n_prefix, 2);

        ret_val = xmlSplitQName(ctxt, (const xmlChar *)name, prefix);
        desret_xmlChar_ptr(ret_val);
        call_tests++;
        des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
        des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
        des_xmlChar_ptr_ptr(n_prefix, prefix, 2);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlSplitQName",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_ctxt);
            printf(" %d", n_name);
            printf(" %d", n_prefix);
            printf("\n");
        }
    }
    }
    }
    function_tests++;

    return(test_ret);
}


static int
test_xmlStringCurrentChar(void) {
    int test_ret = 0;

    int mem_base;
    int ret_val;
    xmlParserCtxtPtr ctxt; /* the XML parser context */
    int n_ctxt;
    xmlChar * cur; /* pointer to the beginning of the char */
    int n_cur;
    int * len; /* pointer to the length of the char read */
    int n_len;

    for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
    for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
    for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
        mem_base = xmlMemBlocks();
        ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
        cur = gen_const_xmlChar_ptr(n_cur, 1);
        len = gen_int_ptr(n_len, 2);

        ret_val = xmlStringCurrentChar(ctxt, (const xmlChar *)cur, len);
        desret_int(ret_val);
        call_tests++;
        des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
        des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 1);
        des_int_ptr(n_len, len, 2);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlStringCurrentChar",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_ctxt);
            printf(" %d", n_cur);
            printf(" %d", n_len);
            printf("\n");
        }
    }
    }
    }
    function_tests++;

    return(test_ret);
}


static int
test_xmlStringDecodeEntities(void) {
    int test_ret = 0;

    int mem_base;
    xmlChar * ret_val;
    xmlParserCtxtPtr ctxt; /* the parser context */
    int n_ctxt;
    xmlChar * str; /* the input string */
    int n_str;
    int what; /* combination of XML_SUBSTITUTE_REF and XML_SUBSTITUTE_PEREF */
    int n_what;
    xmlChar end; /* an end marker xmlChar, 0 if none */
    int n_end;
    xmlChar end2; /* an end marker xmlChar, 0 if none */
    int n_end2;
    xmlChar end3; /* an end marker xmlChar, 0 if none */
    int n_end3;

    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_what = 0;n_what < gen_nb_int;n_what++) {
    for (n_end = 0;n_end < gen_nb_xmlChar;n_end++) {
    for (n_end2 = 0;n_end2 < gen_nb_xmlChar;n_end2++) {
    for (n_end3 = 0;n_end3 < gen_nb_xmlChar;n_end3++) {
        mem_base = xmlMemBlocks();
        ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
        str = gen_const_xmlChar_ptr(n_str, 1);
        what = gen_int(n_what, 2);
        end = gen_xmlChar(n_end, 3);
        end2 = gen_xmlChar(n_end2, 4);
        end3 = gen_xmlChar(n_end3, 5);

        ret_val = xmlStringDecodeEntities(ctxt, (const xmlChar *)str, what, end, end2, end3);
        desret_xmlChar_ptr(ret_val);
        call_tests++;
        des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
        des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
        des_int(n_what, what, 2);
        des_xmlChar(n_end, end, 3);
        des_xmlChar(n_end2, end2, 4);
        des_xmlChar(n_end3, end3, 5);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlStringDecodeEntities",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_ctxt);
            printf(" %d", n_str);
            printf(" %d", n_what);
            printf(" %d", n_end);
            printf(" %d", n_end2);
            printf(" %d", n_end3);
            printf("\n");
        }
    }
    }
    }
    }
    }
    }
    function_tests++;

    return(test_ret);
}


static int
test_xmlStringLenDecodeEntities(void) {
    int test_ret = 0;

    int mem_base;
    xmlChar * ret_val;
    xmlParserCtxtPtr ctxt; /* the parser context */
    int n_ctxt;
    xmlChar * str; /* the input string */
    int n_str;
    int len; /* the string length */
    int n_len;
    int what; /* combination of XML_SUBSTITUTE_REF and XML_SUBSTITUTE_PEREF */
    int n_what;
    xmlChar end; /* an end marker xmlChar, 0 if none */
    int n_end;
    xmlChar end2; /* an end marker xmlChar, 0 if none */
    int n_end2;
    xmlChar end3; /* an end marker xmlChar, 0 if none */
    int n_end3;

    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_len = 0;n_len < gen_nb_int;n_len++) {
    for (n_what = 0;n_what < gen_nb_int;n_what++) {
    for (n_end = 0;n_end < gen_nb_xmlChar;n_end++) {
    for (n_end2 = 0;n_end2 < gen_nb_xmlChar;n_end2++) {
    for (n_end3 = 0;n_end3 < gen_nb_xmlChar;n_end3++) {
        mem_base = xmlMemBlocks();
        ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
        str = gen_const_xmlChar_ptr(n_str, 1);
        len = gen_int(n_len, 2);
        what = gen_int(n_what, 3);
        end = gen_xmlChar(n_end, 4);
        end2 = gen_xmlChar(n_end2, 5);
        end3 = gen_xmlChar(n_end3, 6);

        ret_val = xmlStringLenDecodeEntities(ctxt, (const xmlChar *)str, len, what, end, end2, end3);
        desret_xmlChar_ptr(ret_val);
        call_tests++;
        des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
        des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
        des_int(n_len, len, 2);
        des_int(n_what, what, 3);
        des_xmlChar(n_end, end, 4);
        des_xmlChar(n_end2, end2, 5);
        des_xmlChar(n_end3, end3, 6);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlStringLenDecodeEntities",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_ctxt);
            printf(" %d", n_str);
            printf(" %d", n_len);
            printf(" %d", n_what);
            printf(" %d", n_end);
            printf(" %d", n_end2);
            printf(" %d", n_end3);
            printf("\n");
        }
    }
    }
    }
    }
    }
    }
    }
    function_tests++;

    return(test_ret);
}


static int
test_xmlSwitchEncoding(void) {
    int test_ret = 0;

    int mem_base;
    int ret_val;
    xmlParserCtxtPtr ctxt; /* the parser context */
    int n_ctxt;
    xmlCharEncoding enc; /* the encoding value (number) */
    int n_enc;

    for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
    for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
        mem_base = xmlMemBlocks();
        ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
        enc = gen_xmlCharEncoding(n_enc, 1);

        ret_val = xmlSwitchEncoding(ctxt, enc);
        desret_int(ret_val);
        call_tests++;
        des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
        des_xmlCharEncoding(n_enc, enc, 1);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlSwitchEncoding",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_ctxt);
            printf(" %d", n_enc);
            printf("\n");
        }
    }
    }
    function_tests++;

    return(test_ret);
}


static int
test_xmlSwitchInputEncoding(void) {
    int test_ret = 0;

    int mem_base;
    int ret_val;
    xmlParserCtxtPtr ctxt; /* the parser context */
    int n_ctxt;
    xmlParserInputPtr input; /* the input stream */
    int n_input;
    xmlCharEncodingHandlerPtr handler; /* the encoding handler */
    int n_handler;

    for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
    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();
        ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
        input = gen_xmlParserInputPtr(n_input, 1);
        handler = gen_xmlCharEncodingHandlerPtr(n_handler, 2);

        ret_val = xmlSwitchInputEncoding(ctxt, input, handler);
        desret_int(ret_val);
        call_tests++;
        des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
        des_xmlParserInputPtr(n_input, input, 1);
        des_xmlCharEncodingHandlerPtr(n_handler, handler, 2);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlSwitchInputEncoding",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_ctxt);
            printf(" %d", n_input);
            printf(" %d", n_handler);
            printf("\n");
        }
    }
    }
    }
    function_tests++;

    return(test_ret);
}


static int
test_xmlSwitchToEncoding(void) {
    int test_ret = 0;

    int mem_base;
    int ret_val;
    xmlParserCtxtPtr ctxt; /* the parser context */
    int n_ctxt;
    xmlCharEncodingHandlerPtr handler; /* the encoding handler */
    int n_handler;

    for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
    for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandlerPtr;n_handler++) {
        mem_base = xmlMemBlocks();
        ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
        handler = gen_xmlCharEncodingHandlerPtr(n_handler, 1);

        ret_val = xmlSwitchToEncoding(ctxt, handler);
        desret_int(ret_val);
        call_tests++;
        des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
        des_xmlCharEncodingHandlerPtr(n_handler, handler, 1);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlSwitchToEncoding",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_ctxt);
            printf(" %d", n_handler);
            printf("\n");
        }
    }
    }
    function_tests++;

    return(test_ret);
}

static int
test_parserInternals(void) {
    int test_ret = 0;

    if (quiet == 0) printf("Testing parserInternals : 33 of 90 functions ...\n");
    test_ret += test_htmlCreateFileParserCtxt();
    test_ret += test_htmlInitAutoClose();
    test_ret += test_inputPop();
    test_ret += test_inputPush();
    test_ret += test_namePop();
    test_ret += test_namePush();
    test_ret += test_nodePop();
    test_ret += test_nodePush();
    test_ret += test_xmlCheckLanguageID();
    test_ret += test_xmlCopyChar();
    test_ret += test_xmlCopyCharMultiByte();
    test_ret += test_xmlCreateEntityParserCtxt();
    test_ret += test_xmlCreateFileParserCtxt();
    test_ret += test_xmlCreateMemoryParserCtxt();
    test_ret += test_xmlCreateURLParserCtxt();
    test_ret += test_xmlCurrentChar();
    test_ret += test_xmlErrMemory();
    test_ret += test_xmlIsLetter();
    test_ret += test_xmlNewEntityInputStream();
    test_ret += test_xmlNewInputFromFile();
    test_ret += test_xmlNewInputStream();
    test_ret += test_xmlNewStringInputStream();
    test_ret += test_xmlNextChar();
    test_ret += test_xmlParserInputShrink();
    test_ret += test_xmlPopInput();
    test_ret += test_xmlPushInput();
    test_ret += test_xmlSetEntityReferenceFunc();
    test_ret += test_xmlSplitQName();
    test_ret += test_xmlStringCurrentChar();
    test_ret += test_xmlStringDecodeEntities();
    test_ret += test_xmlStringLenDecodeEntities();
    test_ret += test_xmlSwitchEncoding();
    test_ret += test_xmlSwitchInputEncoding();
    test_ret += test_xmlSwitchToEncoding();

    if (test_ret != 0)
	printf("Module parserInternals: %d errors\n", test_ret);
    return(test_ret);
}

static int
test_xmlPatternFromRoot(void) {
    int test_ret = 0;

#if defined(LIBXML_PATTERN_ENABLED)
    int mem_base;
    int ret_val;
    xmlPatternPtr comp; /* the precompiled pattern */
    int n_comp;

    for (n_comp = 0;n_comp < gen_nb_xmlPatternPtr;n_comp++) {
        mem_base = xmlMemBlocks();
        comp = gen_xmlPatternPtr(n_comp, 0);

        ret_val = xmlPatternFromRoot(comp);
        desret_int(ret_val);
        call_tests++;
        des_xmlPatternPtr(n_comp, comp, 0);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlPatternFromRoot",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_comp);
            printf("\n");
        }
    }
    function_tests++;
#endif

    return(test_ret);
}


static int
test_xmlPatternGetStreamCtxt(void) {
    int test_ret = 0;


    /* missing type support */
    return(test_ret);
}


static int
test_xmlPatternMatch(void) {
    int test_ret = 0;

#if defined(LIBXML_PATTERN_ENABLED)
    int mem_base;
    int ret_val;
    xmlPatternPtr comp; /* the precompiled pattern */
    int n_comp;
    xmlNodePtr node; /* a node */
    int n_node;

    for (n_comp = 0;n_comp < gen_nb_xmlPatternPtr;n_comp++) {
    for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
        mem_base = xmlMemBlocks();
        comp = gen_xmlPatternPtr(n_comp, 0);
        node = gen_xmlNodePtr(n_node, 1);

        ret_val = xmlPatternMatch(comp, node);
        desret_int(ret_val);
        call_tests++;
        des_xmlPatternPtr(n_comp, comp, 0);
        des_xmlNodePtr(n_node, node, 1);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlPatternMatch",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_comp);
            printf(" %d", n_node);
            printf("\n");
        }
    }
    }
    function_tests++;
#endif

    return(test_ret);
}


static int
test_xmlPatternMaxDepth(void) {
    int test_ret = 0;

#if defined(LIBXML_PATTERN_ENABLED)
    int mem_base;
    int ret_val;
    xmlPatternPtr comp; /* the precompiled pattern */
    int n_comp;

    for (n_comp = 0;n_comp < gen_nb_xmlPatternPtr;n_comp++) {
        mem_base = xmlMemBlocks();
        comp = gen_xmlPatternPtr(n_comp, 0);

        ret_val = xmlPatternMaxDepth(comp);
        desret_int(ret_val);
        call_tests++;
        des_xmlPatternPtr(n_comp, comp, 0);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlPatternMaxDepth",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_comp);
            printf("\n");
        }
    }
    function_tests++;
#endif

    return(test_ret);
}


static int
test_xmlPatternMinDepth(void) {
    int test_ret = 0;

#if defined(LIBXML_PATTERN_ENABLED)
    int mem_base;
    int ret_val;
    xmlPatternPtr comp; /* the precompiled pattern */
    int n_comp;

    for (n_comp = 0;n_comp < gen_nb_xmlPatternPtr;n_comp++) {
        mem_base = xmlMemBlocks();
        comp = gen_xmlPatternPtr(n_comp, 0);

        ret_val = xmlPatternMinDepth(comp);
        desret_int(ret_val);
        call_tests++;
        des_xmlPatternPtr(n_comp, comp, 0);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlPatternMinDepth",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_comp);
            printf("\n");
        }
    }
    function_tests++;
#endif

    return(test_ret);
}


static int
test_xmlPatternStreamable(void) {
    int test_ret = 0;

#if defined(LIBXML_PATTERN_ENABLED)
    int mem_base;
    int ret_val;
    xmlPatternPtr comp; /* the precompiled pattern */
    int n_comp;

    for (n_comp = 0;n_comp < gen_nb_xmlPatternPtr;n_comp++) {
        mem_base = xmlMemBlocks();
        comp = gen_xmlPatternPtr(n_comp, 0);

        ret_val = xmlPatternStreamable(comp);
        desret_int(ret_val);
        call_tests++;
        des_xmlPatternPtr(n_comp, comp, 0);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlPatternStreamable",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_comp);
            printf("\n");
        }
    }
    function_tests++;
#endif

    return(test_ret);
}


static int
test_xmlPatterncompile(void) {
    int test_ret = 0;


    /* missing type support */
    return(test_ret);
}

#ifdef LIBXML_PATTERN_ENABLED

#define gen_nb_xmlStreamCtxtPtr 1
static xmlStreamCtxtPtr gen_xmlStreamCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    return(NULL);
}
static void des_xmlStreamCtxtPtr(int no ATTRIBUTE_UNUSED, xmlStreamCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
}
#endif


static int
test_xmlStreamPop(void) {
    int test_ret = 0;

#if defined(LIBXML_PATTERN_ENABLED)
    int mem_base;
    int ret_val;
    xmlStreamCtxtPtr stream; /* the stream context */
    int n_stream;

    for (n_stream = 0;n_stream < gen_nb_xmlStreamCtxtPtr;n_stream++) {
        mem_base = xmlMemBlocks();
        stream = gen_xmlStreamCtxtPtr(n_stream, 0);

        ret_val = xmlStreamPop(stream);
        desret_int(ret_val);
        call_tests++;
        des_xmlStreamCtxtPtr(n_stream, stream, 0);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlStreamPop",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_stream);
            printf("\n");
        }
    }
    function_tests++;
#endif

    return(test_ret);
}


static int
test_xmlStreamPush(void) {
    int test_ret = 0;

#if defined(LIBXML_PATTERN_ENABLED)
    int mem_base;
    int ret_val;
    xmlStreamCtxtPtr stream; /* the stream context */
    int n_stream;
    xmlChar * name; /* the current name */
    int n_name;
    xmlChar * ns; /* the namespace name */
    int n_ns;

    for (n_stream = 0;n_stream < gen_nb_xmlStreamCtxtPtr;n_stream++) {
    for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
    for (n_ns = 0;n_ns < gen_nb_const_xmlChar_ptr;n_ns++) {
        mem_base = xmlMemBlocks();
        stream = gen_xmlStreamCtxtPtr(n_stream, 0);
        name = gen_const_xmlChar_ptr(n_name, 1);
        ns = gen_const_xmlChar_ptr(n_ns, 2);

        ret_val = xmlStreamPush(stream, (const xmlChar *)name, (const xmlChar *)ns);
        desret_int(ret_val);
        call_tests++;
        des_xmlStreamCtxtPtr(n_stream, stream, 0);
        des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
        des_const_xmlChar_ptr(n_ns, (const xmlChar *)ns, 2);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlStreamPush",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_stream);
            printf(" %d", n_name);
            printf(" %d", n_ns);
            printf("\n");
        }
    }
    }
    }
    function_tests++;
#endif

    return(test_ret);
}


static int
test_xmlStreamPushAttr(void) {
    int test_ret = 0;

#if defined(LIBXML_PATTERN_ENABLED)
    int mem_base;
    int ret_val;
    xmlStreamCtxtPtr stream; /* the stream context */
    int n_stream;
    xmlChar * name; /* the current name */
    int n_name;
    xmlChar * ns; /* the namespace name */
    int n_ns;

    for (n_stream = 0;n_stream < gen_nb_xmlStreamCtxtPtr;n_stream++) {
    for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
    for (n_ns = 0;n_ns < gen_nb_const_xmlChar_ptr;n_ns++) {
        mem_base = xmlMemBlocks();
        stream = gen_xmlStreamCtxtPtr(n_stream, 0);
        name = gen_const_xmlChar_ptr(n_name, 1);
        ns = gen_const_xmlChar_ptr(n_ns, 2);

        ret_val = xmlStreamPushAttr(stream, (const xmlChar *)name, (const xmlChar *)ns);
        desret_int(ret_val);
        call_tests++;
        des_xmlStreamCtxtPtr(n_stream, stream, 0);
        des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
        des_const_xmlChar_ptr(n_ns, (const xmlChar *)ns, 2);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlStreamPushAttr",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_stream);
            printf(" %d", n_name);
            printf(" %d", n_ns);
            printf("\n");
        }
    }
    }
    }
    function_tests++;
#endif

    return(test_ret);
}


static int
test_xmlStreamPushNode(void) {
    int test_ret = 0;

#if defined(LIBXML_PATTERN_ENABLED)
    int mem_base;
    int ret_val;
    xmlStreamCtxtPtr stream; /* the stream context */
    int n_stream;
    xmlChar * name; /* the current name */
    int n_name;
    xmlChar * ns; /* the namespace name */
    int n_ns;
    int nodeType; /* the type of the node being pushed */
    int n_nodeType;

    for (n_stream = 0;n_stream < gen_nb_xmlStreamCtxtPtr;n_stream++) {
    for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
    for (n_ns = 0;n_ns < gen_nb_const_xmlChar_ptr;n_ns++) {
    for (n_nodeType = 0;n_nodeType < gen_nb_int;n_nodeType++) {
        mem_base = xmlMemBlocks();
        stream = gen_xmlStreamCtxtPtr(n_stream, 0);
        name = gen_const_xmlChar_ptr(n_name, 1);
        ns = gen_const_xmlChar_ptr(n_ns, 2);
        nodeType = gen_int(n_nodeType, 3);

        ret_val = xmlStreamPushNode(stream, (const xmlChar *)name, (const xmlChar *)ns, nodeType);
        desret_int(ret_val);
        call_tests++;
        des_xmlStreamCtxtPtr(n_stream, stream, 0);
        des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
        des_const_xmlChar_ptr(n_ns, (const xmlChar *)ns, 2);
        des_int(n_nodeType, nodeType, 3);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlStreamPushNode",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_stream);
            printf(" %d", n_name);
            printf(" %d", n_ns);
            printf(" %d", n_nodeType);
            printf("\n");
        }
    }
    }
    }
    }
    function_tests++;
#endif

    return(test_ret);
}


static int
test_xmlStreamWantsAnyNode(void) {
    int test_ret = 0;

#if defined(LIBXML_PATTERN_ENABLED)
    int mem_base;
    int ret_val;
    xmlStreamCtxtPtr streamCtxt; /* the stream context */
    int n_streamCtxt;

    for (n_streamCtxt = 0;n_streamCtxt < gen_nb_xmlStreamCtxtPtr;n_streamCtxt++) {
        mem_base = xmlMemBlocks();
        streamCtxt = gen_xmlStreamCtxtPtr(n_streamCtxt, 0);

        ret_val = xmlStreamWantsAnyNode(streamCtxt);
        desret_int(ret_val);
        call_tests++;
        des_xmlStreamCtxtPtr(n_streamCtxt, streamCtxt, 0);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlStreamWantsAnyNode",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_streamCtxt);
            printf("\n");
        }
    }
    function_tests++;
#endif

    return(test_ret);
}

static int
test_pattern(void) {
    int test_ret = 0;

    if (quiet == 0) printf("Testing pattern : 10 of 15 functions ...\n");
    test_ret += test_xmlPatternFromRoot();
    test_ret += test_xmlPatternGetStreamCtxt();
    test_ret += test_xmlPatternMatch();
    test_ret += test_xmlPatternMaxDepth();
    test_ret += test_xmlPatternMinDepth();
    test_ret += test_xmlPatternStreamable();
    test_ret += test_xmlPatterncompile();
    test_ret += test_xmlStreamPop();
    test_ret += test_xmlStreamPush();
    test_ret += test_xmlStreamPushAttr();
    test_ret += test_xmlStreamPushNode();
    test_ret += test_xmlStreamWantsAnyNode();

    if (test_ret != 0)
	printf("Module pattern: %d errors\n", test_ret);
    return(test_ret);
}
#ifdef LIBXML_SCHEMAS_ENABLED

#define gen_nb_xmlRelaxNGPtr 1
static xmlRelaxNGPtr gen_xmlRelaxNGPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    return(NULL);
}
static void des_xmlRelaxNGPtr(int no ATTRIBUTE_UNUSED, xmlRelaxNGPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
}
#endif


static int
test_xmlRelaxNGDump(void) {
    int test_ret = 0;

#if defined(LIBXML_SCHEMAS_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
    int mem_base;
    FILE * output; /* the file output */
    int n_output;
    xmlRelaxNGPtr schema; /* a schema structure */
    int n_schema;

    for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
    for (n_schema = 0;n_schema < gen_nb_xmlRelaxNGPtr;n_schema++) {
        mem_base = xmlMemBlocks();
        output = gen_FILE_ptr(n_output, 0);
        schema = gen_xmlRelaxNGPtr(n_schema, 1);

        xmlRelaxNGDump(output, schema);
        call_tests++;
        des_FILE_ptr(n_output, output, 0);
        des_xmlRelaxNGPtr(n_schema, schema, 1);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlRelaxNGDump",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_output);
            printf(" %d", n_schema);
            printf("\n");
        }
    }
    }
    function_tests++;
#endif

    return(test_ret);
}


static int
test_xmlRelaxNGDumpTree(void) {
    int test_ret = 0;

#if defined(LIBXML_SCHEMAS_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
    int mem_base;
    FILE * output; /* the file output */
    int n_output;
    xmlRelaxNGPtr schema; /* a schema structure */
    int n_schema;

    for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
    for (n_schema = 0;n_schema < gen_nb_xmlRelaxNGPtr;n_schema++) {
        mem_base = xmlMemBlocks();
        output = gen_FILE_ptr(n_output, 0);
        schema = gen_xmlRelaxNGPtr(n_schema, 1);

        xmlRelaxNGDumpTree(output, schema);
        call_tests++;
        des_FILE_ptr(n_output, output, 0);
        des_xmlRelaxNGPtr(n_schema, schema, 1);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlRelaxNGDumpTree",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_output);
            printf(" %d", n_schema);
            printf("\n");
        }
    }
    }
    function_tests++;
#endif

    return(test_ret);
}

#ifdef LIBXML_SCHEMAS_ENABLED

#define gen_nb_xmlRelaxNGParserCtxtPtr 1
static xmlRelaxNGParserCtxtPtr gen_xmlRelaxNGParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    return(NULL);
}
static void des_xmlRelaxNGParserCtxtPtr(int no ATTRIBUTE_UNUSED, xmlRelaxNGParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
}
#endif

#ifdef LIBXML_SCHEMAS_ENABLED

#define gen_nb_xmlRelaxNGValidityErrorFunc_ptr 1
static xmlRelaxNGValidityErrorFunc * gen_xmlRelaxNGValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    return(NULL);
}
static void des_xmlRelaxNGValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlRelaxNGValidityErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
}
#endif

#ifdef LIBXML_SCHEMAS_ENABLED

#define gen_nb_xmlRelaxNGValidityWarningFunc_ptr 1
static xmlRelaxNGValidityWarningFunc * gen_xmlRelaxNGValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    return(NULL);
}
static void des_xmlRelaxNGValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, xmlRelaxNGValidityWarningFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
}
#endif

#ifdef 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


static int
test_xmlRelaxNGGetParserErrors(void) {
    int test_ret = 0;

#if defined(LIBXML_SCHEMAS_ENABLED)
    int mem_base;
    int ret_val;
    xmlRelaxNGParserCtxtPtr ctxt; /* a Relax-NG validation context */
    int n_ctxt;
    xmlRelaxNGValidityErrorFunc * err; /* the error callback result */
    int n_err;
    xmlRelaxNGValidityWarningFunc * warn; /* the warning callback result */
    int n_warn;
    void ** ctx; /* contextual data for the callbacks result */
    int n_ctx;

    for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGParserCtxtPtr;n_ctxt++) {
    for (n_err = 0;n_err < gen_nb_xmlRelaxNGValidityErrorFunc_ptr;n_err++) {
    for (n_warn = 0;n_warn < gen_nb_xmlRelaxNGValidityWarningFunc_ptr;n_warn++) {
    for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
        mem_base = xmlMemBlocks();
        ctxt = gen_xmlRelaxNGParserCtxtPtr(n_ctxt, 0);
        err = gen_xmlRelaxNGValidityErrorFunc_ptr(n_err, 1);
        warn = gen_xmlRelaxNGValidityWarningFunc_ptr(n_warn, 2);
        ctx = gen_void_ptr_ptr(n_ctx, 3);

        ret_val = xmlRelaxNGGetParserErrors(ctxt, err, warn, ctx);
        desret_int(ret_val);
        call_tests++;
        des_xmlRelaxNGParserCtxtPtr(n_ctxt, ctxt, 0);
        des_xmlRelaxNGValidityErrorFunc_ptr(n_err, err, 1);
        des_xmlRelaxNGValidityWarningFunc_ptr(n_warn, warn, 2);
        des_void_ptr_ptr(n_ctx, ctx, 3);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlRelaxNGGetParserErrors",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_ctxt);
            printf(" %d", n_err);
            printf(" %d", n_warn);
            printf(" %d", n_ctx);
            printf("\n");
        }
    }
    }
    }
    }
    function_tests++;
#endif

    return(test_ret);
}

#ifdef LIBXML_SCHEMAS_ENABLED

#define gen_nb_xmlRelaxNGValidCtxtPtr 1
static xmlRelaxNGValidCtxtPtr gen_xmlRelaxNGValidCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    return(NULL);
}
static void des_xmlRelaxNGValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlRelaxNGValidCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
}
#endif


static int
test_xmlRelaxNGGetValidErrors(void) {
    int test_ret = 0;

#if defined(LIBXML_SCHEMAS_ENABLED)
    int mem_base;
    int ret_val;
    xmlRelaxNGValidCtxtPtr ctxt; /* a Relax-NG validation context */
    int n_ctxt;
    xmlRelaxNGValidityErrorFunc * err; /* the error function result */
    int n_err;
    xmlRelaxNGValidityWarningFunc * warn; /* the warning function result */
    int n_warn;
    void ** ctx; /* the functions context result */
    int n_ctx;

    for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
    for (n_err = 0;n_err < gen_nb_xmlRelaxNGValidityErrorFunc_ptr;n_err++) {
    for (n_warn = 0;n_warn < gen_nb_xmlRelaxNGValidityWarningFunc_ptr;n_warn++) {
    for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
        mem_base = xmlMemBlocks();
        ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
        err = gen_xmlRelaxNGValidityErrorFunc_ptr(n_err, 1);
        warn = gen_xmlRelaxNGValidityWarningFunc_ptr(n_warn, 2);
        ctx = gen_void_ptr_ptr(n_ctx, 3);

        ret_val = xmlRelaxNGGetValidErrors(ctxt, err, warn, ctx);
        desret_int(ret_val);
        call_tests++;
        des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
        des_xmlRelaxNGValidityErrorFunc_ptr(n_err, err, 1);
        des_xmlRelaxNGValidityWarningFunc_ptr(n_warn, warn, 2);
        des_void_ptr_ptr(n_ctx, ctx, 3);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlRelaxNGGetValidErrors",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_ctxt);
            printf(" %d", n_err);
            printf(" %d", n_warn);
            printf(" %d", n_ctx);
            printf("\n");
        }
    }
    }
    }
    }
    function_tests++;
#endif

    return(test_ret);
}


static int
test_xmlRelaxNGInitTypes(void) {
    int test_ret = 0;

#if defined(LIBXML_SCHEMAS_ENABLED)
    int mem_base;
    int ret_val;

        mem_base = xmlMemBlocks();

        ret_val = xmlRelaxNGInitTypes();
        desret_int(ret_val);
        call_tests++;
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlRelaxNGInitTypes",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf("\n");
        }
    function_tests++;
#endif

    return(test_ret);
}


static int
test_xmlRelaxNGNewDocParserCtxt(void) {
    int test_ret = 0;

#if defined(LIBXML_SCHEMAS_ENABLED)
    int mem_base;
    xmlRelaxNGParserCtxtPtr ret_val;
    xmlDocPtr doc; /* a preparsed document tree */
    int n_doc;

    for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
        mem_base = xmlMemBlocks();
        doc = gen_xmlDocPtr(n_doc, 0);

        ret_val = xmlRelaxNGNewDocParserCtxt(doc);
        desret_xmlRelaxNGParserCtxtPtr(ret_val);
        call_tests++;
        des_xmlDocPtr(n_doc, doc, 0);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlRelaxNGNewDocParserCtxt",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_doc);
            printf("\n");
        }
    }
    function_tests++;
#endif

    return(test_ret);
}


static int
test_xmlRelaxNGNewMemParserCtxt(void) {
    int test_ret = 0;

#if defined(LIBXML_SCHEMAS_ENABLED)
    int mem_base;
    xmlRelaxNGParserCtxtPtr ret_val;
    char * buffer; /* a pointer to a char array containing the schemas */
    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 = xmlRelaxNGNewMemParserCtxt((const char *)buffer, size);
        desret_xmlRelaxNGParserCtxtPtr(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 xmlRelaxNGNewMemParserCtxt",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_buffer);
            printf(" %d", n_size);
            printf("\n");
        }
    }
    }
    function_tests++;
#endif

    return(test_ret);
}


static int
test_xmlRelaxNGNewParserCtxt(void) {
    int test_ret = 0;

#if defined(LIBXML_SCHEMAS_ENABLED)
    int mem_base;
    xmlRelaxNGParserCtxtPtr ret_val;
    char * URL; /* the location of the schema */
    int n_URL;

    for (n_URL = 0;n_URL < gen_nb_const_char_ptr;n_URL++) {
        mem_base = xmlMemBlocks();
        URL = gen_const_char_ptr(n_URL, 0);

        ret_val = xmlRelaxNGNewParserCtxt((const char *)URL);
        desret_xmlRelaxNGParserCtxtPtr(ret_val);
        call_tests++;
        des_const_char_ptr(n_URL, (const char *)URL, 0);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlRelaxNGNewParserCtxt",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_URL);
            printf("\n");
        }
    }
    function_tests++;
#endif

    return(test_ret);
}


static int
test_xmlRelaxNGNewValidCtxt(void) {
    int test_ret = 0;


    /* missing type support */
    return(test_ret);
}


static int
test_xmlRelaxNGParse(void) {
    int test_ret = 0;


    /* missing type support */
    return(test_ret);
}


static int
test_xmlRelaxNGSetParserErrors(void) {
    int test_ret = 0;


    /* missing type support */
    return(test_ret);
}


static int
test_xmlRelaxNGSetParserStructuredErrors(void) {
    int test_ret = 0;


    /* missing type support */
    return(test_ret);
}


static int
test_xmlRelaxNGSetValidErrors(void) {
    int test_ret = 0;


    /* missing type support */
    return(test_ret);
}


static int
test_xmlRelaxNGSetValidStructuredErrors(void) {
    int test_ret = 0;


    /* missing type support */
    return(test_ret);
}


static int
test_xmlRelaxNGValidateDoc(void) {
    int test_ret = 0;

#if defined(LIBXML_SCHEMAS_ENABLED)
    int mem_base;
    int ret_val;
    xmlRelaxNGValidCtxtPtr ctxt; /* a Relax-NG validation context */
    int n_ctxt;
    xmlDocPtr doc; /* a parsed document tree */
    int n_doc;

    for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
    for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
        mem_base = xmlMemBlocks();
        ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
        doc = gen_xmlDocPtr(n_doc, 1);

        ret_val = xmlRelaxNGValidateDoc(ctxt, doc);
        desret_int(ret_val);
        call_tests++;
        des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
        des_xmlDocPtr(n_doc, doc, 1);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlRelaxNGValidateDoc",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_ctxt);
            printf(" %d", n_doc);
            printf("\n");
        }
    }
    }
    function_tests++;
#endif

    return(test_ret);
}


static int
test_xmlRelaxNGValidateFullElement(void) {
    int test_ret = 0;

#if defined(LIBXML_SCHEMAS_ENABLED)
    int mem_base;
    int ret_val;
    xmlRelaxNGValidCtxtPtr ctxt; /* the validation context */
    int n_ctxt;
    xmlDocPtr doc; /* a document instance */
    int n_doc;
    xmlNodePtr elem; /* an element instance */
    int n_elem;

    for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
    for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
    for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
        mem_base = xmlMemBlocks();
        ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
        doc = gen_xmlDocPtr(n_doc, 1);
        elem = gen_xmlNodePtr(n_elem, 2);

        ret_val = xmlRelaxNGValidateFullElement(ctxt, doc, elem);
        desret_int(ret_val);
        call_tests++;
        des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
        des_xmlDocPtr(n_doc, doc, 1);
        des_xmlNodePtr(n_elem, elem, 2);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlRelaxNGValidateFullElement",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_ctxt);
            printf(" %d", n_doc);
            printf(" %d", n_elem);
            printf("\n");
        }
    }
    }
    }
    function_tests++;
#endif

    return(test_ret);
}


static int
test_xmlRelaxNGValidatePopElement(void) {
    int test_ret = 0;

#if defined(LIBXML_SCHEMAS_ENABLED)
    int mem_base;
    int ret_val;
    xmlRelaxNGValidCtxtPtr ctxt; /* the RelaxNG validation context */
    int n_ctxt;
    xmlDocPtr doc; /* a document instance */
    int n_doc;
    xmlNodePtr elem; /* an element instance */
    int n_elem;

    for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
    for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
    for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
        mem_base = xmlMemBlocks();
        ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
        doc = gen_xmlDocPtr(n_doc, 1);
        elem = gen_xmlNodePtr(n_elem, 2);

        ret_val = xmlRelaxNGValidatePopElement(ctxt, doc, elem);
        desret_int(ret_val);
        call_tests++;
        des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
        des_xmlDocPtr(n_doc, doc, 1);
        des_xmlNodePtr(n_elem, elem, 2);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlRelaxNGValidatePopElement",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_ctxt);
            printf(" %d", n_doc);
            printf(" %d", n_elem);
            printf("\n");
        }
    }
    }
    }
    function_tests++;
#endif

    return(test_ret);
}


static int
test_xmlRelaxNGValidatePushCData(void) {
    int test_ret = 0;

#if defined(LIBXML_SCHEMAS_ENABLED)
    int mem_base;
    int ret_val;
    xmlRelaxNGValidCtxtPtr ctxt; /* the RelaxNG validation context */
    int n_ctxt;
    xmlChar * data; /* some character data read */
    int n_data;
    int len; /* the lenght of the data */
    int n_len;

    for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
    for (n_data = 0;n_data < gen_nb_const_xmlChar_ptr;n_data++) {
    for (n_len = 0;n_len < gen_nb_int;n_len++) {
        mem_base = xmlMemBlocks();
        ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
        data = gen_const_xmlChar_ptr(n_data, 1);
        len = gen_int(n_len, 2);

        ret_val = xmlRelaxNGValidatePushCData(ctxt, (const xmlChar *)data, len);
        desret_int(ret_val);
        call_tests++;
        des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
        des_const_xmlChar_ptr(n_data, (const xmlChar *)data, 1);
        des_int(n_len, len, 2);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlRelaxNGValidatePushCData",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_ctxt);
            printf(" %d", n_data);
            printf(" %d", n_len);
            printf("\n");
        }
    }
    }
    }
    function_tests++;
#endif

    return(test_ret);
}


static int
test_xmlRelaxNGValidatePushElement(void) {
    int test_ret = 0;

#if defined(LIBXML_SCHEMAS_ENABLED)
    int mem_base;
    int ret_val;
    xmlRelaxNGValidCtxtPtr ctxt; /* the validation context */
    int n_ctxt;
    xmlDocPtr doc; /* a document instance */
    int n_doc;
    xmlNodePtr elem; /* an element instance */
    int n_elem;

    for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
    for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
    for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
        mem_base = xmlMemBlocks();
        ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
        doc = gen_xmlDocPtr(n_doc, 1);
        elem = gen_xmlNodePtr(n_elem, 2);

        ret_val = xmlRelaxNGValidatePushElement(ctxt, doc, elem);
        desret_int(ret_val);
        call_tests++;
        des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
        des_xmlDocPtr(n_doc, doc, 1);
        des_xmlNodePtr(n_elem, elem, 2);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlRelaxNGValidatePushElement",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_ctxt);
            printf(" %d", n_doc);
            printf(" %d", n_elem);
            printf("\n");
        }
    }
    }
    }
    function_tests++;
#endif

    return(test_ret);
}


static int
test_xmlRelaxParserSetFlag(void) {
    int test_ret = 0;

#if defined(LIBXML_SCHEMAS_ENABLED)
    int mem_base;
    int ret_val;
    xmlRelaxNGParserCtxtPtr ctxt; /* a RelaxNG parser context */
    int n_ctxt;
    int flags; /* a set of flags values */
    int n_flags;

    for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGParserCtxtPtr;n_ctxt++) {
    for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
        mem_base = xmlMemBlocks();
        ctxt = gen_xmlRelaxNGParserCtxtPtr(n_ctxt, 0);
        flags = gen_int(n_flags, 1);

        ret_val = xmlRelaxParserSetFlag(ctxt, flags);
        desret_int(ret_val);
        call_tests++;
        des_xmlRelaxNGParserCtxtPtr(n_ctxt, ctxt, 0);
        des_int(n_flags, flags, 1);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlRelaxParserSetFlag",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_ctxt);
            printf(" %d", n_flags);
            printf("\n");
        }
    }
    }
    function_tests++;
#endif

    return(test_ret);
}

static int
test_relaxng(void) {
    int test_ret = 0;

    if (quiet == 0) printf("Testing relaxng : 14 of 24 functions ...\n");
    test_ret += test_xmlRelaxNGDump();
    test_ret += test_xmlRelaxNGDumpTree();
    test_ret += test_xmlRelaxNGGetParserErrors();
    test_ret += test_xmlRelaxNGGetValidErrors();
    test_ret += test_xmlRelaxNGInitTypes();
    test_ret += test_xmlRelaxNGNewDocParserCtxt();
    test_ret += test_xmlRelaxNGNewMemParserCtxt();
    test_ret += test_xmlRelaxNGNewParserCtxt();
    test_ret += test_xmlRelaxNGNewValidCtxt();
    test_ret += test_xmlRelaxNGParse();
    test_ret += test_xmlRelaxNGSetParserErrors();
    test_ret += test_xmlRelaxNGSetParserStructuredErrors();
    test_ret += test_xmlRelaxNGSetValidErrors();
    test_ret += test_xmlRelaxNGSetValidStructuredErrors();
    test_ret += test_xmlRelaxNGValidateDoc();
    test_ret += test_xmlRelaxNGValidateFullElement();
    test_ret += test_xmlRelaxNGValidatePopElement();
    test_ret += test_xmlRelaxNGValidatePushCData();
    test_ret += test_xmlRelaxNGValidatePushElement();
    test_ret += test_xmlRelaxParserSetFlag();

    if (test_ret != 0)
	printf("Module relaxng: %d errors\n", test_ret);
    return(test_ret);
}
static int
test_schemasInternals(void) {
    int test_ret = 0;

    if (quiet == 0) printf("Testing schemasInternals : 0 of 2 functions ...\n");

    if (test_ret != 0)
	printf("Module schemasInternals: %d errors\n", test_ret);
    return(test_ret);
}

static int
test_xmlSchematronNewDocParserCtxt(void) {
    int test_ret = 0;


    /* missing type support */
    return(test_ret);
}


static int
test_xmlSchematronNewMemParserCtxt(void) {
    int test_ret = 0;


    /* missing type support */
    return(test_ret);
}


static int
test_xmlSchematronNewParserCtxt(void) {
    int test_ret = 0;


    /* missing type support */
    return(test_ret);
}

#ifdef LIBXML_SCHEMATRON_ENABLED

#define gen_nb_xmlSchematronPtr 1
static xmlSchematronPtr gen_xmlSchematronPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    return(NULL);
}
static void des_xmlSchematronPtr(int no ATTRIBUTE_UNUSED, xmlSchematronPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
}
#endif


static int
test_xmlSchematronNewValidCtxt(void) {
    int test_ret = 0;


    /* missing type support */
    return(test_ret);
}

#ifdef LIBXML_SCHEMATRON_ENABLED

#define gen_nb_xmlSchematronParserCtxtPtr 1
static xmlSchematronParserCtxtPtr gen_xmlSchematronParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    return(NULL);
}
static void des_xmlSchematronParserCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSchematronParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
}
#endif


static int
test_xmlSchematronParse(void) {
    int test_ret = 0;


    /* missing type support */
    return(test_ret);
}

#ifdef LIBXML_SCHEMATRON_ENABLED

#define gen_nb_xmlSchematronValidCtxtPtr 1
static xmlSchematronValidCtxtPtr gen_xmlSchematronValidCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    return(NULL);
}
static void des_xmlSchematronValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSchematronValidCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
}
#endif


static int
test_xmlSchematronSetValidStructuredErrors(void) {
    int test_ret = 0;


    /* missing type support */
    return(test_ret);
}


static int
test_xmlSchematronValidateDoc(void) {
    int test_ret = 0;

#if defined(LIBXML_SCHEMATRON_ENABLED)
    int mem_base;
    int ret_val;
    xmlSchematronValidCtxtPtr ctxt; /* the schema validation context */
    int n_ctxt;
    xmlDocPtr instance; /* the document instace tree */
    int n_instance;

    for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchematronValidCtxtPtr;n_ctxt++) {
    for (n_instance = 0;n_instance < gen_nb_xmlDocPtr;n_instance++) {
        mem_base = xmlMemBlocks();
        ctxt = gen_xmlSchematronValidCtxtPtr(n_ctxt, 0);
        instance = gen_xmlDocPtr(n_instance, 1);

        ret_val = xmlSchematronValidateDoc(ctxt, instance);
        desret_int(ret_val);
        call_tests++;
        des_xmlSchematronValidCtxtPtr(n_ctxt, ctxt, 0);
        des_xmlDocPtr(n_instance, instance, 1);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlSchematronValidateDoc",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_ctxt);
            printf(" %d", n_instance);
            printf("\n");
        }
    }
    }
    function_tests++;
#endif

    return(test_ret);
}

static int
test_schematron(void) {
    int test_ret = 0;

    if (quiet == 0) printf("Testing schematron : 1 of 10 functions ...\n");
    test_ret += test_xmlSchematronNewDocParserCtxt();
    test_ret += test_xmlSchematronNewMemParserCtxt();
    test_ret += test_xmlSchematronNewParserCtxt();
    test_ret += test_xmlSchematronNewValidCtxt();
    test_ret += test_xmlSchematronParse();
    test_ret += test_xmlSchematronSetValidStructuredErrors();
    test_ret += test_xmlSchematronValidateDoc();

    if (test_ret != 0)
	printf("Module schematron: %d errors\n", test_ret);
    return(test_ret);
}

static int
test_xmlAddChild(void) {
    int test_ret = 0;

    int mem_base;
    xmlNodePtr ret_val;
    xmlNodePtr parent; /* the parent node */
    int n_parent;
    xmlNodePtr cur; /* the child node */
    int n_cur;

    for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
    for (n_cur = 0;n_cur < gen_nb_xmlNodePtr_in;n_cur++) {
        mem_base = xmlMemBlocks();
        parent = gen_xmlNodePtr(n_parent, 0);
        cur = gen_xmlNodePtr_in(n_cur, 1);

        ret_val = xmlAddChild(parent, cur);
        if (ret_val == NULL) { xmlFreeNode(cur) ; cur = NULL ; }
        desret_xmlNodePtr(ret_val);
        call_tests++;
        des_xmlNodePtr(n_parent, parent, 0);
        des_xmlNodePtr_in(n_cur, cur, 1);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlAddChild",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_parent);
            printf(" %d", n_cur);
            printf("\n");
        }
    }
    }
    function_tests++;

    return(test_ret);
}


static int
test_xmlAddChildList(void) {
    int test_ret = 0;

    int mem_base;
    xmlNodePtr ret_val;
    xmlNodePtr parent; /* the parent node */
    int n_parent;
    xmlNodePtr cur; /* the first node in the list */
    int n_cur;

    for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
    for (n_cur = 0;n_cur < gen_nb_xmlNodePtr_in;n_cur++) {
        mem_base = xmlMemBlocks();
        parent = gen_xmlNodePtr(n_parent, 0);
        cur = gen_xmlNodePtr_in(n_cur, 1);

        ret_val = xmlAddChildList(parent, cur);
        if (ret_val == NULL) { xmlFreeNodeList(cur) ; cur = NULL ; }
        desret_xmlNodePtr(ret_val);
        call_tests++;
        des_xmlNodePtr(n_parent, parent, 0);
        des_xmlNodePtr_in(n_cur, cur, 1);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlAddChildList",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_parent);
            printf(" %d", n_cur);
            printf("\n");
        }
    }
    }
    function_tests++;

    return(test_ret);
}


static int
test_xmlAddNextSibling(void) {
    int test_ret = 0;

    int mem_base;
    xmlNodePtr ret_val;
    xmlNodePtr cur; /* the child node */
    int n_cur;
    xmlNodePtr elem; /* the new node */
    int n_elem;

    for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
    for (n_elem = 0;n_elem < gen_nb_xmlNodePtr_in;n_elem++) {
        mem_base = xmlMemBlocks();
        cur = gen_xmlNodePtr(n_cur, 0);
        elem = gen_xmlNodePtr_in(n_elem, 1);

        ret_val = xmlAddNextSibling(cur, elem);
        if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; }
        desret_xmlNodePtr(ret_val);
        call_tests++;
        des_xmlNodePtr(n_cur, cur, 0);
        des_xmlNodePtr_in(n_elem, elem, 1);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlAddNextSibling",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_cur);
            printf(" %d", n_elem);
            printf("\n");
        }
    }
    }
    function_tests++;

    return(test_ret);
}


static int
test_xmlAddPrevSibling(void) {
    int test_ret = 0;

#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
    int mem_base;
    xmlNodePtr ret_val;
    xmlNodePtr cur; /* the child node */
    int n_cur;
    xmlNodePtr elem; /* the new node */
    int n_elem;

    for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
    for (n_elem = 0;n_elem < gen_nb_xmlNodePtr_in;n_elem++) {
        mem_base = xmlMemBlocks();
        cur = gen_xmlNodePtr(n_cur, 0);
        elem = gen_xmlNodePtr_in(n_elem, 1);

        ret_val = xmlAddPrevSibling(cur, elem);
        if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; }
        desret_xmlNodePtr(ret_val);
        call_tests++;
        des_xmlNodePtr(n_cur, cur, 0);
        des_xmlNodePtr_in(n_elem, elem, 1);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlAddPrevSibling",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_cur);
            printf(" %d", n_elem);
            printf("\n");
        }
    }
    }
    function_tests++;
#endif

    return(test_ret);
}


static int
test_xmlAddSibling(void) {
    int test_ret = 0;

    int mem_base;
    xmlNodePtr ret_val;
    xmlNodePtr cur; /* the child node */
    int n_cur;
    xmlNodePtr elem; /* the new node */
    int n_elem;

    for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
    for (n_elem = 0;n_elem < gen_nb_xmlNodePtr_in;n_elem++) {
        mem_base = xmlMemBlocks();
        cur = gen_xmlNodePtr(n_cur, 0);
        elem = gen_xmlNodePtr_in(n_elem, 1);

        ret_val = xmlAddSibling(cur, elem);
        if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; }
        desret_xmlNodePtr(ret_val);
        call_tests++;
        des_xmlNodePtr(n_cur, cur, 0);
        des_xmlNodePtr_in(n_elem, elem, 1);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlAddSibling",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_cur);
            printf(" %d", n_elem);
            printf("\n");
        }
    }
    }
    function_tests++;

    return(test_ret);
}


static int
test_xmlAttrSerializeTxtContent(void) {
    int test_ret = 0;

#if defined(LIBXML_OUTPUT_ENABLED)
#ifdef LIBXML_OUTPUT_ENABLED
    int mem_base;
    xmlBufferPtr buf; /* the XML buffer output */
    int n_buf;
    xmlDocPtr doc; /* the document */
    int n_doc;
    xmlAttrPtr attr; /* the attribute node */
    int n_attr;
    xmlChar * string; /* the text content */
    int n_string;

    for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
    for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
    for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
    for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
        mem_base = xmlMemBlocks();
        buf = gen_xmlBufferPtr(n_buf, 0);
        doc = gen_xmlDocPtr(n_doc, 1);
        attr = gen_xmlAttrPtr(n_attr, 2);
        string = gen_const_xmlChar_ptr(n_string, 3);

        xmlAttrSerializeTxtContent(buf, doc, attr, (const xmlChar *)string);
        call_tests++;
        des_xmlBufferPtr(n_buf, buf, 0);
        des_xmlDocPtr(n_doc, doc, 1);
        des_xmlAttrPtr(n_attr, attr, 2);
        des_const_xmlChar_ptr(n_string, (const xmlChar *)string, 3);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlAttrSerializeTxtContent",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_buf);
            printf(" %d", n_doc);
            printf(" %d", n_attr);
            printf(" %d", n_string);
            printf("\n");
        }
    }
    }
    }
    }
    function_tests++;
#endif
#endif

    return(test_ret);
}


static int
test_xmlBufferAdd(void) {
    int test_ret = 0;

    int mem_base;
    int ret_val;
    xmlBufferPtr buf; /* the buffer to dump */
    int n_buf;
    xmlChar * str; /* the #xmlChar string */
    int n_str;
    int len; /* the number of #xmlChar to add */
    int n_len;

    for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
    for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
    for (n_len = 0;n_len < gen_nb_int;n_len++) {
        mem_base = xmlMemBlocks();
        buf = gen_xmlBufferPtr(n_buf, 0);
        str = gen_const_xmlChar_ptr(n_str, 1);
        len = gen_int(n_len, 2);

        ret_val = xmlBufferAdd(buf, (const xmlChar *)str, len);
        desret_int(ret_val);
        call_tests++;
        des_xmlBufferPtr(n_buf, buf, 0);
        des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
        des_int(n_len, len, 2);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlBufferAdd",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_buf);
            printf(" %d", n_str);
            printf(" %d", n_len);
            printf("\n");
        }
    }
    }
    }
    function_tests++;

    return(test_ret);
}


static int
test_xmlBufferAddHead(void) {
    int test_ret = 0;

    int mem_base;
    int ret_val;
    xmlBufferPtr buf; /* the buffer */
    int n_buf;
    xmlChar * str; /* the #xmlChar string */
    int n_str;
    int len; /* the number of #xmlChar to add */
    int n_len;

    for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
    for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
    for (n_len = 0;n_len < gen_nb_int;n_len++) {
        mem_base = xmlMemBlocks();
        buf = gen_xmlBufferPtr(n_buf, 0);
        str = gen_const_xmlChar_ptr(n_str, 1);
        len = gen_int(n_len, 2);

        ret_val = xmlBufferAddHead(buf, (const xmlChar *)str, len);
        desret_int(ret_val);
        call_tests++;
        des_xmlBufferPtr(n_buf, buf, 0);
        des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
        des_int(n_len, len, 2);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlBufferAddHead",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_buf);
            printf(" %d", n_str);
            printf(" %d", n_len);
            printf("\n");
        }
    }
    }
    }
    function_tests++;

    return(test_ret);
}


static int
test_xmlBufferCCat(void) {
    int test_ret = 0;

    int mem_base;
    int ret_val;
    xmlBufferPtr buf; /* the buffer to dump */
    int n_buf;
    char * str; /* the C char string */
    int n_str;

    for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
    for (n_str = 0;n_str < gen_nb_const_char_ptr;n_str++) {
        mem_base = xmlMemBlocks();
        buf = gen_xmlBufferPtr(n_buf, 0);
        str = gen_const_char_ptr(n_str, 1);

        ret_val = xmlBufferCCat(buf, (const char *)str);
        desret_int(ret_val);
        call_tests++;
        des_xmlBufferPtr(n_buf, buf, 0);
        des_const_char_ptr(n_str, (const char *)str, 1);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlBufferCCat",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_buf);
            printf(" %d", n_str);
            printf("\n");
        }
    }
    }
    function_tests++;

    return(test_ret);
}


static int
test_xmlBufferCat(void) {
    int test_ret = 0;

    int mem_base;
    int ret_val;
    xmlBufferPtr buf; /* the buffer to add to */
    int n_buf;
    xmlChar * str; /* the #xmlChar string */
    int n_str;

    for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
    for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
        mem_base = xmlMemBlocks();
        buf = gen_xmlBufferPtr(n_buf, 0);
        str = gen_const_xmlChar_ptr(n_str, 1);

        ret_val = xmlBufferCat(buf, (const xmlChar *)str);
        desret_int(ret_val);
        call_tests++;
        des_xmlBufferPtr(n_buf, buf, 0);
        des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlBufferCat",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_buf);
            printf(" %d", n_str);
            printf("\n");
        }
    }
    }
    function_tests++;

    return(test_ret);
}


#define gen_nb_const_xmlBufferPtr 1
static xmlBufferPtr gen_const_xmlBufferPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
    return(NULL);
}
static void des_const_xmlBufferPtr(int no ATTRIBUTE_UNUSED, const xmlBufferPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
}

static int
test_xmlBufferContent(void) {
    int test_ret = 0;

    int mem_base;
    const xmlChar * ret_val;
    xmlBufferPtr buf; /* the buffer */
    int n_buf;

    for (n_buf = 0;n_buf < gen_nb_const_xmlBufferPtr;n_buf++) {
        mem_base = xmlMemBlocks();
        buf = gen_const_xmlBufferPtr(n_buf, 0);

        ret_val = xmlBufferContent((const xmlBufferPtr)buf);
        desret_const_xmlChar_ptr(ret_val);
        call_tests++;
        des_const_xmlBufferPtr(n_buf, (const xmlBufferPtr)buf, 0);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlBufferContent",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_buf);
            printf("\n");
        }
    }
    function_tests++;

    return(test_ret);
}


static int
test_xmlBufferCreate(void) {
    int test_ret = 0;

    int mem_base;
    xmlBufferPtr ret_val;

        mem_base = xmlMemBlocks();

        ret_val = xmlBufferCreate();
        desret_xmlBufferPtr(ret_val);
        call_tests++;
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlBufferCreate",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf("\n");
        }
    function_tests++;

    return(test_ret);
}


static int
test_xmlBufferCreateSize(void) {
    int test_ret = 0;


    /* missing type support */
    return(test_ret);
}


static int
test_xmlBufferCreateStatic(void) {
    int test_ret = 0;


    /* missing type support */
    return(test_ret);
}


static int
test_xmlBufferEmpty(void) {
    int test_ret = 0;

    int mem_base;
    xmlBufferPtr buf; /* the buffer */
    int n_buf;

    for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
        mem_base = xmlMemBlocks();
        buf = gen_xmlBufferPtr(n_buf, 0);

        xmlBufferEmpty(buf);
        call_tests++;
        des_xmlBufferPtr(n_buf, buf, 0);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlBufferEmpty",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_buf);
            printf("\n");
        }
    }
    function_tests++;

    return(test_ret);
}


static int
test_xmlBufferGrow(void) {
    int test_ret = 0;

    int mem_base;
    int ret_val;
    xmlBufferPtr buf; /* the buffer */
    int n_buf;
    unsigned int len; /* the minimum free size to allocate */
    int n_len;

    for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
    for (n_len = 0;n_len < gen_nb_unsigned_int;n_len++) {
        mem_base = xmlMemBlocks();
        buf = gen_xmlBufferPtr(n_buf, 0);
        len = gen_unsigned_int(n_len, 1);

        ret_val = xmlBufferGrow(buf, len);
        desret_int(ret_val);
        call_tests++;
        des_xmlBufferPtr(n_buf, buf, 0);
        des_unsigned_int(n_len, len, 1);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlBufferGrow",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_buf);
            printf(" %d", n_len);
            printf("\n");
        }
    }
    }
    function_tests++;

    return(test_ret);
}


static int
test_xmlBufferLength(void) {
    int test_ret = 0;

    int mem_base;
    int ret_val;
    xmlBufferPtr buf; /* the buffer */
    int n_buf;

    for (n_buf = 0;n_buf < gen_nb_const_xmlBufferPtr;n_buf++) {
        mem_base = xmlMemBlocks();
        buf = gen_const_xmlBufferPtr(n_buf, 0);

        ret_val = xmlBufferLength((const xmlBufferPtr)buf);
        desret_int(ret_val);
        call_tests++;
        des_const_xmlBufferPtr(n_buf, (const xmlBufferPtr)buf, 0);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlBufferLength",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_buf);
            printf("\n");
        }
    }
    function_tests++;

    return(test_ret);
}


static int
test_xmlBufferResize(void) {
    int test_ret = 0;

    int mem_base;
    int ret_val;
    xmlBufferPtr buf; /* the buffer to resize */
    int n_buf;
    unsigned int size; /* the desired size */
    int n_size;

    for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
    for (n_size = 0;n_size < gen_nb_unsigned_int;n_size++) {
        mem_base = xmlMemBlocks();
        buf = gen_xmlBufferPtr(n_buf, 0);
        size = gen_unsigned_int(n_size, 1);

        ret_val = xmlBufferResize(buf, size);
        desret_int(ret_val);
        call_tests++;
        des_xmlBufferPtr(n_buf, buf, 0);
        des_unsigned_int(n_size, size, 1);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlBufferResize",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_buf);
            printf(" %d", n_size);
            printf("\n");
        }
    }
    }
    function_tests++;

    return(test_ret);
}


static int
test_xmlBufferSetAllocationScheme(void) {
    int test_ret = 0;

    int mem_base;
    xmlBufferPtr buf; /* the buffer to tune */
    int n_buf;
    xmlBufferAllocationScheme scheme; /* allocation scheme to use */
    int n_scheme;

    for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
    for (n_scheme = 0;n_scheme < gen_nb_xmlBufferAllocationScheme;n_scheme++) {
        mem_base = xmlMemBlocks();
        buf = gen_xmlBufferPtr(n_buf, 0);
        scheme = gen_xmlBufferAllocationScheme(n_scheme, 1);

        xmlBufferSetAllocationScheme(buf, scheme);
        if ((buf != NULL) && (scheme == XML_BUFFER_ALLOC_IMMUTABLE) && (buf->content != NULL) && (buf->content != static_buf_content)) { xmlFree(buf->content); buf->content = NULL;}
        call_tests++;
        des_xmlBufferPtr(n_buf, buf, 0);
        des_xmlBufferAllocationScheme(n_scheme, scheme, 1);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlBufferSetAllocationScheme",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_buf);
            printf(" %d", n_scheme);
            printf("\n");
        }
    }
    }
    function_tests++;

    return(test_ret);
}


static int
test_xmlBufferShrink(void) {
    int test_ret = 0;

    int mem_base;
    int ret_val;
    xmlBufferPtr buf; /* the buffer to dump */
    int n_buf;
    unsigned int len; /* the number of xmlChar to remove */
    int n_len;

    for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
    for (n_len = 0;n_len < gen_nb_unsigned_int;n_len++) {
        mem_base = xmlMemBlocks();
        buf = gen_xmlBufferPtr(n_buf, 0);
        len = gen_unsigned_int(n_len, 1);

        ret_val = xmlBufferShrink(buf, len);
        desret_int(ret_val);
        call_tests++;
        des_xmlBufferPtr(n_buf, buf, 0);
        des_unsigned_int(n_len, len, 1);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlBufferShrink",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_buf);
            printf(" %d", n_len);
            printf("\n");
        }
    }
    }
    function_tests++;

    return(test_ret);
}


static int
test_xmlBufferWriteCHAR(void) {
    int test_ret = 0;

    int mem_base;
    xmlBufferPtr buf; /* the XML buffer */
    int n_buf;
    xmlChar * string; /* the string to add */
    int n_string;

    for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
    for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
        mem_base = xmlMemBlocks();
        buf = gen_xmlBufferPtr(n_buf, 0);
        string = gen_const_xmlChar_ptr(n_string, 1);

        xmlBufferWriteCHAR(buf, (const xmlChar *)string);
        call_tests++;
        des_xmlBufferPtr(n_buf, buf, 0);
        des_const_xmlChar_ptr(n_string, (const xmlChar *)string, 1);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlBufferWriteCHAR",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_buf);
            printf(" %d", n_string);
            printf("\n");
        }
    }
    }
    function_tests++;

    return(test_ret);
}


static int
test_xmlBufferWriteChar(void) {
    int test_ret = 0;

    int mem_base;
    xmlBufferPtr buf; /* the XML buffer output */
    int n_buf;
    char * string; /* the string to add */
    int n_string;

    for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
    for (n_string = 0;n_string < gen_nb_const_char_ptr;n_string++) {
        mem_base = xmlMemBlocks();
        buf = gen_xmlBufferPtr(n_buf, 0);
        string = gen_const_char_ptr(n_string, 1);

        xmlBufferWriteChar(buf, (const char *)string);
        call_tests++;
        des_xmlBufferPtr(n_buf, buf, 0);
        des_const_char_ptr(n_string, (const char *)string, 1);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlBufferWriteChar",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_buf);
            printf(" %d", n_string);
            printf("\n");
        }
    }
    }
    function_tests++;

    return(test_ret);
}


static int
test_xmlBufferWriteQuotedString(void) {
    int test_ret = 0;

    int mem_base;
    xmlBufferPtr buf; /* the XML buffer output */
    int n_buf;
    xmlChar * string; /* the string to add */
    int n_string;

    for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
    for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
        mem_base = xmlMemBlocks();
        buf = gen_xmlBufferPtr(n_buf, 0);
        string = gen_const_xmlChar_ptr(n_string, 1);

        xmlBufferWriteQuotedString(buf, (const xmlChar *)string);
        call_tests++;
        des_xmlBufferPtr(n_buf, buf, 0);
        des_const_xmlChar_ptr(n_string, (const xmlChar *)string, 1);
        xmlResetLastError();
        if (mem_base != xmlMemBlocks()) {
            printf("Leak of %d blocks found in xmlBufferWriteQuotedString",
	           xmlMemBlocks() - mem_base);
	    test_ret++;
            printf(" %d", n_buf);
            printf(" %d", n_string);
            printf("\n");
        }
    }
    }
    function_tests++;

    return(test_ret);
}


static int
test_xmlBuildQName(void) {
    int test_ret = 0;

    int mem_base;
    xmlChar * ret_val;
    xmlChar * ncname; /* the Name */
    int n_ncname;
    xmlChar * prefix; /* the prefix */
    int n_prefix;
    xmlChar * memory; /* preallocated memory */
    int n_memory;
    int len; /* preallocated memory length */
    int n_len;

    for (n_ncname = 0;n_ncname < gen_nb_const_xmlChar_ptr;n_ncname++) {
    for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
    for (n_memory = 0;n_memory < gen_nb_xmlChar_ptr;n_memory++) {
    for (n_len = 0;n_len < gen_nb_int;n_len++) {
        mem_base = xmlMemBlocks();
        ncname = gen_const_xmlChar_ptr(n_ncname, 0);
        prefix = gen_const_xmlChar_ptr(n_prefix, 1);
        memory = gen_xmlChar_ptr(n_memory, 2);
        len = gen_int(n_len, 3);

        ret_val = xmlBuildQName((const xmlChar *)ncname, (const xmlChar *)prefix, memory, len);
        if ((ret_val != NULL) && (ret_val != ncname) &&
              (ret_val != prefix) && (ret_val != memory))