diff options
Diffstat (limited to 'testapi.c')
-rw-r--r-- | testapi.c | 860 |
1 files changed, 637 insertions, 223 deletions
@@ -193,6 +193,14 @@ int main(int argc, char **argv) { */ 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://missing. example.org/" +#define REMOTE2GOOD "ftp://localhost/foo" + #define gen_nb_void_ptr 2 static void *gen_void_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { @@ -392,8 +400,8 @@ static const char *gen_filepath(int no, int nr ATTRIBUTE_UNUSED) { 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("http://missing.example.org/"); - if (no == 6) return("http://missing. example.org/"); + 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) { @@ -413,9 +421,9 @@ static void des_eaten_name(int no ATTRIBUTE_UNUSED, xmlChar *val ATTRIBUTE_UNUSE 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("ftp://missing.example.org/foo"); - if (no == 3) return("http://missing.example.org/"); - if (no == 4) return("http://missing. example.org/"); + 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) { @@ -464,8 +472,8 @@ static xmlParserInputBufferPtr gen_xmlParserInputBufferPtr(int no, int nr ATTRIB 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("http://missing.example.org/", XML_CHAR_ENCODING_NONE)); - if (no == 6) return(xmlParserInputBufferCreateFilename("http://missing. example.org/", 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) { @@ -642,8 +650,8 @@ static void des_xmlOutputBufferPtr(int no ATTRIBUTE_UNUSED, xmlOutputBufferPtr v #ifdef LIBXML_FTP_ENABLED #define gen_nb_xmlNanoFTPCtxtPtr 4 static void *gen_xmlNanoFTPCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) { - if (no == 0) return(xmlNanoFTPNewCtxt("ftp://example.com/")); - if (no == 1) return(xmlNanoFTPNewCtxt("http://example.com/")); + if (no == 0) return(xmlNanoFTPNewCtxt(REMOTE2GOOD)); + if (no == 1) return(xmlNanoFTPNewCtxt(REMOTE1GOOD)); if (no == 2) return(xmlNanoFTPNewCtxt("foo")); return(NULL); } @@ -656,10 +664,16 @@ static void des_xmlNanoFTPCtxtPtr(int no ATTRIBUTE_UNUSED, void *val, int nr ATT #ifdef LIBXML_HTTP_ENABLED #define gen_nb_xmlNanoHTTPCtxtPtr 1 -static void *gen_xmlNanoHTTPCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +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 ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +static void des_xmlNanoHTTPCtxtPtr(int no ATTRIBUTE_UNUSED, void *val, int nr ATTRIBUTE_UNUSED) { + if (val != NULL) { + xmlNanoHTTPClose(val); + } } #endif @@ -667,7 +681,7 @@ static void des_xmlNanoHTTPCtxtPtr(int no ATTRIBUTE_UNUSED, void *val ATTRIBUTE_ 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 == 0) return(XML_CHAR_ENCODING_8859_1); + 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) { @@ -800,8 +814,15 @@ static void desret_xmlRelaxNGParserCtxtPtr(xmlRelaxNGParserCtxtPtr val) { #ifdef LIBXML_HTML_ENABLED static void desret_const_htmlEntityDesc_ptr(const htmlEntityDesc * val ATTRIBUTE_UNUSED) { } +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) { @@ -1045,6 +1066,21 @@ static void des_xmlSchemaValType(int no ATTRIBUTE_UNUSED, xmlSchemaValType val A #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> @@ -7938,6 +7974,29 @@ test_debugXML(void) { } 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; @@ -8239,7 +8298,8 @@ static int test_dict(void) { int test_ret = 0; - if (quiet == 0) printf("Testing dict : 8 of 9 functions ...\n"); + 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(); @@ -9617,6 +9677,16 @@ test_xmlHashCreate(void) { static int +test_xmlHashCreateDict(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int test_xmlHashLookup(void) { int test_ret = 0; @@ -10348,12 +10418,13 @@ static int test_hash(void) { int test_ret = 0; - if (quiet == 0) printf("Testing hash : 16 of 23 functions ...\n"); + 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(); @@ -11492,8 +11563,32 @@ 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 - /* missing type support */ return(test_ret); } @@ -11513,7 +11608,7 @@ test_xmlNanoFTPOpen(void) { URL = gen_filepath(n_URL, 0); ret_val = xmlNanoFTPOpen(URL); - desret_void_ptr(ret_val); + desret_xmlNanoFTPCtxtPtr(ret_val); call_tests++; des_filepath(n_URL, URL, 0); xmlResetLastError(); @@ -11728,7 +11823,7 @@ static int test_nanoftp(void) { int test_ret = 0; - if (quiet == 0) printf("Testing nanoftp : 15 of 22 functions ...\n"); + if (quiet == 0) printf("Testing nanoftp : 16 of 22 functions ...\n"); test_ret += test_xmlNanoFTPCheckResponse(); test_ret += test_xmlNanoFTPCleanup(); test_ret += test_xmlNanoFTPCloseConnection(); @@ -11813,38 +11908,6 @@ test_xmlNanoHTTPCleanup(void) { static int -test_xmlNanoHTTPClose(void) { - int test_ret = 0; - -#if defined(LIBXML_HTTP_ENABLED) - int mem_base; - 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); - - xmlNanoHTTPClose(ctx); - call_tests++; - des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNanoHTTPClose", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctx); - printf("\n"); - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int test_xmlNanoHTTPContentLength(void) { int test_ret = 0; @@ -11933,19 +11996,19 @@ test_xmlNanoHTTPFetch(void) { 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_filename = 0;n_filename < gen_nb_filepath;n_filename++) { + 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_filepath(n_URL, 0); - filename = gen_filepath(n_filename, 1); + 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_filepath(n_URL, URL, 0); - des_filepath(n_filename, filename, 1); + 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()) { @@ -11993,151 +12056,6 @@ test_xmlNanoHTTPInit(void) { static int -test_xmlNanoHTTPMethod(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 * method; /* the HTTP method to use */ - int n_method; - char * input; /* the input string if any */ - int n_input; - char ** contentType; /* the Content-Type information IN and OUT */ - int n_contentType; - char * headers; /* the extra headers */ - int n_headers; - int ilen; /* input length */ - int n_ilen; - - for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) { - for (n_method = 0;n_method < gen_nb_const_char_ptr;n_method++) { - for (n_input = 0;n_input < gen_nb_const_char_ptr;n_input++) { - for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) { - for (n_headers = 0;n_headers < gen_nb_const_char_ptr;n_headers++) { - for (n_ilen = 0;n_ilen < gen_nb_int;n_ilen++) { - mem_base = xmlMemBlocks(); - URL = gen_filepath(n_URL, 0); - method = gen_const_char_ptr(n_method, 1); - input = gen_const_char_ptr(n_input, 2); - contentType = gen_char_ptr_ptr(n_contentType, 3); - headers = gen_const_char_ptr(n_headers, 4); - ilen = gen_int(n_ilen, 5); - - ret_val = xmlNanoHTTPMethod(URL, (const char *)method, (const char *)input, contentType, (const char *)headers, ilen); - desret_void_ptr(ret_val); - call_tests++; - des_filepath(n_URL, URL, 0); - des_const_char_ptr(n_method, (const char *)method, 1); - des_const_char_ptr(n_input, (const char *)input, 2); - des_char_ptr_ptr(n_contentType, contentType, 3); - des_const_char_ptr(n_headers, (const char *)headers, 4); - des_int(n_ilen, ilen, 5); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNanoHTTPMethod", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_URL); - printf(" %d", n_method); - printf(" %d", n_input); - printf(" %d", n_contentType); - printf(" %d", n_headers); - printf(" %d", n_ilen); - printf("\n"); - } - } - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int -test_xmlNanoHTTPMethodRedir(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 * method; /* the HTTP method to use */ - int n_method; - char * input; /* the input string if any */ - int n_input; - char ** contentType; /* the Content-Type information IN and OUT */ - int n_contentType; - char ** redir; /* the redirected URL OUT */ - int n_redir; - char * headers; /* the extra headers */ - int n_headers; - int ilen; /* input length */ - int n_ilen; - - for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) { - for (n_method = 0;n_method < gen_nb_const_char_ptr;n_method++) { - for (n_input = 0;n_input < gen_nb_const_char_ptr;n_input++) { - 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++) { - for (n_headers = 0;n_headers < gen_nb_const_char_ptr;n_headers++) { - for (n_ilen = 0;n_ilen < gen_nb_int;n_ilen++) { - mem_base = xmlMemBlocks(); - URL = gen_filepath(n_URL, 0); - method = gen_const_char_ptr(n_method, 1); - input = gen_const_char_ptr(n_input, 2); - contentType = gen_char_ptr_ptr(n_contentType, 3); - redir = gen_char_ptr_ptr(n_redir, 4); - headers = gen_const_char_ptr(n_headers, 5); - ilen = gen_int(n_ilen, 6); - - ret_val = xmlNanoHTTPMethodRedir(URL, (const char *)method, (const char *)input, contentType, redir, (const char *)headers, ilen); - desret_void_ptr(ret_val); - call_tests++; - des_filepath(n_URL, URL, 0); - des_const_char_ptr(n_method, (const char *)method, 1); - des_const_char_ptr(n_input, (const char *)input, 2); - des_char_ptr_ptr(n_contentType, contentType, 3); - des_char_ptr_ptr(n_redir, redir, 4); - des_const_char_ptr(n_headers, (const char *)headers, 5); - des_int(n_ilen, ilen, 6); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlNanoHTTPMethodRedir", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_URL); - printf(" %d", n_method); - printf(" %d", n_input); - printf(" %d", n_contentType); - printf(" %d", n_redir); - printf(" %d", n_headers); - printf(" %d", n_ilen); - printf("\n"); - } - } - } - } - } - } - } - } - function_tests++; -#endif - - return(test_ret); -} - - -static int test_xmlNanoHTTPMimeType(void) { int test_ret = 0; @@ -12190,7 +12108,7 @@ test_xmlNanoHTTPOpen(void) { contentType = gen_char_ptr_ptr(n_contentType, 1); ret_val = xmlNanoHTTPOpen(URL, contentType); - desret_void_ptr(ret_val); + desret_xmlNanoHTTPCtxtPtr(ret_val); call_tests++; des_filepath(n_URL, URL, 0); des_char_ptr_ptr(n_contentType, contentType, 1); @@ -12235,7 +12153,7 @@ test_xmlNanoHTTPOpenRedir(void) { redir = gen_char_ptr_ptr(n_redir, 2); ret_val = xmlNanoHTTPOpenRedir(URL, contentType, redir); - desret_void_ptr(ret_val); + desret_xmlNanoHTTPCtxtPtr(ret_val); call_tests++; des_filepath(n_URL, URL, 0); des_char_ptr_ptr(n_contentType, contentType, 1); @@ -12419,16 +12337,13 @@ static int test_nanohttp(void) { int test_ret = 0; - if (quiet == 0) printf("Testing nanohttp : 16 of 17 functions ...\n"); + if (quiet == 0) printf("Testing nanohttp : 13 of 17 functions ...\n"); test_ret += test_xmlNanoHTTPAuthHeader(); test_ret += test_xmlNanoHTTPCleanup(); - test_ret += test_xmlNanoHTTPClose(); test_ret += test_xmlNanoHTTPContentLength(); test_ret += test_xmlNanoHTTPEncoding(); test_ret += test_xmlNanoHTTPFetch(); test_ret += test_xmlNanoHTTPInit(); - test_ret += test_xmlNanoHTTPMethod(); - test_ret += test_xmlNanoHTTPMethodRedir(); test_ret += test_xmlNanoHTTPMimeType(); test_ret += test_xmlNanoHTTPOpen(); test_ret += test_xmlNanoHTTPOpenRedir(); @@ -16657,6 +16572,50 @@ test_parserInternals(void) { } 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; @@ -16698,6 +16657,74 @@ test_xmlPatternMatch(void) { 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_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; @@ -16706,13 +16733,157 @@ test_xmlPatterncompile(void) { return(test_ret); } + +#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) { +} + +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_pattern(void) { int test_ret = 0; - if (quiet == 0) printf("Testing pattern : 1 of 4 functions ...\n"); + if (quiet == 0) printf("Testing pattern : 7 of 12 functions ...\n"); + test_ret += test_xmlPatternFromRoot(); + test_ret += test_xmlPatternGetStreamCtxt(); test_ret += test_xmlPatternMatch(); + test_ret += test_xmlPatternMaxDepth(); + test_ret += test_xmlPatternStreamable(); test_ret += test_xmlPatterncompile(); + test_ret += test_xmlStreamPop(); + test_ret += test_xmlStreamPush(); + test_ret += test_xmlStreamPushAttr(); if (test_ret != 0) printf("Module pattern: %d errors\n", test_ret); @@ -23591,6 +23762,45 @@ test_xmlCopyAttributeTable(void) { static int +test_xmlCopyDocElementContent(void) { + int test_ret = 0; + + int mem_base; + xmlElementContentPtr ret_val; + xmlDocPtr doc; /* the document owning the element declaration */ + int n_doc; + xmlElementContentPtr cur; /* An element content pointer. */ + int n_cur; + + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + for (n_cur = 0;n_cur < gen_nb_xmlElementContentPtr;n_cur++) { + mem_base = xmlMemBlocks(); + doc = gen_xmlDocPtr(n_doc, 0); + cur = gen_xmlElementContentPtr(n_cur, 1); + + ret_val = xmlCopyDocElementContent(doc, cur); + desret_xmlElementContentPtr(ret_val); + call_tests++; + des_xmlDocPtr(n_doc, doc, 0); + des_xmlElementContentPtr(n_cur, cur, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlCopyDocElementContent", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_doc); + printf(" %d", n_cur); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int test_xmlCopyElementContent(void) { int test_ret = 0; @@ -24306,6 +24516,53 @@ test_xmlIsRef(void) { static int +test_xmlNewDocElementContent(void) { + int test_ret = 0; + + int mem_base; + xmlElementContentPtr ret_val; + xmlDocPtr doc; /* the document */ + int n_doc; + xmlChar * name; /* the subelement name or NULL */ + int n_name; + xmlElementContentType type; /* the type of element content decl */ + int n_type; + + 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_xmlElementContentType;n_type++) { + mem_base = xmlMemBlocks(); + doc = gen_xmlDocPtr(n_doc, 0); + name = gen_const_xmlChar_ptr(n_name, 1); + type = gen_xmlElementContentType(n_type, 2); + + ret_val = xmlNewDocElementContent(doc, (const xmlChar *)name, type); + xmlFreeDocElementContent(doc, ret_val); ret_val = NULL; + desret_xmlElementContentPtr(ret_val); + call_tests++; + des_xmlDocPtr(n_doc, doc, 0); + des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1); + des_xmlElementContentType(n_type, type, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNewDocElementContent", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_doc); + printf(" %d", n_name); + printf(" %d", n_type); + printf("\n"); + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int test_xmlNewElementContent(void) { int test_ret = 0; @@ -25779,13 +26036,14 @@ static int test_valid(void) { int test_ret = 0; - if (quiet == 0) printf("Testing valid : 48 of 67 functions ...\n"); + if (quiet == 0) printf("Testing valid : 50 of 70 functions ...\n"); test_ret += test_xmlAddAttributeDecl(); test_ret += test_xmlAddElementDecl(); test_ret += test_xmlAddID(); test_ret += test_xmlAddNotationDecl(); test_ret += test_xmlAddRef(); test_ret += test_xmlCopyAttributeTable(); + test_ret += test_xmlCopyDocElementContent(); test_ret += test_xmlCopyElementContent(); test_ret += test_xmlCopyElementTable(); test_ret += test_xmlCopyEnumeration(); @@ -25807,6 +26065,7 @@ test_valid(void) { test_ret += test_xmlIsID(); test_ret += test_xmlIsMixedElement(); test_ret += test_xmlIsRef(); + test_ret += test_xmlNewDocElementContent(); test_ret += test_xmlNewElementContent(); test_ret += test_xmlNewValidCtxt(); test_ret += test_xmlRemoveID(); @@ -26674,7 +26933,7 @@ test_xmlIOHTTPOpen(void) { filename = gen_filepath(n_filename, 0); ret_val = xmlIOHTTPOpen(filename); - desret_void_ptr(ret_val); + desret_xmlNanoHTTPCtxtPtr(ret_val); call_tests++; des_filepath(n_filename, filename, 0); xmlResetLastError(); @@ -26694,16 +26953,6 @@ test_xmlIOHTTPOpen(void) { static int -test_xmlIOHTTPOpenW(void) { - int test_ret = 0; - - - /* missing type support */ - return(test_ret); -} - - -static int test_xmlIOHTTPRead(void) { int test_ret = 0; @@ -27555,7 +27804,6 @@ test_xmlIO(void) { test_ret += test_xmlIOHTTPClose(); test_ret += test_xmlIOHTTPMatch(); test_ret += test_xmlIOHTTPOpen(); - test_ret += test_xmlIOHTTPOpenW(); test_ret += test_xmlIOHTTPRead(); test_ret += test_xmlNoNetExternalEntityLoader(); test_ret += test_xmlNormalizeWindowsPath(); @@ -28903,6 +29151,40 @@ test_xmlTextReaderBaseUri(void) { static int +test_xmlTextReaderByteConsumed(void) { + int test_ret = 0; + +#if defined(LIBXML_READER_ENABLED) + int mem_base; + long ret_val; + xmlTextReaderPtr reader; /* an XML reader */ + int n_reader; + + for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { + mem_base = xmlMemBlocks(); + reader = gen_xmlTextReaderPtr(n_reader, 0); + + ret_val = xmlTextReaderByteConsumed(reader); + desret_long(ret_val); + call_tests++; + des_xmlTextReaderPtr(n_reader, reader, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextReaderByteConsumed", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_reader); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int test_xmlTextReaderClose(void) { int test_ret = 0; @@ -31050,7 +31332,7 @@ static int test_xmlreader(void) { int test_ret = 0; - if (quiet == 0) printf("Testing xmlreader : 70 of 80 functions ...\n"); + if (quiet == 0) printf("Testing xmlreader : 71 of 81 functions ...\n"); test_ret += test_xmlNewTextReader(); test_ret += test_xmlNewTextReaderFilename(); test_ret += test_xmlReaderForDoc(); @@ -31063,6 +31345,7 @@ test_xmlreader(void) { test_ret += test_xmlReaderWalker(); test_ret += test_xmlTextReaderAttributeCount(); test_ret += test_xmlTextReaderBaseUri(); + test_ret += test_xmlTextReaderByteConsumed(); test_ret += test_xmlTextReaderClose(); test_ret += test_xmlTextReaderConstBaseUri(); test_ret += test_xmlTextReaderConstEncoding(); @@ -32532,6 +32815,71 @@ test_xmlSchemaCompareValues(void) { static int +test_xmlSchemaCompareValuesWhtsp(void) { + int test_ret = 0; + +#if defined(LIBXML_SCHEMAS_ENABLED) + int mem_base; + int ret_val; + xmlSchemaValPtr x; /* a first value */ + int n_x; + xmlSchemaWhitespaceValueType xws; /* the whitespace value of x */ + int n_xws; + xmlSchemaValPtr y; /* a second value */ + int n_y; + xmlSchemaWhitespaceValueType yws; /* the whitespace value of y */ + int n_yws; + + for (n_x = 0;n_x < gen_nb_xmlSchemaValPtr;n_x++) { + for (n_xws = 0;n_xws < gen_nb_xmlSchemaWhitespaceValueType;n_xws++) { + for (n_y = 0;n_y < gen_nb_xmlSchemaValPtr;n_y++) { + for (n_yws = 0;n_yws < gen_nb_xmlSchemaWhitespaceValueType;n_yws++) { + mem_base = xmlMemBlocks(); + x = gen_xmlSchemaValPtr(n_x, 0); + xws = gen_xmlSchemaWhitespaceValueType(n_xws, 1); + y = gen_xmlSchemaValPtr(n_y, 2); + yws = gen_xmlSchemaWhitespaceValueType(n_yws, 3); + + ret_val = xmlSchemaCompareValuesWhtsp(x, xws, y, yws); + desret_int(ret_val); + call_tests++; + des_xmlSchemaValPtr(n_x, x, 0); + des_xmlSchemaWhitespaceValueType(n_xws, xws, 1); + des_xmlSchemaValPtr(n_y, y, 2); + des_xmlSchemaWhitespaceValueType(n_yws, yws, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSchemaCompareValuesWhtsp", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_x); + printf(" %d", n_xws); + printf(" %d", n_y); + printf(" %d", n_yws); + printf("\n"); + } + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlSchemaCopyValue(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int test_xmlSchemaGetBuiltInListSimpleTypeItemType(void) { int test_ret = 0; @@ -32591,6 +32939,47 @@ test_xmlSchemaGetBuiltInType(void) { static int +test_xmlSchemaGetCanonValue(void) { + int test_ret = 0; + +#if defined(LIBXML_SCHEMAS_ENABLED) + int mem_base; + int ret_val; + xmlSchemaValPtr val; /* the precomputed value */ + int n_val; + xmlChar ** retValue; /* the returned value */ + int n_retValue; + + for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr;n_val++) { + for (n_retValue = 0;n_retValue < gen_nb_const_xmlChar_ptr_ptr;n_retValue++) { + mem_base = xmlMemBlocks(); + val = gen_xmlSchemaValPtr(n_val, 0); + retValue = gen_const_xmlChar_ptr_ptr(n_retValue, 1); + + ret_val = xmlSchemaGetCanonValue(val, (const xmlChar **)retValue); + desret_int(ret_val); + call_tests++; + des_xmlSchemaValPtr(n_val, val, 0); + des_const_xmlChar_ptr_ptr(n_retValue, (const xmlChar **)retValue, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSchemaGetCanonValue", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_val); + printf(" %d", n_retValue); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int test_xmlSchemaGetFacetValueAsULong(void) { int test_ret = 0; @@ -32732,6 +33121,26 @@ test_xmlSchemaNewFacet(void) { return(test_ret); } + +static int +test_xmlSchemaNewNOTATIONValue(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlSchemaNewStringValue(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + #ifdef LIBXML_SCHEMAS_ENABLED #define gen_nb_xmlSchemaValPtr_ptr 1 @@ -33110,18 +33519,23 @@ static int test_xmlschemastypes(void) { int test_ret = 0; - if (quiet == 0) printf("Testing xmlschemastypes : 17 of 20 functions ...\n"); + if (quiet == 0) printf("Testing xmlschemastypes : 19 of 25 functions ...\n"); test_ret += test_xmlSchemaCheckFacet(); test_ret += test_xmlSchemaCleanupTypes(); test_ret += test_xmlSchemaCollapseString(); test_ret += test_xmlSchemaCompareValues(); + test_ret += test_xmlSchemaCompareValuesWhtsp(); + test_ret += test_xmlSchemaCopyValue(); test_ret += test_xmlSchemaGetBuiltInListSimpleTypeItemType(); test_ret += test_xmlSchemaGetBuiltInType(); + test_ret += test_xmlSchemaGetCanonValue(); test_ret += test_xmlSchemaGetFacetValueAsULong(); test_ret += test_xmlSchemaGetPredefinedType(); test_ret += test_xmlSchemaInitTypes(); test_ret += test_xmlSchemaIsBuiltInTypeFacet(); test_ret += test_xmlSchemaNewFacet(); + test_ret += test_xmlSchemaNewNOTATIONValue(); + test_ret += test_xmlSchemaNewStringValue(); test_ret += test_xmlSchemaValPredefTypeNode(); test_ret += test_xmlSchemaValPredefTypeNodeNoNorm(); test_ret += test_xmlSchemaValidateFacet(); |