diff options
author | Mike Hommey <glandium@debian.org> | 2009-09-10 22:10:39 +0200 |
---|---|---|
committer | Mike Hommey <glandium@debian.org> | 2009-09-10 22:10:39 +0200 |
commit | c3e4f3c26035bc93a69e5aa2ad435809e8be8a4e (patch) | |
tree | e65557c2e042fe8a77635b0548db10ad97bc1bfe /testapi.c | |
parent | e248b20a3b7df364cc9617b8685b4c190338bcd2 (diff) | |
download | libxml2-c3e4f3c26035bc93a69e5aa2ad435809e8be8a4e.tar.gz |
Import upstream version 2.7.4upstream/2.7.4.dfsg
Diffstat (limited to 'testapi.c')
-rw-r--r-- | testapi.c | 128 |
1 files changed, 87 insertions, 41 deletions
@@ -991,6 +991,13 @@ static void des_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, xmlParserNodeIn static void desret_const_xmlParserNodeInfo_ptr(const xmlParserNodeInfo *val ATTRIBUTE_UNUSED) { } +#define gen_nb_void_ptr_ptr 1 +static void ** gen_void_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + return(NULL); +} +static void des_void_ptr_ptr(int no ATTRIBUTE_UNUSED, void ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} + /************************************************************************ * * * WARNING: end of the manually maintained part of the test code * @@ -5345,8 +5352,8 @@ test_xmlC14NDocDumpMemory(void) { 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; + int mode; /* the c14n mode (see @xmlC14NMode) */ + int n_mode; xmlChar ** inclusive_ns_prefixes; /* the list of inclusive namespace prefixes ended with a NULL or NULL if there is no inclusive namespaces (only for exclusive canonicalization, ignored otherwise) */ int n_inclusive_ns_prefixes; int with_comments; /* include comments in the result (!=0) or not (==0) */ @@ -5356,24 +5363,24 @@ test_xmlC14NDocDumpMemory(void) { 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_mode = 0;n_mode < gen_nb_int;n_mode++) { for (n_inclusive_ns_prefixes = 0;n_inclusive_ns_prefixes < gen_nb_xmlChar_ptr_ptr;n_inclusive_ns_prefixes++) { for (n_with_comments = 0;n_with_comments < gen_nb_int;n_with_comments++) { for (n_doc_txt_ptr = 0;n_doc_txt_ptr < gen_nb_xmlChar_ptr_ptr;n_doc_txt_ptr++) { mem_base = xmlMemBlocks(); doc = gen_xmlDocPtr(n_doc, 0); nodes = gen_xmlNodeSetPtr(n_nodes, 1); - exclusive = gen_int(n_exclusive, 2); + mode = gen_int(n_mode, 2); inclusive_ns_prefixes = gen_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, 3); with_comments = gen_int(n_with_comments, 4); doc_txt_ptr = gen_xmlChar_ptr_ptr(n_doc_txt_ptr, 5); - ret_val = xmlC14NDocDumpMemory(doc, nodes, exclusive, inclusive_ns_prefixes, with_comments, doc_txt_ptr); + ret_val = xmlC14NDocDumpMemory(doc, nodes, mode, inclusive_ns_prefixes, with_comments, doc_txt_ptr); desret_int(ret_val); call_tests++; des_xmlDocPtr(n_doc, doc, 0); des_xmlNodeSetPtr(n_nodes, nodes, 1); - des_int(n_exclusive, exclusive, 2); + des_int(n_mode, mode, 2); des_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, inclusive_ns_prefixes, 3); des_int(n_with_comments, with_comments, 4); des_xmlChar_ptr_ptr(n_doc_txt_ptr, doc_txt_ptr, 5); @@ -5384,7 +5391,7 @@ test_xmlC14NDocDumpMemory(void) { test_ret++; printf(" %d", n_doc); printf(" %d", n_nodes); - printf(" %d", n_exclusive); + printf(" %d", n_mode); printf(" %d", n_inclusive_ns_prefixes); printf(" %d", n_with_comments); printf(" %d", n_doc_txt_ptr); @@ -5414,8 +5421,8 @@ test_xmlC14NDocSave(void) { 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; + int mode; /* the c14n mode (see @xmlC14NMode) */ + int n_mode; xmlChar ** inclusive_ns_prefixes; /* the list of inclusive namespace prefixes ended with a NULL or NULL if there is no inclusive namespaces (only for exclusive canonicalization, ignored otherwise) */ int n_inclusive_ns_prefixes; int with_comments; /* include comments in the result (!=0) or not (==0) */ @@ -5427,7 +5434,7 @@ test_xmlC14NDocSave(void) { 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_mode = 0;n_mode < gen_nb_int;n_mode++) { for (n_inclusive_ns_prefixes = 0;n_inclusive_ns_prefixes < gen_nb_xmlChar_ptr_ptr;n_inclusive_ns_prefixes++) { for (n_with_comments = 0;n_with_comments < gen_nb_int;n_with_comments++) { for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) { @@ -5435,18 +5442,18 @@ test_xmlC14NDocSave(void) { mem_base = xmlMemBlocks(); doc = gen_xmlDocPtr(n_doc, 0); nodes = gen_xmlNodeSetPtr(n_nodes, 1); - exclusive = gen_int(n_exclusive, 2); + mode = gen_int(n_mode, 2); inclusive_ns_prefixes = gen_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, 3); with_comments = gen_int(n_with_comments, 4); filename = gen_fileoutput(n_filename, 5); compression = gen_int(n_compression, 6); - ret_val = xmlC14NDocSave(doc, nodes, exclusive, inclusive_ns_prefixes, with_comments, filename, compression); + ret_val = xmlC14NDocSave(doc, nodes, mode, inclusive_ns_prefixes, with_comments, filename, compression); desret_int(ret_val); call_tests++; des_xmlDocPtr(n_doc, doc, 0); des_xmlNodeSetPtr(n_nodes, nodes, 1); - des_int(n_exclusive, exclusive, 2); + des_int(n_mode, mode, 2); des_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, inclusive_ns_prefixes, 3); des_int(n_with_comments, with_comments, 4); des_fileoutput(n_filename, filename, 5); @@ -5458,7 +5465,7 @@ test_xmlC14NDocSave(void) { test_ret++; printf(" %d", n_doc); printf(" %d", n_nodes); - printf(" %d", n_exclusive); + printf(" %d", n_mode); printf(" %d", n_inclusive_ns_prefixes); printf(" %d", n_with_comments); printf(" %d", n_filename); @@ -5490,8 +5497,8 @@ test_xmlC14NDocSaveTo(void) { 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; + int mode; /* the c14n mode (see @xmlC14NMode) */ + int n_mode; xmlChar ** inclusive_ns_prefixes; /* the list of inclusive namespace prefixes ended with a NULL or NULL if there is no inclusive namespaces (only for exclusive canonicalization, ignored otherwise) */ int n_inclusive_ns_prefixes; int with_comments; /* include comments in the result (!=0) or not (==0) */ @@ -5501,24 +5508,24 @@ test_xmlC14NDocSaveTo(void) { 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_mode = 0;n_mode < gen_nb_int;n_mode++) { for (n_inclusive_ns_prefixes = 0;n_inclusive_ns_prefixes < gen_nb_xmlChar_ptr_ptr;n_inclusive_ns_prefixes++) { for (n_with_comments = 0;n_with_comments < gen_nb_int;n_with_comments++) { for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) { mem_base = xmlMemBlocks(); doc = gen_xmlDocPtr(n_doc, 0); nodes = gen_xmlNodeSetPtr(n_nodes, 1); - exclusive = gen_int(n_exclusive, 2); + mode = gen_int(n_mode, 2); inclusive_ns_prefixes = gen_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, 3); with_comments = gen_int(n_with_comments, 4); buf = gen_xmlOutputBufferPtr(n_buf, 5); - ret_val = xmlC14NDocSaveTo(doc, nodes, exclusive, inclusive_ns_prefixes, with_comments, buf); + ret_val = xmlC14NDocSaveTo(doc, nodes, mode, inclusive_ns_prefixes, with_comments, buf); desret_int(ret_val); call_tests++; des_xmlDocPtr(n_doc, doc, 0); des_xmlNodeSetPtr(n_nodes, nodes, 1); - des_int(n_exclusive, exclusive, 2); + des_int(n_mode, mode, 2); des_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, inclusive_ns_prefixes, 3); des_int(n_with_comments, with_comments, 4); des_xmlOutputBufferPtr(n_buf, buf, 5); @@ -5529,7 +5536,7 @@ test_xmlC14NDocSaveTo(void) { test_ret++; printf(" %d", n_doc); printf(" %d", n_nodes); - printf(" %d", n_exclusive); + printf(" %d", n_mode); printf(" %d", n_inclusive_ns_prefixes); printf(" %d", n_with_comments); printf(" %d", n_buf); @@ -14618,14 +14625,14 @@ test_xmlRecoverDoc(void) { xmlChar * cur; /* a pointer to an array of xmlChar */ int n_cur; - for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) { + for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) { mem_base = xmlMemBlocks(); - cur = gen_xmlChar_ptr(n_cur, 0); + cur = gen_const_xmlChar_ptr(n_cur, 0); - ret_val = xmlRecoverDoc(cur); + ret_val = xmlRecoverDoc((const xmlChar *)cur); desret_xmlDocPtr(ret_val); call_tests++; - des_xmlChar_ptr(n_cur, cur, 0); + des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { printf("Leak of %d blocks found in xmlRecoverDoc", @@ -17371,16 +17378,6 @@ static void des_xmlRelaxNGValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, xmlRe } #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) { @@ -27386,6 +27383,54 @@ test_xmlXIncludeProcessTreeFlags(void) { static int +test_xmlXIncludeProcessTreeFlagsData(void) { + int test_ret = 0; + +#if defined(LIBXML_XINCLUDE_ENABLED) + int mem_base; + int ret_val; + xmlNodePtr tree; /* an XML node */ + int n_tree; + int flags; /* a set of xmlParserOption used for parsing XML includes */ + int n_flags; + void * data; /* application data that will be passed to the parser context in the _private field of the parser context(s) */ + int n_data; + + for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) { + for (n_flags = 0;n_flags < gen_nb_int;n_flags++) { + for (n_data = 0;n_data < gen_nb_userdata;n_data++) { + mem_base = xmlMemBlocks(); + tree = gen_xmlNodePtr(n_tree, 0); + flags = gen_int(n_flags, 1); + data = gen_userdata(n_data, 2); + + ret_val = xmlXIncludeProcessTreeFlagsData(tree, flags, data); + desret_int(ret_val); + call_tests++; + des_xmlNodePtr(n_tree, tree, 0); + des_int(n_flags, flags, 1); + des_userdata(n_data, data, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXIncludeProcessTreeFlagsData", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_tree); + printf(" %d", n_flags); + printf(" %d", n_data); + printf("\n"); + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int test_xmlXIncludeSetFlags(void) { int test_ret = 0; @@ -27429,7 +27474,7 @@ static int test_xinclude(void) { int test_ret = 0; - if (quiet == 0) printf("Testing xinclude : 7 of 9 functions ...\n"); + if (quiet == 0) printf("Testing xinclude : 8 of 10 functions ...\n"); test_ret += test_xmlXIncludeNewContext(); test_ret += test_xmlXIncludeProcess(); test_ret += test_xmlXIncludeProcessFlags(); @@ -27437,6 +27482,7 @@ test_xinclude(void) { test_ret += test_xmlXIncludeProcessNode(); test_ret += test_xmlXIncludeProcessTree(); test_ret += test_xmlXIncludeProcessTreeFlags(); + test_ret += test_xmlXIncludeProcessTreeFlagsData(); test_ret += test_xmlXIncludeSetFlags(); if (test_ret != 0) @@ -36166,16 +36212,16 @@ test_xmlStrcasestr(void) { int n_val; for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) { - for (n_val = 0;n_val < gen_nb_xmlChar_ptr;n_val++) { + for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) { mem_base = xmlMemBlocks(); str = gen_const_xmlChar_ptr(n_str, 0); - val = gen_xmlChar_ptr(n_val, 1); + val = gen_const_xmlChar_ptr(n_val, 1); - ret_val = xmlStrcasestr((const xmlChar *)str, val); + ret_val = xmlStrcasestr((const xmlChar *)str, (const xmlChar *)val); desret_const_xmlChar_ptr(ret_val); call_tests++; des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0); - des_xmlChar_ptr(n_val, val, 1); + des_const_xmlChar_ptr(n_val, (const xmlChar *)val, 1); xmlResetLastError(); if (mem_base != xmlMemBlocks()) { printf("Leak of %d blocks found in xmlStrcasestr", @@ -49648,7 +49694,7 @@ test_xmlXPathRegisterNs(void) { int ret_val; xmlXPathContextPtr ctxt; /* the XPath context */ int n_ctxt; - xmlChar * prefix; /* the namespace prefix */ + xmlChar * prefix; /* the namespace prefix cannot be NULL or empty string */ int n_prefix; xmlChar * ns_uri; /* the namespace name */ int n_ns_uri; |