summaryrefslogtreecommitdiff
path: root/testapi.c
diff options
context:
space:
mode:
Diffstat (limited to 'testapi.c')
-rw-r--r--testapi.c122
1 files changed, 115 insertions, 7 deletions
diff --git a/testapi.c b/testapi.c
index df14820..4f4b39b 100644
--- a/testapi.c
+++ b/testapi.c
@@ -19,7 +19,7 @@
#include <libxml/xmlerror.h>
#include <libxml/relaxng.h>
-#if defined(_WIN32) && !defined(__CYGWIN__)
+#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__MINGW32__)
#define snprintf _snprintf
#endif
@@ -599,7 +599,7 @@ static void des_xmlTextReaderPtr(int no ATTRIBUTE_UNUSED, xmlTextReaderPtr val,
#endif
#define gen_nb_xmlBufferPtr 3
-static const char *static_buf_content = "a static buffer";
+static const xmlChar *static_buf_content = (xmlChar *)"a static buffer";
static xmlBufferPtr gen_xmlBufferPtr(int no, int nr ATTRIBUTE_UNUSED) {
if (no == 0) return(xmlBufferCreate());
if (no == 1) return(xmlBufferCreateStatic((void *)static_buf_content, 13));
@@ -1040,8 +1040,8 @@ static void des_xmlAttributeType(int no ATTRIBUTE_UNUSED, xmlAttributeType val A
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);
+ if (no == 3) return(XML_BUFFER_ALLOC_HYBRID);
+ if (no == 4) return(XML_BUFFER_ALLOC_IMMUTABLE);
return(0);
}
@@ -8446,11 +8446,36 @@ test_xmlDictSize(void) {
return(test_ret);
}
+
+static int
+test_xmlInitializeDict(void) {
+ int test_ret = 0;
+
+ int mem_base;
+ int ret_val;
+
+ mem_base = xmlMemBlocks();
+
+ ret_val = xmlInitializeDict();
+ desret_int(ret_val);
+ call_tests++;
+ xmlResetLastError();
+ if (mem_base != xmlMemBlocks()) {
+ printf("Leak of %d blocks found in xmlInitializeDict",
+ xmlMemBlocks() - mem_base);
+ test_ret++;
+ printf("\n");
+ }
+ function_tests++;
+
+ return(test_ret);
+}
+
static int
test_dict(void) {
int test_ret = 0;
- if (quiet == 0) printf("Testing dict : 9 of 10 functions ...\n");
+ if (quiet == 0) printf("Testing dict : 10 of 11 functions ...\n");
test_ret += test_xmlDictCleanup();
test_ret += test_xmlDictCreate();
test_ret += test_xmlDictCreateSub();
@@ -8460,6 +8485,7 @@ test_dict(void) {
test_ret += test_xmlDictQLookup();
test_ret += test_xmlDictReference();
test_ret += test_xmlDictSize();
+ test_ret += test_xmlInitializeDict();
if (test_ret != 0)
printf("Module dict: %d errors\n", test_ret);
@@ -18614,6 +18640,38 @@ test_xmlBufferCreateStatic(void) {
static int
+test_xmlBufferDetach(void) {
+ int test_ret = 0;
+
+ int mem_base;
+ xmlChar * ret_val;
+ 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);
+
+ ret_val = xmlBufferDetach(buf);
+ desret_xmlChar_ptr(ret_val);
+ call_tests++;
+ des_xmlBufferPtr(n_buf, buf, 0);
+ xmlResetLastError();
+ if (mem_base != xmlMemBlocks()) {
+ printf("Leak of %d blocks found in xmlBufferDetach",
+ xmlMemBlocks() - mem_base);
+ test_ret++;
+ printf(" %d", n_buf);
+ printf("\n");
+ }
+ }
+ function_tests++;
+
+ return(test_ret);
+}
+
+
+static int
test_xmlBufferEmpty(void) {
int test_ret = 0;
@@ -23957,7 +24015,7 @@ static int
test_tree(void) {
int test_ret = 0;
- if (quiet == 0) printf("Testing tree : 138 of 157 functions ...\n");
+ if (quiet == 0) printf("Testing tree : 139 of 158 functions ...\n");
test_ret += test_xmlAddChild();
test_ret += test_xmlAddChildList();
test_ret += test_xmlAddNextSibling();
@@ -23972,6 +24030,7 @@ test_tree(void) {
test_ret += test_xmlBufferCreate();
test_ret += test_xmlBufferCreateSize();
test_ret += test_xmlBufferCreateStatic();
+ test_ret += test_xmlBufferDetach();
test_ret += test_xmlBufferEmpty();
test_ret += test_xmlBufferGrow();
test_ret += test_xmlBufferLength();
@@ -32275,6 +32334,54 @@ test_xmlTextReaderRelaxNGValidate(void) {
static int
+test_xmlTextReaderRelaxNGValidateCtxt(void) {
+ int test_ret = 0;
+
+#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_SCHEMAS_ENABLED)
+ int mem_base;
+ int ret_val;
+ xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
+ int n_reader;
+ xmlRelaxNGValidCtxtPtr ctxt; /* the RelaxNG schema validation context or NULL */
+ int n_ctxt;
+ int options; /* options (not used yet) */
+ int n_options;
+
+ for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
+ for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
+ for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
+ mem_base = xmlMemBlocks();
+ reader = gen_xmlTextReaderPtr(n_reader, 0);
+ ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 1);
+ options = gen_parseroptions(n_options, 2);
+
+ ret_val = xmlTextReaderRelaxNGValidateCtxt(reader, ctxt, options);
+ desret_int(ret_val);
+ call_tests++;
+ des_xmlTextReaderPtr(n_reader, reader, 0);
+ des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 1);
+ des_parseroptions(n_options, options, 2);
+ xmlResetLastError();
+ if (mem_base != xmlMemBlocks()) {
+ printf("Leak of %d blocks found in xmlTextReaderRelaxNGValidateCtxt",
+ xmlMemBlocks() - mem_base);
+ test_ret++;
+ printf(" %d", n_reader);
+ printf(" %d", n_ctxt);
+ printf(" %d", n_options);
+ printf("\n");
+ }
+ }
+ }
+ }
+ function_tests++;
+#endif
+
+ return(test_ret);
+}
+
+
+static int
test_xmlTextReaderSchemaValidate(void) {
int test_ret = 0;
@@ -32628,7 +32735,7 @@ static int
test_xmlreader(void) {
int test_ret = 0;
- if (quiet == 0) printf("Testing xmlreader : 75 of 85 functions ...\n");
+ if (quiet == 0) printf("Testing xmlreader : 76 of 86 functions ...\n");
test_ret += test_xmlNewTextReader();
test_ret += test_xmlNewTextReaderFilename();
test_ret += test_xmlReaderForDoc();
@@ -32696,6 +32803,7 @@ test_xmlreader(void) {
test_ret += test_xmlTextReaderReadState();
test_ret += test_xmlTextReaderRelaxNGSetSchema();
test_ret += test_xmlTextReaderRelaxNGValidate();
+ test_ret += test_xmlTextReaderRelaxNGValidateCtxt();
test_ret += test_xmlTextReaderSchemaValidate();
test_ret += test_xmlTextReaderSchemaValidateCtxt();
test_ret += test_xmlTextReaderSetErrorHandler();